Skip to main content

X264_OPEN_CLOSE_LOCK

Static X264_OPEN_CLOSE_LOCK 

Source
static X264_OPEN_CLOSE_LOCK: Mutex<()>
Expand description

Process-global lock that serializes libx264 encoder open/close, because those calls are not thread-safe yet several captures in one process open their sessions concurrently.

libx264 mutates process-global state inside x264_encoder_open/x264_encoder_close, so two capture instances sharing one process can race that state and corrupt the heap. The lock is deliberately held only around open and close, never around x264_encoder_encode, so serializing setup costs nothing in the hot per-frame encode path.