mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-18 03:36:22 +02:00
add downstream server settings handling to ThreadedAssignment
This commit is contained in:
parent
9fa97d611a
commit
4539d615d7
6 changed files with 54 additions and 6 deletions
|
@ -120,13 +120,8 @@ void AudioMixer::queueReplicatedAudioPacket(QSharedPointer<ReceivedMessage> mess
|
|||
QUuid nodeID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
|
||||
|
||||
auto replicatedNode = nodeList->addOrUpdateNode(nodeID, NodeType::Agent,
|
||||
<<<<<<< HEAD
|
||||
message->getSenderSockAddr(), message->getSenderSockAddr(),
|
||||
DEFAULT_AGENT_PERMISSIONS, true);
|
||||
=======
|
||||
message->getSenderSockAddr(), message->getSenderSockAddr());
|
||||
|
||||
>>>>>>> remove invoked addOrUpdate and move node to node list thread
|
||||
replicatedNode->setLastHeardMicrostamp(usecTimestampNow());
|
||||
replicatedNode->setIsUpstream(true);
|
||||
|
||||
|
@ -536,7 +531,7 @@ void AudioMixer::clearDomainSettings() {
|
|||
_zoneReverbSettings.clear();
|
||||
}
|
||||
|
||||
void AudioMixer::parseSettingsObject(const QJsonObject &settingsObject) {
|
||||
void AudioMixer::parseSettingsObject(const QJsonObject& settingsObject) {
|
||||
qDebug() << "AVX2 Support:" << (cpuSupportsAVX2() ? "enabled" : "disabled");
|
||||
|
||||
if (settingsObject.contains(AUDIO_THREADING_GROUP_KEY)) {
|
||||
|
@ -754,6 +749,8 @@ void AudioMixer::parseSettingsObject(const QJsonObject &settingsObject) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
parseDownstreamServers(settingsObject, NodeType::AudioMixer);
|
||||
}
|
||||
|
||||
AudioMixer::Timer::Timing::Timing(uint64_t& sum) : _sum(sum) {
|
||||
|
|
|
@ -56,6 +56,17 @@ bool NodeType::isDownstream(NodeType_t nodeType) {
|
|||
return nodeType == NodeType::DownstreamAudioMixer || nodeType == NodeType::DownstreamAvatarMixer;
|
||||
}
|
||||
|
||||
NodeType_t NodeType::downstreamType(NodeType_t primaryType) {
|
||||
switch (primaryType) {
|
||||
case AudioMixer:
|
||||
return DownstreamAudioMixer;
|
||||
case AvatarMixer:
|
||||
return DownstreamAvatarMixer;
|
||||
default:
|
||||
return Unassigned;
|
||||
}
|
||||
}
|
||||
|
||||
Node::Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket,
|
||||
const HifiSockAddr& localSocket, const NodePermissions& permissions, bool isReplicated,
|
||||
const QUuid& connectionSecret, QObject* parent) :
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
class Node : public NetworkPeer {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
Node(const QUuid& uuid, NodeType_t type,
|
||||
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
|
||||
const NodePermissions& permissions, bool isReplicated, const QUuid& connectionSecret = QUuid(),
|
||||
|
|
|
@ -30,8 +30,10 @@ namespace NodeType {
|
|||
const NodeType_t Unassigned = 1;
|
||||
|
||||
void init();
|
||||
|
||||
const QString& getNodeTypeName(NodeType_t nodeType);
|
||||
bool isDownstream(NodeType_t nodeType);
|
||||
NodeType_t downstreamType(NodeType_t primaryType);
|
||||
}
|
||||
|
||||
typedef QSet<NodeType_t> NodeSet;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
//
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QJsonArray>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtCore/QThread>
|
||||
#include <QtCore/QTimer>
|
||||
|
@ -132,3 +133,37 @@ void ThreadedAssignment::domainSettingsRequestFailed() {
|
|||
qCDebug(networking) << "Failed to retreive settings object from domain-server. Bailing on assignment.";
|
||||
setFinished(true);
|
||||
}
|
||||
|
||||
void ThreadedAssignment::parseDownstreamServers(const QJsonObject& settingsObject, NodeType_t nodeType) {
|
||||
static const QString REPLICATION_GROUP_KEY = "replication";
|
||||
static const QString DOWNSTREAM_SERVERS_SETTING_KEY = "downstream_servers";
|
||||
if (settingsObject.contains(REPLICATION_GROUP_KEY)) {
|
||||
const QJsonObject replicationObject = settingsObject[REPLICATION_GROUP_KEY].toObject();
|
||||
|
||||
const QJsonArray downstreamServers = replicationObject[DOWNSTREAM_SERVERS_SETTING_KEY].toArray();
|
||||
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
foreach(const QJsonValue& downstreamServerValue, downstreamServers) {
|
||||
const QJsonArray downstreamServer = downstreamServerValue.toArray();
|
||||
|
||||
// make sure we have the number of values we need
|
||||
if (downstreamServer.size() >= 3) {
|
||||
// make sure this is a downstream server that matches our type
|
||||
if (downstreamServer[2].toString() == NodeType::getNodeTypeName(nodeType)) {
|
||||
// read the address and port and construct a HifiSockAddr from them
|
||||
HifiSockAddr downstreamServerAddr {
|
||||
downstreamServer[0].toString(),
|
||||
static_cast<quint16>(downstreamServer[1].toInt())
|
||||
};
|
||||
|
||||
// manually add the downstream node to our node list
|
||||
nodeList->addOrUpdateNode(QUuid::createUuid(), NodeType::downstreamType(nodeType),
|
||||
downstreamServerAddr, downstreamServerAddr);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@ signals:
|
|||
|
||||
protected:
|
||||
void commonInit(const QString& targetName, NodeType_t nodeType);
|
||||
void parseDownstreamServers(const QJsonObject& settingsObject, NodeType_t nodeType);
|
||||
|
||||
bool _isFinished;
|
||||
QTimer _domainServerTimer;
|
||||
QTimer _statsTimer;
|
||||
|
|
Loading…
Reference in a new issue