[FFmpeg-devel] mp3 seeking issue.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Oct 21 20:08:34 CEST 2012


On Sun, Oct 21, 2012 at 10:51:50AM -0700, Dale Curtis wrote:
> On Sun, Oct 21, 2012 at 12:45 AM, Reimar Döffinger <Reimar.Doeffinger at gmx.de
> > wrote:
> 
> >
> > I think this is a very long standing bug in the MP3 decoder, it probably
> > does not reset some of the state in the flush function.
> > Nobody ever investigated it properly to my knowledge.
> 
> 
> I had some time this morning, I'm not sure if this is correct but it gets
> rid of most of the seek artifacting:

Note that getting _some_ artifacts when seeking in MP3 is normal/not
avoidable in a good way.
The only thing that is a bug is if you get different artifacts depending
on what was decoded before.

> diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
> index 77f86c5..1c1e317 100644
> --- a/libavcodec/mpegaudiodec.c
> +++ b/libavcodec/mpegaudiodec.c
> @@ -1716,6 +1716,9 @@ static void flush(AVCodecContext *avctx)
>  {
>      MPADecodeContext *s = avctx->priv_data;
>      memset(s->synth_buf, 0, sizeof(s->synth_buf));
> +    memset(s->last_buf, 0, sizeof(s->last_buf));
> +    memset(s->sb_samples, 0, sizeof(s->sb_samples));

Seems sensible, and I have a nagging feeling that actually someone else
found proposed that.
Maybe time to get it applied, if anyone familiar with the code can
review it?


More information about the ffmpeg-devel mailing list