[FFmpeg-devel] [PATCH] avcodec/pngdec: init zlib on decoder init.

Benoit Fouet benoit.fouet at free.fr
Thu Nov 20 10:08:44 CET 2014


Hi,

----- Mail original -----
> Le decadi 30 brumaire, an CCXXIII, Benoit Fouet a écrit :
> > ---
> >  libavcodec/pngdec.c | 23 ++++++++++++-----------
> >  1 file changed, 12 insertions(+), 11 deletions(-)
> > 
> > diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
> > index 57b73c1..8467443 100644
> > --- a/libavcodec/pngdec.c
> > +++ b/libavcodec/pngdec.c
> > @@ -924,16 +924,6 @@ static int decode_frame_png(AVCodecContext
> > *avctx,
> >  
> >      s->y = s->state = 0;
> >  
> 
> > -    /* init the zlib */
> > -    s->zstream.zalloc = ff_png_zalloc;
> > -    s->zstream.zfree  = ff_png_zfree;
> > -    s->zstream.opaque = NULL;
> > -    ret = inflateInit(&s->zstream);
> > -    if (ret != Z_OK) {
> > -        av_log(avctx, AV_LOG_ERROR, "inflateInit returned error
> > %d\n", ret);
> > -        return AVERROR_EXTERNAL;
> > -    }
> 
> > I expect the new patch should address your issue.
> 
> AFAICS, the buffer is still inited once and for all and not reset
> between
> frames. Or did I miss something?
> 

I did, you didn't.
Actually, I didn't test multiple PNG frames in a container, which would be the way to trigger this, I think.

So, I've just tested that, and you are correct. I'll drop this patch.

Thanks for your input!

-- 
Ben


More information about the ffmpeg-devel mailing list