aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/LiveTv/ProgressiveFileCopier.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-10-24 01:20:09 -0400
committerGitHub <noreply@github.com>2017-10-24 01:20:09 -0400
commit0aac8045fb69ad1024859812a09e68070ea698f6 (patch)
tree6e8b55133b0eeee606df5049497b80a612843733 /MediaBrowser.Api/LiveTv/ProgressiveFileCopier.cs
parent7924bb7c9add449f61d8695add6f2f3fcbc18a0a (diff)
parent6c5f3ce07e8b36299a4143dc609999d880e7bdfd (diff)
Merge pull request #2974 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Api/LiveTv/ProgressiveFileCopier.cs')
-rw-r--r--MediaBrowser.Api/LiveTv/ProgressiveFileCopier.cs13
1 files changed, 5 insertions, 8 deletions
diff --git a/MediaBrowser.Api/LiveTv/ProgressiveFileCopier.cs b/MediaBrowser.Api/LiveTv/ProgressiveFileCopier.cs
index 9ce109fc4..74293ccd9 100644
--- a/MediaBrowser.Api/LiveTv/ProgressiveFileCopier.cs
+++ b/MediaBrowser.Api/LiveTv/ProgressiveFileCopier.cs
@@ -16,7 +16,6 @@ namespace MediaBrowser.Api.LiveTv
private readonly IFileSystem _fileSystem;
private readonly ILogger _logger;
private readonly string _path;
- private readonly CancellationToken _cancellationToken;
private readonly Dictionary<string, string> _outputHeaders;
const int StreamCopyToBufferSize = 81920;
@@ -28,22 +27,20 @@ namespace MediaBrowser.Api.LiveTv
private readonly IDirectStreamProvider _directStreamProvider;
private readonly IEnvironmentInfo _environment;
- public ProgressiveFileCopier(IFileSystem fileSystem, string path, Dictionary<string, string> outputHeaders, ILogger logger, IEnvironmentInfo environment, CancellationToken cancellationToken)
+ public ProgressiveFileCopier(IFileSystem fileSystem, string path, Dictionary<string, string> outputHeaders, ILogger logger, IEnvironmentInfo environment)
{
_fileSystem = fileSystem;
_path = path;
_outputHeaders = outputHeaders;
_logger = logger;
- _cancellationToken = cancellationToken;
_environment = environment;
}
- public ProgressiveFileCopier(IDirectStreamProvider directStreamProvider, Dictionary<string, string> outputHeaders, ILogger logger, IEnvironmentInfo environment, CancellationToken cancellationToken)
+ public ProgressiveFileCopier(IDirectStreamProvider directStreamProvider, Dictionary<string, string> outputHeaders, ILogger logger, IEnvironmentInfo environment)
{
_directStreamProvider = directStreamProvider;
_outputHeaders = outputHeaders;
_logger = logger;
- _cancellationToken = cancellationToken;
_environment = environment;
}
@@ -69,8 +66,6 @@ namespace MediaBrowser.Api.LiveTv
public async Task WriteToAsync(Stream outputStream, CancellationToken cancellationToken)
{
- cancellationToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _cancellationToken).Token;
-
if (_directStreamProvider != null)
{
await _directStreamProvider.CopyToAsync(outputStream, cancellationToken).ConfigureAwait(false);
@@ -89,7 +84,9 @@ namespace MediaBrowser.Api.LiveTv
inputStream.Position = StartPosition;
}
- while (eofCount < 20 || !AllowEndOfFile)
+ var emptyReadLimit = AllowEndOfFile ? 20 : 100;
+
+ while (eofCount < emptyReadLimit)
{
int bytesRead;
if (allowAsyncFileRead)