Repository navigation
obs-source: port obs_source_filter_add to Rust (Fixes #5799) - #5800
Merged
Merged
Conversation
Move obs_source_filter_add() unchanged out of obs-source.c.h into obs-source-filter-add.c.h, still compiled in the live core-source group. It is EXPORT and declared in obs.h, and filter_compatible() is already declared in obs-internal.h, so the earlier position in the unity group needs no new declaration. No Rust, no behavior change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
New cmocka test through the real core (xvfb-run, skips without a display), against hybrid libobs and the C reference: a NULL source or filter logs the validity check's line once (the source first) and references nothing; a filter already on the list, or one with a parent on another source, logs the "already present" warning with filter_mutex held (probed from a second thread, the mutex is recursive) and changes nothing; an audio filter on a video source is refused without a line, while a source whose type is missing (it owns its info id) takes it; a filter whose last reference is gone (re-added from its own child's filter_remove callback while it is destroyed) logs the 'filter' validity line and is not added. Otherwise each filter goes to the front of the list holding its own reference, its parent the source and its target the old first filter (the source on an empty list); then, with filter_mutex free, the global source_filter_add and the source's filter_add signals fire with the list already holding it, the debug line is logged, and the type's filter_add callback runs with the parent (a type without one skips only that). Co-Authored-By: Claude Opus 5.5 <[email protected]>
New obs-source module filter_add with a todo!() core over a FilterList
trait, and Tier 1 mirrors of test_source_filter_add.c on a model that
records every call: the NULL lines (source first) with nothing touched;
on every chain of up to 6 filters, with and without the type's callback,
on a source that owns its info id or not, the C's order: the lookup and
the parent read under the lock, the info id check and (when it applies)
the two output flags, the reference, the parent, the count and old first
filter for the target, the insert at the front, the unlock, the signals,
the log line, the callback check and call. Every listed entry and a
filter parented elsewhere warn under the lock and unlock; over every
flag pair, a filter that does not fit is refused without a line unless
the source owns its info id; a filter that can't be referenced logs the
'filter' line and unlocks; successive adds chain each to the previous.
soldr cargo test -p obs-data --test obs-tests-core -- source::filter_add::
test result: FAILED. 0 passed; 6 failed
panicked at rust/obs-source/src/filter_add.rs:86:5: not yet implemented: #5799
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Safe core filter_add::add over the FilterList trait, with source_filter_chain's add gates, compatibility rule, ref step and add target, and the shim in ffi::source_filter_add: the exported obs_source_filter_add() (rust-exports.d). The shim rejects NULL before any adapter runs; the lock, count, entry, parent read, the "already present" warning, the info id and output flags, obs_source_get_ref(), the parent and target writes, da_insert() at index 0, the unlock, the two signals on one calldata, the debug line and the callback check and call stay C in the new obs-source-filter-add-fields.c.h (live core-source group, no EXPORT). The extracted C moves to the reference-only group libobs.ported-source-filter-add. Tier 3 (filter_add_parity, oracle source_filter_add.c): the original C and the Rust export on noise-filled real-header sources with real signal handlers on the source and a stand-in core and a recording obs_source_get_ref(), over every chain of up to 7 filters, every filter of the fixture listed or not, parented elsewhere or not, with and without its callback, four flag pairs, with and without an owned info id and a failed reference, and a proptest. It compares the list, every target and parent, each reference, signal, callback and log line in order with the lock state, every other byte, the lock after and the last log line, and rejects five mutants. Registration test in obs-build; rust/README row. Co-Authored-By: Claude Opus 5.5 <[email protected]> Ci-Attestation: {"at":1795745180,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":97,"stamp":"75ecfa68847da50faf8096c4500b0a37","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745180,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":97,"stamp":"7ab00d83bd371503893025c71fd54bb8","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745180,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":97,"stamp":"c4519b29b6000a9b736bf7a4816121ba","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745180,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":97,"stamp":"1c9674beb4f73f567362af269c7eed9c","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745082,"gate":"general/all/client-lint","host":"linux-x86_64","key":"f2d4cff0530bc8f8a2b0c11ec85aa9ba4807d944aaf44897523959ffd266070c","lane":"client-lint","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":69,"stamp":"8c54f07719e7dc5669d101fbe2175b98","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745180,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":97,"stamp":"5ddabdc22bc89f243e95e44ca7cefb24","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745083,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"f2d4cff0530bc8f8a2b0c11ec85aa9ba4807d944aaf44897523959ffd266070c","lane":"client-lint","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":69,"stamp":"da3c6055275f5c530c27e7ca8767e8da","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745083,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"f2d4cff0530bc8f8a2b0c11ec85aa9ba4807d944aaf44897523959ffd266070c","lane":"client-lint","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":69,"stamp":"5a83f3664350a0eeb767d861de88a3e0","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745083,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"f2d4cff0530bc8f8a2b0c11ec85aa9ba4807d944aaf44897523959ffd266070c","lane":"client-lint","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":69,"stamp":"ee369276e761cad07967c9c4f8a86366","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745083,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"f2d4cff0530bc8f8a2b0c11ec85aa9ba4807d944aaf44897523959ffd266070c","lane":"client-lint","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":69,"stamp":"6966519a58b0fd52f3a75a903ffb56df","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745082,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"f2d4cff0530bc8f8a2b0c11ec85aa9ba4807d944aaf44897523959ffd266070c","lane":"client-lint","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":69,"stamp":"206d3869f0f19007b4218b7e90e88b19","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745082,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"f2d4cff0530bc8f8a2b0c11ec85aa9ba4807d944aaf44897523959ffd266070c","lane":"client-lint","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":69,"stamp":"cb8479667049290ea599401eba7ca350","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745083,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"f2d4cff0530bc8f8a2b0c11ec85aa9ba4807d944aaf44897523959ffd266070c","lane":"client-lint","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":69,"stamp":"192c9f12968cf99fe0cd45c1935ff0f9","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745083,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"f2d4cff0530bc8f8a2b0c11ec85aa9ba4807d944aaf44897523959ffd266070c","lane":"client-lint","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":69,"stamp":"ea8cfde7abb7e5396c7f5382a13d45e1","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745083,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"f2d4cff0530bc8f8a2b0c11ec85aa9ba4807d944aaf44897523959ffd266070c","lane":"client-lint","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":69,"stamp":"94214b0ba0ea0c15fdb8b1d2ccedbfcb","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745083,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"f2d4cff0530bc8f8a2b0c11ec85aa9ba4807d944aaf44897523959ffd266070c","lane":"client-lint","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":69,"stamp":"38b4967646a8a5d4337abd78d4f00205","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745082,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"f2d4cff0530bc8f8a2b0c11ec85aa9ba4807d944aaf44897523959ffd266070c","lane":"client-lint","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":69,"stamp":"6210ecef07d920a99bff0c62cb82989e","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745082,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"f2d4cff0530bc8f8a2b0c11ec85aa9ba4807d944aaf44897523959ffd266070c","lane":"client-lint","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":69,"stamp":"49c77b4090264e5af8f54591f14d1310","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Ci-Attestation: {"at":1795745430,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"eae314ef606ac643113b9b4ad20ed7e801eb4c1f02a74429cbd391ea8358b2a5","lane":"client-test-x86_64-unknown-linux-gnu","parents":["e2337ac685b92a852b8b16fcae0ccf9baf4bac37"],"secs":250,"stamp":"f023fdf74b955c77e3c3689b88392d86","tree":"6193de933fe9f46ee6677d796f5b477fe9781352","v":1,"via":"run"} Client-Checks: {"checks":{"base":"b152594daca3044db3bbaad0f73aa8e25da57c6a","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core-source+.h.c","libobs/build/libobs.ported-source-filter-add+.h.c","libobs/build/ported-source-sets/source-filter-add.json","libobs/cmake/rust-exports.d/obs-source-source_filter_add.txt","libobs/obs-source-filter-add-fields.c.h","libobs/obs-source-filter-add.c.h","libobs/obs-source.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_source_filter_add_swap_is_registered.rs","rust/obs-c-oracle/oracle.d/source-filter-add.list","rust/obs-c-oracle/oracle/source_filter_add.c","rust/obs-source/Cargo.toml","rust/obs-source/src/ffi/mod.rs","rust/obs-source/src/ffi/source_filter_add.rs","rust/obs-source/src/filter_add.rs","rust/obs-source/src/lib.rs","rust/obs-source/tests/source/filter_add.rs","rust/obs-source/tests/source/filter_add_parity.rs","rust/obs-source/tests/source/main.rs","test/cmocka/build/test-graph.json","test/cmocka/test_source_filter_add.c","test/cmocka/tests.d/test_source_filter_add.cmake"],"head":"a618826ac0e3df873746467e18f75853e6a12b49","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":"5aa7a053673baa626998f03a16a58d8e74449aa5d8fc5c2d195916322f20ae36","tree":"6193de933fe9f46ee6677d796f5b477fe9781352"}}
This was referenced Nov 27, 2026
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.
Fixes #5799.
Ports
obs_source_filter_add()toobs-source. The safe corefilter_add::addruns over aFilterListtrait and reusessource_filter_chain's add gates, compatibility rule, reference step and add target. The exported entry is the shim inffi::source_filter_add(listed inrust-exports.d); it rejects NULL before any adapter runs.What stays C: the lock, the count and entry reads, the parent read, the "already present" warning, the info id and output flags,
obs_source_get_ref(), the parent and target writes,da_insert()at index 0, the unlock, the two signals on one calldata, the debug line, and thefilter_addcallback check and call. The Rust core reaches them through hidden, non-EXPORT adapters inlibobs/obs-source-filter-add-fields.c.h, in the live core-source group. The extracted C builds in the reference grouplibobs.ported-source-filter-addfor Tier 3.The four commits, in order:
obs_source_filter_add()moves unchanged intolibobs/obs-source-filter-add.c.h, still in the live core-source group. No behavior change.test_source_filter_add, through the real core against both hybrid libobs and the C reference. It covers:filter_mutexheld (probed from a second thread, the mutex is recursive), nothing changed.filter_removecallback during destruction): the 'filter' validity line, not added.filter_mutexfree, the global and sourcefilter_addsignals fire with the list already holding it, the debug line is logged, and the type's callback runs with the parent (a type without one skips only that).todo!()core.No public-header, existing-C-test, WebSocket or workflow edits. Tier 4 does not apply. No user-visible change, so no features ledger line.
RED
GREEN
Tier 1 and Tier 3, on the pushed head (rebased onto current master):
filter_add_parity, withoracle/source_filter_add.c, runs the original C and the Rust export on noise-filled sources built from the real headers, with real signal handlers on the source and a stand-in core and a recordingobs_source_get_ref(). It compares the list, every target and parent, each reference, signal, callback and log line in order with the lock state, every other fixture byte, the lock afterwards and the last log line.Tier 2, the C test run unchanged against both libraries:
Run directly under
xvfb-run,test_source_filter_addshows[ PASSED ] 5 test(s)against hybrid libobs and againstlibobs-c-reference(lddconfirms which library loads), none skipped.Registration:
./lintpasses. The final commit is not signed here, so the PR runs the full selected CI.🤖 Generated with Claude Code