mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 08:21:24 +02:00
immediately send ICE heartbeat once data present
This commit is contained in:
parent
603528eede
commit
69f1cd80e6
7 changed files with 167 additions and 121 deletions
|
@ -68,6 +68,7 @@ void DatagramProcessor::processDatagrams() {
|
|||
Qt::QueuedConnection,
|
||||
Q_ARG(QByteArray, incomingPacket));
|
||||
} else {
|
||||
// qDebug() << "Received audio data packet at" << usecTimestampNow();
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "addReceivedAudioToStream",
|
||||
Qt::QueuedConnection,
|
||||
Q_ARG(QByteArray, incomingPacket));
|
||||
|
|
|
@ -875,6 +875,8 @@ void AudioClient::handleAudioInput() {
|
|||
|
||||
_stats.sentPacket();
|
||||
|
||||
// qDebug() << "Sending audio packet at" << usecTimestampNow();
|
||||
|
||||
int packetBytes = currentPacketPtr - audioDataPacket;
|
||||
nodeList->writeDatagram(audioDataPacket, packetBytes, audioMixer);
|
||||
_outgoingAvatarAudioSequenceNumber++;
|
||||
|
@ -922,6 +924,7 @@ void AudioClient::sendMuteEnvironmentPacket() {
|
|||
|
||||
void AudioClient::addReceivedAudioToStream(const QByteArray& audioByteArray) {
|
||||
if (_audioOutput) {
|
||||
// qDebug() << "Adding received audio to stream at" << usecTimestampNow();
|
||||
// Audio output must exist and be correctly set up if we're going to process received audio
|
||||
_receivedAudioStream.parseData(audioByteArray);
|
||||
}
|
||||
|
|
|
@ -106,6 +106,8 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl) {
|
|||
|
||||
qCDebug(networking) << "Trying to go to URL" << lookupUrl.toString();
|
||||
|
||||
qDebug() << "Lookup of HF URL at" << usecTimestampNow();
|
||||
|
||||
// there are 4 possible lookup strings
|
||||
|
||||
// 1. global place name (name of domain or place) - example: sanfrancisco
|
||||
|
@ -163,6 +165,8 @@ void AddressManager::handleAPIResponse(QNetworkReply& requestReply) {
|
|||
QJsonObject responseObject = QJsonDocument::fromJson(requestReply.readAll()).object();
|
||||
QJsonObject dataObject = responseObject["data"].toObject();
|
||||
|
||||
qDebug() << "Go to address from API response at" << usecTimestampNow();
|
||||
|
||||
goToAddressFromObject(dataObject.toVariantMap(), requestReply);
|
||||
|
||||
emit lookupResultsFinished();
|
||||
|
|
|
@ -135,10 +135,21 @@ void DomainHandler::setIceServerHostnameAndID(const QString& iceServerHostname,
|
|||
replaceableSockAddr->~HifiSockAddr();
|
||||
replaceableSockAddr = new (replaceableSockAddr) HifiSockAddr(iceServerHostname, ICE_SERVER_DEFAULT_PORT);
|
||||
|
||||
if (_iceServerSockAddr.getAddress().isNull()) {
|
||||
// connect to lookup completed for ice-server socket so we can request a heartbeat once hostname is looked up
|
||||
connect(&_iceServerSockAddr, &HifiSockAddr::lookupCompleted, this, &DomainHandler::completedIceServerHostnameLookup);
|
||||
} else {
|
||||
completedIceServerHostnameLookup();
|
||||
}
|
||||
|
||||
|
||||
// refresh our ICE client UUID to something new
|
||||
_iceClientID = QUuid::createUuid();
|
||||
|
||||
qCDebug(networking) << "ICE required to connect to domain via ice server at" << iceServerHostname;
|
||||
|
||||
qDebug() << "ICE server info set at" << usecTimestampNow();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,6 +183,14 @@ void DomainHandler::completedHostnameLookup(const QHostInfo& hostInfo) {
|
|||
qCDebug(networking, "Failed domain server lookup");
|
||||
}
|
||||
|
||||
void DomainHandler::completedIceServerHostnameLookup() {
|
||||
qDebug() << "ICE server socket is at" << _iceServerSockAddr;
|
||||
qDebug() << "ICE server socket lookup completed at" << usecTimestampNow();
|
||||
// emit our signal so we can send a heartbeat to ice-server immediately
|
||||
emit iceSocketAndIDReceived();
|
||||
|
||||
}
|
||||
|
||||
void DomainHandler::setIsConnected(bool isConnected) {
|
||||
if (_isConnected != isConnected) {
|
||||
_isConnected = isConnected;
|
||||
|
@ -270,6 +289,8 @@ void DomainHandler::processICEResponsePacket(const QByteArray& icePacket) {
|
|||
NetworkPeer packetPeer;
|
||||
iceResponseStream >> packetPeer;
|
||||
|
||||
qDebug() << "Recieved response for network peer from ICE server at" << usecTimestampNow();
|
||||
|
||||
if (packetPeer.getUUID() != _iceDomainID) {
|
||||
qCDebug(networking) << "Received a network peer with ID that does not match current domain. Will not attempt connection.";
|
||||
} else {
|
||||
|
|
|
@ -85,7 +85,9 @@ public slots:
|
|||
|
||||
private slots:
|
||||
void completedHostnameLookup(const QHostInfo& hostInfo);
|
||||
void completedIceServerHostnameLookup();
|
||||
void settingsRequestFinished();
|
||||
|
||||
signals:
|
||||
void hostnameChanged(const QString& hostname);
|
||||
|
||||
|
@ -96,6 +98,7 @@ signals:
|
|||
void connectedToDomain(const QString& hostname);
|
||||
void disconnectedFromDomain();
|
||||
|
||||
void iceSocketAndIDReceived();
|
||||
void requestICEConnectionAttempt();
|
||||
|
||||
void settingsReceived(const QJsonObject& domainSettingsObject);
|
||||
|
|
|
@ -64,6 +64,9 @@ NodeList::NodeList(char newOwnerType, unsigned short socketListenPort, unsigned
|
|||
// clear our NodeList when the domain changes
|
||||
connect(&_domainHandler, &DomainHandler::disconnectedFromDomain, this, &NodeList::reset);
|
||||
|
||||
// send an ICE heartbeat as soon as we get ice server information
|
||||
connect(&_domainHandler, &DomainHandler::iceSocketAndIDReceived, this, &NodeList::handleICEConnectionToDomainServer);
|
||||
|
||||
// handle ICE signal from DS so connection is attempted immediately
|
||||
connect(&_domainHandler, &DomainHandler::requestICEConnectionAttempt, this, &NodeList::handleICEConnectionToDomainServer);
|
||||
|
||||
|
@ -160,6 +163,7 @@ void NodeList::processNodeData(const HifiSockAddr& senderSockAddr, const QByteAr
|
|||
if (!_domainHandler.getSockAddr().isNull()) {
|
||||
// only process a list from domain-server if we're talking to a domain
|
||||
// TODO: how do we make sure this is actually the domain we want the list from (DTLS probably)
|
||||
qDebug() << "Processing domain server list at" << usecTimestampNow();
|
||||
processDomainServerList(packet);
|
||||
}
|
||||
break;
|
||||
|
@ -198,6 +202,8 @@ void NodeList::processNodeData(const HifiSockAddr& senderSockAddr, const QByteAr
|
|||
if (sendingNode) {
|
||||
sendingNode->setLastHeardMicrostamp(usecTimestampNow());
|
||||
|
||||
qDebug() << "Activating socket for node" << sendingNode->getUUID() << "at" << usecTimestampNow();
|
||||
|
||||
// activate the appropriate socket for this node, if not yet updated
|
||||
activateSocketFromNodeCommunication(packet, sendingNode);
|
||||
|
||||
|
@ -216,6 +222,8 @@ void NodeList::processNodeData(const HifiSockAddr& senderSockAddr, const QByteAr
|
|||
case PacketTypeUnverifiedPingReply: {
|
||||
qCDebug(networking) << "Received reply from domain-server on" << senderSockAddr;
|
||||
|
||||
qDebug() << "Received reply from domain server at" << usecTimestampNow();
|
||||
|
||||
// for now we're unsafely assuming this came back from the domain
|
||||
if (senderSockAddr == _domainHandler.getICEPeer().getLocalSocket()) {
|
||||
qCDebug(networking) << "Connecting to domain using local socket";
|
||||
|
@ -379,6 +387,8 @@ void NodeList::sendDomainServerCheckIn() {
|
|||
}
|
||||
}
|
||||
|
||||
qDebug() << "Sending domain server check in at" << usecTimestampNow();
|
||||
|
||||
if (!isUsingDTLS) {
|
||||
writeUnverifiedDatagram(domainServerPacket, _domainHandler.getSockAddr());
|
||||
}
|
||||
|
@ -504,6 +514,8 @@ void NodeList::handleICEConnectionToDomainServer() {
|
|||
|
||||
_domainHandler.getICEPeer().resetConnectionAttemps();
|
||||
|
||||
qDebug() << "Sending heartbeat to ice server at" << usecTimestampNow();
|
||||
|
||||
LimitedNodeList::sendHeartbeatToIceServer(_domainHandler.getICEServerSockAddr(),
|
||||
_domainHandler.getICEClientID(),
|
||||
_domainHandler.getICEDomainID());
|
||||
|
@ -511,6 +523,8 @@ void NodeList::handleICEConnectionToDomainServer() {
|
|||
qCDebug(networking) << "Sending ping packets to establish connectivity with domain-server with ID"
|
||||
<< uuidStringWithoutCurlyBraces(_domainHandler.getICEDomainID());
|
||||
|
||||
qDebug() << "Sending ping packet to domain server at" << usecTimestampNow();
|
||||
|
||||
// send the ping packet to the local and public sockets for this node
|
||||
QByteArray localPingPacket = constructPingPacket(PingType::Local, false, _domainHandler.getICEClientID());
|
||||
writeUnverifiedDatagram(localPingPacket, _domainHandler.getICEPeer().getLocalSocket());
|
||||
|
@ -596,6 +610,7 @@ void NodeList::sendAssignment(Assignment& assignment) {
|
|||
}
|
||||
|
||||
void NodeList::pingPunchForInactiveNode(const SharedNodePointer& node) {
|
||||
qDebug() << "Sending ping punch to node" << node->getUUID() << "at" << usecTimestampNow();
|
||||
|
||||
// send the ping packet to the local and public sockets for this node
|
||||
QByteArray localPingPacket = constructPingPacket(PingType::Local);
|
||||
|
|
|
@ -76,6 +76,7 @@ signals:
|
|||
void limitOfSilentDomainCheckInsReached();
|
||||
private slots:
|
||||
void sendPendingDSPathQuery();
|
||||
void handleICEConnectionToDomainServer();
|
||||
private:
|
||||
NodeList() : LimitedNodeList(0, 0) { assert(false); } // Not implemented, needed for DependencyManager templates compile
|
||||
NodeList(char ownerType, unsigned short socketListenPort = 0, unsigned short dtlsListenPort = 0);
|
||||
|
@ -85,8 +86,6 @@ private:
|
|||
void sendSTUNRequest();
|
||||
bool processSTUNResponse(const QByteArray& packet);
|
||||
|
||||
void handleICEConnectionToDomainServer();
|
||||
|
||||
void processDomainServerAuthRequest(const QByteArray& packet);
|
||||
void requestAuthForDomainServer();
|
||||
void activateSocketFromNodeCommunication(const QByteArray& packet, const SharedNodePointer& sendingNode);
|
||||
|
|
Loading…
Reference in a new issue