mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-18 06:53:07 +03:00
better bitrate syncing
This commit is contained in:
@@ -659,6 +659,32 @@ namespace MediaBrowser.Api.Playback
|
||||
}
|
||||
}
|
||||
|
||||
protected int? GetVideoBitrateParam(StreamState state)
|
||||
{
|
||||
if (state.VideoRequest.VideoBitRate.HasValue)
|
||||
{
|
||||
// Make sure we don't request a bitrate higher than the source
|
||||
var currentBitrate = state.VideoStream == null ? state.VideoRequest.VideoBitRate.Value : state.VideoStream.BitRate ?? state.VideoRequest.VideoBitRate.Value;
|
||||
|
||||
return Math.Min(currentBitrate, state.VideoRequest.VideoBitRate.Value);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected int? GetAudioBitrateParam(StreamState state)
|
||||
{
|
||||
if (state.Request.AudioBitRate.HasValue)
|
||||
{
|
||||
// Make sure we don't request a bitrate higher than the source
|
||||
var currentBitrate = state.AudioStream == null ? state.Request.AudioBitRate.Value : state.AudioStream.BitRate ?? state.Request.AudioBitRate.Value;
|
||||
|
||||
return Math.Min(currentBitrate, state.Request.AudioBitRate.Value);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user agent param.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user