Commit 6fe35008 authored by Steve Lhomme's avatar Steve Lhomme
Browse files

video_output: split the code to read filter/decoder pictures under lock

The same logic should also be applied when fully draining pictures before
updating filters.
parent 427a52da
......@@ -1489,66 +1489,72 @@ static int ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool render_now)
return VLC_SUCCESS;
}
static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
static void FillCurrentLocked(vout_thread_sys_t *vout, bool frame_by_frame, bool *paused)
{
vout_thread_sys_t *sys = vout;
bool frame_by_frame = !deadline;
bool paused = sys->pause.is_on;
bool first = !sys->displayed.current;
assert(sys->clock);
vlc_mutex_lock(&sys->filter.lock);
if (sys->filter.changed ||
sys->private.interlacing.has_deint != sys->filter.new_interlaced)
{
sys->private.interlacing.has_deint = sys->filter.new_interlaced;
ThreadChangeFilters(vout);
}
if (deadline)
*deadline = VLC_TICK_INVALID;
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, false);
if (!sys->displayed.current || frame_by_frame)
{
vlc_mutex_unlock(&sys->filter.lock);
return VLC_EGENERIC; // wait with no known deadline
}
return;
}
bool render_now;
if (frame_by_frame)
{
if (!sys->displayed.next)
{
sys->displayed.next =
ThreadGetPrerenderedLocked(vout, false, false, &paused, false);
ThreadGetPrerenderedLocked(vout, false, false, paused, false);
}
vlc_mutex_unlock(&sys->filter.lock);
picture_Release(sys->displayed.current);
sys->displayed.current = sys->displayed.next;
sys->displayed.next = NULL;
render_now = true;
}
else
{
if (!paused)
if (!*paused)
{
if (!sys->displayed.next)
{
sys->displayed.next =
ThreadGetPrerenderedLocked(vout, false, true, &paused, false);
ThreadGetPrerenderedLocked(vout, false, true, paused, false);
}
}
vlc_mutex_unlock(&sys->filter.lock);
}
}
static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
{
vout_thread_sys_t *sys = vout;
bool frame_by_frame = !deadline;
bool paused = sys->pause.is_on;
bool first = !sys->displayed.current; // after start or flush
assert(sys->clock);
vlc_mutex_lock(&sys->filter.lock);
if (sys->filter.changed ||
sys->private.interlacing.has_deint != sys->filter.new_interlaced)
{
sys->private.interlacing.has_deint = sys->filter.new_interlaced;
ThreadChangeFilters(vout);
}
if (deadline)
*deadline = VLC_TICK_INVALID;
FillCurrentLocked(sys, frame_by_frame, &paused);
vlc_mutex_unlock(&sys->filter.lock);
if (!sys->displayed.current)
return VLC_EGENERIC; // wait with no known deadline
bool render_now = frame_by_frame;
if (!frame_by_frame)
{
const vlc_tick_t system_now = vlc_tick_now();
const vlc_tick_t render_delay = vout_chrono_GetHigh(&sys->render) + VOUT_MWAIT_TOLERANCE;
......
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