aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/ApiEntryPoint.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/ApiEntryPoint.cs')
-rw-r--r--MediaBrowser.Api/ApiEntryPoint.cs17
1 files changed, 12 insertions, 5 deletions
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs
index 8233717ab..dc811812a 100644
--- a/MediaBrowser.Api/ApiEntryPoint.cs
+++ b/MediaBrowser.Api/ApiEntryPoint.cs
@@ -237,9 +237,12 @@ namespace MediaBrowser.Api
{
lock (_activeTranscodingJobs)
{
- var job = _activeTranscodingJobs.First(j => j.Type == type && string.Equals(j.Path, path, StringComparison.OrdinalIgnoreCase));
+ var job = _activeTranscodingJobs.FirstOrDefault(j => j.Type == type && string.Equals(j.Path, path, StringComparison.OrdinalIgnoreCase));
- _activeTranscodingJobs.Remove(job);
+ if (job != null)
+ {
+ _activeTranscodingJobs.Remove(job);
+ }
}
if (!string.IsNullOrWhiteSpace(state.Request.DeviceId))
@@ -349,7 +352,7 @@ namespace MediaBrowser.Api
if (job.Type != TranscodingJobType.Progressive)
{
- timerDuration = 1800000;
+ timerDuration = 60000;
}
job.PingTimeout = timerDuration;
@@ -488,13 +491,17 @@ namespace MediaBrowser.Api
{
try
{
- Logger.Info("Killing ffmpeg process for {0}", job.Path);
+ Logger.Info("Stopping ffmpeg process with q command for {0}", job.Path);
//process.Kill();
process.StandardInput.WriteLine("q");
// Need to wait because killing is asynchronous
- process.WaitForExit(5000);
+ if (!process.WaitForExit(5000))
+ {
+ Logger.Info("Killing ffmpeg process for {0}", job.Path);
+ process.Kill();
+ }
}
catch (Exception ex)
{