aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/LiveTv/EmbyTV
diff options
context:
space:
mode:
authorcvium <clausvium@gmail.com>2021-09-10 09:29:14 +0200
committercvium <clausvium@gmail.com>2021-09-10 09:29:14 +0200
commit1603d1928e888abeccc6a5fab2e1f13aa65eea6c (patch)
tree4be38a370ab2c2340af7a547f1c79390c2de42cc /Emby.Server.Implementations/LiveTv/EmbyTV
parentb96dbbf553820861eab9d1a453adcc8ce8a9ef05 (diff)
Kill ProgressiveFileCopier and seek to end for ongoing livetv
Diffstat (limited to 'Emby.Server.Implementations/LiveTv/EmbyTV')
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs16
1 files changed, 12 insertions, 4 deletions
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs
index c5a9a92ec2..fdefa2679a 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs
@@ -5,6 +5,7 @@ using System.IO;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
+using Jellyfin.Api.Helpers;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Dto;
@@ -50,16 +51,23 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
onStarted();
- _logger.LogInformation("Copying recording stream to file {0}", targetFile);
+ _logger.LogInformation("Copying recording to file {FilePath}", targetFile);
// The media source is infinite so we need to handle stopping ourselves
using var durationToken = new CancellationTokenSource(duration);
using var cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, durationToken.Token);
-
- await directStreamProvider.CopyToAsync(output, cancellationTokenSource.Token).ConfigureAwait(false);
+ var linkedCancellationToken = cancellationTokenSource.Token;
+
+ await using var fileStream = new ProgressiveFileStream(directStreamProvider.GetStream(), null, null);
+ await _streamHelper.CopyToAsync(
+ fileStream,
+ output,
+ IODefaults.CopyToBufferSize,
+ 1000,
+ linkedCancellationToken).ConfigureAwait(false);
}
- _logger.LogInformation("Recording completed to file {0}", targetFile);
+ _logger.LogInformation("Recording completed: {FilePath}", targetFile);
}
private async Task RecordFromMediaSource(MediaSourceInfo mediaSource, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken)