Commit 45026e1a authored by Steve Lhomme's avatar Steve Lhomme
Browse files

video_output: fully drain the static video filters before changing filters

There might still be some pictures left to display before we flush everything.

In pause mode we should still update the filters since the deinterlacing state
didn't change but the user added/removed some user filters.
parent 6fe35008
......@@ -1489,16 +1489,18 @@ static int ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool render_now)
return VLC_SUCCESS;
}
static void FillCurrentLocked(vout_thread_sys_t *vout, bool frame_by_frame, bool *paused)
static bool FillCurrentLocked(vout_thread_sys_t *vout, bool frame_by_frame, bool *paused, bool fully_drain)
{
bool got_picture = false;
vout_thread_sys_t *sys = vout;
if (!sys->displayed.current)
{
assert(!sys->displayed.next);
sys->displayed.current =
ThreadGetPrerenderedLocked(vout, true, !frame_by_frame, paused, false);
ThreadGetPrerenderedLocked(vout, true, !frame_by_frame, paused, fully_drain);
got_picture = sys->displayed.current != NULL;
if (!sys->displayed.current || frame_by_frame)
return;
return got_picture;
}
if (frame_by_frame)
......@@ -1506,7 +1508,8 @@ static void FillCurrentLocked(vout_thread_sys_t *vout, bool frame_by_frame, bool
if (!sys->displayed.next)
{
sys->displayed.next =
ThreadGetPrerenderedLocked(vout, false, false, paused, false);
ThreadGetPrerenderedLocked(vout, false, false, paused, fully_drain);
got_picture |= sys->displayed.next != NULL;
}
picture_Release(sys->displayed.current);
......@@ -1520,10 +1523,12 @@ static void FillCurrentLocked(vout_thread_sys_t *vout, bool frame_by_frame, bool
if (!sys->displayed.next)
{
sys->displayed.next =
ThreadGetPrerenderedLocked(vout, false, true, paused, false);
ThreadGetPrerenderedLocked(vout, false, true, paused, fully_drain);
got_picture |= sys->displayed.next != NULL;
}
}
}
return got_picture;
}
static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
......@@ -1536,17 +1541,24 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
assert(sys->clock);
vlc_mutex_lock(&sys->filter.lock);
bool got_picture = false;
if (sys->filter.changed ||
sys->private.interlacing.has_deint != sys->filter.new_interlaced)
{
sys->private.interlacing.has_deint = sys->filter.new_interlaced;
ThreadChangeFilters(vout);
got_picture = FillCurrentLocked(sys, frame_by_frame, &paused, true);
if (!got_picture)
{
// no more pictures to drain from previous filters, update them
sys->private.interlacing.has_deint = sys->filter.new_interlaced;
ThreadChangeFilters(vout);
}
}
if (deadline)
*deadline = VLC_TICK_INVALID;
FillCurrentLocked(sys, frame_by_frame, &paused);
if (!got_picture)
FillCurrentLocked(sys, frame_by_frame, &paused, false);
vlc_mutex_unlock(&sys->filter.lock);
if (!sys->displayed.current)
......
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