Skip to content

fix(output): copy the stop signal's last error before shutting down unstarted encoders - #2087

Merged
zackees merged 1 commit into
masterfrom
fix/output-stop-signal-before-encoder-shutdown
Oct 24, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/output-stop-signal-before-encoder-shutdown

Conversation

@zackees

@zackees zackees commented Oct 24, 2026

Copy link
Copy Markdown
Member

Fixes #2086

obs_output_end_data_capture_internal starts shutdown_unstarted_encoders_thread and then sends the stop signal. The signal's last_error comes from the encoders' last_error_message, which the thread frees (obs_encoder_shutdown → obs_encoder_set_last_error(NULL)). The stop parameters are now built first (calldata_set_string copies the string) and sent after the thread starts. The thread order is unchanged: a stop handler that restarts the output still waits for the shutdown in start. signal_stop() is split into stop_params_init and signal_stop_params, and the other callers are unchanged.

RED: TSan run 40066620813 on master has 46 data-race reports in 14 tests (obs-encoder.c.h:2231 against obs-output.c.h:2706). Only TSan shows this race reliably, so there is no Tier 2 RED; GREEN is a TSan run on this branch, linked below. PR CI runs Tier 2 for unchanged behavior (test_output_failed_start_encoders covers this path). ./lint passes. obs-output has no Rust port.

@zackees
zackees enabled auto-merge October 24, 2026 07:35
@zackees

zackees commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

@zackees
zackees added this pull request to the merge queue Oct 24, 2026
Merged via the queue into master with commit 91cc728 Oct 24, 2026
33 checks passed
chriscoveries pushed a commit to chriscoveries/obsrust-fork that referenced this pull request Oct 24, 2026
…bs-rust#2098) (obs-rust#2100)

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 obs-rust#2087 did for the not-active path.

Fixes obs-rust#2098
@zackees
zackees deleted the fix/output-stop-signal-before-encoder-shutdown branch October 26, 2026 15:44
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 reads encoder last_error while the unstarted-encoder shutdown thread frees it

1 participant