Skip to content

test: Extract and characterize core video-info query before Rust swap #5167

Closed

Description

@zackees

Scout D / rank 2: C-only prerequisite for the remaining Phase 6 core video-info query, later targeting obs-core. Snapshot: master a62bfe717d5d9610a5136ca211273e66a1ae1f84 (2026-11-19 UTC).

Context and scope

Exported entry points: obs_get_video_info. Live C definitions: libobs/obs.c.h:1682-1690; public declarations remain in the unchanged libobs headers.

Move only these public bodies verbatim to proposed libobs/obs-video-info-query.c.h, within the existing libobs/build/libobs.core+.h.c PCH family. Preserve signatures, behavior, field-read/callback/lock order and all private dependency semantics. This prerequisite contains no Rust; a separate whole-file Rust-swap issue/PR follows after it lands.

Rust-side confirmation: rust/obs-util/src/ffi/platform_filename.rs:72 is an extern import and lines 90-100 call the C getter; rust/obs-output/src/output_begin.rs mentions it as a dependency. Other hits are comments and C snippets in native tests. No Rust ABI body implements obs_get_video_info. Existing canvas_video_info_getter implements a different canvas-specific API.

Characterization and build brief

Preserve short-circuit order: no global core, no graphics, or no main-canvas mix returns false without writing any byte of the caller output. Do not form a field address through a NULL core. With a live graphics/mix, copy the complete stored obs_video_info and return true, preserving every field and borrowed pointer identity, without normalization, allocation or reference changes. NULL output is safe only on an unavailable-video path; a live-video NULL output is outside the original contract. Use deterministic real-header fixtures/recorders for the mix-present branch; no GPU or change to canvas implementation is part of this unit.

Existing coverage to preserve: test/cmocka/test_no_core_getters.c:53-63; existing callers in test/cmocka/test_formatted_filename.c and test/cmocka/test_core_setup_rules_steps.c. The formatted-filename fixture supplies its own getter, so it is not proof of this public implementation. Add focused complete-copy/no-graphics/no-mix coverage only where absent.

Dependencies and sequencing: No functional prerequisite. This is one nine-line public body in obs.c.h/core, not an edit to obs-canvas.c.h, core-source, or the video-render implementation. Keep the mix/layout reads behind private C field adapters in the later swap, validate the global token before adapters, and measure the public obs_video_info layout against the unchanged real header.

Acceptance criteria

  • Reuse applicable existing C characterization unchanged. Add a new focused test only for missing coverage, proving baseline behavior against original C first. Record RED for the missing extraction seam/new focused contract before GREEN; when assertions already cover the entire contract, use an extraction/build contract instead of redundant behavioral tests.
  • Land a separate behavior-neutral C-only extraction commit/PR before the Rust swap. No public-header/signature edits, no existing C-test edits, no WebSocket plugin modifications and no new workflow files. Scope unity-local aliases and undefine them at file end; keep sorted source membership and native metadata consistent.
  • Run focused unchanged/new C tests against both libobs-c-reference and hybrid libobs; retain identical public symbol sets and validate affected native-build registrations. Run repository lint once. Preserve fixture host conditions and check Windows MSVC fixture linkage as applicable (no max_align_t or invalid enum sentinels). New threading fixtures use synchronization and the policy's 100-repeat determinism check, not sleeps.
  • Later swap: Tier 1 mirrors every unchanged C assertion in safe Rust, with a committed failing stub before GREEN. Tier 2 retains the unchanged C tests, real-header size/alignment/all-field-offset checks for any exposed layout, and symbol parity. Tier 3 compares the thin ABI shim and safe core against the original extracted C oracle, with bounded edge/random cases and a demonstrated mutation failure. Respect existing documented oracle exclusions; introduce no behavior changes here.
  • Add Rust cases only to the existing Core state category (soldr cargo test -p obs-data --test obs-tests-core), with the existing owning obs-core suite modules, never another Rust test executable. Link every real private adapter into affected standalone Rust-static consumers; never use aborting link stubs. Reject NULL owner tokens before field accessors where the original contract permits NULL. Rust through soldr, Python through uv; publication through ./push.
  • Tier 4 is inapplicable to this non-protocol extraction; keep the unchanged C++ WebSocket plugin compatibility contract. Exercise existing relevant black-box coverage if a later swap changes an externally observed protocol path.

Append points / lane VI / core: libobs/build/libobs.core+.h.c, libobs/build/modules.d/core.json and applicable existing source inventories. Proposed new coverage only: test/cmocka/test_video_info_query.c, its tests.d fragment and sorted test graph registration when needed. Later Rust append points: rust/obs-core/src/lib.rs, src/ffi/mod.rs, existing category suite modules, per-unit export/source/oracle fragments and real-adapter link support. Every selected Scout D unit shares this physical core unity group: run at most one at a time and rebase between sibling landings.

Decisions

P2 / port / size:S / ready: one small deterministic extraction/characterization prerequisite, with no functional prerequisite on another unmerged conversion. The later Rust implementation and behavior fixes are separate work. Names above are proposed and may follow equivalent current conventions. All selected bodies live outside core-source, graphics and core-output unity groups; leave those busy groups and source/canvas/scene-item, graphics-backend and output/encoder instance implementations untouched. Refresh Ready/comments/open PRs before claiming. This issue is unclaimed; the scout posted no Claiming comment.

Refs #1509
Refs #2566

Activity

  1. added
    portPort a C unit to Rust (four-tier policy)
    readyMeets the definition of Ready; claimable
    P2Normal priority
    on Nov 19, 2026
  2. zackees commented on Nov 19, 2026

    @zackees
    MemberAuthor

    Claiming: core video-info query characterization and behavior-neutral C extraction in pool slot obs-studio5, branch test/5167-video-info-query.

    1. Characterize unavailable-video and complete-copy behavior against original C, then commit the missing-extraction seam RED.
    2. Extract only obs_get_video_info verbatim, keeping core unity membership sorted and native inventories consistent.
    3. Run focused C-reference/hybrid checks, the complete native_build:: module, unrelated Linux Rust-static cmocka links, and ./lint once; publish subject to backpressure and file the separate Rust-swap issue.

    First PR expected this session after the focused RED/GREEN evidence; no sibling scout units are included.

  3. zackees commented on Nov 19, 2026

    @zackees
    MemberAuthor

    Landed on master in #5178 (66483e5): the core video-info query is characterized and extracted to libobs/obs-video-info-query.c.h. The Rust swap is #5179.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Normal priorityportPort a C unit to Rust (four-tier policy)readyMeets the definition of Ready; claimablesize:SHours

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions