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
perf: obs-audio-mix: add only into the active mixes #3189
obs_audio_mix_add (libobs/obs-audio-mix.c.h:41-52, Rust rust/obs-core/src/audio_mix.rs:192) adds every root source into all 6 mixes under audio_buf_mutex, though audio_callback gets the active mixers mask and typical setups use 1-2 tracks. Inactive mixes are never read (audio-io.c.h:126).
Proposed change
Pass mixers through mix_audio and skip unset bits. Output unchanged. Expected ~3-6x less mix-add work. Check no other caller relies on all 6 being filled.
Acceptance criteria
Before/after numbers (audio_mix bench with a mask sweep: 1 vs 6 mixes, 4/16/32 sources) in the PR; nothing lands unmeasured.
RED then GREEN; Tier 3 parity stays bit-exact unless this issue says otherwise.
Found by a read-only code scout and not yet measured. Parent: #3176.
Check every reader of the six mix buffers between mix_audio() and the outputs (audio-io.c.h, monitoring, the clamp), so a skipped mix is never read.
RED: obs_audio_mix_add() takes the active mixers mask; Tier 1 tests that an inactive mix is left untouched and an active one is added as before, and an audio_mix bench sweep (1 and 6 active mixes, 4, 16 and 32 sources).
GREEN: audio_callback() passes its mask through mix_audio(); the Rust core and shim skip unset bits. Tier 3 parity bit-exact with the mask, and record.py before/after numbers in the PR.
Note for whoever implements this: obs_audio_mix_add ships as Rust (libobs/cmake/rust-hidden.txt, rust/obs-core/src/ffi/audio_mix.rs), so the C in obs-audio-mix.c.h is only the Tier 3 reference. The mixers mask has to reach the Rust mix_into (rust/obs-core/src/audio_mix.rs), and the caller mix_audio in obs-audio.c.h (still C) has to pass it.
Covered in #3227: the shim obs_audio_mix_add_mixers() skips the mixes outside the mask (mix_active() in rust/obs-core/src/audio_mix.rs) before mix_into(), and audio_callback() in obs-audio.c.h passes its mask through a new mix_audio_mixers(); mix_audio() stays the all-mixes form because test_audio_buffering_subsample calls it. The C in obs-audio-mix.c.h changed only as the Tier 3 reference.
Activity
vpacher commentedon Oct 31, 2026
Claiming: #3189
Plan (one PR):
mix_audio()and the outputs (audio-io.c.h, monitoring, the clamp), so a skipped mix is never read.obs_audio_mix_add()takes the activemixersmask; Tier 1 tests that an inactive mix is left untouched and an active one is added as before, and anaudio_mixbench sweep (1 and 6 active mixes, 4, 16 and 32 sources).audio_callback()passes its mask throughmix_audio(); the Rust core and shim skip unset bits. Tier 3 parity bit-exact with the mask, andrecord.pybefore/after numbers in the PR.First PR within a day.
zackees commentedon Oct 31, 2026
Note for whoever implements this:
obs_audio_mix_addships as Rust (libobs/cmake/rust-hidden.txt,rust/obs-core/src/ffi/audio_mix.rs), so the C inobs-audio-mix.c.his only the Tier 3 reference. The mixers mask has to reach the Rustmix_into(rust/obs-core/src/audio_mix.rs), and the callermix_audioinobs-audio.c.h(still C) has to pass it.vpacher commentedon Oct 31, 2026
Covered in #3227: the shim
obs_audio_mix_add_mixers()skips the mixes outside the mask (mix_active()inrust/obs-core/src/audio_mix.rs) beforemix_into(), andaudio_callback()inobs-audio.c.hpasses its mask through a newmix_audio_mixers();mix_audio()stays the all-mixes form becausetest_audio_buffering_subsamplecalls it. The C inobs-audio-mix.c.hchanged only as the Tier 3 reference.perf(audio-mix): add only into the active mixes (obs-rust#3189) (obs-…