Repository navigation
obs-source: Port the transition start checks and child handover - #2478
Merged
Merged
Conversation
Behaviour-neutral extraction before the Rust port. The decisions of obs_transition_start(), set_source(), activate_transition(), obs_transition_get_active_source(), obs_transition_save(), obs_transition_set_manual_time(), obs_transition_set() and copy_source_state() in obs-source-transition.c.h move to libobs/obs-source-transition-start.c.h, as fourteen functions on plain values declared in the new libobs/obs-source-transition-start.h without EXPORT (hidden, as -fvisibility=hidden keeps them): - _refused(): the first refusal of obs_transition_start() (the destination is source A and nothing is running); - _walks(): whether the recursion walk runs (a destination that is not the transition itself); - _admit() -> GO | REFUSE | DONE: the second read's refusal and the manual same-target success; - _duration_ns(): (uint64_t)ms * 1000000; - _restart(): set_source()'s clock rule; - _adds(), _removes() and _calls_back(): the handover of an active slot (the new child added first, the old one removed only if the add worked) and the admission callback; - _unsized(): a transition size of 0; - _null_dest(): a start to no destination sets both flags itself; - _activates(): activate_transition() adds only to a slot not active yet; - _active_index(): B while transitioning, else A; - _manual_reset(): manual mode and t == 0.0f; - _child_active(): a child goes out (obs_transition_set()) or comes in (copy_source_state()) as an active child. Split per read, as obs-rust#2153 did. obs_transition_start() reads the sources in three lock sections on purpose (the plugin's transition_start callback can re-enter, and obs_transition_set() runs in between), so each function gets only what one section read and is asked where the C decided before. The rest stays C at its point: the locks, lock_textures(), the pointer comparisons, transition_active() and its ||, which reads the video flag only when the audio flag is clear (so the "finish the running transition first" step and the stop signal are still that read), the fixed duration read (only when it is enabled), the size reads (cy only when cx is not 0), copy_source_state()'s read of the old slot's flag (only with an old child), the swap gate (tr_dest == tr_source), every obs_source_get_ref() and obs_source_release(), the active child calls, the recursion walk and check_transition_recursion(), the plugin callback, the signals, recalculate_transition_size() and _matrices(), os_gettime_ns() and the logs. The mode crosses as int; the header copies OBS_TRANSITION_MODE_MANUAL and obs-source-transition.c.h checks it with _Static_assert (enum obs_transition_mode is already checked int-sized there). Checked in a scratch harness (not committed). It compiles origin/master's transition_active(), write_start_clock(), set_source(), obs_transition_get_active_source(), activate_transition(), check_transition_recursion(), obs_transition_start(), obs_transition_set_manual_time(), obs_transition_set(), obs_transition_save(), copy_source_state(), obs_transition_swap_begin(), obs_transition_swap_end() and obs_transition_clear() verbatim next to this branch's and the moved file, as C++, over stand-in sources whose fields log every read and write with its value. Every call is logged in order with its arguments: both mutexes of both transitions (lock and unlock), transition_valid(), obs_source_get_ref() (which may return NULL, as for a source being destroyed), obs_source_release(), the active child calls (the add may fail), obs_source_enum_full_tree() with each visit, obs_source_get_name(), blog(), the signals, os_gettime_ns(), the size and matrix recalculation and the obs_data writes. A concurrent writer, which takes the transition's mutex as libobs does, may move any source, slot flag, transitioning flag, the mode, the manual target and value, the size, the fixed duration and the start time at any unlock or call. The plugin's transition_start may do nothing, start the transition again (two levels deep), set it, set a manual time or write a field. Inputs: two transitions and four children; every slot empty or any source; every flag; modes 0, 1 and out of the enum; durations 0, 1, 300, 1000, UINT32_MAX - 1, UINT32_MAX and random; sizes 0, 1 and full HD; fixed duration on and off; manual times 0, -0, NaN, 1, 0.5, the smallest denormal, -1 and infinity; destinations empty, the transition itself, the other transition or a child; one to six operations each. 11,000,000 runs: 4,000,000 each with GCC and Clang at -O2, 1,000,000 each at -O0, 300,000 each under ASan and UBSan with no recovery (GCC -O0, Clang -O2) and 400,000 with gcov. All 1,236,343,886 events match, as does the final state. Every branch of origin/master's functions is taken both ways, but set_source()'s callback == NULL edge: every caller passes activate_transition(). 29 deliberately broken moves were planted, and all 29 fail it: the second section read without its lock, the second section's reads merged into the first, the video flag read always (restart rule and active source), cy read always, the fixed duration read always, the old child removed before the add, obs_transition_save() reading the flags before its lock, the old slot's flag read without an old child, and twenty-one changed decisions (each operand of each rule dropped or inverted, the duration in us and in 32 bits, the size at 1, the reset at t <= 0 and not for -0.0, and the active index swapped). git blame on the moved lines shows upstream commits (6839ff7, a97039d, e6b52f2, a1fbf10) and the fork's recursion fix from obs-rust#737 (8094e1f: the clock flags, the walk's start value and the null destination); they move as they are. The new file joins libobs.core-source with libobs.pch.h, which includes the new header; source-sets.json lists it. docs/rust-port/naming.md already maps libobs/obs-source*.c.h to rust/obs-source. The exported symbol sets are unchanged; the fourteen functions are local. Refs obs-rust#2473
test_transition_start_steps compiles libobs/obs-source-transition-start.c.h (ASan and UBSan) and calls only its functions through obs-source-transition-start.h. 17 cases: - the header's copy of OBS_TRANSITION_MODE_MANUAL, the enum's size and the admission values; - the first refusal and the recursion walk over all four inputs each; - the second admission over all 16 flag combinations at six modes (0, manual, 2, -1 and the ends of int); - the duration in ns at 0, 1, 300, around 2^32 ns and UINT32_MAX ms; - set_source()'s clock rule, the handover, the callback gate and the null destination over every combination, the size of 0, the slot activation, the active index and the active child rule; - the manual reset at 0, -0 (resets), NaN (does not), 1, the smallest denormal either side, -1 and infinity, and never outside manual mode. obs_transition_start(), set_source(), activate_transition(), obs_transition_set(), obs_transition_set_manual_time(), the active source and the swap are also copied onto a stand-in transition that counts each child's references and active references, to pin end to end: a start from idle (sized and unsized), to source A, to the transition itself and to a tree that holds it (refused before anything changes), while running (finished on B first, then to the new one), and to no destination with and without a source A; a re-entering transition_start callback that starts the same transition, to another destination and to the same one; a failed add (a cycle the walk did not see) that keeps the nested start's clock and child; the fixed duration on and off at 0, 1, 300 and UINT32_MAX against the same requested durations; the manual times at 0, -0, NaN and 1 in manual and auto mode; the swap with the same transition, a running one and inactive slots; and the set while running, idle and to none. Characterized, not endorsed: - the mode a re-entering start writes stays, even when the outer start then completes (the comment in obs_transition_start() says so); - since upstream's finish step (0df94d5) runs before the second read, a running manual transition started again to the same destination finishes on it, and the start is then refused as a start to source A: the transition jumps to the destination. The manual "already there" success needs another thread's start between the finish and the second read; - a start to no destination with a source B in a slot that is not active adds NULL, which fails, and is refused with the recursion warning (libobs never leaves a source B in an inactive slot); - obs_transition_set() marks slot A active even when the add of the new source fails, so the next set removes an active reference it never got. It is in the native test graph, in name order, with the header as a watch input. No assert_in_range or fail_msg, so it builds with cmocka 1.x and 2.x, and no two enum types are compared. The real-libobs tests test_transition_recursive_destination, test_transition_swap, test_studio_mode_swap, test_studio_mode_exit, test_saved_transition, test_tbar_position, test_fade_to_color_mix, test_visibility_transition and test_stinger_media_duration cover the callers. Refs obs-rust#2473
RED for the port of libobs/obs-source-transition-start.c.h to a new transition_start module of rust/obs-source, next to transition_clock and transition_render. The safe core is a stub (todo!()): refused(), walks(), admit() -> Admission (Go, Refuse, Done), duration_ns(), restart(), adds(), removes(), calls_back(), is_unsized() (unsized is a reserved word), null_dest(), activates(), active_index(), manual_reset() and child_active(), with MODE_MANUAL taken from transition_clock. The plan sketched first_gate(), second_gate(), clock(), handover(), after_add() and needs_resize() as wider steps. handover() and after_add() would decide the remove before the add's result is known, and needs_resize(cx, cy) would read cy when cx is 0, where the C reads it only when cx is not 0. So each step is its own function, asked at its own point, as obs-rust#2153 did; the fixed duration choice, the finish step and the swap gate stay C as the reads they are. tests/source/transition_start.rs ports test_transition_start_steps 1:1: its 17 cases under the same names (steps_*), in the same order, with the same values and expectations, the characterized-not-endorsed cases and the stand-in transition's copies of the callers included. Edge cases (edge_*) check the core against models of the original C: - every decision over every combination of its flags; - the second admission over all 16 flag combinations and the manual reset at both zeros and NaN for every mode from -70,000 to 70,000 and the ends of i32; - the duration at every power of two and its neighbours, every 65,521st u32 and the ends, against the exact 128-bit product; - the manual reset over 18 special floats (both zeros, NaNs with either sign and payload, infinities, denormals, the extremes) at six modes, and every 4,099th f32 bit pattern; - proptests (4,096 cases each): every decision over full-range values and any f32 bit pattern, and sequences of up to eleven starts, sets, manual times, active source reads and swaps, with a re-entering plugin, failing adds, a fixed duration and unsized transitions, through the stand-in against a copy of the callers with origin/master's expressions inline. soldr cargo test -p obs-data --test obs-tests-core -- source::transition_start passes 1 of 23 (the constants) and fails 22 with "not yet implemented". Refs obs-rust#2473
Ports libobs/obs-source-transition-start.c.h, the start checks and child handover of obs-source-transition.c, to the transition_start module of rust/obs-source. obs-source-transition.c.h stays C around it: the three lock sections of obs_transition_start() with their reads, the pointer comparisons, transition_active(), the finish step, the fixed duration read, the size reads, lock_textures(), every obs_source_get_ref() and obs_source_release(), the active child calls in their order, the recursion walk, the plugin's transition_start callback (which can re-enter), the signals, the size and matrix recalculation, os_gettime_ns() and the logs. The hybrid libobs drops the C file and links the Rust shims in its place. Safe core (src/transition_start.rs), fourteen functions: - refused(): same_as_source && !active; walks(): has_dest && !recursive; - admit() -> Admission: Refuse as refused(), Done when active, manual, the same mode and the same destination, else Go; - duration_ns(): the u32 widened to u64 times 1e6 (cannot wrap); - restart(): !active || (!same_as_dest && !same_as_source); - adds(), removes(), calls_back() and child_active(): the C's &&; - is_unsized(): size == 0; null_dest(): !has_dest && same_as_dest && !same_as_source; activates(): !slot_active; - active_index(): 1 while active, else 0; - manual_reset(): MODE_MANUAL and t == 0.0, an IEEE compare (true for -0.0, false for NaN) as the C's t == 0.0f. MODE_MANUAL is transition_clock's. The module denies clippy's arithmetic, indexing, as, unwrap, expect, panic, todo, unimplemented and unreachable lints, keeps no state and takes no lock. Shims (src/ffi/source_transition_start.rs): the fourteen C signatures by value; the mode as int, the admission as the C's enum (u32, as source_transition_clock returns its step). No pointer crosses and no struct is mirrored. No intentional difference from the C. C side: the file leaves libobs.core-source for its own group, libobs.ported-source-transition-start (LIBOBS_PORTED_SOURCES), whose PCH is only obs-source-transition-start.h; libobs.pch.h keeps the header for obs-source-transition.c. The functions are not EXPORT, so the shims are hidden: rust-hidden.txt, the local: list of rust-exports.map and rust-unexports-macos.txt. libobs-rust already links the crate's ffi. The exported symbol sets are unchanged and equal: 1766 on the C backend, the hybrid and libobs-c-reference; the fourteen functions are local in all three, and the hybrid's come from the Rust archive (the group's object is built only for libobs-c-reference). ci/test_ported_sources.py checks the group on every host. test_transition_start_steps still compiles the C file into itself, unchanged. The new test_transition_start_steps_rust builds the same test source against libobs_rust-static instead, as test_source_audio_place_steps_rust does, and links: the test includes the header and obs.h and calls only the fourteen hidden functions. test_transition_recursive_destination, test_transition_swap, test_studio_mode_swap, test_studio_mode_exit, test_saved_transition, test_transition_scale_type, test_item_transition_empty_source, test_visibility_transition, test_stinger_media_duration, test_transition_removed_child_audio, test_group_hide_transition_audio, test_tbar_position, test_fade_to_color_mix, test_transition_audio_rescale, test_slideshow_manual_end, test_transition_clock_steps and test_transition_render_steps see the swap through the real libobs, and pass on the C backend, the hybrid and libobs-c-reference. soldr cargo test -p obs-data --test obs-tests-core -- source::transition_start passes 23 of 23. No user-visible change, so no docs/features.md line. Refs obs-rust#2473
Tier 3 for the transition_start port. oracle/source_transition_start.c compiles the unchanged libobs/obs-source-transition-start.c.h with its fourteen functions renamed to oracle_*, plus the header's values and the sizes of the admission enum, bool and size_t. tests/source/transition_start_parity.rs gives each input to the oracle, to the shim the hybrid links and to the core, and compares each bool as the byte the C returns (it must be 0 or 1), the admission as the C's enum value and each number exactly: - the header's values and the three sizes; - every function of flags over every combination of them; - the second admission over all 16 flag combinations for every mode from -100,000 to 100,000, every 65,521st int and the ends; - the duration and the size rule over every value to 100,000, every 65,521st uint32_t, every power of two and its neighbours, and the ends; - the manual reset at every mode from -1,000 to 1,000 and the ends over 36 special floats, and in manual mode over every 257th f32 bit pattern, the 65,536 patterns either side of both zeros, of both infinities and of the start of both quiet NaN ranges; - proptests (20,000 cases each) of every function over any flags, any int mode, any uint32_t and any f32 bit pattern. Nothing is excluded: the C has no undefined or host-dependent result here, and the port has no intentional difference. The callers are not copied again: every function's whole flag domain is compared, and Tier 1's sequence proptest runs the copied callers on the core against origin/master's expressions inline. Mutation check (once, not committed): 43 mutants, 27 in the core and 16 in the shims (failing tests per tier, Tier 1 of 23 and Tier 3 of 6): mutant Tier 1 Tier 3 core: refused ignores active 7 3 core: refused ignores the source 17 3 core: walks ignores recursive 4 2 core: done without active 4 2 core: done in any mode 3 2 core: done without the same mode 3 2 core: done without the same dest 3 2 core: done asked before refuse 0 0 core: duration in us 11 2 core: duration in 32 bits 5 2 core: restart ignores active 4 2 core: restart ignores source A 2 2 core: restart || as && 5 2 core: adds ignores the slot 11 2 core: removes ignores the add 4 2 core: removes ignores the old child 2 2 core: calls back after a failed add 4 2 core: unsized at 1 1 1 core: null dest ignores source A 2 2 core: null dest ignores the dest 2 2 core: activates inverted 9 2 core: active index inverted 6 2 core: reset at t <= 0 4 2 core: reset not for -0.0 5 1 core: reset in any mode 5 1 core: child_active ignores the slot 3 2 core: MODE_MANUAL 2 5 4 shim: refuse and done swapped 0 2 shim: refused arguments swapped 0 2 shim: walks recursive inverted 0 2 shim: admit mode + 1 0 2 shim: duration + 1 0 2 shim: restart dest and source swapped 0 0 shim: removes old and add swapped 0 0 shim: adds arguments swapped 0 0 shim: unsized of size / 2 0 1 shim: null dest dest and source swapped 0 0 shim: active index inverted 0 2 shim: reset of -t 0 0 shim: reset mode + 1 0 1 shim: child_active arguments swapped 0 0 shim: calls_back add inverted 0 2 shim: activates inverted 0 2 36 are killed: Tier 1 kills every core mutant that changes a result, and Tier 3 kills every one that does, in the core and the shims. The seven survivors are equivalent: the core asking Done before Refuse (the two need active and !active, so they never meet); the shims swapping the arguments of adds(), removes(), child_active() (each an && of its arguments), restart() (symmetric in the destination and source A) and null_dest() (!has_dest && same_as_dest && !same_as_source is the same with has_dest and same_as_source swapped); and the reset of -t (negation keeps both zeros zero and NaN NaN). soldr cargo test -p obs-data --test obs-tests-core -- source::transition_start passes 29 of 29 (Tier 1 23, Tier 3 6). Refs obs-rust#2473
rust/README.md gets the row for libobs/obs-source-transition-start.c.h (obs-source::transition_start), in sorted place: what moved, what stays C and why (every read in its lock section, since obs_transition_start() reads the sources in three sections on purpose and the plugin's transition_start callback can re-enter; the || around transition_active(), the fixed duration and size reads, the active child calls in their order, the walk, the callbacks and the signals), the characterized-not-endorsed behaviours, the tests that see the swap and what Tier 3 covers. The obs-source crate row, its Cargo description and the lib.rs crate docs name the new module. docs/rust-port/naming.md already maps libobs/obs-source*.c.h to rust/obs-source. rust/obs-c-oracle/benches/port_comparison/source_transition_start.rs, in the sorted mod and modules![...] lists, runs 1024 starts over every combination of the flags the C reads, manual and auto modes, durations from 0 to UINT32_MAX ms and sizes of 0 and full HD, through every decision in the C's order, then a manual time and the set's two active child rules, on the shims and on the oracle, and checks both checksums match. Release, x86_64 Linux, GCC, a loaded host, median per 1024 starts: Rust 19.65 us, C 20.63 us (0.95x), about 19 ns a start. The port changes nothing a user can see, so docs/features.md has no line. Fixes obs-rust#2473
Member
|
Coordinator review: a decision port in the standard shape, like #2469. The transition start checks and the child handover move into a steps unit and then to Rust, with a C reference copy, a parity test, a bench and the export maps. The only existing test file touched is the test-graph.json entry. Queuing; it merges when CI is green. |
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 #2473
What and why
Ports the start checks and child handover of
libobs/obs-source-transition.c.htorust/obs-source, as a new moduletransition_start, next totransition_clockandtransition_render. Everyobs_transition_start()goes through them: each Studio Mode switch, T-bar grab and scene change.obs_transition_start(): the first refusal (the destination is already source A and nothing is running), whether the recursion walk runs, the second admission (refused, already there in manual mode, or go), the duration in ns, and the start to no destination that sets both flags itself;set_source(): the clock restart rule, the handover of an active slot (the new child added first, the old one removed only if the add worked), the admission callback gate, and the size recalculation for a size of 0;activate_transition(): the child is added only to a slot that is not active yet;obs_transition_get_active_source()andobs_transition_save(): B while transitioning, else A;obs_transition_set_manual_time(): manual mode andt == 0.0fsets source A;obs_transition_set()andcopy_source_state(): whether a child goes out or comes in as an active child.The earlier transition ports (#2055 clock and fit, #2184 render and audio) left all of this in C.
This unit is concurrency-sensitive, so the plan's API was split per step.
obs_transition_start()reads the sources in three separate lock sections on purpose: the plugin'stransition_startcallback can re-enter (start the same transition again, or set it), andobs_transition_set()runs between the first two. The plan sketchedfirst_gate(),second_gate(),clock(),handover(same_child, already_active, has_new, has_old),after_add(add_ok, has_callback)andneeds_resize(cx, cy).handover()would decide the removal before the add's result is known, andneeds_resize()would readcywhencxis 0, where the C reads it only whencxis not 0. So each step is its own function, asked at its own point, as #2153 did. Each one gets only values the C already read, in the lock section where it reads them today. No lock section is merged, and no read moves across a lock, a callback or a signal. Fourteen functions cross the C ABI:obs_source_transition_start_refused(),_walks(),_admit()(GO,REFUSEorDONE),_duration_ns()and_null_dest();_restart(),_adds(),_removes(),_calls_back()and_unsized();_activates(),_active_index(),_manual_reset()and_child_active().What stays C, at its point and under its condition:
lock_textures(), and every pointer comparison (dest == sources[0],dest == sources[1],new_child == old_child,dest == transition,tr_dest == tr_source);transition_active()with its||: the video flag is read only when the audio flag is clear. So the "finish the running transition first" step and the stop signal ofobs_transition_set()are still exactly that read;cyonly whencxis not 0), andcopy_source_state()'s read of the old slot's flag (only with an old child);obs_source_get_ref()andobs_source_release(); the active child calls in their order;obs_source_enum_full_tree()withcheck_transition_recursion(); the plugin callback;obs_source_dosignal();recalculate_transition_size()and_matrices();os_gettime_ns(); the logs.The header copies
OBS_TRANSITION_MODE_MANUAL, andobs-source-transition.c.hchecks it with_Static_assert(enum obs_transition_modeis already checked asint-sized there). No pointer crosses and no struct is mirrored. The core reusestransition_clock::MODE_MANUAL.Six commits:
Move (behaviour-neutral,
78dd0b9be): the decisions go tolibobs/obs-source-transition-start.c.h, declared in the newobs-source-transition-start.hwithoutEXPORT, so they are hidden. The file joinslibobs.core-source.git blameon the moved lines shows upstream commits (6839ff7, a97039d, e6b52f2, a1fbf10) and the fork's recursion fix from libobs: Reject recursive transition destinations #737 (8094e1f); they move as they are.The move was checked against the original code. A scratch harness (not committed) compiles origin/master's
transition_active(),write_start_clock(),set_source(),obs_transition_get_active_source(),activate_transition(),check_transition_recursion(),obs_transition_start(),obs_transition_set_manual_time(),obs_transition_set(),obs_transition_save(),copy_source_state(),obs_transition_swap_begin(),obs_transition_swap_end()andobs_transition_clear()verbatim, next to this branch's and the moved file, as C++:transition_valid(),obs_source_get_ref()(which may return NULL, as for a source being destroyed),obs_source_release(), the active child calls (the add may fail), the tree walk with each visit, the names,blog(), the signals,os_gettime_ns(), the size and matrix recalculation and theobs_datawrites;transition_startmay do nothing, start the same transition again (two levels deep), set it, set a manual time or write a field;UINT32_MAX, sizes 0, 1 and full HD, the fixed duration on and off, manual times 0, -0, NaN, 1, 0.5, the smallest denormal, -1 and infinity, and destinations that are empty, the transition itself, the other transition or a child.11,000,000 runs (GCC and Clang
-O2, 4,000,000 each;-O0, 1,000,000 each; ASan with UBSan, no recovery, under GCC-O0and Clang-O2, 300,000 each; gcov, 400,000): all 1,236,343,886 logged events match on both sides, and so does the final state. Every branch of origin/master's functions is taken both ways, exceptset_source()'scallback == NULLedge: every caller passesactivate_transition().29 deliberately broken moves were tried, and all 29 fail the harness:
cyread always, the fixed duration read always;obs_transition_save()reading the flags before its lock, the old slot's flag read without an old child;t <= 0and not for -0.0, the active index swapped.Characterization (
55784bb8e):test_transition_start_steps, 17 cases. It compiles the moved file with ASan and UBSan and calls only its functions:UINT32_MAXms;It also copies the callers onto a stand-in transition that counts each child's references and active references:
transition_startcallback that starts the same transition again;UINT32_MAX;It is in the test graph, sorted, with the header as a watch input.
RED (
d3930f32b): Tier 1 againsttodo!(). It ports the 17 C cases 1:1 and adds six edge tests:i32;u32, against the exact 128-bit product;f32bit pattern;GREEN (
c57410162): the safe core (fourteen functions,Admission) and fourteen#[no_mangle]shims, in a newlibobs.ported-source-transition-startgroup whose PCH is only the new header.source-sets.json, the unity lists, the three export lists andci/test_ported_sources.py, each in sorted place.test_transition_start_steps_rustbuilds the unchanged test source againstlibobs_rust-static, astest_source_audio_place_steps_rustdoes.Tier 3 (
2cdfba826): a C oracle of the unchanged file, the parity tests and a mutation check.Docs (
602fab079): the README row, the crate's description,lib.rs, and aport_comparisonbench module in the sorted lists. The port changes nothing a user can see, sodocs/features.mdhas no line.The core denies clippy's arithmetic, indexing,
as, unwrap, expect, panic, todo, unimplemented and unreachable lints. It keeps no state and takes no lock. The duration widens to 64 bits before the product, which cannot wrap (UINT32_MAX * 1e6is below 2^52), and has no division.manual_reset()uses Rust's IEEEf32 ==, which matches the C'st == 0.0f(true for -0.0, false for NaN).obs_transition_start()already says so);DONE) now needs another thread's start between the finish and the second read;obs_transition_set()marks slot A active even when adding its source fails (see below).Bench (x86_64 Linux, GCC, release, not pinned to a core, a loaded host; median per 1024 starts, each through every decision in the C's order, then a manual time and the set's two active child rules): Rust 19.65 µs, C 20.63 µs (0.95x), about 19 ns a start.
RED → GREEN
d3930f32b(obs-source: Test the transition_start port).soldr cargo test -p obs-data --test obs-tests-core -- source::transition_start: 1 passed (the constants, which are not stubs), 22 failed, each on atodo!()("not yet implemented").6229a7c6e, the same tree on2fbf34251),local_gate --lane lintwas clean, and--test-diff origin/masterran 4300 tests: 4278 passed, 6 skipped, and only those 22 failed.c57410162): Tier 1 23/23.test_transition_start_stepspasses 17/17 on the C backend, on hybridlibobsand onlibobs-c-reference, andtest_transition_start_steps_rustpasses 17/17 against the Rust archive.test_transition_recursive_destination,test_transition_swap,test_studio_mode_swap,test_studio_mode_exit,test_saved_transition,test_transition_scale_type,test_item_transition_empty_source,test_visibility_transition,test_stinger_media_duration,test_transition_removed_child_audio,test_group_hide_transition_audio,test_tbar_position,test_fade_to_color_mix,test_transition_audio_rescale,test_slideshow_manual_end,test_transition_clock_stepsandtest_transition_render_steps. That is 130 cmocka cases on the C backend, and 183 with the three_rustvariants on the other two.libobs-c-reference.2cdfba826): 6/6, oracle, shims and core compared exactly (eachboolas the C's byte):boolandsize_t;intand the ends;uint32_t, every power of two and its neighbours, and the ends;f32bit pattern, and the 65,536 patterns either side of both zeros, both infinities and the start of both quiet NaN ranges;f32bit pattern;DONEbeforeREFUSE(the two needactiveand!active, so they never meet); the shims swapping the arguments ofadds(),removes(),child_active(),restart()andnull_dest()(each symmetric in the swapped pair); and a reset of-t.602fab079(the head, on4cd953c4e):local_gate --lane lintand--test-diff origin/masterpass (test-diff: 4401 passed, 6 skipped);--lane cross(clippy forx86_64-pc-windows-msvcandaarch64-apple-darwin, withSOLDR_RUSTC_WRAPPER=none) passes. It ran on200da06a6, the same branch onced504882; the one commit between them changes only CI scripts anddocs/features.md;SOLDR_RUSTC_WRAPPER=none soldr cargo clippy --workspace --target x86_64-pc-windows-msvc --all-targets --locked -- -D warningsis clean (the cross lane lints only--lib --binswithout the oracle);soldr cargo test -p obs-c-oracle --locked --bench port_comparisonpasses.libobs,libobs-c-reference) on200da06a6, under a private Xvfb with a fresh HOME:libobs;libobs-c-reference. The one failure,test_pulse_monitor_device, comes from the shared session's default sink, which other PulseAudio tests change while they run in parallel. It passes 3/3 alone and does not touch transitions;test_pulse_default_follow,test_v4l2_vivid_replug,test_v4l2_vivid_stall). The exported symbol sets of those builds are still identical (1766).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)