From 67985252514acd57d00a0a7a73e8a29c5e815882 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 26 Apr 2016 17:01:37 +0200 Subject: vo_rpi: wait for vsync with a timeout Sucks, but better than freezing forever given the (to me) unpredictable RPI behavior. This will be good enough to drop out of vsync timing mode, or to abort playback. --- video/out/vo_rpi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'video') diff --git a/video/out/vo_rpi.c b/video/out/vo_rpi.c index e5ca1d79e3..06327e9fd7 100644 --- a/video/out/vo_rpi.c +++ b/video/out/vo_rpi.c @@ -33,6 +33,7 @@ #include "common/common.h" #include "common/msg.h" #include "options/m_config.h" +#include "osdep/timer.h" #include "vo.h" #include "win_state.h" #include "video/mp_image.h" @@ -363,9 +364,12 @@ static void wait_next_vsync(struct vo *vo) { struct priv *p = vo->priv; pthread_mutex_lock(&p->vsync_mutex); + struct timespec end = mp_rel_time_to_timespec(0.050); int64_t old = p->vsync_counter; - while (old == p->vsync_counter && !p->reload_display) - pthread_cond_wait(&p->vsync_cond, &p->vsync_mutex); + while (old == p->vsync_counter && !p->reload_display) { + if (pthread_cond_timedwait(&p->vsync_cond, &p->vsync_mutex, &end)) + break; + } pthread_mutex_unlock(&p->vsync_mutex); } -- cgit v1.2.3