Skip to content

rust: Port the source audio render mix plan in obs-source.c to obs-source #2207

Closed

Description

@rdoupe

Unit

Port the source audio render mix plan in libobs/obs-source.c.h to rust/obs-source, as a new module audio_render_plan. These decisions move:

  • obs_source_audio_render: the route, which is one of no buffer, custom render, submix, or the tick.
  • custom_audio_render:
    • which mixes to clear before the callback;
    • the pending and timestamp result;
    • which mixes to clear after the callback.
  • process_audio_source_tick:
    • pending when there is no timestamp or not enough input;
    • for each of mixes 1-5, clear it or copy it from mix 0 (the submix case uses mix 1 only, with the mask forced to 1);
    • mix 0 is cleared when it is not in both masks.

These stay in C: the buffers and audio_buf_mutex, deque_peek_front, every memset/memcpy, the plugin callbacks, audio_submix, and apply_audio_volume (ported in #2175).

Plan (one PR, separate commits)

  1. A behaviour-neutral move into libobs/obs-source-audio-render.c.h, as hidden functions.
  2. Characterization in test_source_audio_render_steps. It covers:
    • every route;
    • the mixer masks at 0, 1, 0x3f and above, and UINT32_MAX;
    • the pending conditions at the size edges;
    • the submix case;
    • the callback's success and failure.
  3. RED, then GREEN: the safe Rust core plus shims, in a libobs.ported-source-audio-render group. Exported symbols are unchanged.
  4. Tier 3 parity against the original C: exhaustive over flags and masks, plus a proptest over full-range sizes and timestamps. 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_volume_apply_steps
  • test_audio_capture_mix_race
  • test_group_hide_transition_audio
  • the submix and custom audio render tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions