aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2018-10-27 13:09:27 -0700
committerJames Zern <jzern@google.com>2018-10-29 23:07:35 -0700
commit32d021cfa6520c53da23a10732f9ae9cf28ea948 (patch)
tree83a14e947a4742c23935abf5ec500c59796fc64f
parentf3bcb9c16a427934a681558a24202bd118e0aa06 (diff)
downloadffmpeg-32d021cfa6520c53da23a10732f9ae9cf28ea948.tar.gz
avcodec/libvpxdec: fix setting auto threads
a thread count of 0 is treated the same as 1, use av_cpu_count() to get the correct thread count when auto threads is requested. this matches the fix in libvpxenc: 27df34bf1f avcodec/libvpxenc: fix setting amount of threads used for encoding Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: James Zern <jzern@google.com>
-rw-r--r--libavcodec/libvpxdec.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index 04f27d3396..164dbda49b 100644
--- a/libavcodec/libvpxdec.c
+++ b/libavcodec/libvpxdec.c
@@ -47,8 +47,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
{
VPxContext *ctx = avctx->priv_data;
struct vpx_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", vpx_codec_version_str());