This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 59913ff570 apv_encode_vulkan: stop leaking the frame on every packet
59913ff570 is described below

commit 59913ff57073c536e3171aa147fd15af2bbbc978
Author:     Lynne <[email protected]>
AuthorDate: Thu Sep 24 11:42:54 2026 +0900
Commit:     Lynne <[email protected]>
CommitDate: Thu Sep 24 11:47:29 2026 +0900

    apv_encode_vulkan: stop leaking the frame on every packet
    
    The frame was inserted into the fragment without a reference, so CBS
    never freed it, leaking 35 KB per packet. Keep it in the context, as
    the other CBS-based encoders do.
---
 libavcodec/apv_encode_vulkan.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/libavcodec/apv_encode_vulkan.c b/libavcodec/apv_encode_vulkan.c
index 8c604241d4..d814eb72e8 100644
--- a/libavcodec/apv_encode_vulkan.c
+++ b/libavcodec/apv_encode_vulkan.c
@@ -105,6 +105,7 @@ typedef struct VulkanEncodeAPVContext {
     /* CBS used to assemble the output packet */
     CodedBitstreamContext *cbc;
     CodedBitstreamFragment au;
+    APVRawFrame raw_frame;
 
     FFVkEncodeLoop loop;
 
@@ -550,7 +551,7 @@ static int build_packet(AVCodecContext *avctx, 
FFVkExecContext *exec,
     VulkanEncodeAPVFrameData *fd = exec->opaque;
     FFVkBuffer *compacted_buf = fd->compacted_ref;
     FFVkBuffer *sizes_buf     = fd->sizes_ref;
-    APVRawFrame *raw_frame = NULL;
+    APVRawFrame *raw_frame = &ev->raw_frame;
 
     /* Wait for the GPU encode to finish */
     ff_vk_exec_wait(&ev->s, exec);
@@ -582,10 +583,7 @@ static int build_packet(AVCodecContext *avctx, 
FFVkExecContext *exec,
         sizes = (const uint32_t *)sizes_buf->mapped_mem;
     }
 
-    /* Allocate the cbs frame structure */
-    raw_frame = av_mallocz(sizeof(*raw_frame));
-    if (!raw_frame)
-        return AVERROR(ENOMEM);
+    memset(raw_frame, 0, sizeof(*raw_frame));
 
     raw_frame->pbu_header.pbu_type = APV_PBU_PRIMARY_FRAME;
     raw_frame->pbu_header.group_id = 1;
@@ -664,12 +662,8 @@ static int build_packet(AVCodecContext *avctx, 
FFVkExecContext *exec,
 
     err = ff_cbs_insert_unit_content(&ev->au, -1, APV_PBU_PRIMARY_FRAME,
                                      raw_frame, NULL);
-    if (err < 0) {
-        av_freep(&raw_frame);
+    if (err < 0)
         return err;
-    }
-    /* raw_frame is now owned by the fragment unit */
-    raw_frame = NULL;
 
     /* Assemble straight into the packet: ff_cbs_write_packet() hands pkt a
      * reference to CBS's own assembled buffer -- no copy. */

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to