Commit dfc77d2c authored by Michel Kaempf's avatar Michel Kaempf

* include/decoder_fifo.h :

- correction d'un bug dans la fonction GetByte (freeze �ventuel des
d�codeurs lors du suicide du thread input) ;
parent 000cd66f
...@@ -111,16 +111,18 @@ static __inline__ byte_t GetByte( bit_stream_t * p_bit_stream ) ...@@ -111,16 +111,18 @@ static __inline__ byte_t GetByte( bit_stream_t * p_bit_stream )
* time to jump to the next PES packet */ * time to jump to the next PES packet */
if ( p_bit_stream->p_ts->p_next_ts == NULL ) if ( p_bit_stream->p_ts->p_next_ts == NULL )
{ {
/* We are going to read/write the start and end indexes of the
* decoder fifo and to use the fifo's conditional variable,
* that's why we need to take the lock before */
vlc_mutex_lock( &p_bit_stream->p_decoder_fifo->data_lock );
/* Is the input thread dying ? */ /* Is the input thread dying ? */
if ( p_bit_stream->p_input->b_die ) if ( p_bit_stream->p_input->b_die )
{ {
vlc_mutex_unlock( &(p_bit_stream->p_decoder_fifo->data_lock) );
return( 0 ); return( 0 );
} }
/* We are going to read/write the start and end indexes of the
* decoder fifo and to use the fifo's conditional variable,
* that's why we need to take the lock before */
vlc_mutex_lock( &p_bit_stream->p_decoder_fifo->data_lock );
/* We should increase the start index of the decoder fifo, but /* We should increase the start index of the decoder fifo, but
* if we do this now, the input thread could overwrite the * if we do this now, the input thread could overwrite the
* pointer to the current PES packet, and we weren't able to * pointer to the current PES packet, and we weren't able to
...@@ -131,8 +133,7 @@ static __inline__ byte_t GetByte( bit_stream_t * p_bit_stream ) ...@@ -131,8 +133,7 @@ static __inline__ byte_t GetByte( bit_stream_t * p_bit_stream )
while ( DECODER_FIFO_ISEMPTY(*p_bit_stream->p_decoder_fifo) ) while ( DECODER_FIFO_ISEMPTY(*p_bit_stream->p_decoder_fifo) )
{ {
vlc_cond_wait( &p_bit_stream->p_decoder_fifo->data_wait, vlc_cond_wait( &p_bit_stream->p_decoder_fifo->data_wait, &p_bit_stream->p_decoder_fifo->data_lock );
&p_bit_stream->p_decoder_fifo->data_lock );
if ( p_bit_stream->p_input->b_die ) if ( p_bit_stream->p_input->b_die )
{ {
vlc_mutex_unlock( &(p_bit_stream->p_decoder_fifo->data_lock) ); vlc_mutex_unlock( &(p_bit_stream->p_decoder_fifo->data_lock) );
......
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