[vlc-devel] [PATCH] decoder: reset the deleted vout on lock and release it outside of variable lock

Thomas Guillem thomas at gllm.fr
Tue Sep 3 11:37:56 CEST 2019


OK, but I would test it with tsan

On Tue, Sep 3, 2019, at 11:32, Steve Lhomme wrote:
> - on_vout_deleted() was and is not called under lock
> - vout_UnregisterSubpictureChannel() is not called under lock anymore (in some
> cases it's called without the variable lock)
> - vout_Release() is not called under lock anymore (in many cases it's called
> without the variable lock)
> ---
>  src/input/decoder.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index 5bd59fc6b0..51defd973e 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -610,19 +610,23 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec,
>      if( !p_vout )
>      {
>          msg_Warn( p_dec, "no vout found, dropping subpicture" );
> -        if( p_owner->p_vout )
> +        vlc_mutex_lock( &p_owner->lock );
> +        vout_thread_t *p_deleted_vout = p_owner->p_vout;
> +        ssize_t i_deleted_spu_channel = p_owner->i_spu_channel;
> +
> +        p_owner->p_vout = NULL;
> +        p_owner->i_spu_channel = VOUT_SPU_CHANNEL_INVALID;
> +        vlc_mutex_unlock( &p_owner->lock );
> +
> +        if( p_deleted_vout )
>          {
> -            assert(p_owner->i_spu_channel != VOUT_SPU_CHANNEL_INVALID);
> -            decoder_Notify(p_owner, on_vout_deleted, p_owner->p_vout);
> +            assert(i_deleted_spu_channel != VOUT_SPU_CHANNEL_INVALID);
> +            decoder_Notify(p_owner, on_vout_deleted, p_deleted_vout);
>  
> -            vlc_mutex_lock( &p_owner->lock );
> -            vout_UnregisterSubpictureChannel(p_owner->p_vout,
> -                                             p_owner->i_spu_channel);
> -            p_owner->i_spu_channel = VOUT_SPU_CHANNEL_INVALID;
> +            vout_UnregisterSubpictureChannel(p_deleted_vout,
> +                                             i_deleted_spu_channel);
>  
> -            vout_Release(p_owner->p_vout);
> -            p_owner->p_vout = NULL;
> -            vlc_mutex_unlock( &p_owner->lock );
> +            vout_Release(p_deleted_vout);
>          }
>          return NULL;
>      }
> -- 
> 2.17.1
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list