diff options
Diffstat (limited to 'Emby.Server.Implementations/LiveTv')
| -rw-r--r-- | Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs | 4 | ||||
| -rw-r--r-- | Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs | 10 |
2 files changed, 11 insertions, 3 deletions
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs index 360a2cee78..7b88be19c1 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs @@ -25,10 +25,10 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts { _cancellationToken = cancellationToken; + byte[] buffer = new byte[BufferSize]; + while (!cancellationToken.IsCancellationRequested) { - byte[] buffer = new byte[BufferSize]; - var bytesRead = await source.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false); if (bytesRead > 0) diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs index 7605641b22..bd6f319062 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs @@ -19,6 +19,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts public Action<QueueStream> OnFinished { get; set; } private readonly ILogger _logger; + private bool _isActive; public QueueStream(Stream outputStream, ILogger logger) { @@ -29,7 +30,10 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts public void Queue(byte[] bytes) { - _queue.Enqueue(bytes); + if (_isActive) + { + _queue.Enqueue(bytes); + } } public void Start(CancellationToken cancellationToken) @@ -57,6 +61,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts { while (!cancellationToken.IsCancellationRequested) { + _isActive = true; + var bytes = Dequeue(); if (bytes != null) { @@ -83,6 +89,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts } finally { + _isActive = false; + if (OnFinished != null) { OnFinished(this); |
