[FFmpeg-devel] [PATCH 10/11] avcodec/encode: Avoid unreferencing blank AVFrames
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Fri Sep 2 23:16:42 EEST 2022
Andreas Rheinhardt:
> ff_thread_video_encode_frame() already returns blank frames.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
> libavcodec/encode.c | 7 +++----
> 1 file 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;
> }
>
Will apply the remaining patches of this patchset tomorrow unless there
are objections.
- Andreas
More information about the ffmpeg-devel
mailing list