You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rust: Port the async frame copy plan and cache decisions in obs-source.c to obs-source #2192
Port the async frame copy plan and cache decisions in libobs/obs-source.c.h to rust/obs-source, as a new module frame_copy. These decisions move:
The frame copy.copy_frame_data_line, copy_frame_data_plane and copy_frame_data:
which metadata is copied, including the colour range only when the frame is not full range;
the rows for each plane of each video_format ((height + 1) / 2 for 4:2:0 chroma);
one copy, or row by row with the smaller line size.
The texture check.async_texture_changed: whether the size or the convert type changed.
The cache.
clean_cache: the unused count, and dropping a frame at MAX_UNUSED_FRAME_DURATION.
In cache_video: the overflow at MAX_ASYNC_FRAMES (clear and refuse), the reset on a change, and which unused frame to pick first.
The full-range rule for non-YUV frames in obs_source_output_video/obs_source_output_video2 and their preload and set-frame variants, plus preload_frame_changed.
These stay in C: every memcpy, frame create and destroy, the cache and frame arrays, async_mutex, the refcount atomics, and get_convert_type (C passes in both types).
Plan (one PR, separate commits)
A behaviour-neutral move into libobs/obs-source-frame-copy.c.h, as hidden functions.
Characterization in test_source_frame_copy_steps. It covers:
every video_format, plus values outside the enum;
odd heights;
equal, smaller and larger line sizes on each plane, and a line size of 0;
the cache overflow at MAX_ASYNC_FRAMES - 1, at the limit and at + 1;
the unused-count drop at the limit;
each full-range case.
RED, then GREEN: the safe Rust core plus shims, in a libobs.ported-source-frame-copy group. Exported symbols are unchanged.
Tier 3 parity against the original C. It is exhaustive over format × line-size relation and adds a proptest over full-range sizes and line sizes. The step test also runs under ASan, because the plan drives memcpy. Plus a deliberate-break check and port_comparison numbers.
These real-libobs tests must stay green on every lane: test_video_frame, test_async_frame_pacing_steps, the media restart tests, the v4l2 and PipeWire camera tests, and the async rotation and deinterlace tests.
Activity
rdoupe commentedon Oct 24, 2026
Claiming: #2192.
libobs: Move the async frame copy plan into obs-source-frame-copy.c
test: Characterize the async frame copy plan and cache decisions
obs-source: Add Tier 1 tests for the async frame copy plan port
obs-source: Port the async frame copy plan
obs-source: Check the async frame copy plan port against the C
docs: Record the async frame copy plan port
libobs: Move the async frame copy plan into obs-source-frame-copy.c
test: Characterize the async frame copy plan and cache decisions
obs-source: Add Tier 1 tests for the async frame copy plan port
obs-source: Port the async frame copy plan
obs-source: Check the async frame copy plan port against the C
docs: Record the async frame copy plan port
obs-source: Port the async frame copy plan and cache decisions (obs-r…