aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/encode.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-08-25 18:42:10 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-09-03 15:41:19 +0200
commit25ea90b733883d0cbfdb76014b619a1b37489fca (patch)
treea922ee8852d94a2bbd63925df69eab4e42c5b50f /libavcodec/encode.c
parent1a5cd79f518268203c4fff7c664b387e5720f1f4 (diff)
downloadffmpeg-25ea90b733883d0cbfdb76014b619a1b37489fca.tar.gz
avcodec/encode: Avoid unreferencing blank AVFrames
ff_thread_video_encode_frame() already returns blank frames. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/encode.c')
-rw-r--r--libavcodec/encode.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 2c02b24cf2..8c6d81286c 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -263,18 +263,17 @@ static int encode_simple_internal(AVCodecContext *avctx, AVPacket *avpkt)
av_assert0(codec->cb_type == FF_CODEC_CB_TYPE_ENCODE);
if (CONFIG_FRAME_THREAD_ENCODER && avci->frame_thread_encoder)
- /* This might unref frame. */
+ /* This will unref frame. */
ret = ff_thread_video_encode_frame(avctx, avpkt, frame, &got_packet);
else {
ret = ff_encode_encode_cb(avctx, avpkt, frame, &got_packet);
+ if (frame)
+ av_frame_unref(frame);
}
if (avci->draining && !got_packet)
avci->draining_done = 1;
- if (frame)
- av_frame_unref(frame);
-
return ret;
}