[FFmpeg-devel] [PATCH] avcodec/libvpxdec: fix setting auto threads

James Zern jzern at google.com
Sat Oct 27 23:52:14 EEST 2018


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

Signed-off-by: James Zern <jzern at google.com>
---
 libavcodec/libvpxdec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index 04f27d3396..5193ac51c3 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 = avctx->thread_count ? avctx->thread_count : av_cpu_count()
     };
 
     av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str());
-- 
2.19.1.568.g152ad8e336-goog



More information about the ffmpeg-devel mailing list