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,
p_netlist->i_nb_data = i_nb_data;
p_netlist->i_nb_pes = i_nb_pes;
p_netlist->i_buffer_size = i_buffer_size;
return (0); /* Everything went all right */
}
......@@ -179,7 +180,8 @@ void input_NetlistMviovec( void * p_netlist, size_t i_nb_iovec )
/*****************************************************************************
* 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;
netlist_t * pt_netlist; /* for a cast */
......@@ -188,6 +190,15 @@ struct data_packet_s * input_NetlistNewPacket( void * p_netlist )
pt_netlist = ( netlist_t * ) p_netlist;
/* 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 */
vlc_mutex_lock ( &pt_netlist->lock );
......@@ -205,6 +216,8 @@ struct data_packet_s * input_NetlistNewPacket( void * p_netlist )
/* unlock */
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
//le lock un autre thread rend un paquet et crase
......
......@@ -3,7 +3,9 @@
*****************************************************************************/
typedef struct netlist_s
{
vlc_mutex_t lock;
vlc_mutex_t lock;
size_t i_buffer_size;
/* Buffers */
byte_t * p_buffers; /* Big malloc'ed area */
......@@ -20,7 +22,6 @@ typedef struct netlist_s
unsigned int i_nb_data;
/* Index */
unsigned int i_data_start, i_data_end;
unsigned int i_pes_start, i_pes_end;
unsigned int i_iovec_start, i_iovec_end;
......@@ -34,7 +35,7 @@ int input_NetlistInit( struct input_thread_s *,
size_t i_buffer_size );
struct iovec * input_NetlistGetiovec( void * );
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 * );
void input_NetlistDeletePacket( void *, struct data_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