Skip to content

Commit

Permalink
Allow clients to send audio container override for HLS
Browse files Browse the repository at this point in the history
This will improve flexibility due to overcome the complex compatibility situation of HLS

Signed-off-by: gnattu <gnattuoc@me.com>
  • Loading branch information
gnattu committed Apr 22, 2024
1 parent 8025f72 commit 6695baf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Jellyfin.Api/Controllers/UniversalAudioController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ public class UniversalAudioController : BaseJellyfinApiController
var supportedHlsContainers = new[] { "ts", "mp4" };

// fallback to mpegts if device reports some weird value unsupported by hls
var segmentContainer = Array.Exists(supportedHlsContainers, element => element == transcodingContainer) ? transcodingContainer : "ts";
var requestedSegmentContainer = Array.Exists(supportedHlsContainers, element => element == transcodingContainer) ? transcodingContainer : "ts";
var segmentContainer = Array.Exists(supportedHlsContainers, element => element == mediaSource.TranscodingContainer) ? mediaSource.TranscodingContainer : requestedSegmentContainer;
var dynamicHlsRequestDto = new HlsAudioRequestDto
{
Id = itemId,
Expand Down
5 changes: 5 additions & 0 deletions MediaBrowser.Model/Dlna/StreamBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ public StreamBuilder(ITranscoderSupport transcoderSupport, ILogger logger)
if (directPlayMethod is PlayMethod.DirectStream)
{
var remuxContainer = item.TranscodingContainer ?? "ts";
var supportedHlsContainers = new[] { "ts", "mp4" };
// If the container specified for the profile is an HLS supported container, use that container instead, overriding the preference
// The client should be responsible to ensure this container is compatible
remuxContainer = Array.Exists(supportedHlsContainers, element => element == directPlayInfo.Profile?.Container) ? directPlayInfo.Profile?.Container : remuxContainer;
bool codeIsSupported;
if (item.TranscodingSubProtocol == MediaStreamProtocol.hls)
{
Expand All @@ -152,6 +156,7 @@ public StreamBuilder(ITranscoderSupport transcoderSupport, ILogger logger)
playlistItem.Container = remuxContainer;
playlistItem.TranscodeReasons = transcodeReasons;
playlistItem.SubProtocol = item.TranscodingSubProtocol;
item.TranscodingContainer = remuxContainer;
return playlistItem;
}

Expand Down

0 comments on commit 6695baf

Please sign in to comment.