1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/vda_h264_dec: fix a memory leak

Signed-off-by: Sebastien Zwickert <dilaroga@gmail.com>
This commit is contained in:
Xidorn Quan 2013-05-21 12:12:31 +08:00 committed by Sebastien Zwickert
parent ffd7fd7944
commit 499b82f604

View File

@ -102,6 +102,8 @@ static int vdadec_decode(AVCodecContext *avctx,
AVBufferRef *buffer = pic->buf[0]; AVBufferRef *buffer = pic->buf[0];
VDABufferContext *context = av_buffer_get_opaque(buffer); VDABufferContext *context = av_buffer_get_opaque(buffer);
CVPixelBufferRef cv_buffer = (CVPixelBufferRef)pic->data[3]; CVPixelBufferRef cv_buffer = (CVPixelBufferRef)pic->data[3];
CVPixelBufferRetain(cv_buffer);
CVPixelBufferLockBaseAddress(cv_buffer, 0); CVPixelBufferLockBaseAddress(cv_buffer, 0);
context->cv_buffer = cv_buffer; context->cv_buffer = cv_buffer;
pic->format = ctx->pix_fmt; pic->format = ctx->pix_fmt;
@ -202,6 +204,7 @@ static av_cold int vdadec_init(AVCodecContext *avctx)
vda_ctx->height = avctx->height; vda_ctx->height = avctx->height;
vda_ctx->format = 'avc1'; vda_ctx->format = 'avc1';
vda_ctx->use_sync_decoding = 1; vda_ctx->use_sync_decoding = 1;
vda_ctx->use_ref_buffer = 1;
ctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts); ctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts);
switch (ctx->pix_fmt) { switch (ctx->pix_fmt) {
case AV_PIX_FMT_UYVY422: case AV_PIX_FMT_UYVY422: