Skip to content

obs-source: swap source audio-pause subscriptions to safe Rust (Refs #4375) - #5258

Merged
rdoupe merged 2 commits into
masterfrom
port/4375-source-audio-pause-swap
Nov 19, 2026
Merged

rdoupe merged 2 commits into
masterfrom
port/4375-source-audio-pause-swap

Conversation

@rdoupe

@rdoupe rdoupe commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #4375

Moves obs_source_add_audio_pause_callback and obs_source_remove_audio_pause_callback from libobs/obs-source-audio-pause-callbacks.c.h into obs-source. The C extraction (#4380) is the prerequisite. This builds on Zach's port/4375-source-audio-pause branch from 2026-11-09 (co-authored), rebased onto current master with the README row filled in.

What changed

  • obs-source::audio_pause_callbacks::update: a NULL source logs <name>: Null 'source' parameter (the obs_source_valid() text) and touches nothing; otherwise the signal handler is fetched once and the pair is connected to, or disconnected from, media_pause then media_stopped, the C's order.
  • obs-source::ffi::source_audio_pause_callbacks: the two public exports. obs_source_get_signal_handler(), signal_handler_connect/_disconnect and blog are called through their existing C ABI; nothing about the source layout is mirrored.
  • C: the original moves out of libobs.core-source into its own ported group, libobs.ported-source-audio-pause-callbacks. Its only in-tree caller (the macOS CoreAudio monitor) is unchanged.

Tests

  • Tier 1: rust/obs-source/tests/source/audio_pause_callbacks.rs mirrors the two cmocka cases on the core, plus the fetch-once-then-pause-then-stopped order.
  • Tier 2: test_source_audio_pause_callbacks.c is unchanged and links OBS::libobs, so it now runs against the Rust exports in the hybrid libobs (and against the C reference).
  • Tier 3: audio_pause_callbacks_parity.rs compares the core's ordered call trace with the original C bodies (rust/obs-c-oracle/oracle/source_audio_pause_callbacks.c, which records instead of connecting) over every NULL source / NULL callback / NULL param / add-or-remove combination and proptest sequences of up to 64 operations; the C recorder also checks the callback and param it was handed.
  • Tier 4 does not apply (no protocol surface).

Evidence

RED (6dbbecb, core stubbed):

soldr cargo test -p obs-data --test obs-tests-core -- source::audio_pause_callbacks
test source::audio_pause_callbacks_parity::all_edges ... FAILED
test source::audio_pause_callbacks::subscriptions_and_removal_from_c ... FAILED
test source::audio_pause_callbacks::acquires_handler_once_before_paired_updates ... FAILED
test source::audio_pause_callbacks::null_source_from_c ... FAILED
test source::audio_pause_callbacks_parity::operation_sequences ... FAILED
test result: FAILED. 0 passed; 5 failed

GREEN:

soldr cargo test -p obs-data --test obs-tests-core
test result: ok. 6132 passed; 0 failed; 5 ignored

soldr cargo test -p obs-studio-rust --test obs-tests-app -- native_build::
test result: ok. 322 passed; 0 failed

OBS_CTEST_JOBS=10 uv run rust/tools/linux-validate/run.py --repeat 1 --tests 'audio_pause_callbacks|audio_capture_callbacks'
100% tests passed, 0 tests failed out of 2

# hybrid libobs from that build: the export is the Rust body
nm --dynamic --defined-only libobs.so.30 | grep audio_pause_callback
T obs_source_add_audio_pause_callback
T obs_source_remove_audio_pause_callback
(objdump: calls obs_source_get_signal_handler, then obs_source::audio_pause_callbacks::update)

# the cmocka binary run directly in the build volume:
[ RUN      ] null_source
debug: obs_source_add_audio_pause_callback: Null 'source' parameter
debug: obs_source_remove_audio_pause_callback: Null 'source' parameter
[  PASSED  ] 2 test(s).

uv run --no-project ci/windows_link_check.py
Tier 2 win-x64: linked   Tier 2 mac-arm64: linked

./lint   -> lane lint: ok

🤖 Generated with Claude Code

rdoupe and others added 2 commits November 19, 2026 11:10
Tier 1 mirrors test_source_audio_pause_callbacks.c on the core;
Tier 3 compares its call trace with the original C bodies. The core
is a stub, so every case fails.

Builds on Zach Vorhies' port/4375-source-audio-pause branch.

Co-Authored-By: Zach Vorhies <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, Refs #4375)

obs_source_add_audio_pause_callback and obs_source_remove_audio_pause_callback
move from libobs/obs-source-audio-pause-callbacks.c.h to obs-source. The
original C moves to its own ported group. The signal handler and
obs_source_get_signal_handler() stay where they are.

Builds on Zach Vorhies' port/4375-source-audio-pause branch.

Co-Authored-By: Zach Vorhies <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ci-Attestation: {"at":1795106347,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":95,"stamp":"5f8e3e223d40593080606d87f8f815ab","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106347,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":95,"stamp":"91df059559f826f54639f70b1287f5e5","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106347,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":95,"stamp":"bb9678de9a238a9438780988ae93a0c1","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106347,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":95,"stamp":"82136829518d787a934d30c092816d0d","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106251,"gate":"general/all/client-lint","host":"linux-x86_64","key":"2362aa3cb8c651270286d2563fbeee0fc1fa792e2eef3c9a99900b1bd7cbab41","lane":"client-lint","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":61,"stamp":"7978837f5096f39c4b5306a8290c4804","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106347,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":95,"stamp":"8bf2cfd1284ec81cb03181ea869e9b6c","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106251,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"2362aa3cb8c651270286d2563fbeee0fc1fa792e2eef3c9a99900b1bd7cbab41","lane":"client-lint","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":61,"stamp":"e9dd82b0d20c755d22af090bea71bbe5","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106251,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"2362aa3cb8c651270286d2563fbeee0fc1fa792e2eef3c9a99900b1bd7cbab41","lane":"client-lint","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":61,"stamp":"fd493dc1bad556e3d1e95d50e54f2628","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106251,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"2362aa3cb8c651270286d2563fbeee0fc1fa792e2eef3c9a99900b1bd7cbab41","lane":"client-lint","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":61,"stamp":"4c33c2a521f01c1b64e78e2824580dde","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106251,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"2362aa3cb8c651270286d2563fbeee0fc1fa792e2eef3c9a99900b1bd7cbab41","lane":"client-lint","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":61,"stamp":"b4781a7cf432e6aaafbf5bf4185c4aeb","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106251,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"2362aa3cb8c651270286d2563fbeee0fc1fa792e2eef3c9a99900b1bd7cbab41","lane":"client-lint","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":61,"stamp":"ff2ff87b57419bc7e8b269a933b86fe8","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106251,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"2362aa3cb8c651270286d2563fbeee0fc1fa792e2eef3c9a99900b1bd7cbab41","lane":"client-lint","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":61,"stamp":"f17ccbb012e2a7cc04cfbe781da9bb53","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106251,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"2362aa3cb8c651270286d2563fbeee0fc1fa792e2eef3c9a99900b1bd7cbab41","lane":"client-lint","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":61,"stamp":"c55e1d345f2945af79deedbf481552cf","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106251,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"2362aa3cb8c651270286d2563fbeee0fc1fa792e2eef3c9a99900b1bd7cbab41","lane":"client-lint","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":61,"stamp":"8724f9d8387bd13196cc865305a2baea","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106251,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"2362aa3cb8c651270286d2563fbeee0fc1fa792e2eef3c9a99900b1bd7cbab41","lane":"client-lint","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":61,"stamp":"b25b4767d25fd34ccee65316ce0408d3","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106251,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"2362aa3cb8c651270286d2563fbeee0fc1fa792e2eef3c9a99900b1bd7cbab41","lane":"client-lint","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":61,"stamp":"a54d0cc2b8591287e10401ede0018950","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106251,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"2362aa3cb8c651270286d2563fbeee0fc1fa792e2eef3c9a99900b1bd7cbab41","lane":"client-lint","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":61,"stamp":"6885f506da313002c0275187b3bdfa1c","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106251,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"2362aa3cb8c651270286d2563fbeee0fc1fa792e2eef3c9a99900b1bd7cbab41","lane":"client-lint","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":61,"stamp":"0097c674098fca764bbb2042665a46f8","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}
Ci-Attestation: {"at":1795106562,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"9298ac90c25fddee0a04b1eaf5d3625c1cb9d436dd2bf2915a4b64cb562fbbb2","lane":"client-test-x86_64-unknown-linux-gnu","parents":["6dbbecb58d5579f0fc69c5674b7ca6dc8cd4b134"],"secs":214,"stamp":"c120c2fd7cdea12e0cad046452f68b6f","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98","v":1,"via":"run"}

Client-Checks: {"checks":{"base":"9135554e3e5b9c608f75794f930709ea15dd2af8","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core-source+.h.c","libobs/build/libobs.ported-source-audio-pause-callbacks+.h.c","libobs/build/ported-source-sets/source-audio-pause-callbacks.json","libobs/cmake/rust-exports.d/obs-source-source_audio_pause_callbacks.txt","rust/README.md","rust/obs-c-oracle/oracle/source_audio_pause_callbacks.c","rust/obs-source/src/audio_pause_callbacks.rs","rust/obs-source/src/ffi/mod.rs","rust/obs-source/src/ffi/source_audio_pause_callbacks.rs","rust/obs-source/src/lib.rs","rust/obs-source/tests/source/audio_pause_callbacks.rs","rust/obs-source/tests/source/audio_pause_callbacks_parity.rs","rust/obs-source/tests/source/main.rs"],"head":"8d1d763483e68b80c2a3080eb3ec84705c077127","tools":{"orchestrator-python":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]","schema-dependencies":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504-GITv2.15.4\n   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ICU ISO8859X Regexps Automata RelaxNG Schemas Schematron Modules Debug Zlib"},"tracked-digest":"1a97a65e0b99e2577cb368f59f99df6066b1eb8b0111c5fe67de11d64e049ead","tree":"8c5d086b4591b88c9b4b42e8efbf85df20520f98"}}
@rdoupe
rdoupe requested a review from zackees as a code owner November 19, 2026 16:42
@rdoupe rdoupe changed the title obs-source: swap source audio-pause subscriptions to safe Rust (GREEN, Refs #4375) obs-source: swap source audio-pause subscriptions to safe Rust (Refs #4375) Nov 19, 2026
@rdoupe
rdoupe added this pull request to the merge queue Nov 19, 2026
Merged via the queue into master with commit 82bdc6f Nov 19, 2026
46 checks passed
@rdoupe
rdoupe deleted the port/4375-source-audio-pause-swap branch November 19, 2026 18:16
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In review to Done in obs-rust Multiview Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant