[vlc-devel] [RFC PATCH] es_out: Stop decoder wait before flush

Ludovic Fauvet etix at videolan.org
Tue Nov 10 10:46:00 CET 2015


On Tue, Nov 10, 2015, at 10:25, Thomas Guillem wrote:
> Currently, DecoderThread will deadlock in DecoderWaitUnblock if
> input_DecoderFlush is called while es_out is buffering.
> 
> A obvious way to fix this deadlock is to stop decoder wait via
> input_DecoderStopWait before calling input_DecoderFlush.
> ---
>  src/input/es_out.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/src/input/es_out.c b/src/input/es_out.c
> index 72dbbde..c94982e 100644
> --- a/src/input/es_out.c
> +++ b/src/input/es_out.c
> @@ -579,13 +579,16 @@ static void EsOutChangePosition( es_out_t *out )
>  
>          if( p_es->p_dec != NULL )
>          {
> -            input_DecoderFlush( p_es->p_dec );
> -            if( !p_sys->b_buffering )
> +            if( p_sys->b_buffering )
>              {
> -                input_DecoderStartWait( p_es->p_dec );
> +                input_DecoderStopWait( p_es->p_dec );
>                  if( p_es->p_dec_record != NULL )
> -                    input_DecoderStartWait( p_es->p_dec_record );
> +                    input_DecoderStopWait( p_es->p_dec_record );
>              }
> +            input_DecoderFlush( p_es->p_dec );
> +            input_DecoderStartWait( p_es->p_dec );
> +            if( p_es->p_dec_record != NULL )
> +                input_DecoderStartWait( p_es->p_dec_record );
>          }
>      }
>  
> -- 
> 2.1.4

Tested, it fixes the aforementioned deadlock.

-- 
Ludovic Fauvet
www.videolan.org


More information about the vlc-devel mailing list