Skip to content

rust: Port the source monitoring, monitor-only mute and balance rules in obs-source.c to obs-source #2621

Closed

Description

@rdoupe

Rust port, round 12 unit 1: the monitoring, monitor-only mute, balance, mixer, flag, push-to and audio-active decisions left in libobs/obs-source.c.h, moved to obs-source next to ptm_gate and volume_apply.

Unit

libobs/obs-source.c.h (the decisions only) to rust/obs-source, new module monitoring.

Phase and position

Phase 6 (libobs core), the core-source+ group. After the transition load checks (#2595), the last unit in this group.

Dependencies and existing tests

Rust takes over these decisions, on plain values:

C keeps obs_source_valid(), audio_mutex, every os_atomic_* (read where it is today), every calldata_*, signal and log (the deprecation warnings included), obs_source_set_muted()/obs_source_muted(), audio_monitor_create()/_destroy(), the getters' literals for an invalid source, and everything of the volume and the push-to gate (already Rust).

Existing real-libobs tests: the Monitor Only tests from #2444 and #2447 and the balance test from #2051. A characterization test of the moved decisions (test_source_monitoring_steps) lands first.

Notes

  • Concurrency: each decision is its own function, asked at its own point. obs_source_set_monitoring_type() reads monitor_only_muted once and the mute after each call it makes; C keeps both reads there and asks the core after each, so the core never assumes a mute it asked for has happened. Monitor Only mutes before it turns monitoring on.
  • Handlers of audio_balance and audio_mixers may change the value: C keeps the signal and asks the core again with what the handler left.
  • No SIMD, no per-OS code, no struct mirrored, no pointer crosses. The monitoring type crosses as int, checked with _Static_assert.
  • Expected intentional differences: none.

Plan

The standard six commits:

  1. move (behaviour-neutral);
  2. characterization test;
  3. Tier 1 RED;
  4. GREEN in a libobs.ported-source-monitoring group;
  5. Tier 3 parity;
  6. docs.

Activity

  1. added
    enhancement
    port
    ready
    on Oct 27, 2026
  2. rdoupe commented on Oct 27, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: #2621 (round 12 unit 1, source monitoring, monitor-only mute and balance rules).

    1. Move the decisions into libobs/obs-source-monitoring.c.h (hidden, declared in obs-source-monitoring.h), behaviour-neutral, checked with a harness against master's functions.
    2. Characterization: test_source_monitoring_steps.
    3. Tier 1 RED against todo!().
    4. GREEN: rust/obs-source monitoring and its shims, in a new libobs.ported-source-monitoring group.
    5. Tier 3 parity against the C oracle, with a mutation check.
    6. Docs.

    Draft PR once the RED commit exists, today.

  3. rdoupe commented on Oct 27, 2026

    @rdoupe
    CollaboratorAuthor

    Fixed by #2629 (merged as 7ba13d0): the monitoring, monitor-only mute, balance, mixer, flag, push-to and audio-active decisions left in libobs/obs-source.c.h now live in rust/obs-source (module monitoring), behind thirteen hidden C-ABI functions. Tier 1, the characterization test, Tier 3 parity and the mutation check all pass; exported symbols are unchanged and there are no intentional differences.

    Nothing is left of this unit, so there is no follow-up issue for it. Unrelated, found on the way: the Windows-GNU oracle build failing under -Wconversion in audio-math.h (#2648) is tracked and fixed separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementportready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions