[FFmpeg-cvslog] lavfi/framesync: avoid forcing frame writability unnecessarily

Anton Khirnov git at videolan.org
Wed Jul 31 12:13:21 EEST 2024


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Jul 24 17:10:41 2024 +0200| [43f702a2532c7ddd84160a0a46ed36ad6f4b7c0a] | committer: Anton Khirnov

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

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

 libavfilter/framesync.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c
index 535fbe9c7c..8e06e0e700 100644
--- a/libavfilter/framesync.c
+++ b/libavfilter/framesync.c
@@ -273,7 +273,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;
@@ -291,10 +290,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;
         }



More information about the ffmpeg-cvslog mailing list