Repository navigation
obs-core: swap obs_enum_sources and the source/canvas enumerators to Rust (Refs #5495) - #5496
Merged
Merged
Conversation
…s enumerators (Refs #5495) Safe mirrors of every test_enum_sources case (an empty core, public inputs and groups only with one reference each, the early stops, a source with no reference left skipped, every source visited by obs_enum_all_sources without references, transitions skipped, the named canvases with their stops and a destroyed one gone, and another canvas's scenes referenced for each call) over a recording host table with a re-entrant mutex, per-entry counts and a callback that can stop or unlink the current entry. Plus what the C test cannot see: the order of every read and call (a reference released before the next link is read; private flag, input type and group id asked in that order), the uthash next read before each callback of the unreferenced walks, the canvases' head read before their mutex is taken, an input with the group id called back twice, and the scene type asked of every referenced canvas entry. Against a todo!() core: soldr cargo test -p obs-data --test obs-tests-core -- enum_sources:: test result: FAILED. 0 passed; 13 failed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Rust (Refs #5495) obs_enum_sources, obs_enum_all_sources, obs_enum_canvases and obs_canvas_enum_scenes now come from obs-core in hybrid libobs. The safe core makes the walks in the original's order: obs_enum_sources takes a reference on each uuid-table entry under sources_mutex (passing over one with none left), skips a private source, calls back for an input and then, unless that call answered false, for a source with the group id (the original's else if), and releases each reference before the next link is read; obs_enum_all_sources (the static obs_enum_uuid) and obs_enum_canvases read each next link before the callback (HASH_ITER), the canvases' head before canvases_mutex is taken; obs_canvas_enum_scenes references each entry of the canvas's own table under its mutex and calls back the scenes. A false answer releases and stops. A NULL callback walks nothing. The mutexes, table heads and links, obs_source_get_ref/obs_source_release and the private flag, type and id stay C behind private adapters (libobs/obs-enum-sources-fields.c.h, core group, also a Rust-static support member). The original moves to libobs.ported-enum-sources for the C reference; rust-exports.d/obs-core-enum_sources.txt exports the four names. Tier 3 (oracle/enum_sources.c) runs the original and the shims on one recording fixture core of real struct obs_source and struct obs_canvas entries over the C test's tables, every flag of an entry, early stops, the callback unlinking the current entry or taking the next one's last reference and proptest tables, with mutants: soldr cargo test -p obs-data --test obs-tests-core -- enum_sources test result: ok. 18 passed; 0 failed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Ci-Attestation: {"at":1795419512,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":93,"stamp":"64188d5c8d6f7625002ca816403c573a","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419512,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":93,"stamp":"227c6f4aaa4df16afd9ba7fb169f973a","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419512,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":93,"stamp":"2d513d1c8d60e3b298c5d38b6e9e4cf1","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419512,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":93,"stamp":"0deb0aeba4faae615ed3dbc7ab64026d","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419418,"gate":"general/all/client-lint","host":"linux-x86_64","key":"4ce3a2d636f0de42f000570d4626309d8c7ab5eb6bb94dea44fb3887ace189bc","lane":"client-lint","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":110,"stamp":"2fe57189bc0fbb9e59ab13dd0f1abe34","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419512,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":93,"stamp":"f6ba4f1abfda974331c0eec048f57b13","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419418,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"4ce3a2d636f0de42f000570d4626309d8c7ab5eb6bb94dea44fb3887ace189bc","lane":"client-lint","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":110,"stamp":"43945ff9c80c36218bd312e386e43d2b","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419418,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"4ce3a2d636f0de42f000570d4626309d8c7ab5eb6bb94dea44fb3887ace189bc","lane":"client-lint","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":110,"stamp":"0592e27cc8cf779e625d8a880eaf0d8d","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419418,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"4ce3a2d636f0de42f000570d4626309d8c7ab5eb6bb94dea44fb3887ace189bc","lane":"client-lint","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":110,"stamp":"df2537f049496c860276da1fa9e69860","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419418,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"4ce3a2d636f0de42f000570d4626309d8c7ab5eb6bb94dea44fb3887ace189bc","lane":"client-lint","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":110,"stamp":"8064e8680d63e2cacb5319f584161ed0","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419418,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"4ce3a2d636f0de42f000570d4626309d8c7ab5eb6bb94dea44fb3887ace189bc","lane":"client-lint","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":110,"stamp":"a4b0f20bf4eb460f34b94d5a1c5ff9d5","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419418,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"4ce3a2d636f0de42f000570d4626309d8c7ab5eb6bb94dea44fb3887ace189bc","lane":"client-lint","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":110,"stamp":"69e688838d6a56db4c70c3533b78e1c4","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419418,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"4ce3a2d636f0de42f000570d4626309d8c7ab5eb6bb94dea44fb3887ace189bc","lane":"client-lint","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":110,"stamp":"ffbdddc4ed366229ce58995bc9fc62b7","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419418,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"4ce3a2d636f0de42f000570d4626309d8c7ab5eb6bb94dea44fb3887ace189bc","lane":"client-lint","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":110,"stamp":"9423cca3e1d958ba2d40b03462369aa4","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419418,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"4ce3a2d636f0de42f000570d4626309d8c7ab5eb6bb94dea44fb3887ace189bc","lane":"client-lint","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":110,"stamp":"00cca968ef1f1ec150586338a5d04818","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419418,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"4ce3a2d636f0de42f000570d4626309d8c7ab5eb6bb94dea44fb3887ace189bc","lane":"client-lint","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":110,"stamp":"8e6fd50bf439d40de2ddfb4ce620c09c","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419418,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"4ce3a2d636f0de42f000570d4626309d8c7ab5eb6bb94dea44fb3887ace189bc","lane":"client-lint","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":110,"stamp":"1c20f4af1c06f1fdeb0646bc656d5235","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419418,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"4ce3a2d636f0de42f000570d4626309d8c7ab5eb6bb94dea44fb3887ace189bc","lane":"client-lint","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":110,"stamp":"9e3f399e7cbb2da1465cdff5401a4a5b","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Ci-Attestation: {"at":1795419752,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"f6eaf11c3c256c19e6a718bc5b942b6af30f2c8a5347f12fb37ff87cb1d668f5","lane":"client-test-x86_64-unknown-linux-gnu","parents":["98311a65435932a28b87d7b3517ca0c498d84704"],"secs":239,"stamp":"358787aaba6773b11189d204a5307a52","tree":"456fa12f2b27622cbcc8a770274621c123c48588","v":1,"via":"run"} Client-Checks: {"checks":{"base":"81d3adb7f37f05221f5e182c2b106f5122f344b0","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core+.h.c","libobs/build/libobs.ported-enum-sources+.h.c","libobs/build/ported-source-sets/enum-sources.json","libobs/cmake/rust-exports.d/obs-core-enum_sources.txt","libobs/obs-enum-sources-fields.c.h","rust/README.md","rust/obs-c-oracle/oracle/enum_sources.c","rust/obs-core/src/enum_sources.rs","rust/obs-core/src/ffi/enum_sources.rs","rust/obs-core/src/ffi/mod.rs","rust/obs-core/src/lib.rs","rust/obs-core/tests/obs_core/enum_sources.rs","rust/obs-core/tests/obs_core/enum_sources_parity.rs","rust/obs-core/tests/obs_core/main.rs","test/cmocka/build/rust-static-support.json","test/cmocka/enum-sources-link-support.c"],"head":"a355ae58b85c5214c5825b24930d1c340f02bf40","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":"c75fc2018f97f5537839eb64d6f7d78b68ccefd6927f60dee4a77b7d9ec9bbff","tree":"456fa12f2b27622cbcc8a770274621c123c48588"}}
rdoupe
marked this pull request as draft
November 23, 2026 07:42
rdoupe
marked this pull request as ready for review
November 23, 2026 07:43
rdoupe
enabled auto-merge
November 23, 2026 07:43
Collaborator
Author
|
Reran the failed jobs: the macOS Tier 2 job failed during CMake configure while cloning corrosion from GitHub ( |
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.
Swaps
obs_enum_sources,obs_enum_all_sources,obs_enum_canvasesandobs_canvas_enum_scenes(with their static helperobs_enum_uuid) fromlibobs/obs-enum-sources.c.htoobs-corein hybridlibobs. The public C API and ABI stay the same. Existing C tests and public headers are unchanged.Refs #5495. This follows the C-only extraction (PR #5494, merged), the same way
obs_set_audio_monitoring_devicefollowed its extraction (#5490 → #5492).What moved
The walks are now safe Rust (
rust/obs-core/src/enum_sources.rs), and each one makes its reads and calls in the same order as the original:obs_enum_sources: walks the uuid table from its head while holdingsources_mutex. It takes a reference on each entry and passes over an entry with no reference left. It skips private sources. It calls back for an input. Unless that call answered false, it then calls back for a source whose id is the group's. This is the original'selse if, so an input carrying the group id is called back twice. A false answer releases the reference and stops the walk. Each reference is released before the next link is read.obs_enum_all_sources(the staticobs_enum_uuid): visits every entry while holding the mutex, without taking a reference. It reads each next link before that entry's callback (HASH_ITER), so a callback can unlink the current entry.obs_enum_canvases: the same walk over the named canvases. As in the original, the head is read beforecanvases_mutexis taken.obs_canvas_enum_scenes: walks the canvas's own table in order while holding that canvas'ssources_mutex. It references each entry, asks the type of the listed entry, calls back for scenes and releases every reference. A false answer releases and stops.The mutexes, the table heads and links,
obs_source_get_ref/obs_source_release, and the private flag, type and id all stay in C behind private adapters inlibobs/obs-enum-sources-fields.c.h. That file takes the original's place in the core group and is also a Rust-static support member (test/cmocka/enum-sources-link-support.c). The original moves tolibobs.ported-enum-sources, which only the C reference builds.rust-exports.d/obs-core-enum_sources.txtexports the four names. Before the swap, I checked every consumer:obs_enum_scenes's adapter,obs-canvas.c.h,obs-audio-monitoring-device.c.h, scripting,obs-mcpand the cmocka tests.test_ws_scene_countstubsobs_canvas_enum_scenesitself and links neitherlibobsnor the Rust staticlib. The Rust shims name only the new adapters, and the oracle defines those under their real names, so no*_links.cis needed.Evidence
obs-core: RED Tier 1 mirrors ...): Tier 1 mirrors everytest_enum_sourcescase on a recording host table. It also checks what the C test cannot see: the order of every read and call, the next link read before each callback, the canvases' head read before locking, an input with the group id called back twice, and the scene type asked of each referenced canvas entry. Run against atodo!()core:oracle/enum_sources.c) runs the original and the shims on the same recording fixture core, built from realstruct obs_sourceandstruct obs_canvasentries:enum_sources.rs, run, then reverted):(input || group) && !visit, a single call instead of theelse if: caught byenum_sources_step_order,enum_sources_input_with_group_id,characterized_edgesandany_walk_matches_original_c.iterate: caught byenum_uuid_reads_next_before_each_callback,enum_canvases_reads_head_before_locking,characterized_edges,any_walk_matches_original_candmutants_are_caught.enum_canvases_reads_head_before_locking,characterized_edges,any_walk_matches_original_candmutants_are_caught.obs_enum_sources, the release moved after the next read and applied to every listed entry: caught byenum_sources_step_order,enum_sources_skips_source_without_references,characterized_edgesandany_walk_matches_original_c.test_enum_sourcesandtest_enum_scenesunchanged:libobs-c-referenceand 1087/1087 on hybridlibobs, then the two tests passed 2/2 again on each library. Exported symbols are identical between C and Rust (1769). The ported C objects excluded from productionlibobswent from 588 to 589../lintpasses.characterized_edgesat 0.013 s. Peak RSS is 22 MB. The tests start no threads of their own.Tier 4 does not apply.
docs/features.mdis unchanged because there is no user-visible change (as for #5488).🤖 Generated with Claude Code