mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 22:22:54 +02:00
push various PACKET_TYPES, repairs to Agent for UUID setup
This commit is contained in:
parent
0ae825d761
commit
74e66dfd35
6 changed files with 45 additions and 30 deletions
|
@ -155,23 +155,32 @@ void Agent::run() {
|
||||||
NodeList::getInstance()->sendDomainServerCheckIn();
|
NodeList::getInstance()->sendDomainServerCheckIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstDomainCheckIn) {
|
|
||||||
// find the audio-mixer in the NodeList so we can inject audio at it
|
// find the audio-mixer in the NodeList so we can inject audio at it
|
||||||
Node* audioMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AUDIO_MIXER);
|
Node* audioMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AUDIO_MIXER);
|
||||||
|
|
||||||
|
if (audioMixer && audioMixer->getActiveSocket()) {
|
||||||
emit willSendAudioDataCallback();
|
emit willSendAudioDataCallback();
|
||||||
|
|
||||||
if (audioMixer && scriptedAudioInjector.hasSamplesToInject()) {
|
if (scriptedAudioInjector.hasSamplesToInject()) {
|
||||||
int usecToSleep = usecTimestamp(&startTime) + (thisFrame++ * INJECT_INTERVAL_USECS) - usecTimestampNow();
|
int usecToSleep = usecTimestamp(&startTime) + (thisFrame++ * INJECT_INTERVAL_USECS) - usecTimestampNow();
|
||||||
if (usecToSleep > 0) {
|
if (usecToSleep > 0) {
|
||||||
usleep(usecToSleep);
|
usleep(usecToSleep);
|
||||||
}
|
}
|
||||||
|
|
||||||
scriptedAudioInjector.injectAudio(NodeList::getInstance()->getNodeSocket(), audioMixer->getPublicSocket());
|
scriptedAudioInjector.injectAudio(NodeList::getInstance()->getNodeSocket(), audioMixer->getActiveSocket());
|
||||||
|
|
||||||
// clear out the audio injector so that it doesn't re-send what we just sent
|
// clear out the audio injector so that it doesn't re-send what we just sent
|
||||||
scriptedAudioInjector.clear();
|
scriptedAudioInjector.clear();
|
||||||
}
|
}
|
||||||
|
} else if (audioMixer) {
|
||||||
|
int usecToSleep = usecTimestamp(&startTime) + (thisFrame++ * INJECT_INTERVAL_USECS) - usecTimestampNow();
|
||||||
|
if (usecToSleep > 0) {
|
||||||
|
usleep(usecToSleep);
|
||||||
|
}
|
||||||
|
|
||||||
|
// don't have an active socket for the audio-mixer, ping it now
|
||||||
|
NodeList::getInstance()->pingPublicAndLocalSocketsForInactiveNode(audioMixer);
|
||||||
|
}
|
||||||
|
|
||||||
// allow the scripter's call back to setup visual data
|
// allow the scripter's call back to setup visual data
|
||||||
emit willSendVisualDataCallback();
|
emit willSendVisualDataCallback();
|
||||||
|
@ -182,8 +191,6 @@ void Agent::run() {
|
||||||
// since we're in non-threaded mode, call process so that the packets are sent
|
// since we're in non-threaded mode, call process so that the packets are sent
|
||||||
voxelScripter.getVoxelPacketSender()->process();
|
voxelScripter.getVoxelPacketSender()->process();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (engine.hasUncaughtException()) {
|
if (engine.hasUncaughtException()) {
|
||||||
int line = engine.uncaughtExceptionLineNumber();
|
int line = engine.uncaughtExceptionLineNumber();
|
||||||
qDebug() << "Uncaught exception at line" << line << ":" << engine.uncaughtException().toString() << "\n";
|
qDebug() << "Uncaught exception at line" << line << ":" << engine.uncaughtException().toString() << "\n";
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include <PacketHeaders.h>
|
#include <PacketHeaders.h>
|
||||||
|
#include <UUID.h>
|
||||||
|
|
||||||
#include "InjectedAudioRingBuffer.h"
|
#include "InjectedAudioRingBuffer.h"
|
||||||
|
|
||||||
|
@ -22,6 +23,9 @@ InjectedAudioRingBuffer::InjectedAudioRingBuffer() :
|
||||||
int InjectedAudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
|
int InjectedAudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||||
unsigned char* currentBuffer = sourceBuffer + numBytesForPacketHeader(sourceBuffer);
|
unsigned char* currentBuffer = sourceBuffer + numBytesForPacketHeader(sourceBuffer);
|
||||||
|
|
||||||
|
// push past the UUID for this injector
|
||||||
|
currentBuffer += NUM_BYTES_RFC4122_UUID;
|
||||||
|
|
||||||
// use parsePositionalData in parent PostionalAudioRingBuffer class to pull common positional data
|
// use parsePositionalData in parent PostionalAudioRingBuffer class to pull common positional data
|
||||||
currentBuffer += parsePositionalData(currentBuffer, numBytes - (currentBuffer - sourceBuffer));
|
currentBuffer += parsePositionalData(currentBuffer, numBytes - (currentBuffer - sourceBuffer));
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ PositionalAudioRingBuffer::~PositionalAudioRingBuffer() {
|
||||||
|
|
||||||
int PositionalAudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
|
int PositionalAudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||||
unsigned char* currentBuffer = sourceBuffer + numBytesForPacketHeader(sourceBuffer);
|
unsigned char* currentBuffer = sourceBuffer + numBytesForPacketHeader(sourceBuffer);
|
||||||
currentBuffer += NUM_BYTES_RFC4122_UUID; // the source ID
|
currentBuffer += NUM_BYTES_RFC4122_UUID; // the source UUID
|
||||||
currentBuffer += parsePositionalData(currentBuffer, numBytes - (currentBuffer - sourceBuffer));
|
currentBuffer += parsePositionalData(currentBuffer, numBytes - (currentBuffer - sourceBuffer));
|
||||||
currentBuffer += parseAudioSamples(currentBuffer, numBytes - (currentBuffer - sourceBuffer));
|
currentBuffer += parseAudioSamples(currentBuffer, numBytes - (currentBuffer - sourceBuffer));
|
||||||
|
|
||||||
|
|
|
@ -589,14 +589,12 @@ void NodeList::pingPublicAndLocalSocketsForInactiveNode(Node* node) const {
|
||||||
Node* NodeList::addOrUpdateNode(const QUuid& uuid, char nodeType, sockaddr* publicSocket, sockaddr* localSocket) {
|
Node* NodeList::addOrUpdateNode(const QUuid& uuid, char nodeType, sockaddr* publicSocket, sockaddr* localSocket) {
|
||||||
NodeList::iterator node = end();
|
NodeList::iterator node = end();
|
||||||
|
|
||||||
if (publicSocket) {
|
|
||||||
for (node = begin(); node != end(); node++) {
|
for (node = begin(); node != end(); node++) {
|
||||||
if (node->matches(publicSocket, localSocket, nodeType)) {
|
if (node->getUUID() == uuid) {
|
||||||
// we already have this node, stop checking
|
// we already have this node, stop checking
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (node == end()) {
|
if (node == end()) {
|
||||||
// we didn't have this node, so add them
|
// we didn't have this node, so add them
|
||||||
|
|
|
@ -17,20 +17,21 @@ PACKET_VERSION versionForPacketType(PACKET_TYPE type) {
|
||||||
|
|
||||||
case PACKET_TYPE_MICROPHONE_AUDIO_NO_ECHO:
|
case PACKET_TYPE_MICROPHONE_AUDIO_NO_ECHO:
|
||||||
case PACKET_TYPE_MICROPHONE_AUDIO_WITH_ECHO:
|
case PACKET_TYPE_MICROPHONE_AUDIO_WITH_ECHO:
|
||||||
return 1;
|
return 2;
|
||||||
|
|
||||||
case PACKET_TYPE_HEAD_DATA:
|
case PACKET_TYPE_HEAD_DATA:
|
||||||
return 9;
|
return 10;
|
||||||
|
|
||||||
case PACKET_TYPE_AVATAR_URLS:
|
case PACKET_TYPE_AVATAR_URLS:
|
||||||
return 1;
|
return 2;
|
||||||
|
|
||||||
case PACKET_TYPE_AVATAR_FACE_VIDEO:
|
case PACKET_TYPE_AVATAR_FACE_VIDEO:
|
||||||
return 1;
|
return 2;
|
||||||
|
|
||||||
case PACKET_TYPE_VOXEL_STATS:
|
case PACKET_TYPE_VOXEL_STATS:
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
|
case PACKET_TYPE_DOMAIN:
|
||||||
case PACKET_TYPE_DOMAIN_LIST_REQUEST:
|
case PACKET_TYPE_DOMAIN_LIST_REQUEST:
|
||||||
case PACKET_TYPE_DOMAIN_REPORT_FOR_DUTY:
|
case PACKET_TYPE_DOMAIN_REPORT_FOR_DUTY:
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -102,10 +102,15 @@ void VoxelEditPacketSender::queuePacketToNode(const QUuid& nodeUUID, unsigned ch
|
||||||
NodeList* nodeList = NodeList::getInstance();
|
NodeList* nodeList = NodeList::getInstance();
|
||||||
for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
|
for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
|
||||||
// only send to the NodeTypes that are NODE_TYPE_VOXEL_SERVER
|
// only send to the NodeTypes that are NODE_TYPE_VOXEL_SERVER
|
||||||
if (node->getActiveSocket() != NULL && node->getType() == NODE_TYPE_VOXEL_SERVER &&
|
if (node->getType() == NODE_TYPE_VOXEL_SERVER &&
|
||||||
((node->getUUID() == nodeUUID) || (nodeUUID.isNull()))) {
|
((node->getUUID() == nodeUUID) || (nodeUUID.isNull()))) {
|
||||||
|
if (node->getActiveSocket()) {
|
||||||
sockaddr* nodeAddress = node->getActiveSocket();
|
sockaddr* nodeAddress = node->getActiveSocket();
|
||||||
queuePacketForSending(*nodeAddress, buffer, length);
|
queuePacketForSending(*nodeAddress, buffer, length);
|
||||||
|
} else {
|
||||||
|
// we don't have an active socket for this node, ping it
|
||||||
|
nodeList->pingPublicAndLocalSocketsForInactiveNode(&(*node));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue