Repository navigation
libobs: characterize and extract obs_set_audio_monitoring_device (Refs #5489) - #5490
Merged
Merged
Conversation
On interposed libpulse, so monitoring is available without a sound server: a new device is stored by copy and every live monitor is reset once onto it; the same id again returns true, keeps the old name, resets nothing and tells no capture source; each public input with OBS_SOURCE_DO_NOT_SELF_MONITOR is told with its own device_id (the one capturing the new device starts deduplication, the one that stops matching stops it), inputs without the flag and private ones are not; obs_reset_audio_monitoring with no monitors touches nothing and with monitors resets each once. The Linux core inventory check counts one more PulseAudio-only core test (6 to 7). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#5489) Moves obs_reset_audio_monitoring, the static check_all_aoc_sources and obs_set_audio_monitoring_device verbatim from obs.c.h into obs-audio-monitoring-device.c.h, a member of the core unity group (alphabetical), ahead of their Rust swap. The OBS_SOURCE_DO_NOT_SELF_MONITOR assert moves with them, since only check_all_aoc_sources relies on it. They call no static helper of obs.c.h, so the file declares nothing. No behavior change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Ci-Attestation: {"at":1795407338,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":63,"stamp":"8255796e79fc97968af9901b41e9d0ae","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407338,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":63,"stamp":"5b85dce0cf31255bf5a358ec4417c825","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407338,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":63,"stamp":"97b1149c295ffdbb1c22b078b9f39761","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407338,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":63,"stamp":"6da3b69f9de823e868c85b3b8e4fc000","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407273,"gate":"general/all/client-lint","host":"linux-x86_64","key":"c5d79f91a96457b7273a6ee805715cb7d3493ae0fb301dc1bf1e68745adf49e5","lane":"client-lint","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":11,"stamp":"e2ef261799fbf680398d363c6e2d8d05","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407338,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":63,"stamp":"8eb7922e29368b02ab46bdad03969629","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407274,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"c5d79f91a96457b7273a6ee805715cb7d3493ae0fb301dc1bf1e68745adf49e5","lane":"client-lint","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":11,"stamp":"4fd7c128f7aea5312867be1759ac0a39","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407274,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"c5d79f91a96457b7273a6ee805715cb7d3493ae0fb301dc1bf1e68745adf49e5","lane":"client-lint","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":11,"stamp":"20a973472e859c4d21cf977fed597889","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407274,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"c5d79f91a96457b7273a6ee805715cb7d3493ae0fb301dc1bf1e68745adf49e5","lane":"client-lint","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":11,"stamp":"64fe64be9d7ed608488700ce0810936a","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407274,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"c5d79f91a96457b7273a6ee805715cb7d3493ae0fb301dc1bf1e68745adf49e5","lane":"client-lint","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":11,"stamp":"c01469a2b3b7b17bbdcfaa3dee58ed42","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407274,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"c5d79f91a96457b7273a6ee805715cb7d3493ae0fb301dc1bf1e68745adf49e5","lane":"client-lint","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":11,"stamp":"2218350a3463668c6755db4b9e68bede","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407274,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"c5d79f91a96457b7273a6ee805715cb7d3493ae0fb301dc1bf1e68745adf49e5","lane":"client-lint","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":11,"stamp":"36383eee403f57b1ced3ba0b72f87feb","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407274,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"c5d79f91a96457b7273a6ee805715cb7d3493ae0fb301dc1bf1e68745adf49e5","lane":"client-lint","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":11,"stamp":"df8659eef73a271eb53c20d8f547e65a","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407274,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"c5d79f91a96457b7273a6ee805715cb7d3493ae0fb301dc1bf1e68745adf49e5","lane":"client-lint","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":11,"stamp":"37b605294b00f4e27249070562362f35","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407274,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"c5d79f91a96457b7273a6ee805715cb7d3493ae0fb301dc1bf1e68745adf49e5","lane":"client-lint","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":11,"stamp":"16de3e6830ffc26d44b4db705b0f5fda","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407274,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"c5d79f91a96457b7273a6ee805715cb7d3493ae0fb301dc1bf1e68745adf49e5","lane":"client-lint","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":11,"stamp":"e6953bd4de35cc7f8267cfb69b2393dd","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407274,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"c5d79f91a96457b7273a6ee805715cb7d3493ae0fb301dc1bf1e68745adf49e5","lane":"client-lint","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":11,"stamp":"d6e15f9ea51d009feede27936816ace6","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407274,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"c5d79f91a96457b7273a6ee805715cb7d3493ae0fb301dc1bf1e68745adf49e5","lane":"client-lint","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":11,"stamp":"7e1a1d08521f414ad2fe733a21bea334","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Ci-Attestation: {"at":1795407496,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"6c005f7da8b18a666b8b7e661c6a4fca71e89bf6882f0d96b4644e53c7a45632","lane":"client-test-x86_64-unknown-linux-gnu","parents":["78a66541bc22eefca1e0f1198f3b9e0b301c82c2"],"secs":158,"stamp":"40b491b0bae48c0c9169966eb9431d15","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d","v":1,"via":"run"} Client-Checks: {"checks":{"base":"7bbf74d626f4b88587877bbc16794551f1a618f4","coverage":"all-tracked-applicable-files","diff":["ci/test_native_b2_portability.py","libobs/build/libobs.core+.h.c","libobs/obs-audio-monitoring-device.c.h","libobs/obs.c.h","test/cmocka/build/test-graph.json","test/cmocka/test_set_audio_monitoring_device.c","test/cmocka/tests.d/test_set_audio_monitoring_device.cmake"],"head":"4875b6d3bd2dace7687227d3bfae3b517c96847a","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":"bc3cddfba08601175b7a71018102d5aee0f49529ae44cbd05c015fdfbdbdd396","tree":"a594c5ae17426a02763e6a1bcbb2a22fa5dcc59d"}}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a C characterization of
obs_set_audio_monitoring_deviceandobs_reset_audio_monitoring, then moves them (with their static helpercheck_all_aoc_sources) verbatim fromlibobs/obs.c.hintolibobs/obs-audio-monitoring-device.c.h, a member of the core unity group (libobs/build/libobs.core+.h.c, alphabetical, right afterobs-audio-info-queries-fields.c.h).test_set_audio_monitoring_deviceis registered once in the canonical test graph with itstests.dmarker. No behavior change; existing C tests and public headers are unchanged.Refs #5489. This is the C-only prerequisite; the Rust swap follows separately (as
obs_reset_audio2did: #5485, then #5486).What the test pins
test_core_setup_rules_steps(test_monitoring_device) already pins the NULL/empty refusals and the return value per availability;test_pulse_monitor_resetpins one monitor surviving a failed PulseAudio reset. The new test covers the rest. Liketest_pulse_monitor_reset, it interposes only the external libpulse symbols in the executable (-Wl,--export-dynamic,-fvisibility=default), so monitoring is available without a sound server; the monitors, the source enumeration and the deduplication signal all run in libobs.obs_get_audio_monitoring_devicereads back the name and id given, from the core's own storage (not the caller's buffers, which are then overwritten). Each of two live monitors is reset exactly once: its old stream disconnected and unreferenced once, one new stream connected to the new id, and a later reset uses the stored id.OBS_SOURCE_DO_NOT_SELF_MONITORis told with its owndevice_idsetting, observed through the core'sdeduplication_changedsignal. Settingsink_bstarts deduplication for the source capturingsink_b.monitoronly. Thensink_cstops it for that source (NULL) and starts it for thesink_c.monitorone, in that order. Thensink_dstops it, and a fourth id tells nobody. An input without the flag and a private flagged input, both with a matchingdevice_id, are never told.obs_reset_audio_monitoring: with no monitors it creates no context, stream or mainloop and leaves the device as it was; with two monitors it resets each once on the current id, every time it is called.obs_shutdown().ci/test_native_b2_portability.pycounts the Linux core tests that need PulseAudio; it goes from 6 to 7 for this test (the same kind of update as #5268).The move
obs-audio-monitoring-device.c.hsorts beforeobs.c.hin the group. The three functions call no static helper ofobs.c.h, so the new file declares nothing. TheOBS_CORE_SETUP_RULES_DO_NOT_SELF_MONITOR == OBS_SOURCE_DO_NOT_SELF_MONITORassert moves with them, since onlycheck_all_aoc_sourcesrelies on it. The getter stays inobs-core-monitoring-device.c.h(already on Rust). Onlyobs.c.hincludes it, in this one group.Evidence
test:commit 78a6654): the test and its registration alone, against the C still inobs.c.h.OBS_CTEST_JOBS=10 uv run rust/tools/linux-validate/run.py --repeat 1 --tests 'test_set_audio_monitoring_device|test_core_setup_rules_steps|test_pulse_monitor_reset': full Linux Tier 2 passed on the C reference and hybrid libobs (1086/1086 each), then the seven related tests again on each (7/7).libobs:commit 1179654): the 60 moved lines are identical (diff) to the lines removed fromobs.c.h; the new file only adds the group's PCH include.Running 5 test(s)andPASSED 5 test(s)on both libraries.check_all_aoc_sourcespasses an empty id instead of the source'sdevice_id: onlyaoc_sources_told_with_their_device_idfails (test_set_audio_monitoring_device.c:465, 0 signals instead of 1); 4 of 5 pass.bstrdup(id)formonitoring_device_name): the name read-back fails ("sink_a" != "Sink A", line 333). The cases after it fail too, because the failed case leaves its monitors alive../lintpasses.🤖 Generated with Claude Code