mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 09:29:16 +02:00
Fix domain settings not getting cleared on re-assignment
This commit is contained in:
parent
9a4b624029
commit
cde7d68570
2 changed files with 20 additions and 3 deletions
|
@ -38,13 +38,14 @@
|
|||
#include "AudioMixer.h"
|
||||
|
||||
static const float DEFAULT_ATTENUATION_PER_DOUBLING_IN_DISTANCE = 0.5f; // attenuation = -6dB * log2(distance)
|
||||
static const int DEFAULT_NUM_STATIC_JITTER_FRAMES = -1;
|
||||
static const float DEFAULT_NOISE_MUTING_THRESHOLD = 1.0f;
|
||||
static const QString AUDIO_MIXER_LOGGING_TARGET_NAME = "audio-mixer";
|
||||
static const QString AUDIO_ENV_GROUP_KEY = "audio_env";
|
||||
static const QString AUDIO_BUFFER_GROUP_KEY = "audio_buffer";
|
||||
static const QString AUDIO_THREADING_GROUP_KEY = "audio_threading";
|
||||
|
||||
int AudioMixer::_numStaticJitterFrames{ -1 };
|
||||
int AudioMixer::_numStaticJitterFrames{ DEFAULT_NUM_STATIC_JITTER_FRAMES };
|
||||
float AudioMixer::_noiseMutingThreshold{ DEFAULT_NOISE_MUTING_THRESHOLD };
|
||||
float AudioMixer::_attenuationPerDoublingInDistance{ DEFAULT_ATTENUATION_PER_DOUBLING_IN_DISTANCE };
|
||||
std::map<QString, std::shared_ptr<CodecPlugin>> AudioMixer::_availableCodecs{ };
|
||||
|
@ -56,7 +57,12 @@ QVector<AudioMixer::ReverbSettings> AudioMixer::_zoneReverbSettings;
|
|||
AudioMixer::AudioMixer(ReceivedMessage& message) :
|
||||
ThreadedAssignment(message) {
|
||||
|
||||
// Always clear settings first
|
||||
// This prevents previous assignment settings from sticking around
|
||||
clearDomainSettings();
|
||||
|
||||
// hash the available codecs (on the mixer)
|
||||
_availableCodecs.clear(); // Make sure struct is clean
|
||||
auto codecPlugins = PluginManager::getInstance()->getCodecPlugins();
|
||||
std::for_each(codecPlugins.cbegin(), codecPlugins.cend(),
|
||||
[&](const CodecPluginPointer& codec) {
|
||||
|
@ -232,7 +238,7 @@ void AudioMixer::sendStatsPacket() {
|
|||
}
|
||||
|
||||
// general stats
|
||||
statsObject["useDynamicJitterBuffers"] = _numStaticJitterFrames == -1;
|
||||
statsObject["useDynamicJitterBuffers"] = _numStaticJitterFrames == DEFAULT_NUM_STATIC_JITTER_FRAMES;
|
||||
|
||||
statsObject["threads"] = _slavePool.numThreads();
|
||||
|
||||
|
@ -490,6 +496,16 @@ int AudioMixer::prepareFrame(const SharedNodePointer& node, unsigned int frame)
|
|||
return data->checkBuffersBeforeFrameSend();
|
||||
}
|
||||
|
||||
void AudioMixer::clearDomainSettings() {
|
||||
_numStaticJitterFrames = DEFAULT_NUM_STATIC_JITTER_FRAMES;
|
||||
_attenuationPerDoublingInDistance = DEFAULT_ATTENUATION_PER_DOUBLING_IN_DISTANCE;
|
||||
_noiseMutingThreshold = DEFAULT_NOISE_MUTING_THRESHOLD;
|
||||
_codecPreferenceOrder.clear();
|
||||
_audioZones.clear();
|
||||
_zoneSettings.clear();
|
||||
_zoneReverbSettings.clear();
|
||||
}
|
||||
|
||||
void AudioMixer::parseSettingsObject(const QJsonObject &settingsObject) {
|
||||
qDebug() << "AVX2 Support:" << (cpuSupportsAVX2() ? "enabled" : "disabled");
|
||||
|
||||
|
@ -525,7 +541,7 @@ void AudioMixer::parseSettingsObject(const QJsonObject &settingsObject) {
|
|||
qDebug() << "Static desired jitter buffer frames:" << _numStaticJitterFrames;
|
||||
} else {
|
||||
qDebug() << "Disabling dynamic jitter buffers.";
|
||||
_numStaticJitterFrames = -1;
|
||||
_numStaticJitterFrames = DEFAULT_NUM_STATIC_JITTER_FRAMES;
|
||||
}
|
||||
|
||||
// check for deprecated audio settings
|
||||
|
|
|
@ -79,6 +79,7 @@ private:
|
|||
QString percentageForMixStats(int counter);
|
||||
|
||||
void parseSettingsObject(const QJsonObject& settingsObject);
|
||||
void clearDomainSettings();
|
||||
|
||||
float _trailingMixRatio { 0.0f };
|
||||
float _throttlingRatio { 0.0f };
|
||||
|
|
Loading…
Reference in a new issue