aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/pthread.c
diff options
context:
space:
mode:
authorJanne Grunau <janne-libav@jannau.net>2011-12-21 01:26:19 +0100
committerJanne Grunau <janne-libav@jannau.net>2011-12-22 21:50:07 +0100
commitad29ecbff0aa41adc535c118cbd956b93dab7289 (patch)
tree56d06ae15e051a94b9ec9dcadcafc9362cfe453d /libavcodec/pthread.c
parentea4d5f48373ab856e01a3cf05426db6e823e01d1 (diff)
downloadffmpeg-ad29ecbff0aa41adc535c118cbd956b93dab7289.tar.gz
windows: use number of CPUs as automatic thread count
Diffstat (limited to 'libavcodec/pthread.c')
-rw-r--r--libavcodec/pthread.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 1800f291d7..bf6733fe7f 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -34,6 +34,8 @@
#if HAVE_SCHED_GETAFFINITY
#define _GNU_SOURCE
#include <sched.h>
+#elif HAVE_GETSYSTEMINFO
+#include <windows.h>
#endif
#include "avcodec.h"
@@ -156,6 +158,10 @@ static int get_logical_cpus(AVCodecContext *avctx)
if (!ret) {
nb_cpus = CPU_COUNT(&cpuset);
}
+#elif HAVE_GETSYSTEMINFO
+ SYSTEM_INFO sysinfo;
+ GetSystemInfo(&sysinfo);
+ nb_cpus = sysinfo.dwNumberOfProcessors;
#endif
av_log(avctx, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus);
return FFMIN(nb_cpus, MAX_AUTO_THREADS);