On 2013-01-08 15:36:29 +0100, Anton Khirnov wrote:
> ---
> libavcodec/zerocodec.c | 34 ++++++----------------------------
> 1 file changed, 6 insertions(+), 28 deletions(-)
>
> diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c
> index 8122cca..9af6fb0 100644
> --- a/libavcodec/zerocodec.c
> +++ b/libavcodec/zerocodec.c
> @@ -96,16 +93,11 @@ static int zerocodec_decode_frame(AVCodecContext *avctx,
> void *data,
> dst -= pic->linesize[0];
> }
>
> - /* Release the previous buffer if need be */
> - if (prev_pic->data[0])
> - avctx->release_buffer(avctx, prev_pic);
> + av_frame_unref(&zc->previous_frame);
> + if ((ret = av_frame_ref(&zc->previous_frame, pic)) < 0)
> + return ret;
>
> *got_frame = 1;
> - *(AVFrame *)data = *pic;
> -
> - /* Store the previous frame for use later.
> - * FFSWAP ensures that e.g. pic->data is NULLed. */
> - FFSWAP(AVFrame, *pic, *prev_pic);
>
> return avpkt->size;
> }
> @@ -113,16 +105,9 @@ static int zerocodec_decode_frame(AVCodecContext *avctx,
> void *data,
> static av_cold int zerocodec_decode_close(AVCodecContext *avctx)
> {
> ZeroCodecContext *zc = avctx->priv_data;
> - AVFrame *prev_pic = &zc->previous_frame;
>
> inflateEnd(&zc->zstream);
>
> - /* Release last frame */
> - if (prev_pic->data[0])
> - avctx->release_buffer(avctx, prev_pic);
> -
> - av_freep(&avctx->coded_frame);
> -
doesn't the decoder still holds an reference on zc->previous_frame
otherwise ok.
Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel