summaryrefslogtreecommitdiffstats
path: root/audio/decode/ad_lavc.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio/decode/ad_lavc.c')
-rw-r--r--audio/decode/ad_lavc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index 242b23b994..802683bf7b 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -205,7 +205,8 @@ static int init(struct dec_audio *da, const char *decoder)
lavc_context = avcodec_alloc_context3(lavc_codec);
ctx->avctx = lavc_context;
- ctx->avframe = avcodec_alloc_frame();
+ ctx->avframe = av_frame_alloc();
+ lavc_context->refcounted_frames = 1;
lavc_context->codec_type = AVMEDIA_TYPE_AUDIO;
lavc_context->codec_id = lavc_codec->id;
@@ -289,7 +290,7 @@ static void uninit(struct dec_audio *da)
av_freep(&lavc_context->extradata);
av_freep(&lavc_context);
}
- avcodec_free_frame(&ctx->avframe);
+ av_frame_free(&ctx->avframe);
}
static int control(struct dec_audio *da, int cmd, void *arg)
@@ -331,6 +332,7 @@ static int decode_new_packet(struct dec_audio *da)
}
int got_frame = 0;
+ av_frame_unref(priv->avframe);
int ret = avcodec_decode_audio4(avctx, priv->avframe, &got_frame, &pkt);
if (mpkt) {
// At least "shorten" decodes sub-frames, instead of the whole packet.