|
|
@ -57,7 +57,7 @@ namespace MediaBrowser.Api.Playback
|
|
|
|
Size = 102400;
|
|
|
|
Size = 102400;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Authenticated]
|
|
|
|
[Authenticated]
|
|
|
|
public class MediaInfoService : BaseApiService
|
|
|
|
public class MediaInfoService : BaseApiService
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -289,7 +289,7 @@ namespace MediaBrowser.Api.Playback
|
|
|
|
if (mediaSource.SupportsDirectStream)
|
|
|
|
if (mediaSource.SupportsDirectStream)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
options.MaxBitrate = GetMaxBitrate(maxBitrate);
|
|
|
|
options.MaxBitrate = GetMaxBitrate(maxBitrate);
|
|
|
|
|
|
|
|
|
|
|
|
// The MediaSource supports direct stream, now test to see if the client supports it
|
|
|
|
// The MediaSource supports direct stream, now test to see if the client supports it
|
|
|
|
var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ?
|
|
|
|
var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ?
|
|
|
|
streamBuilder.BuildAudioItem(options) :
|
|
|
|
streamBuilder.BuildAudioItem(options) :
|
|
|
@ -309,7 +309,7 @@ namespace MediaBrowser.Api.Playback
|
|
|
|
if (mediaSource.SupportsTranscoding)
|
|
|
|
if (mediaSource.SupportsTranscoding)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
options.MaxBitrate = GetMaxBitrate(maxBitrate);
|
|
|
|
options.MaxBitrate = GetMaxBitrate(maxBitrate);
|
|
|
|
|
|
|
|
|
|
|
|
// The MediaSource supports direct stream, now test to see if the client supports it
|
|
|
|
// The MediaSource supports direct stream, now test to see if the client supports it
|
|
|
|
var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ?
|
|
|
|
var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ?
|
|
|
|
streamBuilder.BuildAudioItem(options) :
|
|
|
|
streamBuilder.BuildAudioItem(options) :
|
|
|
@ -336,9 +336,15 @@ namespace MediaBrowser.Api.Playback
|
|
|
|
var maxBitrate = clientMaxBitrate;
|
|
|
|
var maxBitrate = clientMaxBitrate;
|
|
|
|
var remoteClientMaxBitrate = _config.Configuration.RemoteClientBitrateLimit;
|
|
|
|
var remoteClientMaxBitrate = _config.Configuration.RemoteClientBitrateLimit;
|
|
|
|
|
|
|
|
|
|
|
|
if (remoteClientMaxBitrate > 0 && !_networkManager.IsInLocalNetwork(Request.RemoteIp))
|
|
|
|
if (remoteClientMaxBitrate > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
maxBitrate = Math.Min(maxBitrate ?? remoteClientMaxBitrate, remoteClientMaxBitrate);
|
|
|
|
var isInLocalNetwork = _networkManager.IsInLocalNetwork(Request.RemoteIp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.Info("RemoteClientBitrateLimit: {0}, RemoteIp: {1}, IsInLocalNetwork: {2}", remoteClientMaxBitrate, Request.RemoteIp, isInLocalNetwork);
|
|
|
|
|
|
|
|
if (!isInLocalNetwork)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
maxBitrate = Math.Min(maxBitrate ?? remoteClientMaxBitrate, remoteClientMaxBitrate);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return maxBitrate;
|
|
|
|
return maxBitrate;
|
|
|
|