Commit a23f364a authored by Christophe Massiot's avatar Christophe Massiot

More comments.

parent d2ca341d
...@@ -147,6 +147,7 @@ int input_NetlistInit( input_thread_t * p_input, int i_nb_data, int i_nb_pes, ...@@ -147,6 +147,7 @@ int input_NetlistInit( input_thread_t * p_input, int i_nb_data, int i_nb_pes,
p_netlist->i_nb_data = i_nb_data; p_netlist->i_nb_data = i_nb_data;
p_netlist->i_nb_pes = i_nb_pes; p_netlist->i_nb_pes = i_nb_pes;
p_netlist->i_buffer_size = i_buffer_size;
return (0); /* Everything went all right */ return (0); /* Everything went all right */
} }
...@@ -179,7 +180,8 @@ void input_NetlistMviovec( void * p_netlist, size_t i_nb_iovec ) ...@@ -179,7 +180,8 @@ void input_NetlistMviovec( void * p_netlist, size_t i_nb_iovec )
/***************************************************************************** /*****************************************************************************
* input_NetlistNewPacket: returns a free data_packet_t * input_NetlistNewPacket: returns a free data_packet_t
*****************************************************************************/ *****************************************************************************/
struct data_packet_s * input_NetlistNewPacket( void * p_netlist ) struct data_packet_s * input_NetlistNewPacket( void * p_netlist,
size_t i_buffer_size )
{ {
unsigned int i_return; unsigned int i_return;
netlist_t * pt_netlist; /* for a cast */ netlist_t * pt_netlist; /* for a cast */
...@@ -188,6 +190,15 @@ struct data_packet_s * input_NetlistNewPacket( void * p_netlist ) ...@@ -188,6 +190,15 @@ struct data_packet_s * input_NetlistNewPacket( void * p_netlist )
pt_netlist = ( netlist_t * ) p_netlist; pt_netlist = ( netlist_t * ) p_netlist;
/* cast p_netlist -> netlist_t */ /* cast p_netlist -> netlist_t */
#ifdef DEBUG
if( i_buffer_size > p_netlist->i_buffer_size )
{
/* This should not happen */
intf_ErrMsg( "Netlist packet too small !" );
return NULL;
}
#endif
/* lock */ /* lock */
vlc_mutex_lock ( &pt_netlist->lock ); vlc_mutex_lock ( &pt_netlist->lock );
...@@ -206,6 +217,8 @@ struct data_packet_s * input_NetlistNewPacket( void * p_netlist ) ...@@ -206,6 +217,8 @@ struct data_packet_s * input_NetlistNewPacket( void * p_netlist )
/* unlock */ /* unlock */
vlc_mutex_unlock (&pt_netlist->lock); vlc_mutex_unlock (&pt_netlist->lock);
//if (i_buffer_size < p_pes->i_buffer_size) => diminuer p_payload_end
//risque de race condition : que se passe-t-il si aprs avoir rendu //risque de race condition : que se passe-t-il si aprs avoir rendu
//le lock un autre thread rend un paquet et crase //le lock un autre thread rend un paquet et crase
//pp_free_data[i_return] ? //pp_free_data[i_return] ?
......
...@@ -5,6 +5,8 @@ typedef struct netlist_s ...@@ -5,6 +5,8 @@ typedef struct netlist_s
{ {
vlc_mutex_t lock; vlc_mutex_t lock;
size_t i_buffer_size;
/* Buffers */ /* Buffers */
byte_t * p_buffers; /* Big malloc'ed area */ byte_t * p_buffers; /* Big malloc'ed area */
data_packet_t * p_data; /* malloc'ed area */ data_packet_t * p_data; /* malloc'ed area */
...@@ -20,7 +22,6 @@ typedef struct netlist_s ...@@ -20,7 +22,6 @@ typedef struct netlist_s
unsigned int i_nb_data; unsigned int i_nb_data;
/* Index */ /* Index */
unsigned int i_data_start, i_data_end; unsigned int i_data_start, i_data_end;
unsigned int i_pes_start, i_pes_end; unsigned int i_pes_start, i_pes_end;
unsigned int i_iovec_start, i_iovec_end; unsigned int i_iovec_start, i_iovec_end;
...@@ -34,7 +35,7 @@ int input_NetlistInit( struct input_thread_s *, ...@@ -34,7 +35,7 @@ int input_NetlistInit( struct input_thread_s *,
size_t i_buffer_size ); size_t i_buffer_size );
struct iovec * input_NetlistGetiovec( void * ); struct iovec * input_NetlistGetiovec( void * );
void input_NetlistMviovec( void *, size_t ); void input_NetlistMviovec( void *, size_t );
struct data_packet_s * input_NetlistNewPacket( void * ); struct data_packet_s * input_NetlistNewPacket( void *, size_t );
struct pes_packet_s * input_NetlistNewPES( void * ); struct pes_packet_s * input_NetlistNewPES( void * );
void input_NetlistDeletePacket( void *, struct data_packet_s * ); void input_NetlistDeletePacket( void *, struct data_packet_s * );
void input_NetlistDeletePES( void *, struct pes_packet_s * ); void input_NetlistDeletePES( void *, struct pes_packet_s * );
......
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