diff --git a/MediaBrowser.Model/Dlna/AudioOptions.cs b/MediaBrowser.Model/Dlna/AudioOptions.cs index 33e2982e93..6dfe8093e5 100644 --- a/MediaBrowser.Model/Dlna/AudioOptions.cs +++ b/MediaBrowser.Model/Dlna/AudioOptions.cs @@ -66,21 +66,21 @@ namespace MediaBrowser.Model.Dlna return MaxBitrate; } - if (Profile != null) + if (Profile == null) { - if (Context == EncodingContext.Static) - { - if (isAudio && Profile.MaxStaticMusicBitrate.HasValue) - { - return Profile.MaxStaticMusicBitrate; - } - return Profile.MaxStaticBitrate; - } - - return Profile.MaxStreamingBitrate; + return null; } - return null; + if (Context == EncodingContext.Static) + { + if (isAudio && Profile.MaxStaticMusicBitrate.HasValue) + { + return Profile.MaxStaticMusicBitrate; + } + return Profile.MaxStaticBitrate; + } + + return Profile.MaxStreamingBitrate; } } } diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs index dc0c5f1397..3629d15470 100644 --- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs +++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs @@ -5,9 +5,10 @@ using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Model.Dlna { - public class ConditionProcessor + public static class ConditionProcessor { - public bool IsVideoConditionSatisfied(ProfileCondition condition, + public static bool IsVideoConditionSatisfied( + ProfileCondition condition, int? width, int? height, int? videoBitDepth, @@ -64,7 +65,7 @@ namespace MediaBrowser.Model.Dlna } } - public bool IsImageConditionSatisfied(ProfileCondition condition, int? width, int? height) + public static bool IsImageConditionSatisfied(ProfileCondition condition, int? width, int? height) { switch (condition.Property) { @@ -77,7 +78,7 @@ namespace MediaBrowser.Model.Dlna } } - public bool IsAudioConditionSatisfied(ProfileCondition condition, int? audioChannels, int? audioBitrate, int? audioSampleRate, int? audioBitDepth) + public static bool IsAudioConditionSatisfied(ProfileCondition condition, int? audioChannels, int? audioBitrate, int? audioSampleRate, int? audioBitDepth) { switch (condition.Property) { @@ -94,7 +95,8 @@ namespace MediaBrowser.Model.Dlna } } - public bool IsVideoAudioConditionSatisfied(ProfileCondition condition, + public static bool IsVideoAudioConditionSatisfied( + ProfileCondition condition, int? audioChannels, int? audioBitrate, int? audioSampleRate, @@ -121,7 +123,7 @@ namespace MediaBrowser.Model.Dlna } } - private bool IsConditionSatisfied(ProfileCondition condition, int? currentValue) + private static bool IsConditionSatisfied(ProfileCondition condition, int? currentValue) { if (!currentValue.HasValue) { @@ -150,7 +152,7 @@ namespace MediaBrowser.Model.Dlna return false; } - private bool IsConditionSatisfied(ProfileCondition condition, string currentValue) + private static bool IsConditionSatisfied(ProfileCondition condition, string currentValue) { if (string.IsNullOrEmpty(currentValue)) { @@ -175,7 +177,7 @@ namespace MediaBrowser.Model.Dlna } } - private bool IsConditionSatisfied(ProfileCondition condition, bool? currentValue) + private static bool IsConditionSatisfied(ProfileCondition condition, bool? currentValue) { if (!currentValue.HasValue) { @@ -199,7 +201,7 @@ namespace MediaBrowser.Model.Dlna return false; } - private bool IsConditionSatisfied(ProfileCondition condition, float currentValue) + private static bool IsConditionSatisfied(ProfileCondition condition, float currentValue) { if (currentValue <= 0) { @@ -227,7 +229,7 @@ namespace MediaBrowser.Model.Dlna return false; } - private bool IsConditionSatisfied(ProfileCondition condition, double? currentValue) + private static bool IsConditionSatisfied(ProfileCondition condition, double? currentValue) { if (!currentValue.HasValue) { @@ -255,7 +257,7 @@ namespace MediaBrowser.Model.Dlna return false; } - private bool IsConditionSatisfied(ProfileCondition condition, TransportStreamTimestamp? timestamp) + private static bool IsConditionSatisfied(ProfileCondition condition, TransportStreamTimestamp? timestamp) { if (!timestamp.HasValue) { diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs index 6894f45edc..8d8fe9eb5b 100644 --- a/MediaBrowser.Model/Dlna/DeviceProfile.cs +++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs @@ -188,12 +188,10 @@ namespace MediaBrowser.Model.Dlna continue; } - var conditionProcessor = new ConditionProcessor(); - var anyOff = false; foreach (ProfileCondition c in i.Conditions) { - if (!conditionProcessor.IsAudioConditionSatisfied(GetModelProfileCondition(c), audioChannels, audioBitrate, audioSampleRate, audioBitDepth)) + if (!ConditionProcessor.IsAudioConditionSatisfied(GetModelProfileCondition(c), audioChannels, audioBitrate, audioSampleRate, audioBitDepth)) { anyOff = true; break; @@ -235,12 +233,10 @@ namespace MediaBrowser.Model.Dlna continue; } - var conditionProcessor = new ConditionProcessor(); - var anyOff = false; foreach (var c in i.Conditions) { - if (!conditionProcessor.IsImageConditionSatisfied(GetModelProfileCondition(c), width, height)) + if (!ConditionProcessor.IsImageConditionSatisfied(GetModelProfileCondition(c), width, height)) { anyOff = true; break; @@ -301,12 +297,10 @@ namespace MediaBrowser.Model.Dlna continue; } - var conditionProcessor = new ConditionProcessor(); - var anyOff = false; foreach (ProfileCondition c in i.Conditions) { - if (!conditionProcessor.IsVideoConditionSatisfied(GetModelProfileCondition(c), width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)) + if (!ConditionProcessor.IsVideoConditionSatisfied(GetModelProfileCondition(c), width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)) { anyOff = true; break; diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index 7a500d28ef..e61e600c22 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -93,19 +93,10 @@ namespace MediaBrowser.Model.Dlna return GetOptimalStream(streams, options.GetMaxBitrate(false) ?? 0); } - private StreamInfo GetOptimalStream(List streams, long maxBitrate) - { - var sorted = SortMediaSources(streams, maxBitrate); + private static StreamInfo GetOptimalStream(List streams, long maxBitrate) + => SortMediaSources(streams, maxBitrate).FirstOrDefault(); - foreach (StreamInfo stream in sorted) - { - return stream; - } - - return null; - } - - private StreamInfo[] SortMediaSources(List streams, long maxBitrate) + private static IOrderedEnumerable SortMediaSources(List streams, long maxBitrate) { return streams.OrderBy(i => { @@ -151,25 +142,21 @@ namespace MediaBrowser.Model.Dlna return 0; - }).ThenBy(streams.IndexOf).ToArray(); + }).ThenBy(streams.IndexOf); } - private TranscodeReason? GetTranscodeReasonForFailedCondition(ProfileCondition condition) + private static TranscodeReason? GetTranscodeReasonForFailedCondition(ProfileCondition condition) { switch (condition.Property) { - case ProfileConditionValue.AudioBitrate: - if (condition.Condition == ProfileConditionType.LessThanEqual) - { + case ProfileConditionValue.AudioBitrate when condition.Condition == ProfileConditionType.LessThanEqual: return TranscodeReason.AudioBitrateNotSupported; - } + case ProfileConditionValue.AudioBitrate: return TranscodeReason.AudioBitrateNotSupported; + case ProfileConditionValue.AudioChannels when condition.Condition == ProfileConditionType.LessThanEqual: + return TranscodeReason.AudioChannelsNotSupported; case ProfileConditionValue.AudioChannels: - if (condition.Condition == ProfileConditionType.LessThanEqual) - { - return TranscodeReason.AudioChannelsNotSupported; - } return TranscodeReason.AudioChannelsNotSupported; case ProfileConditionValue.AudioProfile: @@ -246,7 +233,7 @@ namespace MediaBrowser.Model.Dlna } } - public static string NormalizeMediaSourceFormatIntoSingleContainer(string inputContainer, string unused1, DeviceProfile profile, DlnaProfileType type) + public static string NormalizeMediaSourceFormatIntoSingleContainer(string inputContainer, string _, DeviceProfile profile, DlnaProfileType type) { if (string.IsNullOrEmpty(inputContainer)) { @@ -266,12 +253,10 @@ namespace MediaBrowser.Model.Dlna { foreach (var directPlayProfile in profile.DirectPlayProfiles) { - if (directPlayProfile.Type == type) + if (directPlayProfile.Type == type + && directPlayProfile.SupportsContainer(format)) { - if (directPlayProfile.SupportsContainer(format)) - { - return format; - } + return format; } } } @@ -282,9 +267,7 @@ namespace MediaBrowser.Model.Dlna private StreamInfo BuildAudioItem(MediaSourceInfo item, AudioOptions options) { - var transcodeReasons = new List(); - - var playlistItem = new StreamInfo + StreamInfo playlistItem = new StreamInfo { ItemId = options.ItemId, MediaType = DlnaProfileType.Audio, @@ -313,9 +296,7 @@ namespace MediaBrowser.Model.Dlna var directPlayInfo = GetAudioDirectPlayMethods(item, audioStream, options); var directPlayMethods = directPlayInfo.Item1; - transcodeReasons.AddRange(directPlayInfo.Item2); - - var conditionProcessor = new ConditionProcessor(); + var transcodeReasons = directPlayInfo.Item2.ToList(); int? inputAudioChannels = audioStream?.Channels; int? inputAudioBitrate = audioStream?.BitDepth; @@ -335,7 +316,7 @@ namespace MediaBrowser.Model.Dlna bool applyConditions = true; foreach (ProfileCondition applyCondition in i.ApplyConditions) { - if (!conditionProcessor.IsAudioConditionSatisfied(applyCondition, inputAudioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth)) + if (!ConditionProcessor.IsAudioConditionSatisfied(applyCondition, inputAudioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth)) { LogConditionFailure(options.Profile, "AudioCodecProfile", applyCondition, item); applyConditions = false; @@ -353,7 +334,7 @@ namespace MediaBrowser.Model.Dlna bool all = true; foreach (ProfileCondition c in conditions) { - if (!conditionProcessor.IsAudioConditionSatisfied(c, inputAudioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth)) + if (!ConditionProcessor.IsAudioConditionSatisfied(c, inputAudioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth)) { LogConditionFailure(options.Profile, "AudioCodecProfile", c, item); var transcodeReason = GetTranscodeReasonForFailedCondition(c); @@ -382,13 +363,12 @@ namespace MediaBrowser.Model.Dlna TranscodingProfile transcodingProfile = null; foreach (var i in options.Profile.TranscodingProfiles) { - if (i.Type == playlistItem.MediaType && i.Context == options.Context) + if (i.Type == playlistItem.MediaType + && i.Context == options.Context + && _transcoderSupport.CanEncodeToAudioCodec(i.AudioCodec ?? i.Container)) { - if (_transcoderSupport.CanEncodeToAudioCodec(i.AudioCodec ?? i.Container)) - { - transcodingProfile = i; - break; - } + transcodingProfile = i; + break; } } @@ -418,7 +398,7 @@ namespace MediaBrowser.Model.Dlna bool applyConditions = true; foreach (var applyCondition in i.ApplyConditions) { - if (!conditionProcessor.IsAudioConditionSatisfied(applyCondition, inputAudioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth)) + if (!ConditionProcessor.IsAudioConditionSatisfied(applyCondition, inputAudioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth)) { LogConditionFailure(options.Profile, "AudioCodecProfile", applyCondition, item); applyConditions = false; @@ -460,7 +440,7 @@ namespace MediaBrowser.Model.Dlna return playlistItem; } - private long? GetBitrateForDirectPlayCheck(MediaSourceInfo item, AudioOptions options, bool isAudio) + private static long? GetBitrateForDirectPlayCheck(MediaSourceInfo item, AudioOptions options, bool isAudio) { if (item.Protocol == MediaProtocol.File) { @@ -533,7 +513,7 @@ namespace MediaBrowser.Model.Dlna return (playMethods, transcodeReasons); } - private List GetTranscodeReasonsFromDirectPlayProfile(MediaSourceInfo item, MediaStream videoStream, MediaStream audioStream, IEnumerable directPlayProfiles) + private static List GetTranscodeReasonsFromDirectPlayProfile(MediaSourceInfo item, MediaStream videoStream, MediaStream audioStream, IEnumerable directPlayProfiles) { var containerSupported = false; var audioSupported = false; @@ -576,18 +556,17 @@ namespace MediaBrowser.Model.Dlna return list; } - private int? GetDefaultSubtitleStreamIndex(MediaSourceInfo item, SubtitleProfile[] subtitleProfiles) + private static int? GetDefaultSubtitleStreamIndex(MediaSourceInfo item, SubtitleProfile[] subtitleProfiles) { int highestScore = -1; foreach (var stream in item.MediaStreams) { - if (stream.Type == MediaStreamType.Subtitle && stream.Score.HasValue) + if (stream.Type == MediaStreamType.Subtitle + && stream.Score.HasValue + && stream.Score.Value > highestScore) { - if (stream.Score.Value > highestScore) - { - highestScore = stream.Score.Value; - } + highestScore = stream.Score.Value; } } @@ -619,7 +598,7 @@ namespace MediaBrowser.Model.Dlna return item.DefaultSubtitleStreamIndex; } - private void SetStreamInfoOptionsFromTranscodingProfile(StreamInfo playlistItem, TranscodingProfile transcodingProfile) + private static void SetStreamInfoOptionsFromTranscodingProfile(StreamInfo playlistItem, TranscodingProfile transcodingProfile) { if (string.IsNullOrEmpty(transcodingProfile.AudioCodec)) { @@ -659,12 +638,10 @@ namespace MediaBrowser.Model.Dlna } playlistItem.SubProtocol = transcodingProfile.Protocol; - if (!string.IsNullOrEmpty(transcodingProfile.MaxAudioChannels)) + if (!string.IsNullOrEmpty(transcodingProfile.MaxAudioChannels) + && int.TryParse(transcodingProfile.MaxAudioChannels, NumberStyles.Any, CultureInfo.InvariantCulture, out int transcodingMaxAudioChannels)) { - if (int.TryParse(transcodingProfile.MaxAudioChannels, NumberStyles.Any, CultureInfo.InvariantCulture, out var transcodingMaxAudioChannels)) - { - playlistItem.TranscodingMaxAudioChannels = transcodingMaxAudioChannels; - } + playlistItem.TranscodingMaxAudioChannels = transcodingMaxAudioChannels; } } @@ -675,9 +652,7 @@ namespace MediaBrowser.Model.Dlna throw new ArgumentNullException(nameof(item)); } - var transcodeReasons = new List(); - - var playlistItem = new StreamInfo + StreamInfo playlistItem = new StreamInfo { ItemId = options.ItemId, MediaType = DlnaProfileType.Video, @@ -710,6 +685,8 @@ namespace MediaBrowser.Model.Dlna isEligibleForDirectPlay, isEligibleForDirectStream); + var transcodeReasons = new List(); + if (isEligibleForDirectPlay || isEligibleForDirectStream) { // See if it can be direct played @@ -776,8 +753,6 @@ namespace MediaBrowser.Model.Dlna SetStreamInfoOptionsFromTranscodingProfile(playlistItem, transcodingProfile); - var conditionProcessor = new ConditionProcessor(); - var isFirstAppliedCodecProfile = true; foreach (var i in options.Profile.CodecProfiles) { @@ -805,7 +780,7 @@ namespace MediaBrowser.Model.Dlna int? numAudioStreams = item.GetStreamCount(MediaStreamType.Audio); int? numVideoStreams = item.GetStreamCount(MediaStreamType.Video); - if (!conditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)) + if (!ConditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)) { //LogConditionFailure(options.Profile, "VideoCodecProfile.ApplyConditions", applyCondition, item); applyConditions = false; @@ -849,7 +824,7 @@ namespace MediaBrowser.Model.Dlna int? inputAudioSampleRate = audioStream == null ? null : audioStream.SampleRate; int? inputAudioBitDepth = audioStream == null ? null : audioStream.BitDepth; - if (!conditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth, audioProfile, isSecondaryAudio)) + if (!ConditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth, audioProfile, isSecondaryAudio)) { //LogConditionFailure(options.Profile, "VideoCodecProfile.ApplyConditions", applyCondition, item); applyConditions = false; @@ -1016,29 +991,27 @@ namespace MediaBrowser.Model.Dlna } } - var conditionProcessor = new ConditionProcessor(); - - int? width = videoStream == null ? null : videoStream.Width; - int? height = videoStream == null ? null : videoStream.Height; - int? bitDepth = videoStream == null ? null : videoStream.BitDepth; - int? videoBitrate = videoStream == null ? null : videoStream.BitRate; - double? videoLevel = videoStream == null ? null : videoStream.Level; - string videoProfile = videoStream == null ? null : videoStream.Profile; + int? width = videoStream?.Width; + int? height = videoStream?.Height; + int? bitDepth = videoStream?.BitDepth; + int? videoBitrate = videoStream?.BitRate; + double? videoLevel = videoStream?.Level; + string videoProfile = videoStream?.Profile; float videoFramerate = videoStream == null ? 0 : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate ?? 0; - bool? isAnamorphic = videoStream == null ? null : videoStream.IsAnamorphic; - bool? isInterlaced = videoStream == null ? (bool?)null : videoStream.IsInterlaced; - string videoCodecTag = videoStream == null ? null : videoStream.CodecTag; - bool? isAvc = videoStream == null ? null : videoStream.IsAVC; + bool? isAnamorphic = videoStream?.IsAnamorphic; + bool? isInterlaced = videoStream?.IsInterlaced; + string videoCodecTag = videoStream?.CodecTag; + bool? isAvc = videoStream?.IsAVC; - int? audioBitrate = audioStream == null ? null : audioStream.BitRate; - int? audioChannels = audioStream == null ? null : audioStream.Channels; - string audioProfile = audioStream == null ? null : audioStream.Profile; - int? audioSampleRate = audioStream == null ? null : audioStream.SampleRate; - int? audioBitDepth = audioStream == null ? null : audioStream.BitDepth; + int? audioBitrate = audioStream?.BitRate; + int? audioChannels = audioStream?.Channels; + string audioProfile = audioStream?.Profile; + int? audioSampleRate = audioStream?.SampleRate; + int? audioBitDepth = audioStream?.BitDepth; TransportStreamTimestamp? timestamp = videoStream == null ? TransportStreamTimestamp.None : mediaSource.Timestamp; - int? packetLength = videoStream == null ? null : videoStream.PacketLength; - int? refFrames = videoStream == null ? null : videoStream.RefFrames; + int? packetLength = videoStream?.PacketLength; + int? refFrames = videoStream?.RefFrames; int? numAudioStreams = mediaSource.GetStreamCount(MediaStreamType.Audio); int? numVideoStreams = mediaSource.GetStreamCount(MediaStreamType.Video); @@ -1046,7 +1019,7 @@ namespace MediaBrowser.Model.Dlna // Check container conditions foreach (ProfileCondition i in conditions) { - if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)) + if (!ConditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)) { LogConditionFailure(profile, "VideoContainerProfile", i, mediaSource); @@ -1069,7 +1042,7 @@ namespace MediaBrowser.Model.Dlna bool applyConditions = true; foreach (ProfileCondition applyCondition in i.ApplyConditions) { - if (!conditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)) + if (!ConditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)) { //LogConditionFailure(profile, "VideoCodecProfile.ApplyConditions", applyCondition, mediaSource); applyConditions = false; @@ -1089,14 +1062,14 @@ namespace MediaBrowser.Model.Dlna foreach (ProfileCondition i in conditions) { - if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)) + if (!ConditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)) { LogConditionFailure(profile, "VideoCodecProfile", i, mediaSource); var transcodeReason = GetTranscodeReasonForFailedCondition(i); var transcodeReasons = transcodeReason.HasValue ? new List { transcodeReason.Value } - : new List { }; + : new List(); return new Tuple>(null, transcodeReasons); } @@ -1116,7 +1089,7 @@ namespace MediaBrowser.Model.Dlna bool applyConditions = true; foreach (ProfileCondition applyCondition in i.ApplyConditions) { - if (!conditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, isSecondaryAudio)) + if (!ConditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, isSecondaryAudio)) { //LogConditionFailure(profile, "VideoAudioCodecProfile.ApplyConditions", applyCondition, mediaSource); applyConditions = false; @@ -1136,14 +1109,14 @@ namespace MediaBrowser.Model.Dlna foreach (ProfileCondition i in conditions) { - if (!conditionProcessor.IsVideoAudioConditionSatisfied(i, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, isSecondaryAudio)) + if (!ConditionProcessor.IsVideoAudioConditionSatisfied(i, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, isSecondaryAudio)) { LogConditionFailure(profile, "VideoAudioCodecProfile", i, mediaSource); var transcodeReason = GetTranscodeReasonForFailedCondition(i); var transcodeReasons = transcodeReason.HasValue ? new List { transcodeReason.Value } - : new List { }; + : new List(); return new Tuple>(null, transcodeReasons); } @@ -1170,7 +1143,8 @@ namespace MediaBrowser.Model.Dlna mediaSource.Path ?? "Unknown path"); } - private (bool directPlay, TranscodeReason? reason) IsEligibleForDirectPlay(MediaSourceInfo item, + private (bool directPlay, TranscodeReason? reason) IsEligibleForDirectPlay( + MediaSourceInfo item, long maxBitrate, MediaStream subtitleStream, VideoOptions options,