aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Playback
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/Playback')
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs7
-rw-r--r--MediaBrowser.Api/Playback/Hls/BaseHlsService.cs12
-rw-r--r--MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs10
-rw-r--r--MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs4
4 files changed, 17 insertions, 16 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 9ff482a1ab..75e13f92c2 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -13,7 +13,6 @@ using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Library;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.MediaInfo;
using System;
@@ -1955,12 +1954,6 @@ namespace MediaBrowser.Api.Playback
/// <param name="videoRequest">The video request.</param>
private void EnforceResolutionLimit(StreamState state, VideoStreamRequest videoRequest)
{
- // If enabled, allow whatever the client asks for
- if (ServerConfigurationManager.Configuration.AllowVideoUpscaling)
- {
- return;
- }
-
// Switch the incoming params to be ceilings rather than fixed values
videoRequest.MaxWidth = videoRequest.MaxWidth ?? videoRequest.Width;
videoRequest.MaxHeight = videoRequest.MaxHeight ?? videoRequest.Height;
diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
index fa78fa0205..8a65e2b565 100644
--- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
@@ -66,7 +66,6 @@ namespace MediaBrowser.Api.Playback.Hls
return ProcessRequestAsync(request, isLive).Result;
}
- private static readonly SemaphoreSlim FfmpegStartLock = new SemaphoreSlim(1, 1);
/// <summary>
/// Processes the request async.
/// </summary>
@@ -82,6 +81,11 @@ namespace MediaBrowser.Api.Playback.Hls
var state = await GetState(request, cancellationTokenSource.Token).ConfigureAwait(false);
+ if (isLive)
+ {
+ state.Request.StartTimeTicks = null;
+ }
+
var playlist = state.OutputFilePath;
if (File.Exists(playlist))
@@ -90,7 +94,7 @@ namespace MediaBrowser.Api.Playback.Hls
}
else
{
- await FfmpegStartLock.WaitAsync(cancellationTokenSource.Token).ConfigureAwait(false);
+ await ApiEntryPoint.Instance.TranscodingStartLock.WaitAsync(cancellationTokenSource.Token).ConfigureAwait(false);
try
{
if (File.Exists(playlist))
@@ -99,6 +103,8 @@ namespace MediaBrowser.Api.Playback.Hls
}
else
{
+ await ApiEntryPoint.Instance.KillTranscodingJobs(state.Request.DeviceId, TranscodingJobType.Hls, FileDeleteMode.All, false).ConfigureAwait(false);
+
// If the playlist doesn't already exist, startup ffmpeg
try
{
@@ -116,7 +122,7 @@ namespace MediaBrowser.Api.Playback.Hls
}
finally
{
- FfmpegStartLock.Release();
+ ApiEntryPoint.Instance.TranscodingStartLock.Release();
}
}
diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
index 5bb6106860..0af336c55b 100644
--- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
@@ -65,7 +65,6 @@ namespace MediaBrowser.Api.Playback.Hls
return GetDynamicSegment(request).Result;
}
- private static readonly SemaphoreSlim FfmpegStartLock = new SemaphoreSlim(1, 1);
private async Task<object> GetDynamicSegment(GetDynamicHlsVideoSegment request)
{
if ((request.StartTimeTicks ?? 0) > 0)
@@ -90,7 +89,7 @@ namespace MediaBrowser.Api.Playback.Hls
return await GetSegmentResult(playlistPath, segmentPath, index, cancellationToken).ConfigureAwait(false);
}
- await FfmpegStartLock.WaitAsync(cancellationTokenSource.Token).ConfigureAwait(false);
+ await ApiEntryPoint.Instance.TranscodingStartLock.WaitAsync(cancellationTokenSource.Token).ConfigureAwait(false);
try
{
if (File.Exists(segmentPath))
@@ -107,10 +106,11 @@ namespace MediaBrowser.Api.Playback.Hls
// If the playlist doesn't already exist, startup ffmpeg
try
{
+ // TODO: Delete files from other jobs, but not this one
+ await ApiEntryPoint.Instance.KillTranscodingJobs(state.Request.DeviceId, TranscodingJobType.Hls, FileDeleteMode.None, false).ConfigureAwait(false);
+
if (currentTranscodingIndex.HasValue)
{
- ApiEntryPoint.Instance.KillTranscodingJobs(state.Request.DeviceId, playlistPath, FileDeleteMode.None);
-
DeleteLastFile(playlistPath, 0);
}
@@ -131,7 +131,7 @@ namespace MediaBrowser.Api.Playback.Hls
}
finally
{
- FfmpegStartLock.Release();
+ ApiEntryPoint.Instance.TranscodingStartLock.Release();
}
Logger.Info("waiting for {0}", segmentPath);
diff --git a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
index f31671b1a1..3848cb2de0 100644
--- a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
+++ b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
@@ -74,7 +74,9 @@ namespace MediaBrowser.Api.Playback.Hls
public void Delete(StopEncodingProcess request)
{
- ApiEntryPoint.Instance.KillTranscodingJobs(request.DeviceId, FileDeleteMode.All);
+ var task = ApiEntryPoint.Instance.KillTranscodingJobs(request.DeviceId, FileDeleteMode.All, true);
+
+ Task.WaitAll(task);
}
/// <summary>