[vlc-devel] [PATCH 5/5] avcodec: abort pictures when flushing

Thomas Guillem thomas at gllm.fr
Wed Dec 16 17:43:00 CET 2015


ping?

On Fri, Dec 11, 2015, at 13:34, Thomas Guillem wrote:
> This fixes a deadlock when seeking paused. It happened when avcodec
> needed more
> pictures than VLC. It was easily reproducible with h264 in a TS file.
> ---
>  modules/codec/avcodec/video.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/modules/codec/avcodec/video.c
> b/modules/codec/avcodec/video.c
> index 202964e..6310f84 100644
> --- a/modules/codec/avcodec/video.c
> +++ b/modules/codec/avcodec/video.c
> @@ -507,9 +507,17 @@ static void Flush( decoder_t *p_dec )
>      p_sys->i_pts = VLC_TS_INVALID; /* To make sure we recover properly
>      */
>      p_sys->i_late_frames = 0;
>  
> +    /* Abort pictures in order to unblock all avcodec workers threads
> waiting
> +     * for a picture. This will avoid a deadlock between
> avcodec_flush_buffers
> +     * and workers threads */
> +    decoder_AbortPictures( p_dec, true );
> +
>      post_mt( p_sys );
>      avcodec_flush_buffers( p_context );
>      wait_mt( p_sys );
> +
> +    /* Reset cancel state to false */
> +    decoder_AbortPictures( p_dec, false );
>  }
>  
>  /*****************************************************************************
> -- 
> 2.1.4
> 


More information about the vlc-devel mailing list