Repository navigation
Description
Bug
With 2x deinterlacing (Yadif 2x, Linear 2x, Discard 2x and so on), the first frame a source shows has its second field skipped, or, less often, held too long. The same happens to the first frame after a restart or a full queue.
When that frame is picked with no second frame queued, its half duration is computed against deinterlace_frame_ts, the previous frame's timestamp (libobs/obs-source-deinterlace-pacing.c.h, from #1954). For a source that has never shown a frame, deinterlace_frame_ts is 0. The result is (uint32_t)(ts / 2), which is effectively random. Example: a capture card's frame stamped 1000 s after boot gives 1e12 / 2 mod 2^32 = 1.78 s.
- Buffered (the default): the second field comes due 1.78 s after the pick. The next frame replaces the first 40 ms later (at 50i), so the first frame's second field is never shown. This happens on nearly every start.
- Unbuffered: the frame's end lands past
TS_JUMP_THRESHOLD, so the next tick moves on as if the clock had jumped, and the second field is skipped the same way. In about 0.8% of starts the truncation leaves 0.5–35.5 ms instead, and the frame is held too long: for example to 59 ms, where a 50i frame ends at 39 ms. - After a pause:
deinterlace_frame_tsis the last frame shown, so a 10 s pause gives 705 ms, with the same effect.
It costs one field per start, restart or queue overflow, and it doesn't persist. test_deinterlace_2x_field_order leaves the first two frames out of its counts partly for this reason (see #456). Upstream has the same code.
Found while porting the pacing in #1950/#1954. Its characterization tests half_duration_first_frame and first_frame_half_duration_hold pin today's behaviour.
Plan
- RED: a steps test, and a real-libobs case in
test_deinterlace_2x_field_order(or a sibling test), both showing that the first frame's second field is shown at the right time, buffered and unbuffered. - GREEN: when there is no usable previous timestamp, don't compute the half duration from a gap. That covers a source that has never shown a frame, a timestamp going backwards, and a gap past
TS_JUMP_THRESHOLD, which is a pause or a new clock. Use a sane fallback instead: the previous half duration if one is known, otherwise half the canvas frame interval. Make the same change in the Rust port and its parity oracle, so the two stay identical.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 23, 2026
Claiming: #1965.
libobs: Show both fields of the first 2x deinterlaced frame
test: Expect both fields of the first 2x deinterlaced frame
libobs: Show both fields of the first 2x deinterlaced frame
libobs: Show both fields of the first 2x deinterlaced frame (obs-rust…