Skip to content

rust: port obs_source_output_video_internal to obs-source #5841

Done

Description

@rdoupe

Port obs_source_output_video_internal() (declared without EXPORT in libobs/obs-internal.h, defined in libobs/obs-source.c.h) into obs-source. It is the last C one of the three async-frame internals the Rust wrappers in libobs/obs-source-frame-wrappers.c.h end in (#5760): obs_source_preload_video_internal() went to Rust in #5838 and obs_source_set_video_frame_internal() is in the queue as #5840. Nothing in the issue list or open PRs covers it. The frame-copy design investigation (#3201) changes what cache_video() copies; this unit leaves cache_video() in C, so it does not conflict.

Contract to keep:

  • obs_source_valid(source, "obs_source_output_video"): a NULL source logs one LOG_DEBUG obs_source_output_video: Null 'source' parameter line (the public entry's name), return.
  • Under audio_buf_mutex alone (not inside async_mutex, bug: libobs: NDI audio with 100 ms frames drops out of the mix for minutes since #522 #3747): last_output_frame_ts = the frame's timestamp, or 0 for a NULL frame.
  • NULL frame: under async_mutex, async_active = false, async_textures_stale = true, last_frame_ts = 0, free_async_cache(); return.
  • Otherwise source_profiler_async_frame_received(), then cache_video(); then under async_mutex, for a non-NULL result: decrement its refs; at 0 destroy it, otherwise push it onto async_frames and set async_active = true. A NULL result (cache overflow) touches nothing more.

Stays C, behind a hidden non-EXPORT -fields.c.h adapter: obs_source_valid, the two mutexes, the atomics, free_async_cache(), cache_video() (and clean_cache()), the profiler call, the refs decrement, obs_source_frame_destroy() and the async_frames push.

Plan (shape of #5838/#5840): extract the body verbatim into its own file in the live core-source group; characterize with a new cmocka test through the public obs_source_output_video()/obs_source_output_video2() against hybrid libobs and the C reference (NULL source, NULL frame clears the queue and marks the textures stale, queued frames and async_active, last_output_frame_ts, cache reuse, the overflow at 30 queued frames drops the queue); Tier 1 RED against todo!() in obs-source's existing test binary; then the Rust swap with a Tier 3 differential against the original C recording every adapter call in order. No public-header, existing-C-test, WebSocket or workflow edits. Tier 4 does not apply.

Activity

  1. added
    enhancement
    port
    on Nov 27, 2026
  2. rdoupe commented on Nov 27, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: I'll port it in one PR, RED then GREEN, once #5840 merges (it edits the neighbouring lines of obs-source.c.h): extract, cmocka characterization, Tier 1 RED, then the swap with Tier 3 parity. Branch port/5841-output-video-internal.

  3. added
    ready
    on Nov 27, 2026
  4. moved this from In progress to Done in obs-rust Multiviewon Nov 28, 2026
  5. added a commit that references this issue on Nov 29, 2026
    01af736
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementportready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions