Skip to content

obs-core: port canvas video info getter (#3950) - #3951

Merged
zackees merged 6 commits into
masterfrom
port/3950-canvas-video-info
Nov 8, 2026
Merged

zackees merged 6 commits into
masterfrom
port/3950-canvas-video-info

Conversation

@zackees

@zackees zackees commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Ports obs_canvas_get_video_info to obs-core while preserving the existing C API, return values and output storage. Rust owns lazy graphics/mix selection; private C adapters expose actual field addresses. The getter acquires no lock or reference. This follows #3946 and #3943, with discovered field adapters and an independent per-port native registration entry.

Fixes #3950, a native child of #444 with an accepted claim assigned to zackees. Queue hold: this PR is ready for the pool manager but must remain unarmed until #3937 has entered the merge queue. Auto-merge is off.

The live-library characterization establishes that absent graphics returns false without touching the output, even with NULL canvas or output. With graphics present, an absent mix returns false and preserves output bytes. A present mix returns true even when its video pointer is NULL, copies the tested storage bytes including padding, and preserves the borrowed graphics_module pointer. The original initialized-OBS and non-NULL canvas preconditions remain; a successful query needs writable output. An isolated child confirms SIGSEGV for NULL canvas with graphics present. Differential coverage also checks self-aliasing output and unchanged canvas, mix, core and token state.

The preserved sequence is C-only actual-library characterization a7bdabf, separate building verbatim extraction 41d58f4, Tier 1 RED cde680a, Rust GREEN 41f392d, and compiler-portable oracle TLS and formatting 436287b. RED originally pushed as d71aac5 and fails both safe-core tests at the intended stub with exit 101. Initializer formatting was folded into the characterization commit; its final blob is identical throughout extraction and the Rust swap. Range-diff confirms the implementation, extraction and RED commits are otherwise unchanged by rebase. The pushed head was checked against current master and replaced only the pinned earlier RED head.

Validation completed with successful exit codes:

  • All five new Rust tests pass in the existing Core state binary. Real-header assertions measure obs_video_info size, alignment and all thirteen field offsets. Fixed cases span every byte-fill value; randomized cases vary availability flags and integer fields. Invalid C dereference combinations are explicitly excluded, with no intentional behavioral differences. Proptest persistence is disabled.
  • A mutation that always selects no info fails both fixed-edge and randomized differential tests with exit 101. GREEN was restored before the final successful checks. The oracle compiles the original getter and automatically discovered adapters against the real header, uses isolated thread-local fixture state, and invokes the Rust implementation through a callback rather than direct production libobs calls.
  • C-only baseline, extraction and final unchanged Tier 2 characterization each pass three repeats against both actual libraries through docker_task_command and this slot's warm volume. Final ldd evidence proves C-reference and hybrid library selection. Their complete dynamic export sets match exactly at 1,767 symbols.
  • The complete native_build module passes all 157 tests. Obs-util passes all 914 unit tests and both doctests. Field-adapter discovery, registration entries, native B2 portability, graph ordering, Rust README policy and all ten build-group checks pass.
  • GCC and Clang accept the getter, adapter, oracle and characterization inside the repository Nix environment with format-nonliteral warnings treated as errors. Rust makes no blog call, so no blog link stub is needed.
  • Final serial full lint passes with exit 0 in 161.4 seconds. One clud-review primary reviewer confirms clean after the oracle's MSVC TLS compatibility pattern was corrected.

Test cost: 25 reduced-parity debug runs per new module. Tier 1 measured below 0.01 seconds at timer resolution with peak RSS 10,816 KiB; layout/parity longest measured 0.01 seconds with peak RSS 16,260 KiB. Neither module starts its own threads; generated sizes and fixture allocations are bounded.

Evidence artifacts are under /home/niteris/.clud/tmp/tool-output/local-test-private/. Final serial gates, both-library replay and full lint are in local-test-vcPhp3.log; post-fix GCC/Clang checks are in local-test-KNywEA.log. Baseline, extraction, RED, initial GREEN and mutation are respectively local-test-fc6FH0.log, local-test-jw5wTa.log, local-test-YhBKo6.log, local-test-qflYRG.log and local-test-MP4ON8.log. Test-cost details and range-diff are in /tmp/port-canvas5-cost.json and /tmp/port-canvas5-range-diff.txt.

The optional channel getter remains in C because it delegates to the view getter's locked source-reference acquisition, a separate ownership characterization unit. Public headers, existing upstream C tests, WebSocket and workflows are unchanged. This behavior-preserving port needs no feature-ledger entry. Tier 4 is inapplicable; the full Tier 2 suite, full unittest entry point, native Windows/macOS runtime checks and local-gate attestation were not run. Hosted checks remain the merge gate and were not awaited under the pool assignment.

Preserve the characterized graphics-present SIGSEGV with an explicit signal, without passing NULL to the C field accessor. Keep absent-graphics false returns and output storage unchanged. Add an independent Tier 1 NULL-accessor trap. RED: UBSan run 42431294485 job 128580754709.
@zackees

zackees commented Nov 8, 2026

Copy link
Copy Markdown
Member Author

Fixed the Rust FFI caller so a NULL canvas never reaches the mix field accessor. The unchanged characterization requires false with untouched output when graphics is absent, and SIGSEGV when graphics exists; the original emits no NULL error log. The wrapper now raises that signal explicitly instead of forming a field address from NULL. A Tier 1 callback trap checks that a missing canvas cannot reach the accessor, independently of the graphics short-circuit test.

RED evidence is the UBSan finding in run 42431294485, job 128580754709. Six focused Rust cases, field discovery, native registration, all 157 native_build tests, obs-util's 914 tests and two doctests, and serial lint pass with exit zero. The unchanged C characterization also passes under the Nix ASan/UBSan build with UBSAN_OPTIONS=halt_on_error=1 and leak detection disabled. The initial leak-enabled run passed its assertions without UBSan findings but exited 8 for a 256-byte allocation in an unknown graphics-initialization module; that separate local LSan result is retained in /tmp/fix-3951-sanitize.log. No sanitizer suppression or C test was changed.

Test cost over 25 reduced-parity Tier 1 module runs: longest 0.009 seconds, peak RSS 14,784 KiB, no test-owned threads. Review's graphics-short-circuit coverage finding was corrected. The fix is appended to the existing branch without rewriting its history. Hosted CI is left to the existing auto-merge handoff.

@zackees
zackees added this pull request to the merge queue Nov 8, 2026
Merged via the queue into master with commit a248518 Nov 8, 2026
40 checks passed
@zackees
zackees deleted the port/3950-canvas-video-info branch November 8, 2026 01:59
@obs-rust-project-manager obs-rust-project-manager Bot moved this from Needs fix to Done in obs-rust Multiview Nov 8, 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.

rust: Port obs_canvas_get_video_info to obs-core

1 participant