summaryrefslogtreecommitdiff
path: root/libavcodec/libaomenc.c
diff options
context:
space:
mode:
authorJun Zhao <mypopydev@gmail.com>2018-11-27 17:18:26 +0800
committerJames Almer <jamrial@gmail.com>2018-11-29 21:37:49 -0300
commitb87063c06dde35ef6b56f51df7642661a3b115da (patch)
treee3332b856ebb6b809b284449b8386c5c4d5b643d /libavcodec/libaomenc.c
parente695b0beba4aab5c1197d1bc96eef1f42635c423 (diff)
downloadffmpeg-b87063c06dde35ef6b56f51df7642661a3b115da.tar.gz
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@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/libaomenc.c')
-rw-r--r--libavcodec/libaomenc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index cb31c55825..17565017b4 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -504,7 +504,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;