ref: 2f2801dc780701f361818aaad2b4bfb659f34685
parent: bd8b6af2b881170b902e6f31d5f7847293610494
parent: 276b585f03f994ba7557fb04454f9c40dfa312f5
author: Ethan Hugg <[email protected]>
date: Thu Mar 6 03:02:28 EST 2014
Merge pull request #434 from mstorsjo/threadlib-core-count-android Use the cpu-features NDK library for detecting the number of cores in WelsThreadLib
--- a/codec/common/WelsThreadLib.cpp
+++ b/codec/common/WelsThreadLib.cpp
@@ -55,6 +55,9 @@
#define HW_NCPU_NAME "hw.ncpu"
#endif
#endif
+#ifdef ANDROID_NDK
+#include <cpu-features.h>
+#endif
#include "WelsThreadLib.h"
#include <stdio.h>
@@ -414,7 +417,10 @@
}
WELS_THREAD_ERROR_CODE WelsQueryLogicalProcessInfo (WelsLogicalProcessInfo* pInfo) {
-#ifdef LINUX
+#ifdef ANDROID_NDK
+ pInfo->ProcessorCount = android_getCpuCount();
+ return WELS_THREAD_ERROR_OK;
+#elif defined(LINUX)
cpu_set_t cpuset;