diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-02-01 15:55:56 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-02-01 15:55:56 -0500 |
| commit | 30538f0731574428fd785695737a30997eab0ae8 (patch) | |
| tree | 39add0298ac5e1f89ae1943bf97690df15b8a553 /Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs | |
| parent | 1d849e3f2549b46014e9f8b422399f00fc55add1 (diff) | |
improve video startup performance
Diffstat (limited to 'Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs')
| -rw-r--r-- | Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs index bd6f31906..7b48ce21a 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs @@ -19,7 +19,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts public Action<QueueStream> OnFinished { get; set; } private readonly ILogger _logger; - private bool _isActive; + public Guid Id = Guid.NewGuid(); public QueueStream(Stream outputStream, ILogger logger) { @@ -30,10 +30,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts public void Queue(byte[] bytes) { - if (_isActive) - { - _queue.Enqueue(bytes); - } + _queue.Enqueue(bytes); } public void Start(CancellationToken cancellationToken) @@ -59,10 +56,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts try { - while (!cancellationToken.IsCancellationRequested) + while (true) { - _isActive = true; - var bytes = Dequeue(); if (bytes != null) { @@ -73,9 +68,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts await Task.Delay(50, cancellationToken).ConfigureAwait(false); } } - - TaskCompletion.TrySetResult(true); - _logger.Debug("QueueStream complete"); } catch (OperationCanceledException) { @@ -89,8 +81,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts } finally { - _isActive = false; - if (OnFinished != null) { OnFinished(this); |
