Skip to content

rust: Port the video frame output step in obs-video.c to obs-core #2165

Closed

Description

@rdoupe

Unit

Port the per-frame video output step decisions in libobs/obs-video.c.h to rust/obs-core, as a new module video_output_step, next to video_copy_plan (#2133). These decisions move:

  • update_active_state: which frame data to clear on a raw, GPU or any activation.
  • stage_output_texture: which copy surfaces to stage (channel 0 only without GPU conversion, otherwise channel_count), and textures_copied.
  • queue_frame:
    • whether to duplicate (no free texture, or a repeat frame with work queued) or queue a new frame;
    • whether to copy (raw output active, or a repeat) or swap the encode textures;
    • the returned count.
  • render_video: which convert textures and copy surfaces to use (raw or GPU), and whether to convert, encode and stage.
  • output_frame: the texture ring (prev_texture, the wrap of cur_texture) and whether a downloaded frame is output.

These stay in C:

  • every gs_* call;
  • the deques and os_sem_post;
  • the texture-frame host calls, the shared-planes and GPU-encode-surface host queries (C passes their results), download_frame's maps;
  • the mix list and its mutex.

Plan (one PR, separate commits)

  1. A behaviour-neutral move into libobs/obs-video-output-step.c.h, as hidden functions.
  2. Characterization in test_video_output_step_steps. It covers:
    • every activation combination;
    • staging with and without GPU conversion, for each channel count;
    • the queue step for each queue state and repeat count;
    • the ring wrap at NUM_TEXTURES;
    • each render-step combination.
  3. RED, then GREEN: the safe Rust core plus shims, in a libobs.ported-video-output-step group. Exported symbols are unchanged.
  4. Tier 3 parity against the original C: exhaustive over the flags and small counts, plus a proptest over full-range counts. Also a deliberate-break check and port_comparison numbers.

These real-libobs tests must stay green on every lane:

  • test_video_output_formats
  • test_scaled_mix_alpha
  • test_encoding_lag_rescale
  • test_video_output_plan
  • test_video_copy_plan_steps
  • test_raw_output_video_reset
  • the GPU encoder tests that run on the host

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions