From 309c3a0e81be553626711912e90015c26f4b09ba Mon Sep 17 00:00:00 2001 From: James Almer Date: Thu, 13 Sep 2018 13:26:00 -0300 Subject: avcodec/libaom: fix setting amount of threads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The libaom doxy says that a value of 0 for the threads fields is equivalent to a value of 1, whereas for avctx->thread_count it means the maximum amount of threads possible for the host system. Use av_cpu_count() to get the correct thread count when auto threads is requested. Reviewed-by: Jan Ekström Signed-off-by: James Almer --- libavcodec/libaomenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavcodec/libaomenc.c') diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index bbf4cf8b64..6a79d9b873 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -319,7 +319,7 @@ 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; + enccfg.g_threads = avctx->thread_count ? avctx->thread_count : av_cpu_count(); if (ctx->lag_in_frames >= 0) enccfg.g_lag_in_frames = ctx->lag_in_frames; -- cgit v1.2.3