Repository navigation
Closed
Labels
readyMeets the definition of Ready; claimable
Description
Unit
Port the frame timing decisions of the graphics thread loop in libobs/obs-video.c.h to rust/obs-core, as a new module video_frame_timing, next to video_pacing (#2738, the frame time step of video_sleep() in the same loop), video_output_step (#2165) and video_copy_plan (#2118). obs_graphics_thread_loop() runs once per frame. These decisions move:
- The tick time of
tick_sources(). Input: the current frame time, the last tick time and the frame interval. Output:- the last tick time to use (on the first frame, when it is 0, the current frame time minus one interval);
- the delta and the seconds that every tick callback and every source's
video_tickgets ((float)((double)delta / 1e9)); - the new last tick time (the current frame time).
- The frame statistics at the end of
obs_graphics_thread_loop(). Input: the three sums ofstruct obs_graphics_context(frame_time_total_ns,fps_total_ns,fps_total_frames), this frame's render time, the new frame time aftervideo_sleep()and the last tick time. Output:- the new sums;
- whether the window of at least one second is complete, and then the fps (
double) and the average frame time (uint64_t) forobs_video_stats_set_timing(), and the reset sums.
These stay in C:
os_gettime_ns()(C passes the times), the profiler calls,gs_*;- the tick callbacks with
draw_callbacks_mutex, the source list withsources_mutex, the references andobs_source_video_tick(); obs_video_stats_set_timing()and the stats mutex;output_frames(),render_displays(),execute_graphics_tasks(),video_sleep().
Plan (one PR, separate commits)
- A behaviour-neutral move of the two decisions into
libobs/obs-video-frame-timing.c.h, as hidden functions on plain values. - Characterization in
test_video_frame_timing_steps. It covers:- the first frame (last tick time 0) and normal frames;
- a clock that goes backwards or jumps (the
uint64_tdelta wraps; the seconds of a huge delta asfloat); - common intervals (25, 29.97, 30, 60 fps) and the
float/doublerounding of the seconds; - the statistics window: just under one second, exactly one second, a late frame that ends the window with a large step, the fps and average frame time values, and the reset;
- large sums near the
uint64_tanduint32_tlimits (characterized, not endorsed).
- RED, then GREEN: the safe Rust core plus shims, in a
libobs.ported-video-frame-timinggroup. Exported symbols are unchanged. - Tier 3 parity against the original C: exhaustive over the edges, plus proptests over full-range times, intervals and sums. Also a deliberate-break check and
port_comparisonnumbers (it runs once per frame).
These real-libobs tests must stay green on every lane:
test_source_video_tick_stepstest_source_profilertest_media_restart_stale_frametest_transition_recursive_destinationtest_slideshow_empty,test_slideshow_manual_endtest_video_pacing_steps,test_video_output_step_steps,test_video_copy_plan_steps
Production check: batched with the other per-frame ports in one before/after run on the obs-rust production box (Linux, NDI output, 25 fps).
Metadata
Metadata
Assignees
Labels
readyMeets the definition of Ready; claimable
Type
Projects
- StatusShow more project fieldsDone
Activity
vpacher commentedon Oct 28, 2026
Claiming: #2754
Plan as in the issue: one PR with the behaviour-neutral move, the characterization (
test_video_frame_timing_steps), RED/GREEN (obs-core::video_frame_timing, grouplibobs.ported-video-frame-timing) and Tier 3 parity. Before pushing: memory and time of the new tests, Windows on a local VM, and a local-gate stamp so PR CI can skip the Linux jobs.obs-core: Port the graphics loop's frame timing (tick time and frame …