mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
kill agents who send NaN bearings
This commit is contained in:
parent
1fb61faded
commit
56e0e3882d
2 changed files with 7 additions and 4 deletions
|
@ -220,7 +220,6 @@ int main(int argc, const char* argv[]) {
|
||||||
bearingRelativeAngleToSource *= (M_PI / 180);
|
bearingRelativeAngleToSource *= (M_PI / 180);
|
||||||
|
|
||||||
float sinRatio = fabsf(sinf(bearingRelativeAngleToSource));
|
float sinRatio = fabsf(sinf(bearingRelativeAngleToSource));
|
||||||
printf("BRA: %f, SR: %f\n", bearingRelativeAngleToSource, sinRatio);
|
|
||||||
numSamplesDelay = PHASE_DELAY_AT_90 * sinRatio;
|
numSamplesDelay = PHASE_DELAY_AT_90 * sinRatio;
|
||||||
weakChannelAmplitudeRatio = 1 - (PHASE_AMPLITUDE_RATIO_AT_90 * sinRatio);
|
weakChannelAmplitudeRatio = 1 - (PHASE_AMPLITUDE_RATIO_AT_90 * sinRatio);
|
||||||
}
|
}
|
||||||
|
@ -291,6 +290,11 @@ int main(int argc, const char* argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
agentList->updateAgentWithData(agentAddress, packetData, receivedBytes);
|
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) {
|
} else if (packetData[0] == PACKET_HEADER_INJECT_AUDIO) {
|
||||||
Agent* matchingInjector = NULL;
|
Agent* matchingInjector = NULL;
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,6 @@ int AudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||||
|
|
||||||
// if this agent sent us a NaN bearing then don't consider this good audio and bail
|
// if this agent sent us a NaN bearing then don't consider this good audio and bail
|
||||||
if (std::isnan(_bearing)) {
|
if (std::isnan(_bearing)) {
|
||||||
printf("Got a nan bearing for this agent\n");
|
|
||||||
_endOfLastWrite = _nextOutput = _buffer;
|
_endOfLastWrite = _nextOutput = _buffer;
|
||||||
_started = false;
|
_started = false;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -69,8 +68,8 @@ int AudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||||
|
|
||||||
// correct the bearing
|
// correct the bearing
|
||||||
_bearing = _bearing > 0
|
_bearing = _bearing > 0
|
||||||
? _bearing - AGENT_LOOPBACK_MODIFIER
|
? _bearing - AGENT_LOOPBACK_MODIFIER
|
||||||
: _bearing + AGENT_LOOPBACK_MODIFIER;
|
: _bearing + AGENT_LOOPBACK_MODIFIER;
|
||||||
} else {
|
} else {
|
||||||
_shouldLoopbackForAgent = false;
|
_shouldLoopbackForAgent = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue