summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-11-10 20:32:47 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-11-10 20:32:47 +0000
commitcf440b521e0c16420bdb6bdb89f400a551933573 (patch)
tree0bec97ea621f1de608137d736478006f5eff6606 /libmpdemux
parent0a85f24278be1c99df5f4b6c1caffbceca2163e1 (diff)
downloadmpv-cf440b521e0c16420bdb6bdb89f400a551933573.tar.bz2
mpv-cf440b521e0c16420bdb6bdb89f400a551933573.tar.xz
Do not hang forever when the card delivers no new data.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16963 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/tvi_v4l2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libmpdemux/tvi_v4l2.c b/libmpdemux/tvi_v4l2.c
index 4bceda69f0..1d406606f6 100644
--- a/libmpdemux/tvi_v4l2.c
+++ b/libmpdemux/tvi_v4l2.c
@@ -1360,6 +1360,7 @@ static void *video_grabber(void *data)
priv_t *priv = (priv_t*)data;
long long skew, prev_skew, xskew, interval, prev_interval, delta;
int i;
+ int err_count = 0;
int framesize = priv->format.fmt.pix.height*priv->format.fmt.pix.width*
pixfmt2depth(priv->format.fmt.pix.pixelformat)/8;
fd_set rdset;
@@ -1546,9 +1547,11 @@ static void *video_grabber(void *data)
return NULL;
}
+#define MAX_LOOP 50
static double grab_video_frame(priv_t *priv, char *buffer, int len)
{
double interval;
+ int loop_cnt = 0;
if (priv->first) {
pthread_create(&priv->video_grabber_thread, NULL, video_grabber, priv);
@@ -1557,6 +1560,7 @@ static double grab_video_frame(priv_t *priv, char *buffer, int len)
while (priv->video_cnt == 0) {
usleep(10000);
+ if (loop_cnt++ > MAX_LOOP) return 0;
}
pthread_mutex_lock(&priv->video_buffer_mutex);