aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Playback/BaseStreamingService.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-08-29 22:13:58 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-08-29 22:13:58 -0400
commita5fa31cf94eeeeef0240b45e5b273b855d76be69 (patch)
tree7af5b027dc6e083600b473cb7221d983905b9845 /MediaBrowser.Api/Playback/BaseStreamingService.cs
parent87c4d447f86ab184c22a7a6dbfe654d2064ac1bf (diff)
better bitrate syncing
Diffstat (limited to 'MediaBrowser.Api/Playback/BaseStreamingService.cs')
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index c9437b2c3..93197c387 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -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>