diff options
| author | nyanmisaka <nst799610810@gmail.com> | 2024-03-16 03:40:14 +0800 |
|---|---|---|
| committer | nyanmisaka <nst799610810@gmail.com> | 2024-03-16 07:35:05 +0800 |
| commit | eca9bf41bcf536708ad74236793b363db3af1e4d (patch) | |
| tree | 9c63f5ed565bc039162125eecad92a90f9f05089 /MediaBrowser.Controller/MediaEncoding/TranscodingJob.cs | |
| parent | 1e964c9bc23b598135590f5b29f25836158a4305 (diff) | |
Add TranscodingSegmentCleaner to replace ffmpeg's hlsenc deletion
FFmpeg deletes segments based on its own transcoding progress,
but we need to delete segments based on client download progress.
Since disk and GPU speeds vary, using hlsenc's built-in deletion
will result in premature deletion of some segments. As a consequence,
the server has to constantly respin new ffmpeg instances, resulting
in choppy video playback.
Signed-off-by: nyanmisaka <nst799610810@gmail.com>
Diffstat (limited to 'MediaBrowser.Controller/MediaEncoding/TranscodingJob.cs')
| -rw-r--r-- | MediaBrowser.Controller/MediaEncoding/TranscodingJob.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/MediaEncoding/TranscodingJob.cs b/MediaBrowser.Controller/MediaEncoding/TranscodingJob.cs index 1e6d5933c..2b6540ea8 100644 --- a/MediaBrowser.Controller/MediaEncoding/TranscodingJob.cs +++ b/MediaBrowser.Controller/MediaEncoding/TranscodingJob.cs @@ -137,6 +137,11 @@ public sealed class TranscodingJob : IDisposable public TranscodingThrottler? TranscodingThrottler { get; set; } /// <summary> + /// Gets or sets transcoding segment cleaner. + /// </summary> + public TranscodingSegmentCleaner? TranscodingSegmentCleaner { get; set; } + + /// <summary> /// Gets or sets last ping date. /// </summary> public DateTime LastPingDate { get; set; } @@ -239,6 +244,7 @@ public sealed class TranscodingJob : IDisposable { #pragma warning disable CA1849 // Can't await in lock block TranscodingThrottler?.Stop().GetAwaiter().GetResult(); + TranscodingSegmentCleaner?.Stop(); var process = Process; @@ -276,5 +282,7 @@ public sealed class TranscodingJob : IDisposable CancellationTokenSource = null; TranscodingThrottler?.Dispose(); TranscodingThrottler = null; + TranscodingSegmentCleaner?.Dispose(); + TranscodingSegmentCleaner = null; } } |
