ref: 261836d1c09120bad130fe566e36d602a8816841
parent: 41ebc91ef217ba59d67fd41ba77aace57dc2343d
author: Paul Brossier <piem@piem.org>
date: Wed Nov 30 12:18:14 EST 2016
src/io/source_avcodec.c: keep a reference to packet to remove it when closing file
--- a/src/io/source_avcodec.c
+++ b/src/io/source_avcodec.c
@@ -59,6 +59,7 @@
AVFormatContext *avFormatCtx;
AVCodecContext *avCodecCtx;
AVFrame *avFrame;
+ AVPacket avPacket;
AVAudioResampleContext *avr;
smpl_t *output;
uint_t read_samples;
@@ -305,7 +306,7 @@
AVFormatContext *avFormatCtx = s->avFormatCtx;
AVCodecContext *avCodecCtx = s->avCodecCtx;
AVFrame *avFrame = s->avFrame;
- AVPacket avPacket;
+ AVPacket avPacket = s->avPacket;
av_init_packet (&avPacket);
AVAudioResampleContext *avr = s->avr;
smpl_t *output = s->output;
@@ -506,6 +507,11 @@
avformat_free_context(s->avFormatCtx);
s->avFormatCtx = NULL;
}
+#if FF_API_LAVF_AVCTX
+ av_packet_unref(&s->avPacket);
+#else
+ av_free_packet(&s->avPacket);
+#endif
return AUBIO_OK;
}