Skip to content

libobs: characterize and extract obs_get_video (Refs #5353) - #5419

Merged
zackees merged 2 commits into
masterfrom
test/get-video-extract
Nov 22, 2026
Merged

zackees merged 2 commits into
masterfrom
test/get-video-extract

Conversation

@rdoupe

@rdoupe rdoupe commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Adds a C characterization of obs_get_video, then moves its body verbatim from libobs/obs.c.h into libobs/obs-get-video.c.h, a member of the core unity group (libobs/build/libobs.core+.h.c, alphabetical). test_get_video is registered once in the canonical test graph with its tests.d marker. No behavior change; existing C tests and public headers are unchanged.

Refs #5353. This is the C-only prerequisite; the Rust swap is #5354.

What the test pins

Three cases, each on a fresh obs_startup() core, with the main canvas's mix swapped for a zeroed stand-in so no graphics or video reset is needed (the getter never dereferences the video_t):

  • a main canvas with no mix (before the first video reset) answers NULL, repeatedly, without changing the canvas's strong or weak reference counts;
  • a main canvas with a mix returns that mix's current video by identity, follows a change of it, answers NULL when it is NULL, and leaves the mix bytes, the canvas's mix pointer and its reference counts untouched;
  • an auxiliary canvas's mix is never the answer.

The issue also lists "NULL main canvas returns NULL". That state is not reachable in a live core through any API, and the obs core global is hidden from test executables (my first draft wrote obs->data.main_canvas and failed to link). That case belongs to the Rust swap's field-adapter parity in #5354, where the main-canvas read is a seam; I'll note it there.

Evidence

  • RED (0658379b6): adds the characterization without registering it. git show 0658379b6:test/cmocka/build/test-graph.json | grep -c test_get_video prints 0, so the build has no test_get_video target.
  • GREEN (aac60aaa3): registers the test and extracts the body. cmp of the extracted body against lines 1718-1724 of the original obs.c.h is identical.
  • OBS_CTEST_JOBS=10 uv run rust/tools/linux-validate/run.py --repeat 25 --tests '^test_get_video$': full Linux Tier 2 passed against the C reference (1074/1074) and hybrid libobs (1074/1074), then test_get_video passed 25 repeats against each.
  • To prove the cases ran rather than skipped, I ran the built binary in the kept build volume under xvfb-run: [ PASSED ] 3 test(s) against /build/tree/libobs/libobs.so.30 and again with LD_LIBRARY_PATH=/build/tree/libobs-c-reference (ldd confirmed each library).
  • ./lint passed; git diff --check clean.

Not run locally: native Windows/macOS. Tier 1/3 and Tier 4 do not apply to a C-only extraction.

🤖 Generated with Claude Code

rdoupe and others added 2 commits November 21, 2026 15:01
Pins the borrowed main-canvas video getter before it moves out of
obs.c.h: no mix answers NULL, a mix's current video comes back by
identity without touching the canvas's references or the mix bytes,
and an auxiliary canvas's mix is never the answer. Not registered yet,
so the build has no such target.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Moves the body unchanged from obs.c.h into obs-get-video.c.h, a member
of the core unity group, and registers test_get_video in the canonical
test graph so it runs against hybrid libobs and the C reference. The
Rust swap is #5354.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ci-Attestation: {"at":1795292213,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":63,"stamp":"37f9de6eded8bc19db1f26ece7efaa32","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292213,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":63,"stamp":"5f7598e6afd966016c7f8f08b15ef2d7","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292213,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":63,"stamp":"b1555affd32d8f2924ee181be4427625","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292213,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":63,"stamp":"30271f7270571a17bcf2b7f5054b76dc","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292149,"gate":"general/all/client-lint","host":"linux-x86_64","key":"944a16025986cc6df3739a8f8b41b9e785f3cd19e58d91d20cfa87c0c9501d85","lane":"client-lint","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":11,"stamp":"db54cd97abf2b4064c1abf269d8680fc","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292213,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":63,"stamp":"0879491ef786799b07bb82dc9c5a0098","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292149,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"944a16025986cc6df3739a8f8b41b9e785f3cd19e58d91d20cfa87c0c9501d85","lane":"client-lint","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":11,"stamp":"cc89d455ee6401771621e24be2fce029","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292149,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"944a16025986cc6df3739a8f8b41b9e785f3cd19e58d91d20cfa87c0c9501d85","lane":"client-lint","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":11,"stamp":"bcb9d1e01536ea12538c126ddb428fea","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292149,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"944a16025986cc6df3739a8f8b41b9e785f3cd19e58d91d20cfa87c0c9501d85","lane":"client-lint","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":11,"stamp":"df2aee92c42d4e1439bc2abf9a55a47c","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292149,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"944a16025986cc6df3739a8f8b41b9e785f3cd19e58d91d20cfa87c0c9501d85","lane":"client-lint","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":11,"stamp":"2590b6acd6316c75132c01a3d264ad21","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292149,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"944a16025986cc6df3739a8f8b41b9e785f3cd19e58d91d20cfa87c0c9501d85","lane":"client-lint","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":11,"stamp":"9bc0bdf0e9b5c243430647d38ea379ed","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292149,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"944a16025986cc6df3739a8f8b41b9e785f3cd19e58d91d20cfa87c0c9501d85","lane":"client-lint","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":11,"stamp":"0708b8fa9ef40379647ba28f9e632c43","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292149,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"944a16025986cc6df3739a8f8b41b9e785f3cd19e58d91d20cfa87c0c9501d85","lane":"client-lint","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":11,"stamp":"a0a6509db92a61c73d65f01649aedee6","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292149,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"944a16025986cc6df3739a8f8b41b9e785f3cd19e58d91d20cfa87c0c9501d85","lane":"client-lint","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":11,"stamp":"1523f28e598bb02b45416b38ef2bfcf1","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292149,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"944a16025986cc6df3739a8f8b41b9e785f3cd19e58d91d20cfa87c0c9501d85","lane":"client-lint","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":11,"stamp":"bb8b0628d4d886b111b290d2413d0e3e","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292149,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"944a16025986cc6df3739a8f8b41b9e785f3cd19e58d91d20cfa87c0c9501d85","lane":"client-lint","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":11,"stamp":"ecc0387410dc56a63317521e9666de52","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292149,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"944a16025986cc6df3739a8f8b41b9e785f3cd19e58d91d20cfa87c0c9501d85","lane":"client-lint","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":11,"stamp":"17ec3ba3c7a1374fd9e3950913d83902","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292149,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"944a16025986cc6df3739a8f8b41b9e785f3cd19e58d91d20cfa87c0c9501d85","lane":"client-lint","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":11,"stamp":"91edbd0bd35146ca594f4cc60ab92ddf","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}
Ci-Attestation: {"at":1795292478,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"5b85581538a061eb342a1bf3e9df49cdf879abbc0582c846789e99a866c8904c","lane":"client-test-x86_64-unknown-linux-gnu","parents":["0658379b6999d8fb9ad0966f9fe3f29771a2607a"],"secs":265,"stamp":"f93a42f6253d87fa84a387e88da87cef","tree":"396c24984ad9870629db5156cc8779786ca1712b","v":1,"via":"run"}

Client-Checks: {"checks":{"base":"a98b199d3fc02ef274f861915dea5aecbdd448f0","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core+.h.c","libobs/obs-get-video.c.h","libobs/obs.c.h","test/cmocka/build/test-graph.json","test/cmocka/test_get_video.c","test/cmocka/tests.d/test_get_video.cmake"],"head":"34194ec3cd99749d072b5d2c299160eadd5a54ef","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":"630147907cc823cba11cc8a2cb9bee5201858b56688a01aa3a8e08cad16d1558","tree":"396c24984ad9870629db5156cc8779786ca1712b"}}
@rdoupe
rdoupe requested a review from zackees as a code owner November 21, 2026 20:21
@rdoupe rdoupe changed the title libobs: extract obs_get_video verbatim (Refs #5353) libobs: characterize and extract obs_get_video (Refs #5353) Nov 21, 2026
@rdoupe
rdoupe enabled auto-merge November 21, 2026 20:38
@rdoupe
rdoupe added this pull request to the merge queue Nov 21, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 21, 2026
@rdoupe
rdoupe added this pull request to the merge queue Nov 21, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 21, 2026
@rdoupe
rdoupe added this pull request to the merge queue Nov 21, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 21, 2026
@zackees
zackees added this pull request to the merge queue Nov 21, 2026
@obs-rust-project-manager obs-rust-project-manager Bot moved this to In merge queue in obs-rust Multiview Nov 21, 2026
@zackees
zackees removed this pull request from the merge queue due to a manual request Nov 21, 2026
@zackees
zackees added this pull request to the merge queue Nov 21, 2026
Merged via the queue into master with commit 7b81739 Nov 22, 2026
46 checks passed
@zackees
zackees deleted the test/get-video-extract branch November 22, 2026 01:03
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In merge queue to Done in obs-rust Multiview Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants