Merge pull request #3291 from birarda/mixer-analytics

perfom packet verification on same thread as NodeList hash
This commit is contained in:
AndrewMeadows 2014-08-15 14:24:40 -07:00
commit e2251852c3
2 changed files with 25 additions and 27 deletions

View file

@ -302,6 +302,7 @@ void AudioMixer::prepareMixForListeningNode(Node* node) {
void AudioMixer::readPendingDatagram(const QByteArray& receivedPacket, const HifiSockAddr& senderSockAddr) {
NodeList* nodeList = NodeList::getInstance();
if (nodeList->packetVersionAndHashMatch(receivedPacket)) {
// pull any new audio data from nodes off of the network stack
PacketType mixerPacketType = packetTypeForPacket(receivedPacket);
if (mixerPacketType == PacketTypeMicrophoneAudioNoEcho
@ -326,6 +327,7 @@ void AudioMixer::readPendingDatagram(const QByteArray& receivedPacket, const Hif
nodeList->processNodeData(senderSockAddr, receivedPacket);
}
}
}
void AudioMixer::sendStatsPacket() {
static QJsonObject statsObject;

View file

@ -33,8 +33,6 @@ void AudioMixerDatagramProcessor::readPendingDatagrams() {
HifiSockAddr senderSockAddr;
static QByteArray incomingPacket;
NodeList* nodeList = NodeList::getInstance();
// read everything that is available
while (_nodeSocket.hasPendingDatagrams()) {
incomingPacket.resize(_nodeSocket.pendingDatagramSize());
@ -43,9 +41,7 @@ void AudioMixerDatagramProcessor::readPendingDatagrams() {
_nodeSocket.readDatagram(incomingPacket.data(), incomingPacket.size(),
senderSockAddr.getAddressPointer(), senderSockAddr.getPortPointer());
if (nodeList->packetVersionAndHashMatch(incomingPacket)) {
// emit the signal to tell AudioMixer it needs to process a packet
emit packetRequiresProcessing(incomingPacket, senderSockAddr);
}
}
}