[FFmpeg-cvslog] avcodec/vda_h264_dec: fix a memory leak

Xidorn Quan git at videolan.org
Mon May 27 09:37:48 CEST 2013


ffmpeg | branch: master | Xidorn Quan <quanxunzhen at gmail.com> | Tue May 21 12:12:31 2013 +0800| [499b82f604616a6ce7de4bd8e15f4698702c1e6a] | committer: Sebastien Zwickert

avcodec/vda_h264_dec: fix a memory leak

Signed-off-by: Sebastien Zwickert <dilaroga at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=499b82f604616a6ce7de4bd8e15f4698702c1e6a
---

 libavcodec/vda_h264_dec.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/vda_h264_dec.c b/libavcodec/vda_h264_dec.c
index 4e60de0..5857e0a 100644
--- a/libavcodec/vda_h264_dec.c
+++ b/libavcodec/vda_h264_dec.c
@@ -102,6 +102,8 @@ static int vdadec_decode(AVCodecContext *avctx,
         AVBufferRef *buffer = pic->buf[0];
         VDABufferContext *context = av_buffer_get_opaque(buffer);
         CVPixelBufferRef cv_buffer = (CVPixelBufferRef)pic->data[3];
+
+        CVPixelBufferRetain(cv_buffer);
         CVPixelBufferLockBaseAddress(cv_buffer, 0);
         context->cv_buffer = cv_buffer;
         pic->format = ctx->pix_fmt;
@@ -202,6 +204,7 @@ static av_cold int vdadec_init(AVCodecContext *avctx)
     vda_ctx->height = avctx->height;
     vda_ctx->format = 'avc1';
     vda_ctx->use_sync_decoding = 1;
+    vda_ctx->use_ref_buffer = 1;
     ctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts);
     switch (ctx->pix_fmt) {
     case AV_PIX_FMT_UYVY422:



More information about the ffmpeg-cvslog mailing list