diff --git a/Emby.Server.Implementations/Sync/SyncHelper.cs b/Emby.Server.Implementations/Sync/SyncHelper.cs
index da475f0038..7fe703796f 100644
--- a/Emby.Server.Implementations/Sync/SyncHelper.cs
+++ b/Emby.Server.Implementations/Sync/SyncHelper.cs
@@ -4,7 +4,7 @@ namespace Emby.Server.Implementations.Sync
{
public class SyncHelper
{
- public static int? AdjustBitrate(int? profileBitrate, string quality)
+ public static long? AdjustBitrate(long? profileBitrate, string quality)
{
if (profileBitrate.HasValue)
{
diff --git a/MediaBrowser.Api/Playback/MediaInfoService.cs b/MediaBrowser.Api/Playback/MediaInfoService.cs
index 8fb78b6e5d..a2ec747be0 100644
--- a/MediaBrowser.Api/Playback/MediaInfoService.cs
+++ b/MediaBrowser.Api/Playback/MediaInfoService.cs
@@ -227,7 +227,7 @@ namespace MediaBrowser.Api.Playback
PlaybackInfoResponse result,
DeviceProfile profile,
AuthorizationInfo auth,
- int? maxBitrate,
+ long? maxBitrate,
long startTimeTicks,
string mediaSourceId,
int? audioStreamIndex,
@@ -249,7 +249,7 @@ namespace MediaBrowser.Api.Playback
MediaSourceInfo mediaSource,
DeviceProfile profile,
AuthorizationInfo auth,
- int? maxBitrate,
+ long? maxBitrate,
long startTimeTicks,
string mediaSourceId,
int? audioStreamIndex,
@@ -383,7 +383,7 @@ namespace MediaBrowser.Api.Playback
}
}
- private int? GetMaxBitrate(int? clientMaxBitrate)
+ private long? GetMaxBitrate(long? clientMaxBitrate)
{
var maxBitrate = clientMaxBitrate;
var remoteClientMaxBitrate = _config.Configuration.RemoteClientBitrateLimit;
@@ -425,7 +425,7 @@ namespace MediaBrowser.Api.Playback
}
}
- private void SortMediaSources(PlaybackInfoResponse result, int? maxBitrate)
+ private void SortMediaSources(PlaybackInfoResponse result, long? maxBitrate)
{
var originalList = result.MediaSources.ToList();
diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs
index d1ef996aea..e9e3c33c0e 100644
--- a/MediaBrowser.Api/Playback/StreamState.cs
+++ b/MediaBrowser.Api/Playback/StreamState.cs
@@ -93,13 +93,9 @@ namespace MediaBrowser.Api.Playback
{
return 3;
}
- return 6;
- }
-
- if (!RunTimeTicks.HasValue)
- {
return 3;
}
+
return 3;
}
}
diff --git a/MediaBrowser.Model/Dlna/AudioOptions.cs b/MediaBrowser.Model/Dlna/AudioOptions.cs
index f3b6df861d..24c7aef98b 100644
--- a/MediaBrowser.Model/Dlna/AudioOptions.cs
+++ b/MediaBrowser.Model/Dlna/AudioOptions.cs
@@ -41,7 +41,7 @@ namespace MediaBrowser.Model.Dlna
///
/// The application's configured quality setting
///
- public int? MaxBitrate { get; set; }
+ public long? MaxBitrate { get; set; }
///
/// Gets or sets the context.
@@ -59,7 +59,7 @@ namespace MediaBrowser.Model.Dlna
/// Gets the maximum bitrate.
///
/// System.Nullable<System.Int32>.
- public int? GetMaxBitrate(bool isAudio)
+ public long? GetMaxBitrate(bool isAudio)
{
if (MaxBitrate.HasValue)
{
diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs
index 821531ed06..d99a21e6d1 100644
--- a/MediaBrowser.Model/Dlna/DeviceProfile.cs
+++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs
@@ -51,8 +51,8 @@ namespace MediaBrowser.Model.Dlna
public int? MaxIconWidth { get; set; }
public int? MaxIconHeight { get; set; }
- public int? MaxStreamingBitrate { get; set; }
- public int? MaxStaticBitrate { get; set; }
+ public long? MaxStreamingBitrate { get; set; }
+ public long? MaxStaticBitrate { get; set; }
public int? MusicStreamingTranscodingBitrate { get; set; }
public int? MaxStaticMusicBitrate { get; set; }
diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs
index bc9a3488f2..262964404e 100644
--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs
+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs
@@ -93,7 +93,7 @@ namespace MediaBrowser.Model.Dlna
return GetOptimalStream(streams, options.GetMaxBitrate(false));
}
- private StreamInfo GetOptimalStream(List streams, int? maxBitrate)
+ private StreamInfo GetOptimalStream(List streams, long? maxBitrate)
{
streams = StreamInfoSorter.SortMediaSources(streams, maxBitrate);
@@ -277,25 +277,26 @@ namespace MediaBrowser.Model.Dlna
playlistItem.MaxAudioChannels = Math.Min(options.MaxAudioChannels.Value, currentValue);
}
- int transcodingBitrate = options.AudioTranscodingBitrate ??
+ long transcodingBitrate = options.AudioTranscodingBitrate ??
options.Profile.MusicStreamingTranscodingBitrate ??
128000;
- int? configuredBitrate = options.GetMaxBitrate(true);
+ var configuredBitrate = options.GetMaxBitrate(true);
if (configuredBitrate.HasValue)
{
transcodingBitrate = Math.Min(configuredBitrate.Value, transcodingBitrate);
}
- playlistItem.AudioBitrate = Math.Min(transcodingBitrate, playlistItem.AudioBitrate ?? transcodingBitrate);
+ var longBitrate = Math.Min(transcodingBitrate, playlistItem.AudioBitrate ?? transcodingBitrate);
+ playlistItem.AudioBitrate = longBitrate > int.MaxValue ? int.MaxValue : Convert.ToInt32(longBitrate);
}
return playlistItem;
}
- private int? GetBitrateForDirectPlayCheck(MediaSourceInfo item, AudioOptions options, bool isAudio)
+ private long? GetBitrateForDirectPlayCheck(MediaSourceInfo item, AudioOptions options, bool isAudio)
{
if (item.Protocol == MediaProtocol.File)
{
@@ -583,11 +584,11 @@ namespace MediaBrowser.Model.Dlna
int audioBitrate = GetAudioBitrate(playlistItem.SubProtocol, options.GetMaxBitrate(false), playlistItem.TargetAudioChannels, playlistItem.TargetAudioCodec, audioStream);
playlistItem.AudioBitrate = Math.Min(playlistItem.AudioBitrate ?? audioBitrate, audioBitrate);
- int? maxBitrateSetting = options.GetMaxBitrate(false);
+ var maxBitrateSetting = options.GetMaxBitrate(false);
// Honor max rate
if (maxBitrateSetting.HasValue)
{
- int videoBitrate = maxBitrateSetting.Value;
+ var videoBitrate = maxBitrateSetting.Value;
if (playlistItem.AudioBitrate.HasValue)
{
@@ -595,15 +596,16 @@ namespace MediaBrowser.Model.Dlna
}
// Make sure the video bitrate is lower than bitrate settings but at least 64k
- int currentValue = playlistItem.VideoBitrate ?? videoBitrate;
- playlistItem.VideoBitrate = Math.Max(Math.Min(videoBitrate, currentValue), 64000);
+ long currentValue = playlistItem.VideoBitrate ?? videoBitrate;
+ var longBitrate = Math.Max(Math.Min(videoBitrate, currentValue), 64000);
+ playlistItem.VideoBitrate = longBitrate > int.MaxValue ? int.MaxValue : Convert.ToInt32(longBitrate);
}
}
return playlistItem;
}
- private int GetAudioBitrate(string subProtocol, int? maxTotalBitrate, int? targetAudioChannels, string targetAudioCodec, MediaStream audioStream)
+ private int GetAudioBitrate(string subProtocol, long? maxTotalBitrate, int? targetAudioChannels, string targetAudioCodec, MediaStream audioStream)
{
int defaultBitrate = audioStream == null ? 192000 : audioStream.BitRate ?? 192000;
// Reduce the bitrate if we're downmixing
@@ -865,7 +867,7 @@ namespace MediaBrowser.Model.Dlna
}
private bool IsEligibleForDirectPlay(MediaSourceInfo item,
- int? maxBitrate,
+ long? maxBitrate,
MediaStream subtitleStream,
VideoOptions options,
PlayMethod playMethod)
@@ -960,7 +962,7 @@ namespace MediaBrowser.Model.Dlna
return null;
}
- private bool IsAudioEligibleForDirectPlay(MediaSourceInfo item, int? maxBitrate)
+ private bool IsAudioEligibleForDirectPlay(MediaSourceInfo item, long? maxBitrate)
{
if (!maxBitrate.HasValue)
{
diff --git a/MediaBrowser.Model/Dlna/StreamInfoSorter.cs b/MediaBrowser.Model/Dlna/StreamInfoSorter.cs
index 293054e5b3..425fb9c93e 100644
--- a/MediaBrowser.Model/Dlna/StreamInfoSorter.cs
+++ b/MediaBrowser.Model/Dlna/StreamInfoSorter.cs
@@ -7,7 +7,7 @@ namespace MediaBrowser.Model.Dlna
{
public class StreamInfoSorter
{
- public static List SortMediaSources(List streams, int? maxBitrate)
+ public static List SortMediaSources(List streams, long? maxBitrate)
{
return streams.OrderBy(i =>
{
diff --git a/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs b/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs
index b6e2a96aa0..913967352f 100644
--- a/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs
+++ b/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs
@@ -7,7 +7,7 @@ namespace MediaBrowser.Model.MediaInfo
public string OpenToken { get; set; }
public string UserId { get; set; }
public string PlaySessionId { get; set; }
- public int? MaxStreamingBitrate { get; set; }
+ public long? MaxStreamingBitrate { get; set; }
public long? StartTimeTicks { get; set; }
public int? AudioStreamIndex { get; set; }
public int? SubtitleStreamIndex { get; set; }
diff --git a/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs b/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs
index a2b85d121e..fc4714be36 100644
--- a/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs
+++ b/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs
@@ -8,7 +8,7 @@ namespace MediaBrowser.Model.MediaInfo
public string UserId { get; set; }
- public int? MaxStreamingBitrate { get; set; }
+ public long? MaxStreamingBitrate { get; set; }
public long? StartTimeTicks { get; set; }