[FFmpeg-cvslog] avfilter/buffersrc: Use av_frame_clone() where appropriate

Andreas Rheinhardt git at videolan.org
Sun Sep 10 12:30:30 EEST 2023


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Sep  7 12:07:30 2023 +0200| [67cc7aaa51fcd781ac5920d3c739e28c81cbb0cb] | committer: Andreas Rheinhardt

avfilter/buffersrc: Use av_frame_clone() where appropriate

Reviewed-by: Nicolas George <george at nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavfilter/buffersrc.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index ea50713701..453fc0fd5c 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -230,17 +230,14 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
     }
 
-    if (!(copy = av_frame_alloc()))
-        return AVERROR(ENOMEM);
-
     if (refcounted && !(flags & AV_BUFFERSRC_FLAG_KEEP_REF)) {
+        if (!(copy = av_frame_alloc()))
+            return AVERROR(ENOMEM);
         av_frame_move_ref(copy, frame);
     } else {
-        ret = av_frame_ref(copy, frame);
-        if (ret < 0) {
-            av_frame_free(&copy);
-            return ret;
-        }
+        copy = av_frame_clone(frame);
+        if (!copy)
+            return AVERROR(ENOMEM);
     }
 
 #if FF_API_PKT_DURATION



More information about the ffmpeg-cvslog mailing list