omit query string from segments on roku

pull/702/head
Luke Pulverenti 9 years ago
parent 049c13cec1
commit d341cd39aa

@ -2179,17 +2179,12 @@ namespace MediaBrowser.Api.Playback
} }
if (state.VideoRequest != null) if (state.VideoRequest != null)
{
var videoCodec = GetVideoEncoder(state);
// 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)) if (string.Equals(state.OutputContainer, "mkv", StringComparison.OrdinalIgnoreCase))
{ {
inputModifier += " -noaccurate_seek"; inputModifier += " -noaccurate_seek";
} }
} }
}
return inputModifier; return inputModifier;
} }

@ -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";
if ((Request.UserAgent ?? string.Empty).IndexOf("roku", StringComparison.OrdinalIgnoreCase) == -1)
{
playlistUrl += queryString; playlistUrl += queryString;
}
var request = state.Request; var request = state.Request;

@ -318,16 +318,18 @@ 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);
}
} }
} }

@ -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
if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
{
var isOutputMkv = string.Equals(state.OutputContainer, "mkv", StringComparison.OrdinalIgnoreCase); var isOutputMkv = string.Equals(state.OutputContainer, "mkv", StringComparison.OrdinalIgnoreCase);
if (isOutputMkv) if (state.RunTimeTicks.HasValue)
{ {
//args += " -copyts -avoid_negative_ts disabled -start_at_zero"; //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;

Loading…
Cancel
Save