limit audio pool to sane thread count

This commit is contained in:
Zach Pomerantz 2016-12-06 23:57:38 +00:00
parent 259775e163
commit 28960681d9

View file

@ -129,7 +129,8 @@ void AudioMixerSlavePool::setNumThreads(int numThreads) {
int maxThreads = QThread::idealThreadCount();
if (maxThreads == -1) {
// idealThreadCount returns -1 if cores cannot be detected
maxThreads = std::numeric_limits<int>::max();
static const int MAX_THREADS_IF_UNKNOWN = 4;
maxThreads = MAX_THREADS_IF_UNKNOWN;
}
int clampedThreads = std::min(std::max(1, numThreads), maxThreads);