omit query string from segments on roku

This commit is contained in:
Luke Pulverenti 2015-12-12 15:41:25 -05:00
parent 885565b41e
commit f83c7be727
4 changed files with 32 additions and 32 deletions

View File

@ -2180,14 +2180,9 @@ namespace MediaBrowser.Api.Playback
if (state.VideoRequest != null) if (state.VideoRequest != null)
{ {
var videoCodec = GetVideoEncoder(state); if (string.Equals(state.OutputContainer, "mkv", StringComparison.OrdinalIgnoreCase))
// See if we can save come cpu cycles by avoiding encoding
if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{ {
if (string.Equals(state.OutputContainer, "mkv", StringComparison.OrdinalIgnoreCase)) inputModifier += " -noaccurate_seek";
{
inputModifier += " -noaccurate_seek";
}
} }
} }

View File

@ -513,7 +513,11 @@ namespace MediaBrowser.Api.Playback.Hls
// Main stream // Main stream
var playlistUrl = isLiveStream ? "live.m3u8" : "main.m3u8"; var playlistUrl = isLiveStream ? "live.m3u8" : "main.m3u8";
playlistUrl += queryString;
if ((Request.UserAgent ?? string.Empty).IndexOf("roku", StringComparison.OrdinalIgnoreCase) == -1)
{
playlistUrl += queryString;
}
var request = state.Request; var request = state.Request;

View File

@ -318,15 +318,17 @@ namespace MediaBrowser.Api.Playback
if (streamInfo != null) if (streamInfo != null)
{ {
streamInfo.PlaySessionId = playSessionId; streamInfo.PlaySessionId = playSessionId;
SetDeviceSpecificSubtitleInfo(streamInfo, mediaSource, auth.Token);
}
if (streamInfo != null && streamInfo.PlayMethod == PlayMethod.Transcode) if (streamInfo.PlayMethod == PlayMethod.Transcode)
{ {
streamInfo.StartPositionTicks = startTimeTicks; streamInfo.StartPositionTicks = startTimeTicks;
mediaSource.TranscodingUrl = streamInfo.ToUrl("-", auth.Token).TrimStart('-'); mediaSource.TranscodingUrl = streamInfo.ToUrl("-", auth.Token).TrimStart('-');
mediaSource.TranscodingContainer = streamInfo.Container; mediaSource.TranscodingContainer = streamInfo.Container;
mediaSource.TranscodingSubProtocol = streamInfo.SubProtocol; mediaSource.TranscodingSubProtocol = streamInfo.SubProtocol;
}
// Do this after the above so that StartPositionTicks is set
SetDeviceSpecificSubtitleInfo(streamInfo, mediaSource, auth.Token);
} }
} }
} }

View File

@ -10,6 +10,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using ServiceStack; using ServiceStack;
using System; using System;
using System.Globalization;
using System.IO; using System.IO;
using CommonIO; using CommonIO;
@ -100,7 +101,6 @@ namespace MediaBrowser.Api.Playback.Progressive
{ {
// Comparison: https://github.com/jansmolders86/mediacenterjs/blob/master/lib/transcoding/desktop.js // Comparison: https://github.com/jansmolders86/mediacenterjs/blob/master/lib/transcoding/desktop.js
format = " -f mp4 -movflags frag_keyframe+empty_moov"; format = " -f mp4 -movflags frag_keyframe+empty_moov";
//format = " -avoid_negative_ts disabled -start_at_zero -copyts -f mp4 -movflags frag_keyframe+empty_moov";
} }
var threads = GetNumberOfThreads(state, string.Equals(videoCodec, "libvpx", StringComparison.OrdinalIgnoreCase)); var threads = GetNumberOfThreads(state, string.Equals(videoCodec, "libvpx", StringComparison.OrdinalIgnoreCase));
@ -124,27 +124,26 @@ namespace MediaBrowser.Api.Playback.Progressive
/// Gets video arguments to pass to ffmpeg /// Gets video arguments to pass to ffmpeg
/// </summary> /// </summary>
/// <param name="state">The state.</param> /// <param name="state">The state.</param>
/// <param name="codec">The video codec.</param> /// <param name="videoCodec">The video codec.</param>
/// <returns>System.String.</returns> /// <returns>System.String.</returns>
private string GetVideoArguments(StreamState state, string codec) private string GetVideoArguments(StreamState state, string videoCodec)
{ {
var args = "-codec:v:0 " + codec; var args = "-codec:v:0 " + videoCodec;
if (state.EnableMpegtsM2TsMode) if (state.EnableMpegtsM2TsMode)
{ {
args += " -mpegts_m2ts_mode 1"; args += " -mpegts_m2ts_mode 1";
} }
// See if we can save come cpu cycles by avoiding encoding var isOutputMkv = string.Equals(state.OutputContainer, "mkv", StringComparison.OrdinalIgnoreCase);
if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
if (state.RunTimeTicks.HasValue)
{ {
var isOutputMkv = string.Equals(state.OutputContainer, "mkv", StringComparison.OrdinalIgnoreCase); //args += " -copyts -avoid_negative_ts disabled -start_at_zero";
}
if (isOutputMkv)
{
//args += " -copyts -avoid_negative_ts disabled -start_at_zero";
}
if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
if (state.VideoStream != null && IsH264(state.VideoStream) && if (state.VideoStream != null && IsH264(state.VideoStream) &&
(string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase) || isOutputMkv)) (string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase) || isOutputMkv))
{ {
@ -164,10 +163,10 @@ namespace MediaBrowser.Api.Playback.Progressive
// Add resolution params, if specified // Add resolution params, if specified
if (!hasGraphicalSubs) if (!hasGraphicalSubs)
{ {
args += GetOutputSizeParam(state, codec); args += GetOutputSizeParam(state, videoCodec);
} }
var qualityParam = GetVideoQualityParam(state, codec, false); var qualityParam = GetVideoQualityParam(state, videoCodec, false);
if (!string.IsNullOrEmpty(qualityParam)) if (!string.IsNullOrEmpty(qualityParam))
{ {
@ -177,7 +176,7 @@ namespace MediaBrowser.Api.Playback.Progressive
// This is for internal graphical subs // This is for internal graphical subs
if (hasGraphicalSubs) if (hasGraphicalSubs)
{ {
args += GetGraphicalSubtitleParam(state, codec); args += GetGraphicalSubtitleParam(state, videoCodec);
} }
return args; return args;