[vlc-devel] [PATCH v3 2/2] Reset p_context->skip_frame when done seeking

Steve Lhomme robux4 at ycbcr.xyz
Mon Sep 2 07:45:46 CEST 2019


On 2019-09-01 0:11, Marc Aldorasi wrote:
> Previously, if p_sys->b_hurry_up was false and we weren't seeking, the
> value of p_context->skip_frame would not be modified.  This means that
> if we started seeking we would set p_context->skip_frame to
> AVDISCARD_NONREF, and then when we finished seeking we wouldn't change
> p_context->skip_frame and it would still be skipping non-reference
> frames, causing choppy playback.  This patch resets
> p_context->skip_frame when we're not seeking so playback is smooth.
> ---
>   modules/codec/avcodec/video.c | 21 +++++++++------------
>   1 file changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
> index 7166d70b33..3ca7574ce6 100644
> --- a/modules/codec/avcodec/video.c
> +++ b/modules/codec/avcodec/video.c
> @@ -1026,24 +1026,21 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
>       /* Defaults that if we aren't in prerolling, we want output picture
>          same for if we are flushing (p_block==NULL) */
>       if( !p_block || !(p_block->i_flags & BLOCK_FLAG_PREROLL) )

The if may be grouped "!(block && block preroll)" to make it clearer 
that the other part of the else (which could also become the first part 
for even clearer code) is for preroll blocks.

The patchset is OK with me. That can be cleaned afterwards.

> +    {
>           b_need_output_picture = true;
> +        p_context->skip_frame = p_sys->i_skip_frame;
> +    }
>       else
> -        b_need_output_picture = false;
> -
> -    /* Change skip_frame config only if hurry_up is enabled */
> -    if( p_sys->b_hurry_up )
>       {
> -        p_context->skip_frame = p_sys->i_skip_frame;
> -
> -        /* Check also if we should/can drop the block and move to next block
> -            as trying to catchup the speed*/
> -        if( p_dec->b_frame_drop_allowed )
> -            p_block = filter_earlydropped_blocks( p_dec, p_block );
> +        b_need_output_picture = false;
> +        p_context->skip_frame = __MAX( p_sys->i_skip_frame, AVDISCARD_NONREF );
>       }
>   
> -    if( !b_need_output_picture )
> +    /* Check also if we should/can drop the block and move to next block
> +       to try to catch up */
> +    if( p_sys->b_hurry_up && p_dec->b_frame_drop_allowed )
>       {
> -        p_context->skip_frame = __MAX( p_context->skip_frame, AVDISCARD_NONREF );
> +        p_block = filter_earlydropped_blocks( p_dec, p_block );
>       }
>   
>       /*
> -- 
> 2.22.0
> 
> _______________________________________________
> 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