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

Francois Cartegnie fcvlcdev at free.fr
Thu May 1 12:14:31 CEST 2014


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) ) ||
+            date_Get( &p_sys->end_date ) - p_block->i_pts > AOUT_MAX_PREPARE_TIME
+      ) )
     {
         date_Set( &p_sys->end_date, p_block->i_pts );
     }
-- 
1.9.0




More information about the vlc-devel mailing list