From b0f44f1d5ac05f70e0a690418165cf5d1d70ac62 Mon Sep 17 00:00:00 2001 From: gnattu Date: Fri, 1 Nov 2024 05:49:31 +0800 Subject: [PATCH 1/2] Set AudioCodec when building stream This was not set at least since 10.9 and the transcoding behavior is close to "undefined" and in 10.10 this will not work at all. This will make the returned transcoding url from PlayBackInfo to correctly specify the desired transcoding codec. If the client wants to use the HLS controller directly it should be responsible to provide valid container and codec in the parameters. --- MediaBrowser.Model/Dlna/StreamBuilder.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index a25ddc367d..f91c32aa84 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -208,6 +208,10 @@ namespace MediaBrowser.Model.Dlna var longBitrate = Math.Min(transcodingBitrate, playlistItem.AudioBitrate ?? transcodingBitrate); playlistItem.AudioBitrate = longBitrate > int.MaxValue ? int.MaxValue : Convert.ToInt32(longBitrate); + if (playlistItem.AudioCodecs.Count == 0 && !string.IsNullOrWhiteSpace(transcodingProfile.AudioCodec)) + { + playlistItem.AudioCodecs = [transcodingProfile.AudioCodec]; + } } playlistItem.TranscodeReasons = transcodeReasons; From 096e1b29701c957e13dd482f343afc6537cb1c9a Mon Sep 17 00:00:00 2001 From: gnattu Date: Fri, 1 Nov 2024 07:09:16 +0800 Subject: [PATCH 2/2] Add comments noting that comma separated codec list is not supported in pure audio transcoding for now --- MediaBrowser.Model/Dlna/StreamBuilder.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index f91c32aa84..767e012029 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -208,6 +208,10 @@ namespace MediaBrowser.Model.Dlna var longBitrate = Math.Min(transcodingBitrate, playlistItem.AudioBitrate ?? transcodingBitrate); playlistItem.AudioBitrate = longBitrate > int.MaxValue ? int.MaxValue : Convert.ToInt32(longBitrate); + + // Pure audio transcoding does not support comma separated list of transcoding codec at the moment. + // So just use the AudioCodec as is would be safe enough as the _transcoderSupport.CanEncodeToAudioCodec + // would fail so this profile will not even be picked up. if (playlistItem.AudioCodecs.Count == 0 && !string.IsNullOrWhiteSpace(transcodingProfile.AudioCodec)) { playlistItem.AudioCodecs = [transcodingProfile.AudioCodec];