[vlc-devel] [PATCH] demux: avcodec: audio: reset reference time on backward seek (fix #9176)

Rémi Denis-Courmont remi at remlab.net
Thu May 1 12:26:46 CEST 2014


Le jeudi 1 mai 2014, 12:14:31 Francois Cartegnie a écrit :
> end_date is never reset when seeking backward, and then audio is trashed
> when pts - end_date > - 2*CLOCK_FREQ
> ---
>  modules/codec/avcodec/audio.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
> index 254c06d..7f873f6 100644
> --- a/modules/codec/avcodec/audio.c
> +++ b/modules/codec/avcodec/audio.c
> @@ -352,8 +352,11 @@ block_t * DecodeAudio ( decoder_t *p_dec, block_t
> **pp_block ) if( p_dec->fmt_out.audio.i_rate != (unsigned
> int)ctx->sample_rate ) date_Init( &p_sys->end_date, ctx->sample_rate, 1 );
> 
> -    if( p_block->i_pts > VLC_TS_INVALID &&
> -        p_block->i_pts > date_Get( &p_sys->end_date ) )
> +    if( p_block->i_pts > VLC_TS_INVALID && (
> +            p_block->i_pts > date_Get( &p_sys->end_date ) ||
> +          ( p_block->i_flags &
> (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) ||

I find mixing && and || without disambiguation parenthesis is
extremely confusing.

> +            date_Get(
> &p_sys->end_date ) - p_block->i_pts > AOUT_MAX_PREPARE_TIME
> +      ) )

No please. MAX_PREPARE_TIME is only for use by audio outputs (to size play-out 
buffers) and the core (to detect overflow). This really does not belong in 
decoders.

-- 
Rémi Denis-Courmont
http://www.remlab.net/




More information about the vlc-devel mailing list