Commit graph

5 commits

Author SHA1 Message Date
gnattu
e2586eed9b Fix concurrent ffmpeg segment racing
This is a nasty one. The failure mode is:

1. Request A started FFmpeg and waited for a segment.
2. Request B requested an earlier or far away segment.
3. Jellyfin thought FFmpeg should to restart at a different position.
4. Request B killed the existing transcoding job.
5. Killing that job cancelled the same token request A was using.
6. The cancellation produced http 500 to request A.

To fix this:

we lock transcoding job state changes and segment handling per playlist, and use a thread safe counter to track how many http responses are still using each job’s segments. A job is only stopped or replaced once that counter reaches zero.
2026-08-05 00:33:42 +08:00
Daniyar Alpyspayev
2614fecf8d move to new System.Threading.Lock type for better performance 2024-12-12 18:10:06 +05:00
Bond_009
97a02f5803 Remove BOM from UTF-8 files
I think some people need to change their IDE configuration ;)
2024-08-30 15:29:48 +02:00
nyanmisaka
eca9bf41bc 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>
2024-03-16 07:35:05 +08:00
Patrick Barron
c2081955c8 Rename and clean up TranscodingJob 2023-12-21 12:53:50 -05:00
Renamed from MediaBrowser.Controller/MediaEncoding/TranscodingJobDto.cs (Browse further)