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? > - > if ((ret = decode_frame_common(avctx, s, p, avpkt)) < 0) > goto the_end; > > @@ -944,7 +934,6 @@ static int decode_frame_png(AVCodecContext *avctx, > > ret = bytestream2_tell(&s->gb); > the_end: > - inflateEnd(&s->zstream); > s->crow_buf = NULL; > return ret; > } > @@ -967,6 +956,7 @@ static int update_thread_context(AVCodecContext *dst, > const AVCodecContext *src) > static av_cold int png_dec_init(AVCodecContext *avctx) > { > PNGDecContext *s = avctx->priv_data; > + int ret; > > s->avctx = avctx; > s->last_picture.f = av_frame_alloc(); > @@ -979,6 +969,16 @@ static av_cold int png_dec_init(AVCodecContext *avctx) > ff_pngdsp_init(&s->dsp); > } > > + /* 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; > + } > + > return 0; > } > > @@ -996,6 +996,7 @@ static av_cold int png_dec_end(AVCodecContext *avctx) > s->last_row_size = 0; > av_freep(&s->tmp_row); > s->tmp_row_size = 0; > + inflateEnd(&s->zstream); > > return 0; > } Regards, -- Nicolas George
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel