aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api
diff options
context:
space:
mode:
authorgnattu <gnattu@users.noreply.github.com>2024-09-08 11:08:54 +0800
committerGitHub <noreply@github.com>2024-09-07 21:08:54 -0600
commitb4f71859d939c5c0fa0a155f712d25cba0c20b8f (patch)
tree53dbe8574abc918c8348682024bab0815619a37f /Jellyfin.Api
parent84b20afe1fc6cb86d9ff8694b3e4524461dea588 (diff)
Make Live TV compatibility profiles customizable (#12529)
Diffstat (limited to 'Jellyfin.Api')
-rw-r--r--Jellyfin.Api/Helpers/StreamingHelpers.cs25
1 files changed, 6 insertions, 19 deletions
diff --git a/Jellyfin.Api/Helpers/StreamingHelpers.cs b/Jellyfin.Api/Helpers/StreamingHelpers.cs
index 535ef27c3..3cc6a393b 100644
--- a/Jellyfin.Api/Helpers/StreamingHelpers.cs
+++ b/Jellyfin.Api/Helpers/StreamingHelpers.cs
@@ -142,28 +142,15 @@ public static class StreamingHelpers
}
else
{
- // Enforce more restrictive transcoding profile for LiveTV due to compatability reasons
- // Cap the MaxStreamingBitrate to 30Mbps, because we are unable to reliably probe source bitrate,
- // which will cause the client to request extremely high bitrate that may fail the player/encoder
- streamingRequest.VideoBitRate = streamingRequest.VideoBitRate > 30000000 ? 30000000 : streamingRequest.VideoBitRate;
-
- if (streamingRequest.SegmentContainer is not null)
- {
- // Remove all fmp4 transcoding profiles, because it causes playback error and/or A/V sync issues
- // Notably: Some channels won't play on FireFox and LG webOS
- // Some channels from HDHomerun will experience A/V sync issues
- streamingRequest.SegmentContainer = "ts";
- streamingRequest.VideoCodec = "h264";
- streamingRequest.AudioCodec = "aac";
- state.SupportedVideoCodecs = ["h264"];
- state.Request.VideoCodec = "h264";
- state.SupportedAudioCodecs = ["aac"];
- state.Request.AudioCodec = "aac";
- }
-
var liveStreamInfo = await mediaSourceManager.GetLiveStreamWithDirectStreamProvider(streamingRequest.LiveStreamId, cancellationToken).ConfigureAwait(false);
mediaSource = liveStreamInfo.Item1;
state.DirectStreamProvider = liveStreamInfo.Item2;
+
+ // Cap the max bitrate when it is too high. This is usually due to ffmpeg is unable to probe the source liveTV streams' bitrate.
+ if (mediaSource.FallbackMaxStreamingBitrate is not null && streamingRequest.VideoBitRate is not null)
+ {
+ streamingRequest.VideoBitRate = Math.Min(streamingRequest.VideoBitRate.Value, mediaSource.FallbackMaxStreamingBitrate.Value);
+ }
}
var encodingOptions = serverConfigurationManager.GetEncodingOptions();