Commit 32d021cf authored by James Zern's avatar James Zern

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:
27df34bf avcodec/libvpxenc: fix setting amount of threads used for encoding
Reviewed-by: 's avatarJames Almer <jamrial@gmail.com>
Signed-off-by: 's avatarJames Zern <jzern@google.com>
parent f3bcb9c1
......@@ -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());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment