Repository navigation
libobs: Move the transition start and set - #3820
Merged
Merged
Conversation
Characterization before obs_transition_start() and obs_transition_set() of obs-source-transition.c, with set_source(), activate_transition() and the recursion check, move to their own file and are ported. test_transition_start_steps pins their rules on plain values and copies of the composition on a stand-in; the recursive destination and set tests pin the recursion refusals, the re-entering callbacks' clocks and the set's active reference. Nothing pinned the rest through the real libobs. test_source_transition_switch creates transitions through the real libobs, with a transition type that counts its transition_start callback and a handler counting the start and stop signals (on the transition and on the core's handler, which hears only a public source). 9 cases pin: - a start from idle; one to slot A's source while idle (refused, and with an empty slot A a start to nothing); one to it while running (the running transition ends on its destination, then starts back); - the running destination again, in either mode: the running transition ends there and the start is refused, so a manual start is never done with nothing called (characterized, not endorsed); a start to no destination; - the fixed duration replacing the one asked for, only while enabled; - a transition_start callback that starts the transition again: the nested start runs whole, then the outer destination wins; - obs_transition_set(): both slots cleared, the source in slot A, a stop signal only while running, and the refusal of the transition itself with its warning; - on an output channel, which children are active after each start and set. Transitions need core video, so it builds on Linux only and runs under xvfb-run; without a display the cases skip. Refs #3794.
The start clock (struct transition_start_clock and write_start_clock()), set_source(), activate_transition(), the recursion check (struct transition_recursion_check and check_transition_recursion()), obs_transition_start() and obs_transition_set() move verbatim from obs-source-transition.c into their own file, obs-source-transition-switch.c, ahead of their port to rust/obs-source. The ported start rules already have obs-source-transition-start.c, so this file is -switch. It is live C in the libobs.core-source group, ahead of obs-source-transition.c in the group's sorted order, with its own copy of lock_transition() / unlock_transition(), #undef'd at its end (BUILD.md rule 5). Nothing outside the moved lines calls the four static helpers; obs_transition_set_manual_time() and obs_transition_start() call obs_transition_set() through its public symbol, as before. The moved text is byte-identical to the text it replaces. No behaviour change: the export sets of the C, hybrid and C reference builds are unchanged. Refs #3794. Local-Gate: v1 tree=ff1b7bf549c4765f6c304f781bb9722aa3cbc7df secs=2472 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run,macos-native:n/a,windows-native:n/a Ci-Attestation: {"at":1794029158,"gate":"rust/all/fmt","host":"linux-x86_64","key":"f3a60aadd6f9865585e963263ce83ff037c4d3cde4d0b8af377e92d52f210a5f","lane":"lint","parents":["d446ae92c312e7ffa538ac8264685fa5241fecf6"],"secs":62,"stamp":"0963ac59a2a2c0761c3610b618459094","tree":"ff1b7bf549c4765f6c304f781bb9722aa3cbc7df","v":1,"via":"run"} Ci-Attestation: {"at":1794029158,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"f3a60aadd6f9865585e963263ce83ff037c4d3cde4d0b8af377e92d52f210a5f","lane":"lint","parents":["d446ae92c312e7ffa538ac8264685fa5241fecf6"],"secs":62,"stamp":"a5512c8b5ff8d36f18a9a5f4213d8bb9","tree":"ff1b7bf549c4765f6c304f781bb9722aa3cbc7df","v":1,"via":"run"} Ci-Attestation: {"at":1794029158,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"0c0086e991069a02b1d9b70dff4923b9a7ec09b315f6c3c559ec3205f1d29fa5","lane":"rust-test","parents":["d446ae92c312e7ffa538ac8264685fa5241fecf6"],"secs":259,"stamp":"c97e6a665ebedebfd9010cf095e54e72","tree":"ff1b7bf549c4765f6c304f781bb9722aa3cbc7df","v":1,"via":"run"} Ci-Attestation: {"at":1794029158,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"049ac2020bf52efd3742309ba2c4c22778de8c2feabccc2beba820219bbeb7f8","lane":"cross","parents":["d446ae92c312e7ffa538ac8264685fa5241fecf6"],"secs":40,"stamp":"b3abb656a1ee90da098d4fe4ef1c68f7","tree":"ff1b7bf549c4765f6c304f781bb9722aa3cbc7df","v":1,"via":"run"} Ci-Attestation: {"at":1794029158,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"049ac2020bf52efd3742309ba2c4c22778de8c2feabccc2beba820219bbeb7f8","lane":"cross","parents":["d446ae92c312e7ffa538ac8264685fa5241fecf6"],"secs":40,"stamp":"cda3acf969cdba132e729294921a2e38","tree":"ff1b7bf549c4765f6c304f781bb9722aa3cbc7df","v":1,"via":"run"} Ci-Attestation: {"at":1794029158,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"049ac2020bf52efd3742309ba2c4c22778de8c2feabccc2beba820219bbeb7f8","lane":"cross","parents":["d446ae92c312e7ffa538ac8264685fa5241fecf6"],"secs":40,"stamp":"fdf5aba497664313a76cef01ce3c120f","tree":"ff1b7bf549c4765f6c304f781bb9722aa3cbc7df","v":1,"via":"run"} Ci-Attestation: {"at":1794029158,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"049ac2020bf52efd3742309ba2c4c22778de8c2feabccc2beba820219bbeb7f8","lane":"cross","parents":["d446ae92c312e7ffa538ac8264685fa5241fecf6"],"secs":40,"stamp":"81f682d48919387a28baefbe7614db97","tree":"ff1b7bf549c4765f6c304f781bb9722aa3cbc7df","v":1,"via":"run"} Ci-Attestation: {"at":1794029158,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"f1c5d65643366eba59c38f9ea4620983ff7e631d3963d444deb9707218e7729a","lane":"tier2-linux","parents":["d446ae92c312e7ffa538ac8264685fa5241fecf6"],"secs":2472,"stamp":"de0e107b49e86d23148e1408ea84027e","tree":"ff1b7bf549c4765f6c304f781bb9722aa3cbc7df","v":1,"via":"run"}
Collaborator
Author
|
Handed off to the coordinator |
This was referenced Nov 7, 2026
This was referenced Nov 8, 2026
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 #3794
What and why
The "Extracting a function before porting it" step for the transition start and set of
libobs/obs-source-transition.c.h. There is no Rust and no change in behaviour; the port torust/obs-source/obs-source-seamcomes next.test: Characterize the transition start and set):test/cmocka/test_source_transition_switch.c, 9 cases through the real libobs, registered intest/cmocka/build/test-graph.json(suitegraphics, Linux with OpenGL, like the other transition tests) with itstests.dnote.libobs: Move the transition start and set): the start clock (struct transition_start_clock,write_start_clock()),set_source(),activate_transition(), the recursion check (struct transition_recursion_check,check_transition_recursion()),obs_transition_start()andobs_transition_set()move verbatim (origin/master lines 81-331) intolibobs/obs-source-transition-switch.c.h. The ported start rules already haveobs-source-transition-start.c.h, so this file is-switch. It is live C inlibobs.core-source, ahead ofobs-source-transition.c.hin the group's sorted order, with its ownlock_transition/unlock_transition,#undef'd at its end (BUILD.md rule 5). Nothing outside the moved lines calls the four static helpers;obs_transition_set_manual_time()andobs_transition_start()still callobs_transition_set()through its public symbol.obs-source-transition.c.hloses 252 lines.No source-set or naming.md entry is needed: the new file is a
.c.hin an existing unity group (only headers are listed insource-sets.d/LIBOBS_SOURCES.json), and naming.md'sobs-source*.c.hrow already covers it; the port adds it to that row's list of seam shims.Characterization.
test_transition_start_stepspins the start rules on plain values and copies of the composition on a stand-in, andtest_transition_recursive_destination,test_transition_set_activeandtest_transition_set_cyclepin the recursive destinations, the re-entering callbacks' clocks and the set's active reference. The new test pins the rest through the real libobs, with a transition type that counts itstransition_startcallback and handlers countingtransition_start/transition_stopon the transition andsource_transition_start/_stopon the core's handler (which hears only a public source, so the transition is a public one):transition_startcallback that starts the transition again: the nested start runs whole, then the outer destination wins;obs_transition_set(): both slots cleared, the source in slot A, a stop signal only while running, and the refusal of the transition itself with its warning;Checked against origin/master's functions. A scratch harness (not committed) builds master's lines 81-331 with the lock macros, and the new file whole, each as its own program over one logging stand-in for
struct obs_sourceand every call they make: the start rules (scripted results), refs and releases, the active child calls (scripted results), the recursion walk (scripted parent and child pairs, the transition among them),transition_valid()andtransition_active(), the size and matrix recalculations,os_gettime_ns(), the signals, the logs, each lock (double locks flagged), and a plugin callback that re-enters the start or set. The program dumps every field of six sources after each call. The logs of 20,000 rounds of 12 random calls (243,069 calls with the re-entries) are byte-identical under gcc and clang at -O0, at -O2, and at -O1 with ASan and UBSan. All 25 planted mutants are caught, in the clock write, each slot read and write, the active flags, the active child calls, the releases, the recursion check, the mode, manual and fixed-duration writes, the signals and the lock around the first read.The move commit is byte-identical to the text it replaces (checked with
cmp).RED → GREEN
libobs-c-reference31/31.fixed_duration_replaces_the_asked_onefails.test_source_transition_switchpassed 9/9 on the C, hybrid andlibobs-c-referencebuilds, before the move and after it, under Xvfb with none skipped, and 15/15 repeated runs.test_source_audio_settingsandtest_source_monitor_only_load, which hang to their timeout on this machine's sessions without a sound server on every build; neither calls a transition function.obs_transition_startandobs_transition_setstay exported (T);activate_transitionandcheck_transition_recursionare local (t),set_sourceandwrite_start_clockare inlined, as before.ci-lint local-gate run: lint, rust-test, cross and Tier 2 on Linux (tier2-linux) passed, and HEAD is stamped; the macOS and Windows native lanes do not apply on this host. The quickci/checks,./lint,--lane cross, the Windows--all-targetsclippy and theport_comparisonbench pass. No Rust changed../unittestrun hiteffect_parser_writer_parity::called_functionswith a random proptest case. That is master's writer parity test, already filed as bug: obs-graphics: writer parity test feeds a dstr with a NUL #3802, not this change; the stamp's rust-test lane then passed.Checklist
master(or the description starts with a Stacked: note)docs/features.mdis added or updated (not applicable: no user-visible change)-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)