diff options
author | wm4 <wm4@nowhere> | 2016-04-26 17:01:37 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-04-26 17:11:16 +0200 |
commit | 67985252514acd57d00a0a7a73e8a29c5e815882 (patch) | |
tree | cda955be724846ac21cc60548b952275d6cf6038 /video/out/vo_rpi.c | |
parent | 74e3d11f214de023871e849e121b50e203a5a1c0 (diff) | |
download | mpv-67985252514acd57d00a0a7a73e8a29c5e815882.tar.bz2 mpv-67985252514acd57d00a0a7a73e8a29c5e815882.tar.xz |
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.
Diffstat (limited to 'video/out/vo_rpi.c')
-rw-r--r-- | video/out/vo_rpi.c | 8 |
1 files changed, 6 insertions, 2 deletions
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); } |