]> git.sesse.net Git - vlc/commitdiff
* modules/access/dvb: Set the DVR device in non-blocking mode because it
authorChristophe Massiot <massiot@videolan.org>
Wed, 27 Jul 2005 12:52:28 +0000 (12:52 +0000)
committerChristophe Massiot <massiot@videolan.org>
Wed, 27 Jul 2005 12:52:28 +0000 (12:52 +0000)
   sometimes blocks on read() after returning from select().

modules/access/dvb/access.c
modules/access/dvb/linux_dvb.c

index c716d2feb9a8828e015412f8bbde8f444f92b4bb..4d82ebb80b131060b11cb958d721a8da954007a6 100644 (file)
@@ -384,19 +384,19 @@ static block_t *Block( access_t *p_access )
 
         if ( FD_ISSET( p_sys->i_handle, &fds ) )
         {
+            p_block = block_New( p_access,
+                                 p_sys->i_read_once * TS_PACKET_SIZE );
+            if( ( p_block->i_buffer = read( p_sys->i_handle, p_block->p_buffer,
+                                p_sys->i_read_once * TS_PACKET_SIZE ) ) <= 0 )
+            {
+                msg_Warn( p_access, "read failed (%s)", strerror(errno) );
+                block_Release( p_block );
+                continue;
+            }
             break;
         }
     }
 
-    p_block = block_New( p_access, p_sys->i_read_once * TS_PACKET_SIZE );
-    if( ( p_block->i_buffer = read( p_sys->i_handle, p_block->p_buffer,
-                                    p_sys->i_read_once*TS_PACKET_SIZE ) ) <= 0 )
-    {
-        msg_Err( p_access, "read failed (%s)", strerror(errno) );
-        block_Release( p_block );
-        return NULL;
-    }
-
     if( p_sys->i_read_once < DVB_READ_ONCE )
         p_sys->i_read_once++;
 
index b7257965c452d12a894fbef0738583dc10547de4..ba93f9eb6fab677fe847f70b63075fb719525103 100644 (file)
@@ -1177,6 +1177,12 @@ int E_(DVROpen)( access_t * p_access )
         return VLC_EGENERIC;
     }
 
+    if( fcntl( p_sys->i_handle, F_SETFL, O_NONBLOCK ) == -1 )
+    {
+        msg_Warn( p_access, "DVROpen: couldn't set non-blocking mode (%s)",
+                  strerror(errno) );
+    }
+
     return VLC_SUCCESS;
 }