]> git.sesse.net Git - vlc/commitdiff
* dvb: read more TS blocks at once. We start reading only 2 ts packets (needed to...
authorLaurent Aimar <fenrir@videolan.org>
Tue, 19 Apr 2005 15:56:06 +0000 (15:56 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Tue, 19 Apr 2005 15:56:06 +0000 (15:56 +0000)
long delay because we only receive PAT at the start), but we increase each time we read
data until 20. This decrease the load (more than 50% for me) while kepping low start up delay.

modules/access/dvb/access.c
modules/access/dvb/dvb.h

index 020e6acfcdef3622d0bc9a17ec09b43e6adf9671..27e41a35a77dd0ed3c088607ce97ecdbfcbda71e 100644 (file)
@@ -211,7 +211,8 @@ vlc_module_end();
 static block_t *Block( access_t * );
 static int Control( access_t *, int, va_list );
 
-#define DVB_READ_ONCE 3
+#define DVB_READ_ONCE 20
+#define DVB_READ_ONCE_START 2
 #define TS_PACKET_SIZE 188
 
 static void FilterUnset( access_t *, int i_max );
@@ -297,6 +298,11 @@ static int Open( vlc_object_t *p_this )
 
     E_(CAMOpen)( p_access );
 
+    if( p_sys->b_budget_mode )
+        p_sys->i_read_once = DVB_READ_ONCE;
+    else
+        p_sys->i_read_once = DVB_READ_ONCE_START;
+
     return VLC_SUCCESS;
 }
 
@@ -382,15 +388,18 @@ static block_t *Block( access_t *p_access )
         }
     }
 
-    p_block = block_New( p_access, DVB_READ_ONCE * TS_PACKET_SIZE );
+    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,
-                                    DVB_READ_ONCE * TS_PACKET_SIZE ) ) <= 0 )
+                                    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++;
+
     return p_block;
 }
 
@@ -495,6 +504,9 @@ static void FilterSet( access_t *p_access, int i_pid, int i_type )
     }
     p_sys->p_demux_handles[i].i_type = i_type;
     p_sys->p_demux_handles[i].i_pid = i_pid;
+
+    if( p_sys->i_read_once < DVB_READ_ONCE )
+        p_sys->i_read_once++;
 }
 
 static void FilterUnset( access_t *p_access, int i_max )
index 4ad870bc7332626dff21486d46677a6317c913f6..96f621653f63192a120be894e407664d81b14863 100644 (file)
@@ -74,6 +74,9 @@ struct access_sys_t
     en50221_session_t p_sessions[MAX_SESSIONS];
     mtime_t i_ca_timeout, i_ca_next_event, i_frontend_timeout;
     dvbpsi_pmt_t *pp_selected_programs[MAX_PROGRAMS];
+
+    /* */
+    int i_read_once;
 };
 
 #define VIDEO0_TYPE     1