[FFmpeg-cvslog] hw_base_encode: Free pictures on close

David Rosca git at videolan.org
Wed Oct 16 13:48:44 EEST 2024


ffmpeg | branch: master | David Rosca <nowrep at gmail.com> | Tue Oct 15 16:49:41 2024 +0200| [48a1a12968345bf673db1e1cbb5c64bd3529c50c] | committer: Lynne

hw_base_encode: Free pictures on close

Fixes leaking recon surfaces with VAAPI.

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

 libavcodec/hw_base_encode.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c
index 7b6ec97d3b..912c707a68 100644
--- a/libavcodec/hw_base_encode.c
+++ b/libavcodec/hw_base_encode.c
@@ -804,6 +804,11 @@ int ff_hw_base_encode_init(AVCodecContext *avctx, FFHWBaseEncodeContext *ctx)
 
 int ff_hw_base_encode_close(FFHWBaseEncodeContext *ctx)
 {
+    FFHWBaseEncodePicture *pic;
+
+    for (pic = ctx->pic_start; pic; pic = pic->next)
+        base_encode_pic_free(pic);
+
     av_fifo_freep2(&ctx->encode_fifo);
 
     av_frame_free(&ctx->frame);



More information about the ffmpeg-cvslog mailing list