fix transcode reasons

This commit is contained in:
Dmitry Lyzo
2023-01-06 20:06:49 +03:00
parent 2a6e292153
commit 20e9db8308
2 changed files with 17 additions and 9 deletions

View File

@@ -1144,7 +1144,6 @@ namespace MediaBrowser.Model.Dlna
var reason = a & flag;
if (reason != 0)
{
a = reason;
return index;
}
@@ -1154,6 +1153,8 @@ namespace MediaBrowser.Model.Dlna
return index;
};
var containerSupported = false;
// Check DirectPlay profiles to see if it can be direct played
var analyzedProfiles = profile.DirectPlayProfiles
.Where(directPlayProfile => directPlayProfile.Type == DlnaProfileType.Video)
@@ -1167,6 +1168,10 @@ namespace MediaBrowser.Model.Dlna
{
directPlayProfileReasons |= TranscodeReason.ContainerNotSupported;
}
else
{
containerSupported = true;
}
// Check video codec
string videoCodec = videoStream?.Codec;
@@ -1231,7 +1236,10 @@ namespace MediaBrowser.Model.Dlna
return profileMatch;
}
var failureReasons = analyzedProfiles[false].Select(analysis => analysis.Result).FirstOrDefault().TranscodeReason;
var failureReasons = analyzedProfiles[false]
.Select(analysis => analysis.Result)
.Where(result => !containerSupported || (result.TranscodeReason & TranscodeReason.ContainerNotSupported) == 0)
.FirstOrDefault().TranscodeReason;
if (failureReasons == 0)
{
failureReasons = TranscodeReason.DirectPlayError;