Repository navigation
obs-source: swap source audio-capture callback registration to safe Rust (Refs #5243) - #5254
Merged
Merged
Conversation
rdoupe
enabled auto-merge
November 19, 2026 16:43
This was referenced Nov 19, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 19, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Nov 19, 2026
…t stub (RED, Refs #5243) Moves the caption registry's ordered-pair update into callback_registry so both source callback lists share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ust (GREEN, Refs #5243) obs_source_add/remove_audio_capture_callback now run in obs-source over the shared ordered-pair registry. The real private adapter keeps audio_cb_mutex, the C darray and its bmem storage. The unchanged C characterization links the Rust through private _rust entries, the real adapter compiled over its recording mutex and the real variadic blog (test_audio_capture_callbacks_rust, outside the test_source_ prefix that gives source-step fixtures an aborting blog stub); Tier 3 compares the Rust with the original C. The audio-controls oracle keeps its no-op stand-ins private. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Ci-Attestation: {"at":1795114575,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":94,"stamp":"1cf32ef3d25d7ad68f11c761ca5b0c2a","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114575,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":94,"stamp":"62ef1be030ea8f161f8a9ae7e613319d","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114575,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":94,"stamp":"c4ba0ebed76aabac8d320df8c0397140","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114575,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":94,"stamp":"21d9bdd81c24166994a34c0ddb080b4b","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114480,"gate":"general/all/client-lint","host":"linux-x86_64","key":"b7d03511ca333ed8ee4e48a83faaef561e36d8e4f42ef5f377fef4faeec4237d","lane":"client-lint","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":75,"stamp":"18f81e9c602268dfa767dd40d9a6f35d","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114575,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":94,"stamp":"bf56ddd441a588f10d278d288a84ef5d","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114480,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"b7d03511ca333ed8ee4e48a83faaef561e36d8e4f42ef5f377fef4faeec4237d","lane":"client-lint","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":75,"stamp":"b22fcc56d6f6a5cda5858de671433cbe","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114480,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"b7d03511ca333ed8ee4e48a83faaef561e36d8e4f42ef5f377fef4faeec4237d","lane":"client-lint","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":75,"stamp":"11829d15e37422a15d2427fe10d889e9","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114480,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"b7d03511ca333ed8ee4e48a83faaef561e36d8e4f42ef5f377fef4faeec4237d","lane":"client-lint","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":75,"stamp":"4c72da0388614c58b987a607e468e606","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114480,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"b7d03511ca333ed8ee4e48a83faaef561e36d8e4f42ef5f377fef4faeec4237d","lane":"client-lint","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":75,"stamp":"9b383d5d7a32aef4f1bbce0e285656b4","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114480,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"b7d03511ca333ed8ee4e48a83faaef561e36d8e4f42ef5f377fef4faeec4237d","lane":"client-lint","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":75,"stamp":"bc525eb29423f62b73a048e4c23e0a54","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114480,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"b7d03511ca333ed8ee4e48a83faaef561e36d8e4f42ef5f377fef4faeec4237d","lane":"client-lint","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":75,"stamp":"db8b8d44ef63656cd710667f242b5e14","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114480,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"b7d03511ca333ed8ee4e48a83faaef561e36d8e4f42ef5f377fef4faeec4237d","lane":"client-lint","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":75,"stamp":"68d34003beaab2e4d21ed4f25ab8e975","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114480,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"b7d03511ca333ed8ee4e48a83faaef561e36d8e4f42ef5f377fef4faeec4237d","lane":"client-lint","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":75,"stamp":"eda790340083d7feb43d4f14f3518c51","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114480,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"b7d03511ca333ed8ee4e48a83faaef561e36d8e4f42ef5f377fef4faeec4237d","lane":"client-lint","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":75,"stamp":"7d01fa4bad64dc5e26a57181c1510dcb","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114480,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"b7d03511ca333ed8ee4e48a83faaef561e36d8e4f42ef5f377fef4faeec4237d","lane":"client-lint","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":75,"stamp":"0eb5cf1ab8650f89b9b3cde52159ced5","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114480,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"b7d03511ca333ed8ee4e48a83faaef561e36d8e4f42ef5f377fef4faeec4237d","lane":"client-lint","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":75,"stamp":"e23772d7a95438198513827fcab8bfdf","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114480,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"b7d03511ca333ed8ee4e48a83faaef561e36d8e4f42ef5f377fef4faeec4237d","lane":"client-lint","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":75,"stamp":"09b2b26ecc7c101a7210721d77dfb682","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Ci-Attestation: {"at":1795114803,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"1986f1abdc20e80e7195d630b7e7cc3f532989b914690c5c50efbe470ce9c860","lane":"client-test-x86_64-unknown-linux-gnu","parents":["d18d25fff73a4991be7d42d3b70748a278e874ed"],"secs":227,"stamp":"f751ac40697d3c983668c2349c415cbe","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5","v":1,"via":"run"} Client-Checks: {"checks":{"base":"6c3417a871453a8b68bb78bc5dd70d07b0bfefc9","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core-source+.h.c","libobs/build/libobs.ported-source-audio-capture-callbacks+.h.c","libobs/build/ported-source-sets/source-audio-capture-callbacks.json","libobs/cmake/rust-exports.d/obs-source-source_audio_capture_callbacks.txt","libobs/cmake/rust-hidden.d/obs-source-source_audio_capture_callbacks.txt","libobs/obs-internal.h","libobs/obs-source-audio-capture-callback-fields.c.h","rust/README.md","rust/obs-build/tests/native/registration/canonical_video_info_query_is_registered.rs","rust/obs-build/tests/native/registration/rust-static/cases/header/test_audio_capture_callbacks.json","rust/obs-c-oracle/oracle/audio_controls.c","rust/obs-c-oracle/oracle/source_audio_capture_callbacks.c","rust/obs-source/src/audio_capture_callbacks.rs","rust/obs-source/src/callback_registry.rs","rust/obs-source/src/caption_callbacks.rs","rust/obs-source/src/ffi/callback_list.rs","rust/obs-source/src/ffi/mod.rs","rust/obs-source/src/ffi/source_audio_capture_callbacks.rs","rust/obs-source/src/ffi/source_caption_callbacks.rs","rust/obs-source/src/lib.rs","rust/obs-source/tests/source/audio_capture_callbacks.rs","rust/obs-source/tests/source/audio_capture_callbacks_parity.rs","rust/obs-source/tests/source/main.rs","test/cmocka/build/test-graph.json","test/cmocka/source-audio-capture-callback-link-support.c","test/cmocka/source-audio-capture-callback-record-support.c","test/cmocka/tests.d/test_audio_capture_callbacks.cmake","test/cmocka/tests.d/video_info_query_link_support.cmake"],"head":"d26fc5bcd8650254811d38ada567bffd5801a146","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":"e3f2b115e013875f432fbe50bab6ee5e0fbbf49fd3cd2a5a12ce72ff6c8ee23b","tree":"eab26f59bb8fdccbbb768130e0f311bc2d39bcd5"}}
rdoupe
force-pushed
the
port/source-audio-capture-callbacks
branch
from
November 19, 2026 19:00
3f9a6a1 to
1f21b35
Compare
rdoupe
enabled auto-merge
November 19, 2026 19:00
|
Ya'll know the machines are gaslighting you right? I've seen dozens of PRs "porting to safe rust" and every one of them I've spot checked is just transpiling from C to unsafe Rust. Sure they may be functionally equivalent and in some cases to provide the same functionality across an FFI bridge it is necessary to use |
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.
Refs #5243
Moves
obs_source_add_audio_capture_callbackandobs_source_remove_audio_capture_callbackfromlibobs/obs-source-audio-capture-callbacks.c.hintoobs-source. The C extraction (#5242) is the prerequisite.What changed
obs-source::callback_registry: the ordered (callback, param) update that caption registration already used, now shared.caption_callbacksand the newaudio_capture_callbackscall it with their own diagnostic names. Behaviour is the same: append keeps order and duplicates, remove erases the first exact pair, NULL callbacks and params are stored, a NULL source logs<name>: Null 'source' parameterat LOG_DEBUG before any lock.ffi::callback_list: the locked C darray behind the registry (shared with the caption shim, which shrinks). The newffi::source_audio_capture_callbacksexports the two public functions, which forward to private_rustentries (hidden from shared libobs,rust-hidden.d), the same shape as obs-encoder: swap texture-input activity to safe Rust (Refs #5216) #5226.libobs/obs-source-audio-capture-callback-fields.c.his the real private adapter (list address,audio_cb_mutexlock/unlock). The source mutex, the darray and its bmem storage stay in C. The original C moves to its own ported group,libobs.ported-source-audio-capture-callbacks.Tests
rust/obs-source/tests/source/audio_capture_callbacks.rsmirrors the three cmocka cases.test_source_audio_capture_callbacks.cis unchanged. A newtest_audio_capture_callbacks_rustbuilds it withSOURCE_AUDIO_CAPTURE_EXTERNALagainstlibobs_rust-static, through the_rustentries and the real adapter compiled over the fixture's recording mutex (test/cmocka/source-audio-capture-callback-record-support.c). That way its lock-count and mutation-under-lock assertions apply to the Rust code. The target name stays outside thetest_source_prefix on purpose: the source-step link fragments give everytest_source_*Rust-static target an abortingblogstub, and this test checks the real diagnostics. Instead it links the real variadicblog(base-variadic.c.h) over the Rust log handler. Every other Rust-static consumer gets the real adapter from the existingvideo_info_query_link_supportarchive.audio_capture_callbacks_parity.rsruns the original C (rust/obs-c-oracle/oracle/source_audio_capture_callbacks.c) side by side with the Rust. It covers the characterized edges, 60-operation growth over every null/non-null pair, a proptest of up to 128 operations, the public and_rustentries alike, the unlocked mutex after each call, NULL-source diagnostics, and the real-header layouts ofstruct audio_cb_infoandstruct darray. Mutation check: making removal erase the last match instead of the first failscharacterized_edgesandsequences.Evidence
RED (commit e642d99, core stubbed):
(The caption cases still pass after the shared-registry refactor.)
GREEN:
Along the way: before the variadic
blogwas linked in, the fixture ran but its handler saw 0 of the 2 diagnostics, because they went through shared libobs's own log state. Before the rename it aborted on the source-stepblogstub.🤖 Generated with Claude Code