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 238df21a4f avfilter/vf_libplacebo: early-free unused resources
238df21a4f is described below

commit 238df21a4f94e30fb3225246db025e410e897965
Author:     Niklas Haas <[email protected]>
AuthorDate: Wed Mar 25 16:57:58 2026 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Wed Mar 25 17:47:09 2026 +0000

    avfilter/vf_libplacebo: early-free unused resources
    
    Otherwise, this will indefinitely persist the last couple of mapped frames
    (including any extra decoded frames) in memory, even though they will never 
be
    used again, causing a gradual memory leak until filter uninit.
    
    Signed-off-by: Niklas Haas <[email protected]>
    Sponsored-by: nxtedition AB
---
 libavfilter/vf_libplacebo.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 316eca37ec..b01a2f6eeb 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -1114,6 +1114,8 @@ props_done:
     struct pl_render_params tmp_params = opts->params;
     for (int i = 0; i < s->nb_inputs; i++) {
         LibplaceboInput *in = &s->inputs[i];
+        if (!in->renderer)
+            continue; /* input was already freed */
         FilterLink *il = ff_filter_link(ctx->inputs[i]);
         FilterLink *ol = ff_filter_link(outlink);
         int high_fps = av_cmp_q(il->frame_rate, ol->frame_rate) >= 0;
@@ -1293,6 +1295,9 @@ static int libplacebo_activate(AVFilterContext *ctx)
             LibplaceboInput *in = &s->inputs[i];
             FilterLink *l = ff_filter_link(outlink);
             if (in->status && out_pts >= in->status_pts) {
+                /* Free up resources which will never be needed again */
+                pl_renderer_destroy(&in->renderer);
+                pl_queue_destroy(&in->queue);
                 in->qstatus = PL_QUEUE_EOF;
                 continue;
             }

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to