diff mbox series

[FFmpeg-devel,6/7] fftools/ffmpeg: Avoid creating unnecessary reference

Message ID AM7PR03MB6660473EC23CD4EE00ED345C8F6A9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit fc01a703dea4fe4f2eff73480958ee6c75aa8c30
Headers show
Series [FFmpeg-devel,1/4] fftools/cmdutils: Atomically add elements to list of pointers, fix crash | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Dec. 3, 2021, 8:45 p.m. UTC
The only caller of do_video_out() doesn't need the frame afterwards,
ergo one can replace an av_frame_ref() by av_frame_move_ref().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 fftools/ffmpeg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 8c3a4f7c0c..638a6441c4 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1138,6 +1138,7 @@  static void do_subtitle_out(OutputFile *of,
     }
 }
 
+/* May modify/reset next_picture */
 static void do_video_out(OutputFile *of,
                          OutputStream *ost,
                          AVFrame *next_picture)
@@ -1421,8 +1422,7 @@  static void do_video_out(OutputFile *of,
 
     av_frame_unref(ost->last_frame);
     if (next_picture)
-        if (av_frame_ref(ost->last_frame, next_picture) < 0)
-            goto error;
+        av_frame_move_ref(ost->last_frame, next_picture);
 
     return;
 error: