mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Stricter sysconf(_SC_NPROCESSORS_ONLN) output check.
While the output should never be 0, in case it is, DetectNumberOfCores() can crash because of an RTC_CHECK. Let's fall back on the default value of 1 instead. Bug: chromium:1282179 Change-Id: Ice083bff4222bbe7e92d789293a7c7b01b7fbd5d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/244088 Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35614}
This commit is contained in:
parent
7336422fe3
commit
fb8a3e4f6c
1 changed files with 1 additions and 1 deletions
|
@ -32,7 +32,7 @@ static int DetectNumberOfCores() {
|
|||
number_of_cores = static_cast<int>(si.dwNumberOfProcessors);
|
||||
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
|
||||
number_of_cores = static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN));
|
||||
if (number_of_cores < 0) {
|
||||
if (number_of_cores <= 0) {
|
||||
RTC_LOG(LS_ERROR) << "Failed to get number of cores";
|
||||
number_of_cores = 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue