Repository navigation
Done
Labels
enhancementNew feature or requestportPort a C unit to Rust (four-tier policy)readyMeets the definition of Ready; claimable
Description
obs_source_audio_render() in libobs/obs-source.c.h (~1881-2030 on master, bfc55e6) and its three static steps, custom_audio_render(), audio_submix() and process_audio_source_tick(), are still C. They are what the audio thread calls for each source every tick. Every decision in them is already Rust: the route and the per-mix plan (obs-source-audio-render.c, #2254) and the volume step (obs_source_apply_audio_volume(), #5916). What is left is the glue on the source's fields, the input deques, audio_buf_mutex and the source callbacks.
Behavior the port keeps, call for call:
obs_source_audio_render(): readaudio_output_buf[0][0], theninfo.audio_render, thencontext.data, each only where the earlier checks reached it (432017b: the audio thread can render a source whosecontext.datais not set yet). Route PENDING setsaudio_pending; CUSTOM runs the custom step; TICK runsaudio_submix()wheninfo.audio_mixis set, then the tick step.custom_audio_render(): point the mix struct at the output buffers, clear each mix the plan says to clear before (readingaudio_mixersonce per mix), callinfo.audio_renderoutside the lock, then underaudio_buf_mutexsetaudio_tsandaudio_pending, return early when pending or unmixed, clear after per mix, thenobs_source_apply_audio_volume().audio_submix(): clearaudio_mix_buf, callinfo.audio_mix, and on success hand the planar float block toobs_source_output_audio()with the tick's rate, frames, layout and timestamp.process_audio_source_tick(): underaudio_buf_mutex, mark pending whenaudio_tsis unset or the input is short; otherwise peek each channel into mix 0, copy or clear mixes 1.., then either stop (submix) or clear the main mix when the plan says and apply the volume. The input size is read only with a timestamp.
Plan, one PR into obs-source (the shape of #5916):
- Extract the four functions verbatim into
libobs/obs-source-audio-render-steps.c.h(livecore-sourcegroup). No behavior change. - Tier 1 RED in obs-source's existing category binary against a
todo!()core over a trait for the field reads/writes, the deques, the mutex and the callbacks. - GREEN: safe core in
obs-source, the export as C ABI inffi/, a field shim with noEXPORT, the extracted file moved to a reference-only ported group. - Tier 3 parity against the original C in
obs-c-oracle: the same buffers, inputs, callbacks and mixers through both, comparing buffers, fields, deque contents, callback calls and lock order. - Tier 2: a new cmocka test of custom, submix and tick sources (pending, short input, unset timestamp, each mixer mask, a failing callback) through the hybrid libobs and the C reference. The existing audio tests run unchanged.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestportPort a C unit to Rust (four-tier policy)readyMeets the definition of Ready; claimable
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Nov 29, 2026
Claiming: #5923 port of obs_source_audio_render and its custom, submix and tick steps (extract, Tier 1 RED, GREEN, Tier 3 parity, Tier 2).
obs-source: port obs_source_audio_render and its custom, submix and t…
rdoupe commentedon Nov 30, 2026
Done in #5926 (merged 2026-11-29); the queue merge didn't close it.