[vlc-devel] [PATCH] decoder: drop decoder output while flushing

Zhao Zhili quinkblack at foxmail.com
Fri Oct 12 14:10:22 CEST 2018


Hi Francois,

On 2018年10月12日 18:53, Francois Cartegnie wrote:
> On flush, threaded decoders or until
> DecoderProcess exit, decoded data is still
> output before decoder flush.
>
> On vout, this causes incorrect first picture
> received.
> ---
>   src/input/decoder.c | 13 +++++++++++--
>   1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index b39c704bfa..023881753b 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -954,6 +954,13 @@ static void DecoderPlayCc( decoder_t *p_dec, block_t *p_cc,
>   
>       vlc_mutex_lock( &p_owner->lock );
>   
> +    if( p_owner->flushing )
> +    {
> +        vlc_mutex_unlock( &p_owner->lock );
> +        block_Release( p_cc );
> +        return;
> +    }
> +

flushing is protected by vlc_fifo_Lock( p_owner->p_fifo ) in other 
places. playAudio/Video/Cc don't hold the lock.

>       p_owner->cc.desc = *p_desc;
>   
>       /* Fanout data to all decoders. We do not know if es_out
> @@ -1026,7 +1033,8 @@ static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
>       bool prerolled;
>   
>       vlc_mutex_lock( &p_owner->lock );
> -    if( p_owner->i_preroll_end > p_picture->date )
> +    if( p_owner->flushing ||
> +        p_owner->i_preroll_end > p_picture->date )
>       {
>           vlc_mutex_unlock( &p_owner->lock );
>           picture_Release( p_picture );
> @@ -1166,7 +1174,8 @@ static void DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
>       assert( p_audio != NULL );
>   
>       vlc_mutex_lock( &p_owner->lock );
> -    if( p_owner->i_preroll_end > p_audio->i_pts )
> +    if( p_owner->flushing ||
> +        p_owner->i_preroll_end > p_audio->i_pts )
>       {
>           vlc_mutex_unlock( &p_owner->lock );
>           block_Release( p_audio );





More information about the vlc-devel mailing list