[MPlayer-cvslog] CVS: main/libmpdemux tvi_v4l2.c,1.32,1.33

Reimar Döffinger CVS syncmail at mplayerhq.hu
Thu Nov 10 21:32:50 CET 2005


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv18933

Modified Files:
	tvi_v4l2.c 
Log Message:
Do not hang forever when the card delivers no new data.


Index: tvi_v4l2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tvi_v4l2.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- tvi_v4l2.c	19 Sep 2005 22:47:16 -0000	1.32
+++ tvi_v4l2.c	10 Nov 2005 20:32:47 -0000	1.33
@@ -1360,6 +1360,7 @@
     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 @@
     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 @@
 
     while (priv->video_cnt == 0) {
 	usleep(10000);
+	if (loop_cnt++ > MAX_LOOP) return 0;
     }
 
     pthread_mutex_lock(&priv->video_buffer_mutex);




More information about the MPlayer-cvslog mailing list