diff options
| author | Patrick Barron <barronpm@gmail.com> | 2023-12-05 14:26:35 -0500 |
|---|---|---|
| committer | Patrick Barron <barronpm@gmail.com> | 2023-12-05 14:26:35 -0500 |
| commit | 192559db32ef60b2a56b7acf689b6edc3cdc3487 (patch) | |
| tree | eddafd624d7e03e367df22227e7a7fafea27a7b9 /Emby.Server.Implementations | |
| parent | 669baf98a577094c5b038c7782045b873d468c0b (diff) | |
Make ILiveStream an IDisposable
Diffstat (limited to 'Emby.Server.Implementations')
| -rw-r--r-- | Emby.Server.Implementations/Library/ExclusiveLiveStream.cs | 7 | ||||
| -rw-r--r-- | Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs | 15 |
2 files changed, 21 insertions, 1 deletions
diff --git a/Emby.Server.Implementations/Library/ExclusiveLiveStream.cs b/Emby.Server.Implementations/Library/ExclusiveLiveStream.cs index 868071a99..b1649afad 100644 --- a/Emby.Server.Implementations/Library/ExclusiveLiveStream.cs +++ b/Emby.Server.Implementations/Library/ExclusiveLiveStream.cs @@ -12,7 +12,7 @@ using MediaBrowser.Model.Dto; namespace Emby.Server.Implementations.Library { - public class ExclusiveLiveStream : ILiveStream + public sealed class ExclusiveLiveStream : ILiveStream { private readonly Func<Task> _closeFn; @@ -51,5 +51,10 @@ namespace Emby.Server.Implementations.Library { return Task.CompletedTask; } + + /// <inheritdoc /> + public void Dispose() + { + } } } diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs index c0ba8710f..c18594a29 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs @@ -112,6 +112,21 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts return stream; } + /// <inheritdoc /> + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool dispose) + { + if (dispose) + { + LiveStreamCancellationTokenSource?.Dispose(); + } + } + protected async Task DeleteTempFiles(string path, int retryCount = 0) { if (retryCount == 0) |
