Commit dd95e5e2 authored by md's avatar md

* dvb.c: Read upto 50 TS packets at once. We're in non-blocking mode,

          so the kernel will deliver less than 50 automatically.
          Note: one DMA cycle might provide upto 350 TS packets (64 kByte)


git-svn-id: svn://svn.videolan.org/dvblast/trunk@90 55d3f8b6-4a41-4d2d-a900-313d1436a5b8
parent ca4126ef
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
* Local declarations * Local declarations
*****************************************************************************/ *****************************************************************************/
#define FRONTEND_LOCK_TIMEOUT 30000000 /* 30 s */ #define FRONTEND_LOCK_TIMEOUT 30000000 /* 30 s */
#define MAX_READ_ONCE 50
#define DVR_BUFFER_SIZE 40*188*1024 /* bytes */ #define DVR_BUFFER_SIZE 40*188*1024 /* bytes */
static int i_frontend, i_dvr; static int i_frontend, i_dvr;
...@@ -172,10 +173,9 @@ static block_t *DVRRead( void ) ...@@ -172,10 +173,9 @@ static block_t *DVRRead( void )
{ {
int i, i_len; int i, i_len;
block_t *p_ts = p_freelist, **pp_current = &p_ts; block_t *p_ts = p_freelist, **pp_current = &p_ts;
int i_read_once = output_Count() * NB_BLOCKS; struct iovec p_iov[MAX_READ_ONCE];
struct iovec p_iov[i_read_once];
for ( i = 0; i < i_read_once; i++ ) for ( i = 0; i < MAX_READ_ONCE; i++ )
{ {
if ( (*pp_current) == NULL ) *pp_current = block_New(); if ( (*pp_current) == NULL ) *pp_current = block_New();
p_iov[i].iov_base = (*pp_current)->p_ts; p_iov[i].iov_base = (*pp_current)->p_ts;
...@@ -183,7 +183,7 @@ static block_t *DVRRead( void ) ...@@ -183,7 +183,7 @@ static block_t *DVRRead( void )
pp_current = &(*pp_current)->p_next; pp_current = &(*pp_current)->p_next;
} }
if ( (i_len = readv(i_dvr, p_iov, i_read_once)) < 0 ) if ( (i_len = readv(i_dvr, p_iov, MAX_READ_ONCE)) < 0 )
{ {
msg_Err( NULL, "couldn't read from DVR device (%s)", msg_Err( NULL, "couldn't read from DVR device (%s)",
strerror(errno) ); strerror(errno) );
......
...@@ -169,18 +169,6 @@ void output_Put( output_t *p_output, block_t *p_block ); ...@@ -169,18 +169,6 @@ void output_Put( output_t *p_output, block_t *p_block );
void comm_Open( void ); void comm_Open( void );
void comm_Read( void ); void comm_Read( void );
/*****************************************************************************
* output_Count
*****************************************************************************/
static inline int output_Count( void )
{
int i, i_nb = 0;
for ( i = 0; i < i_nb_outputs; i++ )
if ( pp_outputs[i]->i_config & OUTPUT_VALID )
i_nb++;
return i_nb;
}
/***************************************************************************** /*****************************************************************************
* block_New * block_New
*****************************************************************************/ *****************************************************************************/
......
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