Commit ff4daed6 authored by Steve Lhomme's avatar Steve Lhomme
Browse files

video_output: drop reused pictures if they are late

The reused picture happens when the decoding+display starts or after a flush.

In the former case it's possible the decoder took some time and we have fresher
pictures available.

In the latter case the kept decoded picture may be very old and we shouldn't be
reusing if it's late.

In both cases, there will be fresher ones coming if the one left was too late.
parent e2478631
...@@ -1122,30 +1122,28 @@ static picture_t *ThreadGetPrerenderedLocked(vout_thread_sys_t *vout, bool reuse ...@@ -1122,30 +1122,28 @@ static picture_t *ThreadGetPrerenderedLocked(vout_thread_sys_t *vout, bool reuse
decoded = picture_Hold(sys->displayed.decoded); decoded = picture_Hold(sys->displayed.decoded);
} else { } else {
decoded = picture_fifo_Pop(sys->decoder_fifo); decoded = picture_fifo_Pop(sys->decoder_fifo);
if (!decoded)
if (decoded) { vlc_video_context *pic_vctx = picture_GetVideoContext(decoded);
if (DropLate(vout, decoded, can_drop_late, paused)) if (!VideoFormatIsCropArEqual(&decoded->format, &sys->filter.src_fmt))
continue; {
vlc_video_context *pic_vctx = picture_GetVideoContext(decoded); // we received an aspect ratio change
if (!VideoFormatIsCropArEqual(&decoded->format, &sys->filter.src_fmt)) // Update the filters with the filter source format with the new aspect ratio
{ video_format_Clean(&sys->filter.src_fmt);
// we received an aspect ratio change video_format_Copy(&sys->filter.src_fmt, &decoded->format);
// Update the filters with the filter source format with the new aspect ratio if (sys->filter.src_vctx)
video_format_Clean(&sys->filter.src_fmt); vlc_video_context_Release(sys->filter.src_vctx);
video_format_Copy(&sys->filter.src_fmt, &decoded->format); sys->filter.src_vctx = pic_vctx ? vlc_video_context_Hold(pic_vctx) : NULL;
if (sys->filter.src_vctx)
vlc_video_context_Release(sys->filter.src_vctx); ThreadChangeFilters(vout);
sys->filter.src_vctx = pic_vctx ? vlc_video_context_Hold(pic_vctx) : NULL;
} }
} }
if (!decoded)
reuse_decoded = false; reuse_decoded = false;
if (DropLate(vout, decoded, can_drop_late, paused))
if (sys->displayed.decoded) if (sys->displayed.decoded)
picture_Release(sys->displayed.decoded); picture_Release(sys->displayed.decoded);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment