summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-25 17:31:59 +0200
committerwm4 <wm4@nowhere>2014-10-25 17:57:22 +0200
commitc6a1b8ebcc1099832f3713348280d9e7c03ac368 (patch)
treec79478d73b57ec02174d1b8aebd50bf3fc49d156 /stream
parent5b91f8985210b2203c4feba1092804eea65da500 (diff)
downloadmpv-c6a1b8ebcc1099832f3713348280d9e7c03ac368.tar.bz2
mpv-c6a1b8ebcc1099832f3713348280d9e7c03ac368.tar.xz
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.)
Diffstat (limited to 'stream')
-rw-r--r--stream/tvi_v4l2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c
index 49b680d112..8738088a0a 100644
--- a/stream/tvi_v4l2.c
+++ b/stream/tvi_v4l2.c
@@ -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;
}