[FFmpeg-devel] [PATCH] Flushing the MP2 Decoder

Michael Niedermayer michaelni
Fri Jan 11 13:16:48 CET 2008


On Thu, Jan 10, 2008 at 07:01:46PM -0600, Brian Brice wrote:
> Hello,
> 
> I believe I've found an issue with seeking relating to the MP2
> decoder.  It's most notable in the scenario that you've been decoding
> frames that have sound, seek to an area of silence, then continue
> decoding.  After the seek, the first frame returned from the decoder
> has a blip of sound from the previous audio.
> 
> Currently, there isn't a flush implementation for the MP2 decoder.  In
> researching what exactly needs to be flushed, I've noticed some fields
> in MPADecodeContext that were previously set, causing the blip.
> 
> I've attached my implementation of a flush function for the MP2 decoder.
> 
> Thanks!
> 
> -- 
> Brian Brice
> http://www.heapify.org/

> --- libavcodec/mpegaudiodec.c.orig	2008-01-10 18:50:54.988827100 -0600
> +++ libavcodec/mpegaudiodec.c	2008-01-10 18:59:13.629452100 -0600
> @@ -2417,6 +2417,9 @@
>  
>  static void flush(AVCodecContext *avctx){
>      MPADecodeContext *s = avctx->priv_data;
> +    memset(s->synth_buf, 0, sizeof(s->synth_buf));

> +    memset(s->synth_buf_offset, 0, sizeof(s->synth_buf_offset));
> +    s->dither_state= 0;

this is not needed


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Thouse who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080111/c5e84376/attachment.pgp>



More information about the ffmpeg-devel mailing list