Repository navigation
Closed
Labels
claimedAn agent or person has claimed this; check the claim comment before starting
Description
Unit
Port the pure clock and fit decisions in libobs/obs-source-transition.c.h (our #556 area) to rust/obs-source, as a new module transition_clock:
calc_time: the manual value, before the start, after the end, a zero duration, and the ratio;- the manual step in
obs_transition_tick: snap when the torque is 0, otherwise step; - the size fold of
recalculate_transition_size(the larger of the two children); - the fit in
recalculate_transition_matrix(max-only, aspect and stretch), which gives the scale and the offsets passed toadd_alignment; mix_spaces;transition_calc_min_ts(the earliest non-zero child timestamp).
These stay C:
- the locks and the child size reads;
add_alignment(already ported) and the matrix build;get_sample_time, the texrenders and the swap handover;calc_torquef. Rust only returns "snap" or "step", soobs-sourcegains no crate dependency.
Plan (one PR, separate commits)
- Behaviour-neutral move into
libobs/obs-source-transition-clock.c.h, as hidden functions. - Characterization:
test_transition_clock_steps. It covers:calc_timearound the start and end, a zero duration, and huge durations;- the manual step with torque 0, with a clamp, and with NaN targets;
- the fit for each scale type, with a source smaller than, equal to and larger than the transition, a zero transition size and a zero child size;
mix_spacesover all 4 × 4 pairs;min_tswith zero, one and two timestamps.
- RED, then GREEN: the safe Rust core plus shims, in a
libobs.ported-source-transition-clockgroup. Exported symbols stay unchanged. - Tier 3 parity against the original C: exhaustive over modes and scale types, plus a proptest over full-range
u64clocks andf32sizes and targets. Then a deliberate-break check andport_comparisonnumbers.
calc_time divides in long double in C, whose width differs by platform. Rust divides in f64, which rounds to the same f32 for every clock below 2^53 ns (about 104 days). Bit parity is limited to that range, and the PR says so.
These real-libobs tests must stay green on every lane: test_transition_swap, test_studio_mode_swap, test_transition_recursive_destination, test_fade_to_color_mix, test_transition_audio_rescale and test_stinger_media_duration.
Metadata
Metadata
Assignees
Labels
claimedAn agent or person has claimed this; check the claim comment before starting
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 24, 2026
Claiming: #2040.
libobs: Move the transition clock and fit into obs-source-transition-…
test: Characterize the transition clock and fit
obs-source: Add Tier 1 tests for the transition clock and fit port
obs-source: Port the transition clock and fit
obs-source: Check the transition clock and fit port against the C
docs: Record the transition clock and fit port
libobs: Move the transition clock and fit into obs-source-transition-…
test: Characterize the transition clock and fit
obs-source: Add Tier 1 tests for the transition clock and fit port
obs-source: Port the transition clock and fit
obs-source: Check the transition clock and fit port against the C
docs: Record the transition clock and fit port
obs-source: Port the transition clock and fit (obs-rust#2055)