Skip to content

rust: Port libobs/obs-video-stats-queries.c.h to obs-core #5364

Closed

Description

@rdoupe

Unit

Port the extracted libobs/obs-video-stats-queries.c.h (obs_get_video_frame_time, obs_get_active_fps, obs_get_average_frame_time_ns, obs_get_total_frames, obs_get_lagged_frames) to rust/obs-core, keeping the public C API/ABI unchanged.

Phase and position

Phase 6 libobs core. Follow-up of the C-only prerequisite #5171, which landed in #5191 (the file and test/cmocka/test_video_stats_queries.c are on master).

Contract to preserve (pinned by test_video_stats_queries.c)

Each query is one call of its matching obs_video_stats_* helper on &obs->video.stats (one lock/read/unlock, the synchronization of #175), returning its value unchanged: u64 frame time and average frame time, double FPS (bit pattern kept), u32 total and lagged frames. No combined snapshot, no no-core defaults (a live core is required).

Test plan

  • RED: safe Tier 1 tests mirroring every C assertion in the existing obs-tests-core binary against a todo!() stub.
  • GREEN: safe core plus thin ABI shim; the C-owned stats struct and its mutex stay in C behind a real adapter (no copied layout, no aborting stubs); test_video_stats_race.c stays unchanged.
  • Tier 2: the unchanged C test against hybrid libobs and libobs-c-reference, identical exported symbols.
  • Tier 3: differential against the original extracted C, with a mutation shown failing.
  • Move the C unit to its own reference-only ported group. No public header, C test or websocket changes. Tier 4 does not apply.

Activity

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

    @rdoupe
    CollaboratorAuthor

    /ready

    Its only prerequisite, #5171, landed in #5191 (libobs/obs-video-stats-queries.c.h is on master).

  3. rdoupe commented on Nov 20, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: Rust swap of the five video-statistics queries on branch port/5363-5364-core-queries, batched with #5363 (same crate, one PR).

    1. RED: safe Tier 1 tests mirroring test_video_stats_queries in obs-tests-core against a stub.
    2. GREEN: safe core, thin ABI shim, the stats struct and mutex kept in C behind a real adapter, Tier 3 parity against the extracted C, C unit moved to a reference-only group, unchanged Tier 2 on hybrid and C reference.
  4. added
    ready
    on Nov 20, 2026
  5. rdoupe commented on Nov 20, 2026

    @rdoupe
    CollaboratorAuthor

    Done in #5365 (merged 2026-11-20): the video statistics queries (obs_get_video_frame_time, obs_get_active_fps, obs_get_average_frame_time_ns, obs_get_total_frames, obs_get_lagged_frames) now run through safe Rust in obs-core, C unit moved to its reference-only ported group.

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

Metadata

Metadata

Assignees

Labels

P2portreadysize:S

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions