process any new events at beginning of Assignment while loop

This commit is contained in:
Stephen Birarda 2013-12-03 10:07:40 -08:00
parent 02732e9a2e
commit 6d162ff7a7

View file

@ -304,13 +304,12 @@ void AudioMixer::run() {
while (!_isFinished) {
// get the NodeList to ping any inactive nodes, for hole punching
nodeList->possiblyPingInactiveNodes();
int numBytesPacketHeader = numBytesForPacketHeader((unsigned char*) &PACKET_TYPE_MIXED_AUDIO);
unsigned char clientPacket[BUFFER_LENGTH_BYTES_STEREO + numBytesPacketHeader];
populateTypeAndVersion(clientPacket, PACKET_TYPE_MIXED_AUDIO);
QCoreApplication::processEvents();
if (_isFinished) {
break;
}
for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
if (node->getLinkedData()) {
((AudioMixerClientData*) node->getLinkedData())->checkBuffersBeforeFrameSend(JITTER_BUFFER_SAMPLES);
@ -336,7 +335,8 @@ void AudioMixer::run() {
}
}
QCoreApplication::processEvents();
// get the NodeList to ping any inactive nodes, for hole punching
nodeList->possiblyPingInactiveNodes();
int usecToSleep = usecTimestamp(&startTime) + (++nextFrame * BUFFER_SEND_INTERVAL_USECS) - usecTimestampNow();