Merge pull request #1111 from MediaBrowser/master

3.0.5621.4
pull/702/head
Luke 10 years ago
commit f4bd53d4db

@ -228,7 +228,7 @@ namespace MediaBrowser.Api
{
lock (_activeTranscodingJobs)
{
var job = _activeTranscodingJobs.First(j => j.Type == type && j.Path.Equals(path, StringComparison.OrdinalIgnoreCase));
var job = _activeTranscodingJobs.First(j => j.Type == type && string.Equals(j.Path, path, StringComparison.OrdinalIgnoreCase));
_activeTranscodingJobs.Remove(job);
}
@ -250,19 +250,11 @@ namespace MediaBrowser.Api
return GetTranscodingJob(path, type) != null;
}
public TranscodingJob GetTranscodingJobByPlaySessionId(string playSessionId)
{
lock (_activeTranscodingJobs)
{
return _activeTranscodingJobs.FirstOrDefault(j => j.PlaySessionId.Equals(playSessionId, StringComparison.OrdinalIgnoreCase));
}
}
public TranscodingJob GetTranscodingJob(string path, TranscodingJobType type)
{
lock (_activeTranscodingJobs)
{
return _activeTranscodingJobs.FirstOrDefault(j => j.Type == type && j.Path.Equals(path, StringComparison.OrdinalIgnoreCase));
return _activeTranscodingJobs.FirstOrDefault(j => j.Type == type && string.Equals(j.Path, path, StringComparison.OrdinalIgnoreCase));
}
}
@ -275,7 +267,7 @@ namespace MediaBrowser.Api
{
lock (_activeTranscodingJobs)
{
var job = _activeTranscodingJobs.FirstOrDefault(j => j.Type == type && j.Path.Equals(path, StringComparison.OrdinalIgnoreCase));
var job = _activeTranscodingJobs.FirstOrDefault(j => j.Type == type && string.Equals(j.Path, path, StringComparison.OrdinalIgnoreCase));
if (job == null)
{
@ -344,7 +336,7 @@ namespace MediaBrowser.Api
if (job.Type != TranscodingJobType.Progressive)
{
timerDuration = 1800000;
// We can really reduce the timeout for apps that are using the newer api
if (!string.IsNullOrWhiteSpace(job.PlaySessionId))
{
@ -462,7 +454,7 @@ namespace MediaBrowser.Api
job.DisposeKillTimer();
Logger.Debug("KillTranscodingJob - JobId {0} PlaySessionId {1}. Killing transcoding", job.Id, job.PlaySessionId);
lock (_activeTranscodingJobs)
{
_activeTranscodingJobs.Remove(job);

@ -185,7 +185,7 @@ namespace MediaBrowser.Api.Playback.Hls
{
var startTranscoding = false;
var currentTranscodingIndex = GetCurrentTranscodingIndex(playlistPath, request.PlaySessionId, segmentExtension);
var currentTranscodingIndex = GetCurrentTranscodingIndex(playlistPath, segmentExtension);
var segmentGapRequiringTranscodingChange = 24 / state.SegmentLength;
if (currentTranscodingIndex == null)
@ -325,11 +325,9 @@ namespace MediaBrowser.Api.Playback.Hls
return position;
}
public int? GetCurrentTranscodingIndex(string playlist, string playSessionId, string segmentExtension)
public int? GetCurrentTranscodingIndex(string playlist, string segmentExtension)
{
var job = string.IsNullOrWhiteSpace(playSessionId) ?
ApiEntryPoint.Instance.GetTranscodingJob(playlist, TranscodingJobType) :
ApiEntryPoint.Instance.GetTranscodingJobByPlaySessionId(playSessionId);
var job = ApiEntryPoint.Instance.GetTranscodingJob(playlist, TranscodingJobType);
if (job == null || job.HasExited)
{
@ -844,11 +842,14 @@ namespace MediaBrowser.Api.Playback.Hls
}
// See if we can save come cpu cycles by avoiding encoding
if (codec.Equals("copy", StringComparison.OrdinalIgnoreCase))
if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
{
args += state.VideoStream != null && IsH264(state.VideoStream)
? args + " -bsf:v h264_mp4toannexb"
: args;
if (state.VideoStream != null && IsH264(state.VideoStream))
{
args += " -bsf:v h264_mp4toannexb";
}
args += " -flags -global_header -sc_threshold 0";
}
else
{
@ -872,9 +873,14 @@ namespace MediaBrowser.Api.Playback.Hls
{
args += GetGraphicalSubtitleParam(state, codec);
}
args += " -flags +loop-global_header -sc_threshold 0";
}
args += " -flags +loop-global_header -sc_threshold 0";
if (!EnableSplitTranscoding(state))
{
args += " -copyts";
}
return args;
}
@ -889,6 +895,8 @@ namespace MediaBrowser.Api.Playback.Hls
var startNumberParam = isEncoding ? GetStartNumber(state).ToString(UsCulture) : "0";
var toTimeParam = string.Empty;
var timestampOffsetParam = string.Empty;
if (EnableSplitTranscoding(state))
{
var startTime = state.Request.StartTimeTicks ?? 0;
@ -902,14 +910,13 @@ namespace MediaBrowser.Api.Playback.Hls
//toTimeParam = " -to " + MediaEncoder.GetTimeParameter(endTime);
toTimeParam = " -t " + MediaEncoder.GetTimeParameter(TimeSpan.FromSeconds(durationSeconds).Ticks);
}
}
var timestampOffsetParam = string.Empty;
if (state.IsOutputVideo)
{
timestampOffsetParam = " -output_ts_offset " + MediaEncoder.GetTimeParameter(state.Request.StartTimeTicks ?? 0).ToString(CultureInfo.InvariantCulture);
if (state.IsOutputVideo && !string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase) && (state.Request.StartTimeTicks ?? 0) > 0)
{
timestampOffsetParam = " -output_ts_offset " + MediaEncoder.GetTimeParameter(state.Request.StartTimeTicks ?? 0).ToString(CultureInfo.InvariantCulture);
}
}
var mapArgs = state.IsOutputVideo ? GetMapArgs(state) : string.Empty;
//var outputTsArg = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state);
@ -962,6 +969,11 @@ namespace MediaBrowser.Api.Playback.Hls
return false;
}
if (string.Equals(state.OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
return false;
}
return state.RunTimeTicks.HasValue && state.IsOutputVideo;
}

@ -259,6 +259,9 @@
</BundleResource>
<BundleResource Include="Resources\appicon.icns" />
<BundleResource Include="Resources\MediaBrowser.Server.Mac\Images.xcassets\AppIcon.appiconset\Contents.json" />
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\.DS_Store">
<Link>Resources\dashboard-ui\.DS_Store</Link>
</BundleResource>
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\about.html">
<Link>Resources\dashboard-ui\about.html</Link>
</BundleResource>
@ -652,6 +655,9 @@
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\wizarduser.html">
<Link>Resources\dashboard-ui\wizarduser.html</Link>
</BundleResource>
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\css\.DS_Store">
<Link>Resources\dashboard-ui\css\.DS_Store</Link>
</BundleResource>
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\css\card.css">
<Link>Resources\dashboard-ui\css\card.css</Link>
</BundleResource>
@ -1672,6 +1678,9 @@
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\thirdparty\cordova\connectsdk.js">
<Link>Resources\dashboard-ui\thirdparty\cordova\connectsdk.js</Link>
</BundleResource>
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\thirdparty\cordova\externalplayer.js">
<Link>Resources\dashboard-ui\thirdparty\cordova\externalplayer.js</Link>
</BundleResource>
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\thirdparty\cordova\generaldevice.js">
<Link>Resources\dashboard-ui\thirdparty\cordova\generaldevice.js</Link>
</BundleResource>
@ -1687,6 +1696,9 @@
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\thirdparty\cordova\serverdiscovery.js">
<Link>Resources\dashboard-ui\thirdparty\cordova\serverdiscovery.js</Link>
</BundleResource>
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\thirdparty\cordova\android\immersive.js">
<Link>Resources\dashboard-ui\thirdparty\cordova\android\immersive.js</Link>
</BundleResource>
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\thirdparty\fontawesome\css\font-awesome.css">
<Link>Resources\dashboard-ui\thirdparty\fontawesome\css\font-awesome.css</Link>
</BundleResource>

@ -1,4 +1,4 @@
using System.Reflection;
//[assembly: AssemblyVersion("3.0.*")]
[assembly: AssemblyVersion("3.0.5621.3")]
[assembly: AssemblyVersion("3.0.5621.4")]

Loading…
Cancel
Save