mirror of
https://github.com/lubosz/overte.git
synced 2025-04-15 17:20:29 +02:00
Merge pull request #14417 from birarda/feat/throttle-in-domain-settings
add throttle start and backoff to DS settings
This commit is contained in:
commit
4fc43e197c
3 changed files with 41 additions and 6 deletions
|
@ -488,11 +488,8 @@ void AudioMixer::throttle(chrono::microseconds duration, int frame) {
|
|||
|
||||
// target different mix and backoff ratios (they also have different backoff rates)
|
||||
// this is to prevent oscillation, and encourage throttling to find a steady state
|
||||
const float TARGET = 0.9f;
|
||||
// on a "regular" machine with 100 avatars, this is the largest value where
|
||||
// - overthrottling can be recovered
|
||||
// - oscillations will not occur after the recovery
|
||||
const float BACKOFF_TARGET = 0.44f;
|
||||
const float TARGET = _throttleStartTarget;
|
||||
const float BACKOFF_TARGET = _throttleBackoffTarget;
|
||||
|
||||
// the mixer is known to struggle at about 80 on a "regular" machine
|
||||
// so throttle 2/80 the streams to ensure smooth audio (throttling is linear)
|
||||
|
@ -551,6 +548,24 @@ void AudioMixer::parseSettingsObject(const QJsonObject& settingsObject) {
|
|||
_slavePool.setNumThreads(numThreads);
|
||||
}
|
||||
}
|
||||
|
||||
const QString THROTTLE_START_KEY = "throttle_start";
|
||||
const QString THROTTLE_BACKOFF_KEY = "throttle_backoff";
|
||||
|
||||
float settingsThrottleStart = audioThreadingGroupObject[THROTTLE_START_KEY].toDouble(_throttleStartTarget);
|
||||
float settingsThrottleBackoff = audioThreadingGroupObject[THROTTLE_BACKOFF_KEY].toDouble(_throttleBackoffTarget);
|
||||
|
||||
if (settingsThrottleBackoff > settingsThrottleStart) {
|
||||
qCWarning(audio) << "Throttle backoff target cannot be higher than throttle start target. Using default values.";
|
||||
} else if (settingsThrottleBackoff < 0.0f || settingsThrottleStart > 1.0f) {
|
||||
qCWarning(audio) << "Throttle start and backoff targets must be greater than or equal to 0.0"
|
||||
<< "and lesser than or equal to 1.0. Using default values.";
|
||||
} else {
|
||||
_throttleStartTarget = settingsThrottleStart;
|
||||
_throttleBackoffTarget = settingsThrottleBackoff;
|
||||
}
|
||||
|
||||
qCDebug(audio) << "Throttle Start:" << _throttleStartTarget << "Throttle Backoff:" << _throttleBackoffTarget;
|
||||
}
|
||||
|
||||
if (settingsObject.contains(AUDIO_BUFFER_GROUP_KEY)) {
|
||||
|
|
|
@ -144,11 +144,13 @@ private:
|
|||
static std::map<QString, CodecPluginPointer> _availableCodecs;
|
||||
static QStringList _codecPreferenceOrder;
|
||||
|
||||
|
||||
static std::vector<ZoneDescription> _audioZones;
|
||||
static std::vector<ZoneSettings> _zoneSettings;
|
||||
static std::vector<ReverbSettings> _zoneReverbSettings;
|
||||
|
||||
float _throttleStartTarget = 0.9f;
|
||||
float _throttleBackoffTarget = 0.44f;
|
||||
|
||||
AudioMixerSlave::SharedData _workerSharedData;
|
||||
};
|
||||
|
||||
|
|
|
@ -1012,6 +1012,24 @@
|
|||
"placeholder": "1",
|
||||
"default": "1",
|
||||
"advanced": true
|
||||
},
|
||||
{
|
||||
"name": "throttle_start",
|
||||
"type": "double",
|
||||
"label": "Throttle Start Target",
|
||||
"help": "Target percentage of frame time to start throttling",
|
||||
"placeholder": "0.9",
|
||||
"default": 0.9,
|
||||
"advanced": true
|
||||
},
|
||||
{
|
||||
"name": "throttle_backoff",
|
||||
"type": "double",
|
||||
"label": "Throttle Backoff Target",
|
||||
"help": "Target percentage of frame time to backoff throttling",
|
||||
"placeholder": "0.44",
|
||||
"default": 0.44,
|
||||
"advanced": true
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue