jellyfin/MediaBrowser.MediaEncoding/Subtitles
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
..
AssWriter.cs Use RegexGenerator where possible 2023-06-28 17:07:57 +02:00
ISubtitleParser.cs Backport pull request #8087 from jellyfin/release-10.8.z 2022-08-01 14:25:42 -04:00
ISubtitleWriter.cs Make probesize and analyzeduration configurable and simplify circular 2019-11-25 12:07:59 +01:00
JsonWriter.cs Fix JSON subtitle writer 2020-01-02 14:38:13 +01:00
SrtWriter.cs Use RegexGenerator where possible 2023-06-28 17:07:57 +02:00
SsaWriter.cs Use RegexGenerator where possible 2023-06-28 17:07:57 +02:00
SubtitleEditParser.cs Fix parallel use of not thread-safe SubtitleFormat instance 2025-01-18 21:16:35 +01:00
SubtitleEncoder.cs Solve CodeQL issue 2024-09-11 11:43:02 +02:00
SubtitleFormatExtensions.cs Add subtitle parser errors to log if available (#12479) 2024-09-06 07:47:06 -06:00
TtmlWriter.cs Use RegexGenerator where possible 2023-06-28 17:07:57 +02:00
VttWriter.cs Use RegexGenerator where possible 2023-06-28 17:07:57 +02:00