Allow direct play even if no audio stream is available

This commit is contained in:
Maxr1998 2022-09-15 02:04:12 +02:00
parent 88d5230bab
commit 8753b7200f
No known key found for this signature in database
GPG Key ID: ECECF0D4F4816C81

View File

@ -436,9 +436,9 @@ namespace MediaBrowser.Model.Dlna
{
containerSupported = true;
videoSupported = videoStream != null && profile.SupportsVideoCodec(videoStream.Codec);
videoSupported = videoStream == null || profile.SupportsVideoCodec(videoStream.Codec);
audioSupported = audioStream != null && profile.SupportsAudioCodec(audioStream.Codec);
audioSupported = audioStream == null || profile.SupportsAudioCodec(audioStream.Codec);
if (videoSupported && audioSupported)
{
@ -447,18 +447,17 @@ namespace MediaBrowser.Model.Dlna
}
}
var list = new List<TranscodeReason>();
if (!containerSupported)
{
reasons |= TranscodeReason.ContainerNotSupported;
}
if (videoStream != null && !videoSupported)
if (!videoSupported)
{
reasons |= TranscodeReason.VideoCodecNotSupported;
}
if (audioStream != null && !audioSupported)
if (!audioSupported)
{
reasons |= TranscodeReason.AudioCodecNotSupported;
}
@ -1182,7 +1181,10 @@ namespace MediaBrowser.Model.Dlna
}
// Check audio codec
var selectedAudioStream = candidateAudioStreams.FirstOrDefault(audioStream => directPlayProfile.SupportsAudioCodec(audioStream.Codec));
MediaStream selectedAudioStream = null;
if (candidateAudioStreams.Any())
{
selectedAudioStream = candidateAudioStreams.FirstOrDefault(audioStream => directPlayProfile.SupportsAudioCodec(audioStream.Codec));
if (selectedAudioStream == null)
{
directPlayProfileReasons |= TranscodeReason.AudioCodecNotSupported;
@ -1191,6 +1193,7 @@ namespace MediaBrowser.Model.Dlna
{
audioCodecProfileReasons = audioStreamMatches.GetValueOrDefault(selectedAudioStream);
}
}
var failureReasons = directPlayProfileReasons | containerProfileReasons | subtitleProfileReasons;