[vlc-devel] [PATCH] decoder: fix race

Thomas Guillem thomas at gllm.fr
Tue Mar 31 09:47:45 CEST 2015



On Tue, Mar 31, 2015, at 09:43, Thomas Guillem wrote:
> It happens when an input wait for a decoder that has not decoded any data
> yet.

And when the decoder won't decode any data because it's a bad decoder
(who says MediaCodec ?).
But It can happen with others decoders when they didn't decoded any data
and when they are in an error state.

> ---
>  src/input/decoder.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index 76c4038..6769279 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -1435,11 +1435,18 @@ static void *DecoderThread( void *p_data )
>                  break;
>              }
>  
> +            vlc_mutex_lock( &p_owner->lock );
>              p_owner->b_idle = true;
> +            vlc_cond_signal( &p_owner->wait_acknowledge );
> +            vlc_mutex_unlock( &p_owner->lock );
> +
>              vlc_fifo_Wait( p_owner->p_fifo );
> +
>              /* Make sure there is no cancellation point other than this
>              one^^.
>               * If you need one, be sure to push cleanup of p_block. */
> +            vlc_mutex_lock( &p_owner->lock );
>              p_owner->b_idle = false;
> +            vlc_mutex_unlock( &p_owner->lock );
>          }
>  
>          p_block = vlc_fifo_DequeueUnlocked( p_owner->p_fifo );
> -- 
> 2.1.3
> 



More information about the vlc-devel mailing list