mirror of
https://github.com/overte-org/overte.git
synced 2025-06-17 08:00:19 +02:00
fixed a for loop that erased elements while iterating
This commit is contained in:
parent
77c377711a
commit
100bc022ec
2 changed files with 7 additions and 3 deletions
|
@ -120,9 +120,10 @@ void AudioMixerClientData::checkBuffersBeforeFrameSend(int jitterBufferLengthSam
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioMixerClientData::pushBuffersAfterFrameSend() {
|
void AudioMixerClientData::pushBuffersAfterFrameSend() {
|
||||||
for (int i = 0; i < _ringBuffers.size(); i++) {
|
QList<PositionalAudioRingBuffer*>::iterator i = _ringBuffers.begin();
|
||||||
|
while (i != _ringBuffers.end()) {
|
||||||
// this was a used buffer, push the output pointer forwards
|
// this was a used buffer, push the output pointer forwards
|
||||||
PositionalAudioRingBuffer* audioBuffer = _ringBuffers[i];
|
PositionalAudioRingBuffer* audioBuffer = *i;
|
||||||
|
|
||||||
if (audioBuffer->willBeAddedToMix()) {
|
if (audioBuffer->willBeAddedToMix()) {
|
||||||
audioBuffer->shiftReadPosition(audioBuffer->isStereo()
|
audioBuffer->shiftReadPosition(audioBuffer->isStereo()
|
||||||
|
@ -133,7 +134,9 @@ void AudioMixerClientData::pushBuffersAfterFrameSend() {
|
||||||
&& audioBuffer->hasStarted() && audioBuffer->isStarved()) {
|
&& audioBuffer->hasStarted() && audioBuffer->isStarved()) {
|
||||||
// this is an empty audio buffer that has starved, safe to delete
|
// this is an empty audio buffer that has starved, safe to delete
|
||||||
delete audioBuffer;
|
delete audioBuffer;
|
||||||
_ringBuffers.erase(_ringBuffers.begin() + i);
|
i = _ringBuffers.erase(i);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
const int TIME_GAP_NUM_SAMPLES_IN_INTERVAL = 500;
|
const int TIME_GAP_NUM_SAMPLES_IN_INTERVAL = 500;
|
||||||
const int TIME_GAP_NUM_INTERVALS_IN_WINDOW = 10;
|
const int TIME_GAP_NUM_INTERVALS_IN_WINDOW = 10;
|
||||||
|
|
||||||
|
// class used to track time between incoming frames for the purpose of varying the jitter buffer length
|
||||||
class InterframeTimeGapHistory {
|
class InterframeTimeGapHistory {
|
||||||
public:
|
public:
|
||||||
InterframeTimeGapHistory();
|
InterframeTimeGapHistory();
|
||||||
|
|
Loading…
Reference in a new issue