Merge pull request #449 from birarda/mixer-crash

temporary fix for mixer crash
This commit is contained in:
ZappoMan 2013-05-29 11:35:26 -07:00
commit 0443942ccb
2 changed files with 22 additions and 11 deletions

View file

@ -287,6 +287,11 @@ int main(int argc, const char* argv[]) {
}
agentList->updateAgentWithData(agentAddress, packetData, receivedBytes);
if (std::isnan(((AudioRingBuffer *)avatarAgent->getLinkedData())->getBearing())) {
// kill off this agent - temporary solution to mixer crash on mac sleep
avatarAgent->setAlive(false);
}
} else if (packetData[0] == PACKET_HEADER_INJECT_AUDIO) {
Agent* matchingInjector = NULL;

View file

@ -7,6 +7,7 @@
//
#include <cstring>
#include <math.h>
#include "PacketHeaders.h"
@ -56,7 +57,12 @@ int AudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
memcpy(&_bearing, dataBuffer, sizeof(float));
dataBuffer += sizeof(_bearing);
if (_bearing > 180 || _bearing < -180) {
// if this agent sent us a NaN bearing then don't consider this good audio and bail
if (std::isnan(_bearing)) {
_endOfLastWrite = _nextOutput = _buffer;
_started = false;
return 0;
} else if (_bearing > 180 || _bearing < -180) {
// we were passed an invalid bearing because this agent wants loopback (pressed the H key)
_shouldLoopbackForAgent = true;