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.
This commit is contained in:
wm4 2016-04-26 17:01:37 +02:00
parent 74e3d11f21
commit 6798525251
1 changed files with 6 additions and 2 deletions

View File

@ -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);
}