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
bug: libobs: buffered 2x deinterlacing flags a recycled frame and skips fields after it falls behind #2009
The buffered 2x deinterlace walk in ready_deinterlace_frames() (libobs/obs-source-deinterlace.c.h) sets the "pair" flag on the wrong frame. It skips fields when a buffered source falls behind.
The bug is in the loop's async_frames.num <= 2 exit:
if (prev_frame) {
da_erase(source->async_frames, 0);
remove_async_frame(source, prev_frame); /* prev_frame goes back to the cache */
}
if (source->async_frames.num <= 2) {
...
if (prev_frame) {
prev_frame->prev_frame= true; /* ...and is then flagged */
There are two effects:
The new front frame is shown alone, not paired. The flag never reaches it.
The cached frame keeps the flag.remove_async_frame() returns the frame to async_cache, and copy_frame_data() doesn't reset prev_frame. The next incoming frame that reuses that cache entry is queued already flagged. When it is picked with another frame behind it, deinterlace_get_closest_frames() takes it as the first of a pair and shows the next frame instead. That frame shows one frame early, and the due frame's fields are skipped.
This reproduces in real libobs while working on #1965: buffered Yadif 2x after a 150 ms pause shows fields 0 1 2 5 5 5 …, both before and after #1995. It is memory-safe, because cached frames stay allocated. Upstream has the same code.
Plan
RED: a real-libobs case in test_deinterlace_2x_field_order (or a sibling) that pauses a buffered source and then checks that the fields after the pause come in order. Add a focused case for the cache-reuse path if it can be reached through the API.
Correction to the description above: the pause case doesn't reproduce. A buffered source's clock only advances while frames are queued, so a pause never makes three frames due at once. The real trigger is a buffered source that falls behind, with three or more frames arriving at once after a tick. #2048 has the reproduction (8 new cases that fail on master) and the fix. The pause cases are kept as guards.
Activity
rdoupe commentedon Oct 23, 2026
Claiming: #2009.
libobs: Show every 2x deinterlaced frame after a buffered source fall…
rdoupe commentedon Oct 24, 2026
Correction to the description above: the pause case doesn't reproduce. A buffered source's clock only advances while frames are queued, so a pause never makes three frames due at once. The real trigger is a buffered source that falls behind, with three or more frames arriving at once after a tick. #2048 has the reproduction (8 new cases that fail on master) and the fix. The pause cases are kept as guards.
libobs: Show every 2x deinterlaced frame after a buffered source fall…
libobs: Move the async frame copy plan into obs-source-frame-copy.c
libobs: Move the async frame copy plan into obs-source-frame-copy.c
obs-source: Port the async frame copy plan and cache decisions (obs-r…
libobs: Move the deinterlace frame selection
test: Characterize the deinterlace frame selection
obs-source: Port the deinterlace frame selection
obs-source: Check deinterlace_select against the C
obs-source: Port the deinterlace frame selection (obs-rust#2329)