[FFmpeg-devel] [PATCH 1/6] avcodec/avcodec: Move initializing frame-thrd encoder to encode_preinit
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Mon Aug 15 07:39:23 EEST 2022
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
> libavcodec/avcodec.c | 6 ------
> libavcodec/encode.c | 6 ++++++
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
> index f82d9e9f74..0451f57f82 100644
> --- a/libavcodec/avcodec.c
> +++ b/libavcodec/avcodec.c
> @@ -283,12 +283,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
> if (ret < 0)
> goto free_and_end;
>
> - if (CONFIG_FRAME_THREAD_ENCODER && av_codec_is_encoder(avctx->codec)) {
> - ret = ff_frame_thread_encoder_init(avctx);
> - if (ret < 0)
> - goto free_and_end;
> - }
> -
> if (HAVE_THREADS
> && !(avci->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))) {
> /* Frame-threaded decoders call FFCodec.init for their child contexts. */
> diff --git a/libavcodec/encode.c b/libavcodec/encode.c
> index 7919b165da..bd66f138a3 100644
> --- a/libavcodec/encode.c
> +++ b/libavcodec/encode.c
> @@ -668,6 +668,12 @@ int ff_encode_preinit(AVCodecContext *avctx)
> return AVERROR(ENOMEM);
> }
>
> + if (CONFIG_FRAME_THREAD_ENCODER) {
> + ret = ff_frame_thread_encoder_init(avctx);
> + if (ret < 0)
> + return ret;
> + }
> +
> return 0;
> }
>
Will apply this patchset tonight unless there are objections.
- Andreas
More information about the ffmpeg-devel
mailing list