diff options
| author | klizas <klizas@users.noreply.github.com> | 2026-10-05 19:18:45 -0400 |
|---|---|---|
| committer | Cody Robibero <cody@robibe.ro> | 2026-10-05 19:18:45 -0400 |
| commit | 7dc6544d3441187f73393dac54dc358b3ceb98ed (patch) | |
| tree | 339d4cf7da2c12397602a372e028433e6e9c2434 /Jellyfin.Api/Controllers/DynamicHlsController.cs | |
| parent | 69e131eaa5bbe6ff01175332b58c5b262863a5a3 (diff) | |
Backport pull request #18186 from jellyfin/release-12.z
Fix segment cleaner deleting segments ahead of playback when remuxing MKV
Original-merge: 3acc9c8443d7ee445c4fe015f2977a47d4ea57ac
Merged-by: crobibero <cody@robibe.ro>
Backported-by: Cody Robibero <cody@robibe.ro>
Diffstat (limited to 'Jellyfin.Api/Controllers/DynamicHlsController.cs')
| -rw-r--r-- | Jellyfin.Api/Controllers/DynamicHlsController.cs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Jellyfin.Api/Controllers/DynamicHlsController.cs b/Jellyfin.Api/Controllers/DynamicHlsController.cs index 034a9dea55..dc0a6b2da9 100644 --- a/Jellyfin.Api/Controllers/DynamicHlsController.cs +++ b/Jellyfin.Api/Controllers/DynamicHlsController.cs @@ -1928,7 +1928,7 @@ public class DynamicHlsController : BaseJellyfinApiController { // Transcoding job is over, so assume all existing files are ready _logger.LogDebug("serving up {0} as transcode is over", segmentPath); - return GetSegmentResult(state, segmentPath, transcodingJob); + return GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob); } var currentTranscodingIndex = GetCurrentTranscodingIndex(playlistPath, segmentExtension); @@ -1937,7 +1937,7 @@ public class DynamicHlsController : BaseJellyfinApiController if (segmentIndex < currentTranscodingIndex) { _logger.LogDebug("serving up {0} as transcode index {1} is past requested point {2}", segmentPath, currentTranscodingIndex, segmentIndex); - return GetSegmentResult(state, segmentPath, transcodingJob); + return GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob); } } @@ -1953,7 +1953,7 @@ public class DynamicHlsController : BaseJellyfinApiController if (transcodingJob.HasExited || System.IO.File.Exists(nextSegmentPath)) { _logger.LogDebug("Serving up {SegmentPath} as it deemed ready", segmentPath); - return GetSegmentResult(state, segmentPath, transcodingJob); + return GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob); } } else @@ -1984,10 +1984,10 @@ public class DynamicHlsController : BaseJellyfinApiController _logger.LogWarning("cannot serve {0} as it doesn't exist and no transcode is running", segmentPath); } - return GetSegmentResult(state, segmentPath, transcodingJob); + return GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob); } - private ActionResult GetSegmentResult(StreamState state, string segmentPath, TranscodingJob? transcodingJob) + private ActionResult GetSegmentResult(StreamState state, string segmentPath, int segmentIndex, TranscodingJob? transcodingJob) { var segmentEndingPositionTicks = state.Request.CurrentRuntimeTicks + state.Request.ActualSegmentLengthTicks; @@ -1997,6 +1997,7 @@ public class DynamicHlsController : BaseJellyfinApiController if (transcodingJob is not null) { transcodingJob.DownloadPositionTicks = Math.Max(transcodingJob.DownloadPositionTicks ?? segmentEndingPositionTicks, segmentEndingPositionTicks); + transcodingJob.ReportSegmentDownloaded(segmentIndex, segmentEndingPositionTicks); _transcodeManager.OnTranscodeEndRequest(transcodingJob); } |
