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 /Jellyfin.Api/Controllers/DynamicHlsController.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 'Jellyfin.Api/Controllers/DynamicHlsController.cs')
| -rw-r--r-- | Jellyfin.Api/Controllers/DynamicHlsController.cs | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/Jellyfin.Api/Controllers/DynamicHlsController.cs b/Jellyfin.Api/Controllers/DynamicHlsController.cs index 590cdc33f..d70c51b86 100644 --- a/Jellyfin.Api/Controllers/DynamicHlsController.cs +++ b/Jellyfin.Api/Controllers/DynamicHlsController.cs @@ -1604,7 +1604,7 @@ public class DynamicHlsController : BaseJellyfinApiController Path.GetFileNameWithoutExtension(outputPath)); } - var hlsArguments = GetHlsArguments(isEventPlaylist, state.SegmentLength); + var hlsArguments = string.Format(CultureInfo.InvariantCulture, "-hls_playlist_type {0} -hls_list_size 0", isEventPlaylist ? "event" : "vod"); return string.Format( CultureInfo.InvariantCulture, @@ -1626,33 +1626,6 @@ public class DynamicHlsController : BaseJellyfinApiController } /// <summary> - /// Gets the HLS arguments for transcoding. - /// </summary> - /// <returns>The command line arguments for HLS transcoding.</returns> - private string GetHlsArguments(bool isEventPlaylist, int segmentLength) - { - var enableThrottling = _encodingOptions.EnableThrottling; - var enableSegmentDeletion = _encodingOptions.EnableSegmentDeletion; - - // Only enable segment deletion when throttling is enabled - if (enableThrottling && enableSegmentDeletion) - { - // Store enough segments for configured seconds of playback; this needs to be above throttling settings - var segmentCount = _encodingOptions.SegmentKeepSeconds / segmentLength; - - _logger.LogDebug("Using throttling and segment deletion, keeping {0} segments", segmentCount); - - return string.Format(CultureInfo.InvariantCulture, "-hls_list_size {0} -hls_flags delete_segments", segmentCount.ToString(CultureInfo.InvariantCulture)); - } - else - { - _logger.LogDebug("Using normal playback, is event playlist? {0}", isEventPlaylist); - - return string.Format(CultureInfo.InvariantCulture, "-hls_playlist_type {0} -hls_list_size 0", isEventPlaylist ? "event" : "vod"); - } - } - - /// <summary> /// Gets the audio arguments for transcoding. /// </summary> /// <param name="state">The <see cref="StreamState"/>.</param> |
