Skip to content

rust: Port the scene audio render window in obs-scene.c to obs-scene #2178

Closed

Description

@rdoupe

Unit

Port the scene audio render window decisions in scene_audio_render() (libobs/obs-scene.c.h) to rust/obs-scene, as a new module audio_window. These decisions move:

  • Which source to read per item. The show transition while it plays for a visible item, the hide transition for a hidden one, and the source otherwise.
  • The earliest timestamp. Taken over items that are not pending and are visible or hiding.
  • The no-audio case. With no such item, process every item's pending actions and report no audio.
  • The window for each item.
    • Skip it if it is pending or has no timestamp.
    • Otherwise compute pos from ns_to_audio_frames, and skip at pos >= AUDIO_OUTPUT_FRAMES.
    • Compute count.
    • Skip a hidden item that has no volume buffer and no hide transition.
    • Skip duplicated audio.

These stay in C:

  • audio_lock;
  • apply_scene_item_volume and process_all_audio_actions, which are already ported; C calls them and passes the result;
  • obs_source_get_audio_mix;
  • the two mix loops.

Plan (one PR, separate commits)

  1. A behaviour-neutral move into libobs/obs-scene-audio-window.c.h, as hidden functions.
  2. Characterization in test_scene_audio_window_steps. It covers:
    • every pick for each combination of visible and active transition;
    • the minimum over item sets, including all pending and no timestamps;
    • the item window at pos = AUDIO_OUTPUT_FRAMES - 1, at it and + 1;
    • a timestamp before the minimum, and the u64 edges;
    • every skip rule.
  3. RED, then GREEN: the safe Rust core plus shims, in a libobs.ported-scene-audio-window group. Exported symbols are unchanged.
  4. Tier 3 parity against the original C:
    • exhaustive over the flags;
    • a proptest over full-range timestamps and sample rates;
    • a deliberate-break check and port_comparison numbers.

These real-libobs tests must stay green on every lane:

  • test_group_hide_transition_audio;
  • the scene item audio action tests;
  • test_audio_capture_mix_race;
  • test_scene_blend;
  • every scene audio test.

Activity

  1. rdoupe commented on Oct 24, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: #2178.

  2. added
    claimed
    on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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