avcodec/libvpxenc: Add a maximum constraint of 16 encoder threads.
authorChirag Lathia <clathia@google.com>
Thu, 15 Nov 2018 18:51:32 +0000 (10:51 -0800)
committerJames Almer <jamrial@gmail.com>
Fri, 16 Nov 2018 00:25:53 +0000 (21:25 -0300)
Signed-off-by: Chirag Lathia <clathia@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/libvpxenc.c

index ad440a9..da9b9c6 100644 (file)
@@ -497,7 +497,8 @@ static av_cold int vpx_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(), 16);
     enccfg.g_lag_in_frames= ctx->lag_in_frames;
 
     if (avctx->flags & AV_CODEC_FLAG_PASS1)