[FFmpeg-cvslog] lavc/libaomenc: Add a maximum constraint of 64 encoder threads.

Jun Zhao git at videolan.org
Tue Jun 18 01:56:41 EEST 2019


ffmpeg | branch: release/4.1 | Jun Zhao <mypopydev at gmail.com> | Tue Nov 27 17:18:26 2018 +0800| [72f03b2af489af4c6d2efc6006629d1f2dabdead] | committer: James Almer

lavc/libaomenc: Add a maximum constraint of 64 encoder threads.

fixed the error in Intel(R) Xeon(R) Gold 6152 CPU like:
[libaom-av1 @ 0x469f340] Failed to initialize encoder: Invalid parameter
[libaom-av1 @ 0x469f340]   Additional information: g_threads out of range [..MAX_NUM_THREADS]

Signed-off-by: Jun Zhao <mypopydev at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>
(cherry picked from commit b87063c06dde35ef6b56f51df7642661a3b115da)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=72f03b2af489af4c6d2efc6006629d1f2dabdead
---

 libavcodec/libaomenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index c5458766cb..b2fcf31031 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -505,7 +505,8 @@ static av_cold int aom_init(AVCodecContext *avctx,
     enccfg.g_h            = avctx->height;
     enccfg.g_timebase.num = avctx->time_base.num;
     enccfg.g_timebase.den = avctx->time_base.den;
-    enccfg.g_threads      = avctx->thread_count ? avctx->thread_count : av_cpu_count();
+    enccfg.g_threads      =
+        FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), 64);
 
     if (ctx->lag_in_frames >= 0)
         enccfg.g_lag_in_frames = ctx->lag_in_frames;



More information about the ffmpeg-cvslog mailing list