aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers/VideoHlsController.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2021-09-09 13:46:26 +0200
committerGitHub <noreply@github.com>2021-09-09 13:46:26 +0200
commit448125f2b41473af01a485856805769175f878e8 (patch)
tree0a13d49f61622ba1701b321ed38c70576407fe2b /Jellyfin.Api/Controllers/VideoHlsController.cs
parent1a5d8e89da713b589855a1e0edcfcde0879a1f49 (diff)
parentfdab8eebc906f18b75dd85a0f3416d74a98a24fe (diff)
Merge pull request #6523 from cvium/fix_livetv_cts_disposed
Diffstat (limited to 'Jellyfin.Api/Controllers/VideoHlsController.cs')
-rw-r--r--Jellyfin.Api/Controllers/VideoHlsController.cs9
1 files changed, 6 insertions, 3 deletions
diff --git a/Jellyfin.Api/Controllers/VideoHlsController.cs b/Jellyfin.Api/Controllers/VideoHlsController.cs
index 9c5e968dd..ef25db8c9 100644
--- a/Jellyfin.Api/Controllers/VideoHlsController.cs
+++ b/Jellyfin.Api/Controllers/VideoHlsController.cs
@@ -264,6 +264,9 @@ namespace Jellyfin.Api.Controllers
// CTS lifecycle is managed internally.
var cancellationTokenSource = new CancellationTokenSource();
+ // Due to CTS.Token calling ThrowIfDisposed (https://github.com/dotnet/runtime/issues/29970) we have to "cache" the token
+ // since it gets disposed when ffmpeg exits
+ var cancellationToken = cancellationTokenSource.Token;
using var state = await StreamingHelpers.GetStreamingState(
streamingRequest,
Request,
@@ -278,7 +281,7 @@ namespace Jellyfin.Api.Controllers
_deviceManager,
_transcodingJobHelper,
TranscodingJobType,
- cancellationTokenSource.Token)
+ cancellationToken)
.ConfigureAwait(false);
TranscodingJobDto? job = null;
@@ -287,7 +290,7 @@ namespace Jellyfin.Api.Controllers
if (!System.IO.File.Exists(playlistPath))
{
var transcodingLock = _transcodingJobHelper.GetTranscodingLock(playlistPath);
- await transcodingLock.WaitAsync(cancellationTokenSource.Token).ConfigureAwait(false);
+ await transcodingLock.WaitAsync(cancellationToken).ConfigureAwait(false);
try
{
if (!System.IO.File.Exists(playlistPath))
@@ -314,7 +317,7 @@ namespace Jellyfin.Api.Controllers
minSegments = state.MinSegments;
if (minSegments > 0)
{
- await HlsHelpers.WaitForMinimumSegmentCount(playlistPath, minSegments, _logger, cancellationTokenSource.Token).ConfigureAwait(false);
+ await HlsHelpers.WaitForMinimumSegmentCount(playlistPath, minSegments, _logger, cancellationToken).ConfigureAwait(false);
}
}
}