Skip to content

test: Extract and characterize core audio-info queries before Rust swap #5169

Closed

Description

@zackees

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

Context and scope

Exported entry points: obs_get_audio_info, obs_get_audio_info2. Live C definitions: libobs/obs.c.h:1737-1775; public declarations remain in the unchanged libobs headers.

Move only these public bodies verbatim to proposed libobs/obs-audio-info-queries.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-audio-controls/src/ffi/audio_controls.rs:76 imports obs_get_audio_info and its volmeter calls it. rust/obs-core/src/ffi/core_setup_rules.rs:124-126 exports the private milliseconds helper only; documentation naming obs_get_audio_info2 is not its public ABI implementation. Neither public getter has a Rust body.

Characterization and build brief

For both getters reject no core before forming &obs->audio and leave caller sentinels unchanged. obs_get_audio_info rejects NULL output or missing audio, then calls audio_output_get_info once and writes sample rate and speaker layout. obs_get_audio_info2 first calls obs_get_audio_info into its local, even when the extended output pointer is NULL; only then checks oai2 and audio->audio. On success copy rate/speakers, fixed_buffering, and (uint32_t)obs_core_setup_rules_buffer_ms(max_buffering_ticks, samples_per_sec), in the existing order. Pin all failure/no-write paths, call order, distinct rates/layouts, both fixed-buffer states and defined buffering boundaries. Reuse the existing Rust milliseconds helper and its documented C-oracle exclusions; do not repair or re-port its arithmetic here.

Existing coverage to preserve: test/cmocka/test_no_core_getters.c:79-111; test/cmocka/test_obs_core_info_characterization.c:190-206; test/cmocka/test_core_setup_rules_steps.c:391-449; test/cmocka/test_core_setup_rules_ms_steps.c. Existing no-core/cold-audio and normal-buffering assertions stay unchanged.

Dependencies and sequencing: No functional prerequisite. media-io audio_output_get_info and the buffering policy are already available. Preserve the no-core fix before field projection. For the later swap measure both public info layouts and reuse real private accessors; do not change audio reset, mixing, devices or media-io adapters.

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 AI / 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_audio_info_queries.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 #2566
Refs #3363
Refs #3272

Activity

  1. added
    port
    ready
    P2
    size:S
    on Nov 19, 2026
  2. rdoupe commented on Nov 19, 2026

    @rdoupe
    Collaborator

    Claiming: batching with #5171 (both core getter extractions out of obs.c.h, one PR, RED then GREEN per issue).

  3. moved this from In progress to Ready in obs-rust Multiviewon Nov 20, 2026
  4. rdoupe commented on Nov 20, 2026

    @rdoupe
    Collaborator

    Done by #5191 (merged as 4f62019): extracted verbatim with its characterization test, ready for the Rust swap.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2portreadysize:S

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions