[x264-devel] [PATCH v2 0/2] Fix input-frame recycling and threadpool shutdown races
汪秀军
xiujunwang.dev at gmail.com
Fri Sep 25 15:41:27 UTC 2026
Hello,
The v1 patch message bodies were damaged by Gmail's flowed-text
formatting, which collapsed some indentation. Please use this v2
series. The patch content is unchanged; the two raw patch files are
attached to their respective messages.
This series fixes two races reproduced on x264 master 0480cb05.
Patch 1 serializes input-frame release and unused-list push/pop with a
shared mutex. The lookahead thread can release last_nonb concurrently
with the caller releasing fenc or obtaining another input frame.
Patch 2 moves the threadpool exit check under its existing run mutex.
This independent race was exposed by closing without flushing.
Validation on macOS arm64, Apple clang 21.0.0:
- Unmodified master reproduces both races under ThreadSanitizer.
- Six 1,200-frame TSan runs pass without suppressions.
- A 128x288, four-slice-thread TSan run passes for 240 frames.
- Closing without flushing after each input count 0..40 passes under TSan.
- Native-assembly checkasm8 and checkasm10 pass.
- Six release-mode comparisons have identical non-SEI NAL data and
decoded frame MD5s.
- A --disable-thread build and a 200-frame encode pass.
These tests cover the configurations above; OpenCL and other platforms
were not tested.
Best regards,
Xiujun Wang
More information about the x264-devel
mailing list