Commit 20bb281b authored by Laurent Aimar's avatar Laurent Aimar
Browse files

* dvb: read more TS blocks at once. We start reading only 2 ts packets (needed to avoid

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.
parent 4ef742f3
......@@ -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 )
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment