Commit 427a52da authored by Steve Lhomme's avatar Steve Lhomme
Browse files

video_output: fully drain video filters before changing the filter aspect ratio

First we peek the decoded picture from the FIFO. It the aspect ratio has
changed we use the pictures remaining in the filters, as long as they are not
late.
If there is no more picture left in the filters we change the filter and
actually pop the decoded picture from the FIFO.
parent 887af03f
......@@ -1124,7 +1124,7 @@ static picture_t *ThreadGetPrerenderedLocked(vout_thread_sys_t *vout, bool reuse
if (reuse_decoded && sys->displayed.decoded) {
decoded = picture_Hold(sys->displayed.decoded);
} else {
decoded = picture_fifo_Pop(sys->decoder_fifo);
decoded = picture_fifo_Peek(sys->decoder_fifo);
if (!decoded)
break;
......@@ -1132,6 +1132,17 @@ static picture_t *ThreadGetPrerenderedLocked(vout_thread_sys_t *vout, bool reuse
if (!VideoFormatIsCropArEqual(&decoded->format, &sys->filter.src_fmt))
{
// we received an aspect ratio change
// drain the last pictures remaining in filters before
// using the decoded picture with a new format
picture = filter_chain_VideoDrain(sys->filter.chain_static, true);
if (picture && DropLate(vout, picture, can_drop_late, paused))
{
picture = NULL;
continue; // try again
}
if (picture)
break;
// Update the filters with the filter source format with the new aspect ratio
video_format_Clean(&sys->filter.src_fmt);
video_format_Copy(&sys->filter.src_fmt, &decoded->format);
......@@ -1141,6 +1152,9 @@ static picture_t *ThreadGetPrerenderedLocked(vout_thread_sys_t *vout, bool reuse
ThreadChangeFilters(vout);
}
// we are going to use this decoded picture, pop it for good
decoded = picture_fifo_Pop(sys->decoder_fifo);
}
reuse_decoded = false;
......
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