mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 03:58:07 +02:00
remove mixer cutoff strategy for testing
This commit is contained in:
parent
5ae63c5b0f
commit
24e9446814
2 changed files with 1 additions and 54 deletions
|
@ -370,50 +370,6 @@ void AudioMixer::run() {
|
||||||
_maxSourceLoudnessInFrame);
|
_maxSourceLoudnessInFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const float STRUGGLE_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD = 0.10;
|
|
||||||
const float BACK_OFF_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD = 0.30;
|
|
||||||
const float CUTOFF_EPSILON = 0.0001;
|
|
||||||
|
|
||||||
const int TRAILING_AVERAGE_FRAMES = 100;
|
|
||||||
const float CURRENT_FRAME_RATIO = 1.0f / TRAILING_AVERAGE_FRAMES;
|
|
||||||
const float PREVIOUS_FRAMES_RATIO = 1 - CURRENT_FRAME_RATIO;
|
|
||||||
|
|
||||||
if (usecToSleep < 0) {
|
|
||||||
usecToSleep = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
_trailingSleepRatio = (PREVIOUS_FRAMES_RATIO * _trailingSleepRatio)
|
|
||||||
+ (usecToSleep * CURRENT_FRAME_RATIO / (float) BUFFER_SEND_INTERVAL_USECS);
|
|
||||||
|
|
||||||
float lastCutoffRatio = _loudnessCutoffRatio;
|
|
||||||
bool hasRatioChanged = false;
|
|
||||||
|
|
||||||
if (_trailingSleepRatio <= STRUGGLE_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD) {
|
|
||||||
// we're struggling - change our min required loudness to reduce some load
|
|
||||||
_loudnessCutoffRatio += (1 - _loudnessCutoffRatio) / 2;
|
|
||||||
|
|
||||||
qDebug() << "Mixer is struggling, sleeping" << _trailingSleepRatio * 100 << "% of frame time. Old cutoff was"
|
|
||||||
<< lastCutoffRatio << "and is now" << _loudnessCutoffRatio;
|
|
||||||
hasRatioChanged = true;
|
|
||||||
} else if (_trailingSleepRatio >= BACK_OFF_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD && _loudnessCutoffRatio != 0) {
|
|
||||||
// we've recovered and can back off the required loudness
|
|
||||||
_loudnessCutoffRatio -= _loudnessCutoffRatio / 2;
|
|
||||||
|
|
||||||
if (_loudnessCutoffRatio < CUTOFF_EPSILON) {
|
|
||||||
_loudnessCutoffRatio = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
qDebug() << "Mixer is recovering, sleeping" << _trailingSleepRatio * 100 << "% of frame time. Old cutoff was"
|
|
||||||
<< lastCutoffRatio << "and is now" << _loudnessCutoffRatio;
|
|
||||||
hasRatioChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasRatioChanged) {
|
|
||||||
// set out min required loudness from the new ratio
|
|
||||||
_minRequiredLoudness = _loudnessCutoffRatio * (_maxSourceLoudnessInFrame - _minSourceLoudnessInFrame);
|
|
||||||
qDebug() << "Minimum loudness required to be mixed is now" << _minRequiredLoudness;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
|
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
|
||||||
if (node->getType() == NodeType::Agent && node->getActiveSocket() && node->getLinkedData()
|
if (node->getType() == NodeType::Agent && node->getActiveSocket() && node->getLinkedData()
|
||||||
|
|
|
@ -96,16 +96,7 @@ void AudioMixerClientData::checkBuffersBeforeFrameSend(int jitterBufferLengthSam
|
||||||
// calculate the average loudness for the next NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL
|
// calculate the average loudness for the next NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL
|
||||||
// that would be mixed in
|
// that would be mixed in
|
||||||
_ringBuffers[i]->updateAverageLoudnessForBoundarySamples(NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
|
_ringBuffers[i]->updateAverageLoudnessForBoundarySamples(NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
|
||||||
|
|
||||||
float ringBufferLoudness = _ringBuffers[i]->getAverageLoudness();
|
|
||||||
|
|
||||||
if (ringBufferLoudness != 0 && ringBufferLoudness < currentMinLoudness) {
|
|
||||||
currentMinLoudness = ringBufferLoudness;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ringBufferLoudness > currentMaxLoudness) {
|
|
||||||
currentMaxLoudness = ringBufferLoudness;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue