aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/libaomdec.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-09-13 13:26:00 -0300
committerJames Almer <jamrial@gmail.com>2018-09-13 13:44:45 -0300
commit309c3a0e81be553626711912e90015c26f4b09ba (patch)
treec59533b618d88a3a919b52134266295e8776fada /libavcodec/libaomdec.c
parent776cdd1dc8e1dd653459b196aae229155a6d8470 (diff)
downloadffmpeg-309c3a0e81be553626711912e90015c26f4b09ba.tar.gz
avcodec/libaom: fix setting amount of threads
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 <jeebjp@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/libaomdec.c')
-rw-r--r--libavcodec/libaomdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c
index 6a2de6d47a..2530c9f76b 100644
--- a/libavcodec/libaomdec.c
+++ b/libavcodec/libaomdec.c
@@ -43,7 +43,7 @@ static av_cold int aom_init(AVCodecContext *avctx,
AV1DecodeContext *ctx = avctx->priv_data;
struct aom_codec_dec_cfg deccfg = {
/* token partitions+1 would be a decent choice */
- .threads = FFMIN(avctx->thread_count, 16)
+ .threads = FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), 16)
};
av_log(avctx, AV_LOG_INFO, "%s\n", aom_codec_version_str());