added out of network bitrate limit

This commit is contained in:
Luke Pulverenti
2015-04-09 01:20:23 -04:00
parent 6e6ce82cf6
commit b9c656e859
24 changed files with 136 additions and 73 deletions

View File

@@ -129,12 +129,7 @@ namespace MediaBrowser.Server.Implementations.Library
return list;
}
public Task<IEnumerable<MediaSourceInfo>> GetPlayackMediaSources(string id, bool enablePathSubstitution, CancellationToken cancellationToken)
{
return GetPlayackMediaSources(id, null, enablePathSubstitution, cancellationToken);
}
public async Task<IEnumerable<MediaSourceInfo>> GetPlayackMediaSources(string id, string userId, bool enablePathSubstitution, CancellationToken cancellationToken)
public async Task<IEnumerable<MediaSourceInfo>> GetPlayackMediaSources(string id, string userId, bool enablePathSubstitution, string[] supportedLiveMediaTypes, CancellationToken cancellationToken)
{
var item = _libraryManager.GetItemById(id);
@@ -184,9 +179,19 @@ namespace MediaBrowser.Server.Implementations.Library
{
if (user != null)
{
if (!user.Policy.EnableMediaPlaybackTranscoding)
if (string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
{
source.SupportsTranscoding = false;
if (!user.Policy.EnableAudioPlaybackTranscoding)
{
source.SupportsTranscoding = false;
}
}
else if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
{
if (!user.Policy.EnableVideoPlaybackTranscoding)
{
source.SupportsTranscoding = false;
}
}
}
}
@@ -238,9 +243,12 @@ namespace MediaBrowser.Server.Implementations.Library
}
}
public MediaSourceInfo GetStaticMediaSource(IHasMediaSources item, string mediaSourceId, bool enablePathSubstitution)
public async Task<MediaSourceInfo> GetMediaSource(IHasMediaSources item, string mediaSourceId, bool enablePathSubstitution)
{
return GetStaticMediaSources(item, enablePathSubstitution).FirstOrDefault(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase));
var sources = await GetPlayackMediaSources(item.Id.ToString("N"), null, enablePathSubstitution, new[] { MediaType.Audio, MediaType.Video },
CancellationToken.None).ConfigureAwait(false);
return sources.FirstOrDefault(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase));
}
public IEnumerable<MediaSourceInfo> GetStaticMediaSources(IHasMediaSources item, bool enablePathSubstitution, User user = null)

View File

@@ -122,7 +122,7 @@
"LabelFree": "Free",
"HeaderPlaybackError": "Playback Error",
"MessagePlaybackErrorNotAllowed": "You're currently not authorized to play this content. Please contact your system administrator for details.",
"MessagePlaybackErrorNoCompatibleStream": "No compatible streams are currently available. Please try again later.",
"MessagePlaybackErrorNoCompatibleStream": "No compatible streams are currently available. Please try again later or contact your system administrator for details.",
"MessagePlaybackErrorRateLimitExceeded": "Your playback rate limit has been exceeded. Please contact your system administrator for details.",
"MessagePlaybackErrorPlaceHolder": "The content chosen is not playable from this device.",
"HeaderSelectAudio": "Select Audio",

View File

@@ -1410,6 +1410,10 @@
"LabelUploadSpeedLimit": "Upload speed limit (mbps):",
"OptionAllowSyncTranscoding": "Allow syncing that requires transcoding",
"HeaderPlayback": "Media Playback",
"OptionAllowMediaPlaybackTranscoding": "Allow media playback that requires transcoding",
"OptionAllowMediaPlaybackTranscodingHelp": "Users will receive friendly messages when content is unplayable based on policy."
"OptionAllowAudioPlaybackTranscoding": "Allow audio playback that requires transcoding",
"OptionAllowVideoPlaybackTranscoding": "Allow video playback that requires transcoding",
"OptionAllowMediaPlaybackTranscodingHelp": "Users will receive friendly messages when content is unplayable based on policy.",
"TabStreaming": "Streaming",
"LabelRemoteClientBitrateLimit": "Remote client bitrate limit (mbps):",
"LabelRemoteClientBitrateLimitHelp": "An optional streaming bitrate limit for all remote clients. This is useful to prevent clients from requesting a higher bitrate than your connection can handle."
}

View File

@@ -305,12 +305,9 @@ namespace MediaBrowser.Server.Implementations.Session
}
}
private async Task<MediaSourceInfo> GetMediaSource(IHasMediaSources item, string mediaSourceId)
private Task<MediaSourceInfo> GetMediaSource(IHasMediaSources item, string mediaSourceId)
{
var sources = await _mediaSourceManager.GetPlayackMediaSources(item.Id.ToString("N"), false, CancellationToken.None)
.ConfigureAwait(false);
return sources.FirstOrDefault(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase));
return _mediaSourceManager.GetMediaSource(item, mediaSourceId, false);
}
/// <summary>

View File

@@ -195,17 +195,39 @@ namespace MediaBrowser.Server.Implementations.Sync
}
};
var maxAudioChannels = supportsAc3 || supportsDca ? "5" : "2";
codecProfiles.Add(new CodecProfile
{
Type = CodecType.VideoAudio,
Codec = "ac3",
Conditions = new[]
{
new ProfileCondition
{
Condition = ProfileConditionType.LessThanEqual,
Property = ProfileConditionValue.AudioChannels,
Value = maxAudioChannels,
Value = "5",
IsRequired = true
},
new ProfileCondition
{
Condition = ProfileConditionType.Equals,
Property = ProfileConditionValue.IsSecondaryAudio,
Value = "false",
IsRequired = false
}
}
});
codecProfiles.Add(new CodecProfile
{
Type = CodecType.VideoAudio,
Codec = "ac3",
Conditions = new[]
{
new ProfileCondition
{
Condition = ProfileConditionType.LessThanEqual,
Property = ProfileConditionValue.AudioChannels,
Value = "2",
IsRequired = true
},
new ProfileCondition