---
 configure            |    2 ++
 libavcodec/pthread.c |    6 ++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 3871a5b..fcae90d 100755
--- a/configure
+++ b/configure
@@ -1086,6 +1086,7 @@ HAVE_LIST="
     gethrtime
     GetProcessMemoryInfo
     GetProcessTimes
+    GetSystemInfo
     getrusage
     gnu_as
     ibm_asm
@@ -2861,6 +2862,7 @@ check_func_headers io.h setmode
 check_func_headers lzo/lzo1x.h lzo1x_999_compress
 check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
 check_func_headers windows.h GetProcessTimes
+check_func_headers windows.h GetSystemInfo
 check_func_headers windows.h MapViewOfFile
 check_func_headers windows.h VirtualAlloc
 
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index ebc0514..38ebba7 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -33,6 +33,8 @@
 
 #if HAVE_SYSCONF
 #include <unistd.h> /* for sysconf and _SC_NPROCESSORS_ONLN */
+#elif HAVE_GETSYSTEMINFO
+#include <windows.h>
 #endif
 
 #include "avcodec.h"
@@ -927,6 +929,10 @@ int ff_thread_init(AVCodecContext *avctx)
     if (!avctx->thread_count) {
 #if HAVE_SYSCONF && defined(_SC_NPROCESSORS_ONLN)
         avctx->thread_count = sysconf(_SC_NPROCESSORS_ONLN);
+#elif HAVE_GETSYSTEMINFO
+        SYSTEM_INFO sysinfo;
+        GetSystemInfo(&sysinfo);
+        avctx->thread_count = sysinfo.dwNumberOfProcessors;
 #endif
         av_log(avctx, AV_LOG_DEBUG, "using %d threads\n", avctx->thread_count);
     }
-- 
1.7.8

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to