mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-20 03:57:17 -04:00
Return more precise transcoding reasons
Using the first profile's reason is somewhat arbitrary, as many clients' first profile may not be the most compatible one. For instance, browsers often set WebM as the first profile, which doesn’t support common codecs like H.264 and AAC by design. This causes `VideoCodecNotSupported` and `AudioCodecNotSupported` to be returned, even if the browser supports those codecs. Only use those reasons when all profiles indicate that the codec is not supported. Signed-off-by: gnattu <gnattuoc@me.com>
This commit is contained in:
parent
6395f4889d
commit
de8bb15c78
1 changed files with 37 additions and 4 deletions
|
@ -1415,16 +1415,49 @@ namespace MediaBrowser.Model.Dlna
|
|||
return profileMatch;
|
||||
}
|
||||
|
||||
TranscodeReason inferredReason = 0;
|
||||
|
||||
var failureReasons = analyzedProfiles[false]
|
||||
.Select(analysis => analysis.Result)
|
||||
.Where(result => !containerSupported || (result.TranscodeReason & TranscodeReason.ContainerNotSupported) == 0)
|
||||
.FirstOrDefault().TranscodeReason;
|
||||
if (failureReasons == 0)
|
||||
.Select(result => result.TranscodeReason)
|
||||
.ToList();
|
||||
|
||||
if (failureReasons.FirstOrDefault() == 0)
|
||||
{
|
||||
failureReasons = TranscodeReason.DirectPlayError;
|
||||
inferredReason = TranscodeReason.DirectPlayError;
|
||||
}
|
||||
else
|
||||
{
|
||||
var videoCodecNotSupportedCount = failureReasons.Count(r => (r & TranscodeReason.VideoCodecNotSupported) != 0);
|
||||
var audioCodecNotSupportedCount = failureReasons.Count(r => (r & TranscodeReason.AudioCodecNotSupported) != 0);
|
||||
|
||||
if (!containerSupported)
|
||||
{
|
||||
inferredReason |= TranscodeReason.ContainerNotSupported;
|
||||
}
|
||||
|
||||
if (videoCodecNotSupportedCount == failureReasons.Count)
|
||||
{
|
||||
inferredReason |= TranscodeReason.VideoCodecNotSupported;
|
||||
}
|
||||
|
||||
if (audioCodecNotSupportedCount == failureReasons.Count)
|
||||
{
|
||||
inferredReason |= TranscodeReason.AudioCodecNotSupported;
|
||||
}
|
||||
|
||||
foreach (var transcodeReason in failureReasons)
|
||||
{
|
||||
var temp = transcodeReason;
|
||||
temp &= ~TranscodeReason.ContainerNotSupported;
|
||||
temp &= ~TranscodeReason.VideoCodecNotSupported;
|
||||
temp &= ~TranscodeReason.AudioCodecNotSupported;
|
||||
inferredReason |= temp;
|
||||
}
|
||||
}
|
||||
|
||||
return (Profile: null, PlayMethod: null, AudioStreamIndex: null, TranscodeReasons: failureReasons);
|
||||
return (Profile: null, PlayMethod: null, AudioStreamIndex: null, TranscodeReasons: inferredReason);
|
||||
}
|
||||
|
||||
private TranscodeReason CheckVideoAudioStreamDirectPlay(MediaOptions options, MediaSourceInfo mediaSource, string container, MediaStream audioStream)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue