From b272c2840bbc0b709895c1e5df6fe18749ee8030 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 24 Jul 2024 17:10:41 +0200 Subject: [PATCH] lavfi/framesync: avoid forcing frame writability unnecessarily Callers of ff_framesync_get_frame() generally do not expect the result to be writable, those that do (e.g. ff_framesync_dualinput_get_writable()) ensure writability themselves. Significantly reduces memory consumption in complex graphs with framesync-based filters (e.g. scale, ssim). Reported-By: Mark Shwartzman Signed-off-by: Paul B Mahol --- libavfilter/framesync.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c index 28a992ba6d..0d5779f830 100644 --- a/libavfilter/framesync.c +++ b/libavfilter/framesync.c @@ -272,7 +272,6 @@ int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, AVFrame *frame; unsigned need_copy = 0, i; int64_t pts_next; - int ret; if (!fs->in[in].frame) { *rframe = NULL; @@ -290,10 +289,6 @@ int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, if (need_copy) { if (!(frame = av_frame_clone(frame))) return AVERROR(ENOMEM); - if ((ret = ff_inlink_make_frame_writable(fs->parent->inputs[in], &frame)) < 0) { - av_frame_free(&frame); - return ret; - } } else { fs->in[in].frame = NULL; }