| 
					
				 | 
			
			
				@@ -898,8 +898,10 @@ namespace MediaBrowser.Model.Dlna 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var appliedVideoConditions = options.Profile.CodecProfiles 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .Where(i => i.Type == CodecType.Video && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     i.ContainsAnyCodec(videoStream?.Codec, container) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    i.ApplyConditions.All(applyCondition => ConditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoRangeType, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var isFirstAppliedCodecProfile = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    i.ApplyConditions.All(applyCondition => ConditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoRangeType, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // Reverse codec profiles for backward compatibility - first codec profile has higher priority 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .Reverse(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             foreach (var i in appliedVideoConditions) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 var transcodingVideoCodecs = ContainerProfile.SplitValue(videoCodec); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -907,8 +909,7 @@ namespace MediaBrowser.Model.Dlna 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (i.ContainsAnyCodec(transcodingVideoCodec, container)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        ApplyTranscodingConditions(playlistItem, i.Conditions, transcodingVideoCodec, true, isFirstAppliedCodecProfile); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        isFirstAppliedCodecProfile = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        ApplyTranscodingConditions(playlistItem, i.Conditions, transcodingVideoCodec, true, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -930,8 +931,10 @@ namespace MediaBrowser.Model.Dlna 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var appliedAudioConditions = options.Profile.CodecProfiles 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .Where(i => i.Type == CodecType.VideoAudio && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     i.ContainsAnyCodec(audioStream?.Codec, container) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    i.ApplyConditions.All(applyCondition => ConditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth, audioProfile, isSecondaryAudio))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            isFirstAppliedCodecProfile = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    i.ApplyConditions.All(applyCondition => ConditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth, audioProfile, isSecondaryAudio))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // Reverse codec profiles for backward compatibility - first codec profile has higher priority 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .Reverse(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             foreach (var codecProfile in appliedAudioConditions) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 var transcodingAudioCodecs = ContainerProfile.SplitValue(audioCodec); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -939,8 +942,7 @@ namespace MediaBrowser.Model.Dlna 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (codecProfile.ContainsAnyCodec(transcodingAudioCodec, container)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        ApplyTranscodingConditions(playlistItem, codecProfile.Conditions, transcodingAudioCodec, true, isFirstAppliedCodecProfile); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        isFirstAppliedCodecProfile = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        ApplyTranscodingConditions(playlistItem, codecProfile.Conditions, transcodingAudioCodec, true, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 |