You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rust: Port the source volume snap and apply decisions in obs-source.c to obs-source #2158
Port the rest of the source volume decisions in libobs/obs-source.c.h to rust/obs-source, next to ptm_gate (#2089), as a new module volume_apply. These decisions move:
In get_source_volume:
the render-side gate: muted, disabled, push-to-mute and push-to-talk active, over the render-side fields (the stop-time updates already use ptm_gate);
the snap to 0 and 1 within 0.0001 (close_float).
In apply_audio_volume:
whether a pending audio action is due this tick (action.timestamp < audio_ts + duration);
the volume action: skip at 1.0, clear at 0.0 or with no mixers, otherwise multiply the mixes in both masks (audio_mixers & mixers).
These stay in C:
the action queue and its mutex, and apply_audio_actions;
conv_frames_to_time (C passes the duration);
the memset and the multiply loops.
Since #2128 the stored volume is finite and non-negative, but the core takes any f32.
Plan (one PR, separate commits)
A behaviour-neutral move into libobs/obs-source-volume.c.h, as hidden functions.
Characterization in test_source_volume_apply_steps. It covers:
every gate flag combination;
the snap at 0 ± 0.0001, 1 ± 0.0001, -0, NaN and ±inf;
each volume action, with every mixer mask edge;
the action-due compare at the threshold - 1, at the threshold and + 1, plus the u64 wrap.
RED, then GREEN: the safe Rust core plus shims, in a libobs.ported-source-volume group. Exported symbols are unchanged.
Tier 3 parity against the original C: exhaustive over the flags and masks, plus a proptest over f32 bit patterns and full-range u64 times. Also a deliberate-break check and port_comparison numbers.
These real-libobs tests must stay green on every lane: test_source_audio_ranges, test_source_volume_mix, test_source_ptm_gate_steps, test_audio_capture_mix_race and the scene item audio action tests.
Activity
rdoupe commentedon Oct 24, 2026
Claiming: #2158.
libobs: Move the source volume snap and apply decisions into obs-sour…
test: Characterize the source volume snap and apply decisions
obs-source: Add Tier 1 tests for the source volume snap and apply port
obs-source: Port the source volume snap and apply decisions
obs-source: Check the source volume snap and apply port against the C
docs: Record the source volume snap and apply port
libobs: Move the source volume snap and apply decisions into obs-sour…
test: Characterize the source volume snap and apply decisions
obs-source: Add Tier 1 tests for the source volume snap and apply port
obs-source: Port the source volume snap and apply decisions
obs-source: Check the source volume snap and apply port against the C
docs: Record the source volume snap and apply port
obs-source: Port the source volume snap and apply decisions (obs-rust…