Skip to content

libobs: Build the stop params before end_data_capture_thread starts (#2098) - #2100

Merged
zackees merged 1 commit into
masterfrom
fix/output-active-stop-params
Oct 24, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/output-active-stop-params

Conversation

@zackees

@zackees zackees commented Oct 24, 2026

Copy link
Copy Markdown
Member

Fixes #2098

This is the active-path twin of #2087. obs_output_end_data_capture_internal created end_data_capture_thread and then called signal_stop. The stop signal reads the encoders' last_error_message, but the thread frees it (stop_video_encoders → … → obs_encoder_shutdown → obs_encoder_set_last_error(NULL)). The params are now built with stop_params_init (calldata_set_string copies the string) before pthread_create, and emitted after with signal_stop_params. The thread order and the signal == false path are unchanged.

RED: TSan run 40074741825 on master (after #2087) still has about 108 obs-encoder.c.h:2231 reports against obs-output.c.h:2732, read from obs_output_end_data_capture_internal:2423. Only TSan shows this race, so there is no Tier 2 RED. GREEN is TSan run 40078572852 on this branch; I'll post the counts when it finishes. Tier 2 in PR CI checks that behavior is unchanged. ./lint passes. obs-output has no Rust port.

…2098)

The active path of obs_output_end_data_capture_internal created
end_data_capture_thread and then read the encoders' last_error for the
stop signal, while the thread's obs_encoder_shutdown freed it. Copy the
params first and emit them after, as #2087 did for the not-active path.

Fixes #2098
@zackees
zackees enabled auto-merge October 24, 2026 08:34
@zackees
zackees added this pull request to the merge queue Oct 24, 2026
Merged via the queue into master with commit 49f4404 Oct 24, 2026
35 checks passed
@zackees

zackees commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

GREEN (TSan run 40078572852 on this branch, against master run 40074741825): obs_encoder_set_last_error races dropped from 52 in 14 tests to 7 in 2 tests (test_encoding_lag_rescale, …).

The 7 left are a different case. A not-active stop (obs_output_end_data_capture_internal:2374, reached from obs_output_destroy → actual_stop) reads last_error while the previous stop's end_data_capture_thread is still shutting the encoders down. That path deliberately doesn't wait for it. Fixing it means locking the encoder's last_error, not reordering, so it's left for a follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

libobs: stop signal after end_data_capture_thread starts reads a freed encoder last_error

1 participant