diff mbox series

[FFmpeg-devel,1/6] avcodec/avcodec: Move initializing frame-thrd encoder to encode_preinit

Message ID DB6PR0101MB2214C632370E0797AA58A52F8F669@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com
State Accepted
Commit 30408768335403114d1ed2e80f8032683f85602a
Headers show
Series [FFmpeg-devel,1/6] avcodec/avcodec: Move initializing frame-thrd encoder to encode_preinit | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 13, 2022, 2:58 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/avcodec.c | 6 ------
 libavcodec/encode.c  | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Andreas Rheinhardt Aug. 15, 2022, 4:39 a.m. UTC | #1
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@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
diff mbox series

Patch

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;
 }