[vlc-devel] commit: v4l doesn't like polling. Revert part of db820529a4af54001dee9c06b6ad8570efa5abc5. ( Antoine Cellerier )

git version control git at videolan.org
Thu Apr 2 20:26:39 CEST 2009


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Thu Apr  2 20:27:29 2009 +0200| [4e23aef98f0199a8620f5c377d29e6801f492296] | committer: Antoine Cellerier 

v4l doesn't like polling. Revert part of db820529a4af54001dee9c06b6ad8570efa5abc5.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4e23aef98f0199a8620f5c377d29e6801f492296
---

 modules/access/v4l.c |   24 +++++++-----------------
 1 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/modules/access/v4l.c b/modules/access/v4l.c
index 2371e84..11261e7 100644
--- a/modules/access/v4l.c
+++ b/modules/access/v4l.c
@@ -44,8 +44,6 @@
 #include <fcntl.h>
 #include <arpa/inet.h>
 
-#include <poll.h>
-
 /* From GStreamer's v4l plugin:
  * Because of some really cool feature in video4linux1, also known as
  * 'not including sys/types.h and sys/time.h', we had to include it
@@ -457,25 +455,17 @@ static int Demux( demux_t *p_demux )
 {
     demux_sys_t *p_sys = p_demux->p_sys;
 
-    struct pollfd fd;
-    fd.fd = p_sys->i_fd;
-    fd.events = POLLIN|POLLPRI;
-    fd.revents = 0;
+    block_t *p_block = GrabVideo( p_demux );
 
-    /* Wait for data */
-    if( poll( &fd, 1, 500 ) )
+    if( !p_block )
     {
-        if( fd.revents & (POLLIN|POLLPRI) )
-        {
-            block_t *p_block = GrabVideo( p_demux );
-            if( p_block )
-            {
-                es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block->i_pts );
-                es_out_Send( p_demux->out, p_sys->p_es, p_block );
-            }
-        }
+        msleep( 10000 ); /* Unfortunately v4l doesn't allow polling */
+        return 1;
     }
 
+    es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block->i_pts );
+    es_out_Send( p_demux->out, p_sys->p_es, p_block );
+
     return 1;
 }
 




More information about the vlc-devel mailing list