summaryrefslogtreecommitdiff
path: root/libavcodec/pthread.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-04 01:12:34 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-04 01:12:34 +0100
commitad1c8dd6734f0aa7a7a87b4669a166715c114b46 (patch)
treec03c08f30bf1a7e8d9859abc48de3391bb05c6a0 /libavcodec/pthread.c
parentd6da16dca5a64ed7ab2db54710a0c703f179d3ba (diff)
parentfd16f567987524a769d5d4f1f69089f000386ac2 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: fate: add dxtory test adx_parser: rewrite. adxdec: Validate channel count to fix a division by zero. adxdec: Do not require extradata. cmdutils: K&R reformatting cosmetics alacdec: implement the 2-pass prediction type. alacenc: implement the 2-pass prediction type. alacenc: do not generate invalid multi-channel ALAC files alacdec: fill in missing or guessed info about the extradata format. utvideo: proper median prediction for interlaced videos lavu: bump lavu minor for av_popcount64 dca: K&R formatting cosmetics dct: K&R formatting cosmetics lavf: flush decoders in avformat_find_stream_info(). win32: detect number of CPUs using affinity Add av_popcount64 snow: Restore three mistakenly removed casts. Conflicts: cmdutils.c doc/APIchanges libavcodec/adx_parser.c libavcodec/adxdec.c libavcodec/alacenc.c libavutil/avutil.h tests/fate/screen.mak Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pthread.c')
-rw-r--r--libavcodec/pthread.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 717b865bae..d545f140ac 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -35,7 +35,7 @@
#define _GNU_SOURCE
#include <sched.h>
#endif
-#if HAVE_GETSYSTEMINFO
+#if HAVE_GETPROCESSAFFINITYMASK
#include <windows.h>
#endif
#if HAVE_SYSCTL
@@ -172,10 +172,11 @@ 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;
+#elif HAVE_GETPROCESSAFFINITYMASK
+ DWORD_PTR proc_aff, sys_aff;
+ ret = GetProcessAffinityMask(GetCurrentProcess(), &proc_aff, &sys_aff);
+ if (ret)
+ nb_cpus = av_popcount64(proc_aff);
#elif HAVE_SYSCTL && defined(HW_NCPU)
int mib[2] = { CTL_HW, HW_NCPU };
size_t len = sizeof(nb_cpus);