diff options
| author | crobibero <cody@robibe.ro> | 2020-09-04 08:16:49 -0600 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-09-04 08:16:49 -0600 |
| commit | 2a8653b3094d967e55b8bd012429d523629cdb38 (patch) | |
| tree | 480ee90c8e3adcc49e1c97e4d1953483589d1889 /Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs | |
| parent | 82f30a35dbbb52dc069d027c9a3af7fc3bbb3100 (diff) | |
| parent | 559a7fc336a022c92f63a8d77b6eb3c2f915c290 (diff) | |
Merge remote-tracking branch 'upstream/master' into http-client-migrate
Diffstat (limited to 'Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs')
| -rw-r--r-- | Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs index a1037948b9..cdabc07054 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs @@ -52,10 +52,10 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV _logger.LogInformation("Copying recording stream to file {0}", targetFile); // The media source is infinite so we need to handle stopping ourselves - var durationToken = new CancellationTokenSource(duration); - cancellationToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, durationToken.Token).Token; + using var durationToken = new CancellationTokenSource(duration); + using var cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, durationToken.Token); - await directStreamProvider.CopyToAsync(output, cancellationToken).ConfigureAwait(false); + await directStreamProvider.CopyToAsync(output, cancellationTokenSource.Token).ConfigureAwait(false); } _logger.LogInformation("Recording completed to file {0}", targetFile); @@ -80,7 +80,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV var durationToken = new CancellationTokenSource(duration); cancellationToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, durationToken.Token).Token; - await _streamHelper.CopyUntilCancelled(await response.Content.ReadAsStreamAsync().ConfigureAwait(false), output, 81920, cancellationToken).ConfigureAwait(false); + await _streamHelper.CopyUntilCancelled( + await response.Content.ReadAsStreamAsync().ConfigureAwait(false), + output, + 81920, + cancellationToken).ConfigureAwait(false); _logger.LogInformation("Recording completed to file {0}", targetFile); } |
