jellyfin/MediaBrowser.MediaEncoding
Attila Szakacs c693da94ce Fix parallel use of not thread-safe SubtitleFormat instance
`SubtitleFormat`'s `LoadSubtitle()` function is
not thread-safe.

A `SubtitleEditParser` instance's `Parse()`
function can be called from multiple threads at
the same time.

`SubtitleFormat`s are cached in the constructor
of each `SubtitleEditParser`, and the same
instances are used for each possibly parallel
`Parse()` function call, which causes subtitle
parse problems.

This patch modifies the code, so we only cache
the extension -> `SubtitleFormat` type/class
mapping and create a new `SubtitleFormat`
instance in each `Parse()` call, so no
`SubtitleFormat` instance is accessed from
multiple threads.

Fixes #12113

Kudos for everyone investigating the issue there,
most notably @RenV123 for PoC-ing the solution.

Signed-off-by: Attila Szakacs <szakacs.attila96@gmail.com>
2025-01-18 21:16:35 +01:00
..
Attachments Backport pull request #12575 from jellyfin/release-10.9.z 2024-09-07 18:09:54 -04:00
BdInfo Fix switch expression 2024-07-20 20:37:44 +02:00
Configuration Add some analyzers to MediaBrowser.MediaEncoding 2020-08-04 17:08:09 +02:00
Encoder Always cleanup trickplay temp for ffmpeg failures (#13030) 2024-11-14 17:00:59 -07:00
Probing Apply suggestions from code review 2024-08-28 03:20:04 +08:00
Properties Add tests for EncoderValidator 2019-09-28 19:41:34 +02:00
Subtitles Fix parallel use of not thread-safe SubtitleFormat instance 2025-01-18 21:16:35 +01:00
Transcoding Use enums for encoding options (#12561) 2024-09-09 08:43:37 -06:00
MediaBrowser.MediaEncoding.csproj AsyncKeyedLock migration 2024-01-03 16:47:25 +01:00