diff --git a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs
index 13d8c26db6..38bd7efeef 100644
--- a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs
+++ b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs
@@ -30,7 +30,7 @@ namespace Jellyfin.Api.Helpers
///
/// Transcoding job helpers.
///
- public class TranscodingJobHelper
+ public class TranscodingJobHelper : IDisposable
{
///
/// The active transcoding jobs.
@@ -46,14 +46,12 @@ namespace Jellyfin.Api.Helpers
private readonly EncodingHelper _encodingHelper;
private readonly IFileSystem _fileSystem;
private readonly IIsoManager _isoManager;
-
private readonly ILogger _logger;
private readonly IMediaEncoder _mediaEncoder;
private readonly IMediaSourceManager _mediaSourceManager;
private readonly IServerConfigurationManager _serverConfigurationManager;
private readonly ISessionManager _sessionManager;
private readonly ILoggerFactory _loggerFactory;
- private readonly IFileSystem _fileSystem;
///
/// Initializes a new instance of the class.
@@ -861,5 +859,28 @@ namespace Jellyfin.Api.Helpers
_fileSystem.DeleteFile(file);
}
}
+
+ ///
+ /// Dispose transcoding job helper.
+ ///
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ ///
+ /// Dispose throttler.
+ ///
+ /// Disposing.
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ _loggerFactory.Dispose();
+ _sessionManager!.PlaybackProgress -= OnPlaybackProgress;
+ _sessionManager!.PlaybackStart -= OnPlaybackProgress;
+ }
+ }
}
}