Repository navigation
obs-core: swap obs_get_video to Rust (Refs #5354) - #5421
Merged
Merged
Conversation
Safe Rust mirrors of every case of the unchanged test_get_video.c (no mix
answers NULL with references unchanged; a mix's video by identity, following
a change and answering NULL for an unset video; an auxiliary canvas's mix is
never the answer), plus the NULL main canvas the C test cannot reach and a
missing mix that never reads a video, against a todo!() core.
soldr cargo test -p obs-data --test obs-tests-core -- get_video
obs_core::get_video: 0 passed; 5 failed
Co-Authored-By: Claude Opus 5.5 <[email protected]>
obs_get_video now comes from obs-core in hybrid libobs. Private C adapters
(obs-get-video-fields.c.h, in the core group and a shared Rust-static
support member) give the current main-canvas field and one borrowed read
each of the canvas's mix and the mix's video. The safe core answers NULL for
no main canvas, no mix or no video, else the video by identity, with no
reference, lock or write. The original moves to libobs.ported-get-video for
the C reference; the unchanged test_get_video runs both libraries.
Tier 3 runs the original and the shim on real-layout core, canvas and mix
fixtures over every state (no main canvas, either canvas with no mix or
either mix, that mix with no video or either token), switched between
reads, checking the answer, unchanged fixture bytes and the adapter layout.
soldr cargo test -p obs-data --test obs-tests-core -- get_video
obs_core::get_video*: 9 passed; 0 failed
Mutation (shim returning the mix pointer as the video): get_video_parity
2 passed; 2 failed. Safe core always None: 3 of the get_video tests fail.
OBS_CTEST_JOBS=10 uv run rust/tools/linux-validate/run.py --repeat 10 --tests '^test_get_video$'
[OFF] 1074/1074, [ON] 1074/1074, test_get_video 10 repeats each
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ci-Attestation: {"at":1795312674,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":64,"stamp":"0048a7c8281744bb2cf18412e1f26c8d","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312674,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":64,"stamp":"b2217d337a0c52e42ad3ea24e9dd31d5","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312674,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":64,"stamp":"3baa9a737542af1a4b5699fbdfb18430","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312674,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":64,"stamp":"3d55ba635f66ad41cf5ed671e53f9348","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312609,"gate":"general/all/client-lint","host":"linux-x86_64","key":"f83b6c4042e72d0005abc87026e5f20cd172097e9c7a0a451fe30154477eb29e","lane":"client-lint","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":99,"stamp":"d05517906114c2446f97459f49a204e3","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312674,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":64,"stamp":"cd57a5a5a6b88c0e7ed39ae340b1b7a9","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312609,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"f83b6c4042e72d0005abc87026e5f20cd172097e9c7a0a451fe30154477eb29e","lane":"client-lint","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":99,"stamp":"2d729eeec56c19f56635070bbced5e9e","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312609,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"f83b6c4042e72d0005abc87026e5f20cd172097e9c7a0a451fe30154477eb29e","lane":"client-lint","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":99,"stamp":"4316bcd67869e63b0a660b1748c07cf3","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312609,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"f83b6c4042e72d0005abc87026e5f20cd172097e9c7a0a451fe30154477eb29e","lane":"client-lint","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":99,"stamp":"9da652bdc8db8e5f31b94db9eeab252e","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312609,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"f83b6c4042e72d0005abc87026e5f20cd172097e9c7a0a451fe30154477eb29e","lane":"client-lint","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":99,"stamp":"1784fefca3cbdc27fbeaeeff6cd54b83","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312609,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"f83b6c4042e72d0005abc87026e5f20cd172097e9c7a0a451fe30154477eb29e","lane":"client-lint","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":99,"stamp":"ec70f7f9e9b0fd5dcedd929ee573e232","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312609,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"f83b6c4042e72d0005abc87026e5f20cd172097e9c7a0a451fe30154477eb29e","lane":"client-lint","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":99,"stamp":"3e2ed3a9fb4d95b0bb54e8d3bafa4d80","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312609,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"f83b6c4042e72d0005abc87026e5f20cd172097e9c7a0a451fe30154477eb29e","lane":"client-lint","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":99,"stamp":"97cbf05af582b0b5b250583832e0708b","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312609,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"f83b6c4042e72d0005abc87026e5f20cd172097e9c7a0a451fe30154477eb29e","lane":"client-lint","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":99,"stamp":"f10d12ed076ed18cb79b848a1693249e","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312609,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"f83b6c4042e72d0005abc87026e5f20cd172097e9c7a0a451fe30154477eb29e","lane":"client-lint","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":99,"stamp":"a8af7ccf5b43645fee25bdb8c5f2f55c","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312609,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"f83b6c4042e72d0005abc87026e5f20cd172097e9c7a0a451fe30154477eb29e","lane":"client-lint","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":99,"stamp":"812f10527e6f109745f58f20ae78cc99","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312609,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"f83b6c4042e72d0005abc87026e5f20cd172097e9c7a0a451fe30154477eb29e","lane":"client-lint","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":99,"stamp":"b3e8dac4e356aa3187ebec1b535ac68a","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312609,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"f83b6c4042e72d0005abc87026e5f20cd172097e9c7a0a451fe30154477eb29e","lane":"client-lint","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":99,"stamp":"85af209bb18112ad5fe1a2f0c7faf74e","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Ci-Attestation: {"at":1795312864,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"6f8be9a76e5b49b717878b6b5ec30710caebe9288af7c583701a54ac4881e025","lane":"client-test-x86_64-unknown-linux-gnu","parents":["a5bef350f58f8333740deaf4411e35bffdb9c231"],"secs":189,"stamp":"bdff2c387b27e0af755e559161c12b38","tree":"51de33862e630a5b895ba7e4267bd653dc797237","v":1,"via":"run"}
Client-Checks: {"checks":{"base":"1d9ab9704a899c04b9cd412283bda12491b55e77","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core+.h.c","libobs/build/libobs.ported-get-video+.h.c","libobs/build/ported-source-sets/get-video.json","libobs/cmake/rust-exports.d/obs-core-get_video.txt","libobs/obs-get-video-fields.c.h","rust/README.md","rust/obs-c-oracle/oracle/get_video.c","rust/obs-core/src/ffi/get_video.rs","rust/obs-core/src/ffi/mod.rs","rust/obs-core/src/get_video.rs","rust/obs-core/src/lib.rs","rust/obs-core/tests/obs_core/get_video.rs","rust/obs-core/tests/obs_core/get_video_parity.rs","rust/obs-core/tests/obs_core/main.rs","test/cmocka/build/rust-static-support.json","test/cmocka/get-video-link-support.c"],"head":"d4c6ea18beb7db2077e68b8abb11c6d1fb3fba05","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":"e6cc6681c175c899db8cd0df4d9d145a5aaf0e90529ca24f121173ad4a05b1ee","tree":"51de33862e630a5b895ba7e4267bd653dc797237"}}
rdoupe
force-pushed
the
port/get-video-rust
branch
from
November 22, 2026 02:01
5f6bd53 to
3d17006
Compare
rdoupe
marked this pull request as ready for review
November 22, 2026 02:05
zackees
approved these changes
Nov 22, 2026
zackees
left a comment
Member
There was a problem hiding this comment.
Coordinator review: approved.
- Correctness:
canvas.and_then(mix).and_then(video)is exactly the originalcanvas && canvas->mix ? canvas->mix->video : NULL: three borrowed reads, no reference, no lock, no write. The struct layouts stay in C behind theobs-get-video-fieldsadapter. - RED → GREEN:
a5bef350f(todo! core, 5 Tier 1 tests fail), then3d17006e9. - Tier 2: the unchanged
test_get_videoruns against both libraries. - Tier 3:
get_video_parityruns the original C in the oracle against the shim on real-layout fixtures. The decoys catch a wrong canvas or mix read. - Ledger: this is an internal port with no user-visible change, so it needs no features line. The
rust/README.mdrow is present.
Nit: the PR adds Rust tests, so the body should carry a Test cost: line (count, runtime, peak RSS, threads; obs-worker §4). Please add it; it doesn't hold the merge.
This was referenced Nov 22, 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.
Swaps
obs_get_videoto Rust inobs-core. Public C API and ABI are unchanged.Refs #5354. Builds on the extraction PR (#5419), now merged; this is rebased onto master.
What changes
libobs/obs-get-video-fields.c.h(core group, and a shared Rust-static support member throughtest/cmocka/get-video-link-support.c) holds the private adapters. They return the current main-canvas field and do one borrowed read each ofcanvas->mixandmix->video. Struct layouts stay in C.obs_core::get_videoanswers NULL when there is no main canvas, no mix (before the first video reset) or no video. Otherwise it returns the video by identity. It takes no reference or lock and writes nothing.obs_core::ffi::get_videois the thin C ABI shim, exported throughrust-exports.d/obs-core-get_video.txt.libobs.ported-get-video(C reference only). The unchangedtest_get_videoruns against both libraries.Evidence
a5bef350f): safe Tier 1 mirrors of everytest_get_video.ccase, plus the NULL main canvas that test cannot reach (the core global is hidden from test executables) and a missing mix that never reads a video. All run against atodo!()core.soldr cargo test -p obs-data --test obs-tests-core -- get_video: all 5obs_core::get_videotests failed.3d17006e9): the same command gives 9 passed, 0 failed (5 Tier 1 tests and 4 Tier 3 tests).get_video_parity,rust/obs-c-oracle/oracle/get_video.c): the original C and the shim run on real-layout core, canvas and mix fixtures. The states covered are: no main canvas; either canvas with no mix or either mix; and that mix with no video or either token. The other canvas and mix always hold a video, so reading the wrong one shows up. The state switches between reads, in both orders and through a proptest over sequences. Each check compares the answer, the unchanged fixture bytes, the real adapter layout, and the original's answers against the characterized ones.get_video_paritygives 2 passed and 2 failed. When the safe core always answers None, 3 of the get_video tests fail.OBS_CTEST_JOBS=10 uv run rust/tools/linux-validate/run.py --repeat 10 --tests '^test_get_video$'gave[OFF](C reference) 1074/1074 and[ON](hybrid libobs) 1074/1074, withtest_get_videopassing 10 repeats against each. The exported-symbol comparison between C and Rust passed.1d9ab9704): the same Tier 1/3 command gives 10 passed, 0 failed, and./lintpassed.Not run locally: native Windows/macOS. Tier 4 does not apply to this getter.
🤖 Generated with Claude Code