[FFmpeg-cvslog] wmavoice: free frame before ff_get_buffer

Timo Rothenpieler git at videolan.org
Sat Nov 11 15:20:38 EET 2017


ffmpeg | branch: master | Timo Rothenpieler <timo at rothenpieler.org> | Sat Nov 11 13:12:06 2017 +0100| [7e76e1ea80052ee95ef33d5341b9251b90766c9c] | committer: Timo Rothenpieler

wmavoice: free frame before ff_get_buffer

synth_superframe can be called twice per call to decode_packet.
It is not fully clear if calling ff_get_buffer on the same frame twice
is supported, so unref the frame first to be save.

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

 libavcodec/wmavoice.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index 2ec4499981..3f86d0da35 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -1756,6 +1756,10 @@ static int synth_superframe(AVCodecContext *ctx, AVFrame *frame,
             stabilize_lsps(lsps[n], s->lsps);
     }
 
+    /* synth_superframe can run multiple times per packet
+     * free potential previous frame */
+    av_frame_unref(frame);
+
     /* get output buffer */
     frame->nb_samples = MAX_SFRAMESIZE;
     if ((res = ff_get_buffer(ctx, frame, 0)) < 0)



More information about the ffmpeg-cvslog mailing list