tv: reduce waiting loop from 10ms to 1ms

I can't believe how shitty this (MPlayer-derived) code is. Maybe it
should be fixed or be replaced with using libavdevice, but that doesn't
seem worth the effort.

Anyway, for now reduce the time it's blocking to wait for new frames
from 10ms to 1ms, because 10ms might be a bit too tight: it could
deliver the frame up to 10ms late - now it's only up to 1ms. (And yes,
it does that instead of using condition variables. It also abuses
volatile variables as atomics. It's hilarious.)
This commit is contained in:
wm4 2014-10-25 17:31:59 +02:00
parent 5b91f89852
commit c6a1b8ebcc
1 changed files with 2 additions and 2 deletions

View File

@ -1590,7 +1590,7 @@ static void *video_grabber(void *data)
return NULL;
}
#define MAX_LOOP 50
#define MAX_LOOP 500
static double grab_video_frame(priv_t *priv, char *buffer, int len)
{
int loop_cnt = 0;
@ -1601,7 +1601,7 @@ static double grab_video_frame(priv_t *priv, char *buffer, int len)
}
while (priv->video_cnt == 0) {
usleep(10000);
usleep(1000);
if (loop_cnt++ > MAX_LOOP) return 0;
}