Update MediaInfoService.cs

pull/2160/head
Artiume 5 years ago committed by GitHub
parent 61b9845e0f
commit be956dfd02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -407,8 +407,13 @@ namespace MediaBrowser.Api.Playback
if (mediaSource.SupportsDirectPlay)
{
if (mediaSource.IsRemote && forceDirectPlayRemoteMediaSource)
if (mediaSource.IsRemote && forceDirectPlayRemoteMediaSource && user.Policy.ForceRemoteSourceTranscoding)
{
mediaSource.SupportsDirectPlay = false;
}
else if (mediaSource.IsRemote && user.Policy.ForceRemoteSourceTranscoding)
{
mediaSource.SupportsDirectPlay = false;
}
else
{
@ -454,11 +459,21 @@ namespace MediaBrowser.Api.Playback
}
if (mediaSource.SupportsDirectStream)
{
if (mediaSource.IsRemote && forceDirectPlayRemoteMediaSource && user.Policy.ForceRemoteSourceTranscoding)
{
mediaSource.SupportsDirectStream = false;
}
else if (mediaSource.IsRemote && user.Policy.ForceRemoteSourceTranscoding)
{
mediaSource.SupportsDirectStream = false;
}
}
else
{
options.MaxBitrate = GetMaxBitrate(maxBitrate, user);
if (item is Audio)
{
if (item is Audio)
if (!user.Policy.EnableAudioPlaybackTranscoding)
{
options.ForceDirectStream = true;
@ -471,36 +486,65 @@ namespace MediaBrowser.Api.Playback
options.ForceDirectStream = true;
}
}
// The MediaSource supports direct stream, now test to see if the client supports it
var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ?
streamBuilder.BuildAudioItem(options) :
streamBuilder.BuildVideoItem(options);
if (streamInfo == null || !streamInfo.IsDirectStream)
{
mediaSource.SupportsDirectStream = false;
}
if (streamInfo != null)
{
SetDeviceSpecificSubtitleInfo(streamInfo, mediaSource, auth.Token);
}
}
}
if (mediaSource.SupportsTranscoding)
{
if (mediaSource.IsRemote && user.Policy.ForceRemoteSourceTranscoding)
{
if (GetMaxBitrate(maxBitrate, user) < mediaSource.Bitrate)
{
options.MaxBitrate = GetMaxBitrate(maxBitrate, user);
}
else
{
options.MaxBitrate = mediaSource.Bitrate;
}
}
else
{
options.MaxBitrate = GetMaxBitrate(maxBitrate, user);
}
// The MediaSource supports direct stream, now test to see if the client supports it
var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ?
streamBuilder.BuildAudioItem(options) :
streamBuilder.BuildVideoItem(options);
if (mediaSource.IsRemote && user.Policy.ForceRemoteSourceTranscoding)
{
if (streamInfo != null)
{
streamInfo.PlaySessionId = playSessionId;
streamInfo.StartPositionTicks = startTimeTicks;
mediaSource.TranscodingUrl = streamInfo.ToUrl("-", auth.Token).TrimStart('-');
mediaSource.TranscodingUrl += "&allowVideoStreamCopy=false";
mediaSource.TranscodingUrl += "&allowAudioStreamCopy=false";
mediaSource.TranscodingContainer = streamInfo.Container;
mediaSource.TranscodingSubProtocol = streamInfo.SubProtocol;
// Do this after the above so that StartPositionTicks is set
SetDeviceSpecificSubtitleInfo(streamInfo, mediaSource, auth.Token);
}
}
else
{
if (streamInfo != null)
{
streamInfo.PlaySessionId = playSessionId;
if (streamInfo.PlayMethod == PlayMethod.Transcode)
{
streamInfo.StartPositionTicks = startTimeTicks;
@ -517,7 +561,6 @@ namespace MediaBrowser.Api.Playback
mediaSource.TranscodingContainer = streamInfo.Container;
mediaSource.TranscodingSubProtocol = streamInfo.SubProtocol;
}
// Do this after the above so that StartPositionTicks is set
SetDeviceSpecificSubtitleInfo(streamInfo, mediaSource, auth.Token);
}

Loading…
Cancel
Save