Repository navigation
libobs: Lock the transition tick's manual step, make the set size atomic - #3698
Merged
Merged
Conversation
RED: the fake transition panics when the mode or a manual field is read without transition_mutex. tick() holds no lock there, so 5 of the 25 transition_size tests fail. Refs #3570. Co-Authored-By: Claude Opus 5.5 <[email protected]>
obs_transition_tick() read the mode and the manual fields and wrote transition_manual_val with no lock. Every other reader and writer holds transition_mutex. The tick now holds it around the step, in the C and in obs-source. While it holds the lock, the step calls only calc_torquef(). transition_cx and _cy are read and written with no lock, so they are now atomic, as transition_actual_cx and _cy are. The Rust code reaches them through the seam. Refs #3570. Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=37348618c8a0c44da6c30748bea37507506ab44f secs=326 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run,macos-native:n/a,windows-native:n/a Ci-Attestation: {"at":1793901064,"gate":"rust/all/fmt","host":"linux-x86_64","key":"9d9af652fee7f3dc497dcbd7599c124b6826abe944f416cdcd4e76c0f6a110e7","lane":"lint","parents":["82fb4357cd193cc70dd7cb5960196f7a799b1518"],"secs":89,"stamp":"5e074d09fa28bdf6f6b405d78f9a5c22","tree":"37348618c8a0c44da6c30748bea37507506ab44f","v":1,"via":"run"} Ci-Attestation: {"at":1793901064,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"9d9af652fee7f3dc497dcbd7599c124b6826abe944f416cdcd4e76c0f6a110e7","lane":"lint","parents":["82fb4357cd193cc70dd7cb5960196f7a799b1518"],"secs":89,"stamp":"96c151438e5040baec1056671675dc38","tree":"37348618c8a0c44da6c30748bea37507506ab44f","v":1,"via":"run"} Ci-Attestation: {"at":1793901064,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"9c3720ac33f433ae84c8a5b3be894893e20a5597f8705365f674c73648d596df","lane":"rust-test","parents":["82fb4357cd193cc70dd7cb5960196f7a799b1518"],"secs":99,"stamp":"6cf0c2cf42f3a79d0fd4c56f6bd60b72","tree":"37348618c8a0c44da6c30748bea37507506ab44f","v":1,"via":"run"} Ci-Attestation: {"at":1793901064,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"b3fac1526f67d96d8e7dca85ea9abc4725cabc4e435a75dece17733319f95992","lane":"cross","parents":["82fb4357cd193cc70dd7cb5960196f7a799b1518"],"secs":74,"stamp":"577ab3991b5529391adaaae2b4a41128","tree":"37348618c8a0c44da6c30748bea37507506ab44f","v":1,"via":"run"} Ci-Attestation: {"at":1793901064,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"b3fac1526f67d96d8e7dca85ea9abc4725cabc4e435a75dece17733319f95992","lane":"cross","parents":["82fb4357cd193cc70dd7cb5960196f7a799b1518"],"secs":74,"stamp":"fb8c320e5c41be094cca2008e60330f9","tree":"37348618c8a0c44da6c30748bea37507506ab44f","v":1,"via":"run"} Ci-Attestation: {"at":1793901064,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"b3fac1526f67d96d8e7dca85ea9abc4725cabc4e435a75dece17733319f95992","lane":"cross","parents":["82fb4357cd193cc70dd7cb5960196f7a799b1518"],"secs":74,"stamp":"c38ea55bb564ba77e0d7cf5ac542a5eb","tree":"37348618c8a0c44da6c30748bea37507506ab44f","v":1,"via":"run"} Ci-Attestation: {"at":1793901064,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"b3fac1526f67d96d8e7dca85ea9abc4725cabc4e435a75dece17733319f95992","lane":"cross","parents":["82fb4357cd193cc70dd7cb5960196f7a799b1518"],"secs":74,"stamp":"dffdd8ccb8b36e3342617a02319aea85","tree":"37348618c8a0c44da6c30748bea37507506ab44f","v":1,"via":"run"} Ci-Attestation: {"at":1793901064,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"68eb2f262ffec86db69dd85b1a892353feddb2a0f9de746a2b787ac11865bbea","lane":"tier2-linux","parents":["82fb4357cd193cc70dd7cb5960196f7a799b1518"],"secs":326,"stamp":"0b70eb877fb3f31159e58025d50dc204","tree":"37348618c8a0c44da6c30748bea37507506ab44f","v":1,"via":"run"}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3570
What and why
obs_transition_tick()read the mode and the manual fields and wrotetransition_manual_valwith no lock, whileobs_transition_start(),obs_transition_set(),obs_transition_get_time(), the load and the manual setters holdtransition_mutex. The tick is ported, so the C andrust/obs-sourceboth change: the tick now holds the lock around the manual step. While it holds the lock, the step calls onlycalc_torquef(), so the lock order does not change.transition_cx,_cyare read and written with no lock, inobs_transition_set_size()and on the graphics thread. They are now atomic at every read and write, astransition_actual_cx,_cyare since #3669. The Rust code reaches them through the seam, so it does not change.Risk: a reader can see a new
cxwith an oldcyfor one call, as it could before. The tick takestransition_mutexone more time per frame, for a short time.With #3640 and #3669 this completes #3570. Expected effect of the old code: a manual transition that is one tick off. I did not measure a user-visible change, so there is no features ledger line.
RED → GREEN
transition_mutex, andtick_orderand the copy of the C expect the lock. 5 of the 25transition_sizetests fail withtransition_mode without transition_mutex.ThreadSanitizer does not run on PRs, so this evidence is local (hybrid libobs, the sanitizer build). 3 passes each of
test_group_hide_transition_audio,test_item_transition_empty_source,test_source_transition_size,test_source_transition_slots,test_source_transition_access,test_transition_recursive_destination,test_transition_load_releaseandtest_transition_audio_rescale:The 51 left are 44 reports inside Mesa's software GL library and the 7 lock order reports, which this PR does not change. All tests pass. The next nightly confirms this on CI.
transitiontests pass.Checklist
master(or the description starts with a Stacked: note)docs/features.mdis added or updated (not applicable: no user-visible change measured)-W..., ratchets): built with scripting ON (PR CI builds no OBS app: rungh workflow run ci.yml --ref <branch>for the full builds) and cross-checked with clang and MSVC (not applicable: no warning or flag changes)🤖 Generated with Claude Code