diff --git a/webrtc/system_wrappers/source/cpu_info.cc b/webrtc/system_wrappers/source/cpu_info.cc index 54fb8d5430..9e2628abc9 100644 --- a/webrtc/system_wrappers/source/cpu_info.cc +++ b/webrtc/system_wrappers/source/cpu_info.cc @@ -15,11 +15,8 @@ #elif defined(WEBRTC_MAC) #include #include -#elif defined(WEBRTC_ANDROID) -// Not implemented yet, might be possible to use Linux implementation -#else // defined(WEBRTC_LINUX) -#include -#include // required for get_nprocs() with uClibc +#else // defined(WEBRTC_LINUX) or defined(WEBRTC_ANDROID) +#include #endif #include "webrtc/system_wrappers/interface/trace.h" @@ -37,8 +34,8 @@ uint32_t CpuInfo::DetectNumberOfCores() { WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1, "Available number of cores:%d", number_of_cores_); -#elif defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) - number_of_cores_ = get_nprocs(); +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID) + number_of_cores_ = static_cast(sysconf(_SC_NPROCESSORS_ONLN)); WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1, "Available number of cores:%d", number_of_cores_);