diff options
author | Owen Williams <owilliams@mixxx.org> | 2019-12-30 15:52:23 -0500 |
---|---|---|
committer | Owen Williams <owilliams@mixxx.org> | 2019-12-30 15:52:23 -0500 |
commit | bcf5f7d9911beb66d75ebd0a5756b6ef869fb3e4 (patch) | |
tree | f12717ddffc7459ea4d8d2b55a7b4bf4bca8a48a /src/mixer/playermanager.cpp | |
parent | 7d4a6bd043e0aec7cb36d05b49ae7d3589bee867 (diff) |
Master Sync: preallocate buffers in engine thread func.
pickMaster gets called from the engine thread so we have to be careful to
avoid memory allocation. Preallocating a constant number fixes this.
Also make kMaxNumberOfDecks a proper mixxx-global value, and check against
it when we add decks. If someone one day invents a skin that uses 6 or 8
decks, this warning will get tripped (but shouldn't break anything
fundamental in Mixxx).
Diffstat (limited to 'src/mixer/playermanager.cpp')
-rw-r--r-- | src/mixer/playermanager.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mixer/playermanager.cpp b/src/mixer/playermanager.cpp index 5240f71210..d377a9538a 100644 --- a/src/mixer/playermanager.cpp +++ b/src/mixer/playermanager.cpp @@ -20,6 +20,7 @@ #include "soundio/soundmanager.h" #include "track/track.h" #include "util/assert.h" +#include "util/defs.h" #include "util/logger.h" #include "util/stat.h" #include "util/sleepableqthread.h" @@ -268,6 +269,12 @@ void PlayerManager::slotChangeNumDecks(double v) { QMutexLocker locker(&m_mutex); int num = (int)v; + VERIFY_OR_DEBUG_ASSERT(num <= kMaxNumberOfDecks) { + qWarning() << "Number of decks exceeds the maximum we expect." + << num << "vs" << kMaxNumberOfDecks + << " Please update util/defs.h"; + } + // Update the soundmanager config even if the number of decks has been // reduced. m_pSoundManager->setConfiguredDeckCount(num); |