mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 16:41:02 +02:00
Merge branch 'protocol' of https://github.com/Atlante45/hifi into atp
This commit is contained in:
commit
659f6742c6
8 changed files with 66 additions and 60 deletions
|
@ -230,8 +230,8 @@ void AssignmentClientMonitor::readPendingDatagrams() {
|
||||||
// tell unknown assignment-client child to exit.
|
// tell unknown assignment-client child to exit.
|
||||||
qDebug() << "asking unknown child to exit.";
|
qDebug() << "asking unknown child to exit.";
|
||||||
|
|
||||||
auto diePacket = NL::create(PacketType::StopNode, 0);
|
auto diePacket = NLPacket::create(PacketType::StopNode, 0);
|
||||||
nodeList->sendPacket(std::move(diePacket), childNode);
|
nodeList->sendPacket(std::move(diePacket), senderSockAddr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -524,11 +524,11 @@ void AudioMixer::sendAudioEnvironmentPacket(SharedNodePointer node) {
|
||||||
setAtBit(bitset, HAS_REVERB_BIT);
|
setAtBit(bitset, HAS_REVERB_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
envPacket.write(&bitset, sizeof(bitset));
|
envPacket->writePrimitive(bitset);
|
||||||
|
|
||||||
if (hasReverb) {
|
if (hasReverb) {
|
||||||
envPacket.write(&reverbTime, sizeof(reverb));
|
envPacket->writePrimitive(reverbTime);
|
||||||
envPacket.write(&wetLevel, sizeof(wetLevel));
|
envPacket->writePrimitive(wetLevel);
|
||||||
}
|
}
|
||||||
nodeList->sendPacket(std::move(envPacket), node);
|
nodeList->sendPacket(std::move(envPacket), node);
|
||||||
}
|
}
|
||||||
|
@ -550,13 +550,14 @@ void AudioMixer::readPendingDatagram(const QByteArray& receivedPacket, const Hif
|
||||||
} else if (mixerPacketType == PacketType::MuteEnvironment) {
|
} else if (mixerPacketType == PacketType::MuteEnvironment) {
|
||||||
SharedNodePointer sendingNode = nodeList->sendingNodeForPacket(receivedPacket);
|
SharedNodePointer sendingNode = nodeList->sendingNodeForPacket(receivedPacket);
|
||||||
if (sendingNode->getCanAdjustLocks()) {
|
if (sendingNode->getCanAdjustLocks()) {
|
||||||
QByteArray packet = receivedPacket;
|
auto packet = NLPacket::create(PacketType::MuteEnvironment);
|
||||||
nodeList->populatePacketHeader(packet, PacketType::MuteEnvironment);
|
// Copy payload
|
||||||
|
packet->write(receivedPacket.mid(numBytesForPacketHeader(receivedPacket)));
|
||||||
|
|
||||||
nodeList->eachNode([&](const SharedNodePointer& node){
|
nodeList->eachNode([&](const SharedNodePointer& node){
|
||||||
if (node->getType() == NodeType::Agent && node->getActiveSocket() &&
|
if (node->getType() == NodeType::Agent && node->getActiveSocket() &&
|
||||||
node->getLinkedData() && node != sendingNode) {
|
node->getLinkedData() && node != sendingNode) {
|
||||||
nodeList->writeDatagram(packet, packet.size(), node);
|
nodeList->sendPacket(std::move(packet), node);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -805,26 +806,27 @@ void AudioMixer::run() {
|
||||||
std::unique_ptr<NLPacket> mixPacket;
|
std::unique_ptr<NLPacket> mixPacket;
|
||||||
|
|
||||||
if (streamsMixed > 0) {
|
if (streamsMixed > 0) {
|
||||||
int mixPacketBytes = sizeof(quint16) + AudioConstants::NETWORK_FRAME_BYTES_STEREO;
|
int mixPacketBytes = sizeof(quint16) + AudioConstants::NETWORK_FRAME_BYTES_STEREO * sizeof(int16_t);
|
||||||
mixPacket = NLPacket::create(PacketType::MixedAudio, mixPacketBytes);
|
mixPacket = NLPacket::create(PacketType::MixedAudio, mixPacketBytes);
|
||||||
|
|
||||||
// pack sequence number
|
// pack sequence number
|
||||||
quint16 sequence = nodeData->getOutgoingSequenceNumber();
|
quint16 sequence = nodeData->getOutgoingSequenceNumber();
|
||||||
mixPacket.write(&sequence, sizeof(quint16));
|
mixPacket->writePrimitive(sequence);
|
||||||
|
|
||||||
// pack mixed audio samples
|
// pack mixed audio samples
|
||||||
mixPacket.write(mixSamples, AudioConstants::NETWORK_FRAME_BYTES_STEREO);
|
mixPacket->write(reinterpret_cast<char*>(_mixSamples),
|
||||||
|
AudioConstants::NETWORK_FRAME_BYTES_STEREO * sizeof(int16_t));
|
||||||
} else {
|
} else {
|
||||||
int silentPacketBytes = sizeof(quint16) + sizeof(quint16);
|
int silentPacketBytes = sizeof(quint16) + sizeof(quint16);
|
||||||
mixPacket = NLPacket::create(PacketType::SilentAudioFrame, silentPacketBytes);
|
mixPacket = NLPacket::create(PacketType::SilentAudioFrame, silentPacketBytes);
|
||||||
|
|
||||||
// pack sequence number
|
// pack sequence number
|
||||||
quint16 sequence = nodeData->getOutgoingSequenceNumber();
|
quint16 sequence = nodeData->getOutgoingSequenceNumber();
|
||||||
mixPacket.write(&sequence, sizeof(quint16));
|
mixPacket->writePrimitive(sequence);
|
||||||
|
|
||||||
// pack number of silent audio samples
|
// pack number of silent audio samples
|
||||||
quint16 numSilentSamples = AudioConstants::NETWORK_FRAME_SAMPLES_STEREO;
|
quint16 numSilentSamples = AudioConstants::NETWORK_FRAME_SAMPLES_STEREO;
|
||||||
mixPacket.write(&numSilentSamples, sizeof(quint16));
|
mixPacket->writePrimitive(numSilentSamples);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send audio environment
|
// Send audio environment
|
||||||
|
|
|
@ -159,21 +159,21 @@ void AudioMixerClientData::sendAudioStreamStatsPackets(const SharedNodePointer&
|
||||||
int numStreamStatsRemaining = _audioStreams.size();
|
int numStreamStatsRemaining = _audioStreams.size();
|
||||||
QHash<QUuid, PositionalAudioStream*>::ConstIterator audioStreamsIterator = _audioStreams.constBegin();
|
QHash<QUuid, PositionalAudioStream*>::ConstIterator audioStreamsIterator = _audioStreams.constBegin();
|
||||||
|
|
||||||
PacketList statsPacketList(PacketType::AudioStreamStats);
|
NLPacketList statsPacketList(PacketType::AudioStreamStats);
|
||||||
|
|
||||||
while (numStreamStatsRemaining > 0) {
|
while (numStreamStatsRemaining > 0) {
|
||||||
|
|
||||||
auto statsPacket = NLPacket::create(PacketType::AudioStreamStats);
|
auto statsPacket = NLPacket::create(PacketType::AudioStreamStats);
|
||||||
|
|
||||||
// pack the append flag in this packet
|
// pack the append flag in this packet
|
||||||
statsPacket->write(&appendFlag, sizeof(quint8));
|
statsPacket->writePrimitive(appendFlag);
|
||||||
appendFlag = 1;
|
appendFlag = 1;
|
||||||
|
|
||||||
int numStreamStatsRoomFor = (statsPacket.size() - sizeof(quint8) - sizeof(quint16)) / sizeof(AudioStreamStats);
|
int numStreamStatsRoomFor = (statsPacket->size() - sizeof(quint8) - sizeof(quint16)) / sizeof(AudioStreamStats);
|
||||||
|
|
||||||
// calculate and pack the number of stream stats to follow
|
// calculate and pack the number of stream stats to follow
|
||||||
quint16 numStreamStatsToPack = std::min(numStreamStatsRemaining, numStreamStatsRoomFor);
|
quint16 numStreamStatsToPack = std::min(numStreamStatsRemaining, numStreamStatsRoomFor);
|
||||||
statsPacket->write(&numStreamStatsToPack, sizeof(quint16));
|
statsPacket->writePrimitive(numStreamStatsToPack);
|
||||||
|
|
||||||
// pack the calculated number of stream stats
|
// pack the calculated number of stream stats
|
||||||
for (int i = 0; i < numStreamStatsToPack; i++) {
|
for (int i = 0; i < numStreamStatsToPack; i++) {
|
||||||
|
@ -182,7 +182,7 @@ void AudioMixerClientData::sendAudioStreamStatsPackets(const SharedNodePointer&
|
||||||
stream->perSecondCallbackForUpdatingStats();
|
stream->perSecondCallbackForUpdatingStats();
|
||||||
|
|
||||||
AudioStreamStats streamStats = stream->getAudioStreamStats();
|
AudioStreamStats streamStats = stream->getAudioStreamStats();
|
||||||
statsPacket->write(&streamStats, sizeof(AudioStreamStats));
|
statsPacket->writePrimitive(streamStats);
|
||||||
|
|
||||||
audioStreamsIterator++;
|
audioStreamsIterator++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -368,7 +368,7 @@ void AvatarMixer::nodeKilled(SharedNodePointer killedNode) {
|
||||||
auto killPacket = NLPacket::create(PacketType::KillAvatar, NUM_BYTES_RFC4122_UUID);
|
auto killPacket = NLPacket::create(PacketType::KillAvatar, NUM_BYTES_RFC4122_UUID);
|
||||||
killPacket->write(killedNode->getUUID().toRfc4122());
|
killPacket->write(killedNode->getUUID().toRfc4122());
|
||||||
|
|
||||||
nodeList->broadcastToNodes(killPacket, NodeSet() << NodeType::Agent);
|
nodeList->broadcastToNodes(std::move(killPacket), NodeSet() << NodeType::Agent);
|
||||||
|
|
||||||
// we also want to remove sequence number data for this avatar on our other avatars
|
// we also want to remove sequence number data for this avatar on our other avatars
|
||||||
// so invoke the appropriate method on the AvatarMixerClientData for other avatars
|
// so invoke the appropriate method on the AvatarMixerClientData for other avatars
|
||||||
|
|
|
@ -42,7 +42,7 @@ OctreeQueryNode::OctreeQueryNode() :
|
||||||
_lodInitialized(false),
|
_lodInitialized(false),
|
||||||
_sequenceNumber(0),
|
_sequenceNumber(0),
|
||||||
_lastRootTimestamp(0),
|
_lastRootTimestamp(0),
|
||||||
_myPacketType(PacketTypeUnknown),
|
_myPacketType(PacketType::Unknown),
|
||||||
_isShuttingDown(false),
|
_isShuttingDown(false),
|
||||||
_sentPacketHistory()
|
_sentPacketHistory()
|
||||||
{
|
{
|
||||||
|
@ -194,14 +194,14 @@ void OctreeQueryNode::resetOctreePacket() {
|
||||||
_octreePacket->reset();
|
_octreePacket->reset();
|
||||||
|
|
||||||
// pack in flags
|
// pack in flags
|
||||||
_octreePacket->write(&flags, sizeof(flags));
|
_octreePacket->writePrimitive(flags);
|
||||||
|
|
||||||
// pack in sequence number
|
// pack in sequence number
|
||||||
_octreePacket->write(&_sequenceNumber, sizeof(_sequenceNumber));
|
_octreePacket->writePrimitive(_sequenceNumber);
|
||||||
|
|
||||||
// pack in timestamp
|
// pack in timestamp
|
||||||
OCTREE_PACKET_SENT_TIME now = usecTimestampNow();
|
OCTREE_PACKET_SENT_TIME now = usecTimestampNow();
|
||||||
_octreePacket->write(&now, sizeof(now));
|
_octreePacket->writePrimitive(now);
|
||||||
|
|
||||||
_octreePacketWaiting = false;
|
_octreePacketWaiting = false;
|
||||||
}
|
}
|
||||||
|
@ -216,10 +216,10 @@ void OctreeQueryNode::writeToPacket(const unsigned char* buffer, unsigned int by
|
||||||
// multiple compressed portions together
|
// multiple compressed portions together
|
||||||
if (_currentPacketIsCompressed) {
|
if (_currentPacketIsCompressed) {
|
||||||
OCTREE_PACKET_INTERNAL_SECTION_SIZE sectionSize = bytes;
|
OCTREE_PACKET_INTERNAL_SECTION_SIZE sectionSize = bytes;
|
||||||
_octreePacket->write(§ionSize, sizeof(sectionSize));
|
_octreePacket->writePrimitive(sectionSize);
|
||||||
}
|
}
|
||||||
if (bytes <= _octreePacket->bytesAvailable()) {
|
if (bytes <= _octreePacket->bytesAvailable()) {
|
||||||
_octreePacket->write(buffer, bytes);
|
_octreePacket->write(reinterpret_cast<const char*>(buffer), bytes);
|
||||||
_octreePacketWaiting = true;
|
_octreePacketWaiting = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ bool OctreeQueryNode::hasNextNackedPacket() const {
|
||||||
const NLPacket* OctreeQueryNode::getNextNackedPacket() {
|
const NLPacket* OctreeQueryNode::getNextNackedPacket() {
|
||||||
if (!_nackedSequenceNumbers.isEmpty()) {
|
if (!_nackedSequenceNumbers.isEmpty()) {
|
||||||
// could return null if packet is not in the history
|
// could return null if packet is not in the history
|
||||||
return _sentPacketHistory.getPacket(_nackedSequenceNumbers.dequeue());
|
return _sentPacketHistory.getPacket(_nackedSequenceNumbers.dequeue()).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -41,13 +41,12 @@ public:
|
||||||
|
|
||||||
void writeToPacket(const unsigned char* buffer, unsigned int bytes); // writes to end of packet
|
void writeToPacket(const unsigned char* buffer, unsigned int bytes); // writes to end of packet
|
||||||
|
|
||||||
NLPacket& getPacket() const { return _octreePacket; }
|
NLPacket& getPacket() const { return *_octreePacket; }
|
||||||
bool isPacketWaiting() const { return _octreePacketWaiting; }
|
bool isPacketWaiting() const { return _octreePacketWaiting; }
|
||||||
|
|
||||||
bool packetIsDuplicate() const;
|
bool packetIsDuplicate() const;
|
||||||
bool shouldSuppressDuplicatePacket();
|
bool shouldSuppressDuplicatePacket();
|
||||||
|
|
||||||
unsigned int getAvailable() const { return _octreePacketAvailableBytes; }
|
|
||||||
int getMaxSearchLevel() const { return _maxSearchLevel; }
|
int getMaxSearchLevel() const { return _maxSearchLevel; }
|
||||||
void resetMaxSearchLevel() { _maxSearchLevel = 1; }
|
void resetMaxSearchLevel() { _maxSearchLevel = 1; }
|
||||||
void incrementMaxSearchLevel() { _maxSearchLevel++; }
|
void incrementMaxSearchLevel() { _maxSearchLevel++; }
|
||||||
|
|
|
@ -147,33 +147,33 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
|
||||||
NLPacket& statsPacket = nodeData->stats.getStatsMessage();
|
NLPacket& statsPacket = nodeData->stats.getStatsMessage();
|
||||||
|
|
||||||
// If the size of the stats message and the octree message will fit in a packet, then piggyback them
|
// If the size of the stats message and the octree message will fit in a packet, then piggyback them
|
||||||
if (nodeData->getPacket()->getSizeWithHeader() <= statsPacket->bytesAvailable()) {
|
if (nodeData->getPacket().getSizeWithHeader() <= statsPacket.bytesAvailable()) {
|
||||||
|
|
||||||
// copy octree message to back of stats message
|
// copy octree message to back of stats message
|
||||||
statsPacket->write(nodeData->getPacket()->getData(), nodeData->getPacket()->getSizeWithHeader());
|
statsPacket.write(nodeData->getPacket().getData(), nodeData->getPacket().getSizeWithHeader());
|
||||||
|
|
||||||
// since a stats message is only included on end of scene, don't consider any of these bytes "wasted", since
|
// since a stats message is only included on end of scene, don't consider any of these bytes "wasted", since
|
||||||
// there was nothing else to send.
|
// there was nothing else to send.
|
||||||
int thisWastedBytes = 0;
|
int thisWastedBytes = 0;
|
||||||
_totalWastedBytes += thisWastedBytes;
|
_totalWastedBytes += thisWastedBytes;
|
||||||
_totalBytes += statsPacket->getSizeWithHeader();
|
_totalBytes += statsPacket.getSizeWithHeader();
|
||||||
_totalPackets++;
|
_totalPackets++;
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
NLPacket& sentPacket = nodeData->getPacket();
|
NLPacket& sentPacket = nodeData->getPacket();
|
||||||
|
|
||||||
sentPacket->seek(sizeof(OCTREE_PACKET_FLAGS));
|
sentPacket.seek(sizeof(OCTREE_PACKET_FLAGS));
|
||||||
|
|
||||||
OCTREE_PACKET_SEQUENCE sequence;
|
OCTREE_PACKET_SEQUENCE sequence;
|
||||||
sentPacket->read(&sequence, sizeof(sequence));
|
sentPacket.readPrimitive(&sequence);
|
||||||
|
|
||||||
OCTREE_PACKET_SENT_TIME timestamp;
|
OCTREE_PACKET_SENT_TIME timestamp;
|
||||||
sentPacket->read(×tamp, sizeof(timestamp));
|
sentPacket.readPrimitive(×tamp);
|
||||||
|
|
||||||
qDebug() << "Adding stats to packet at " << now << " [" << _totalPackets <<"]: sequence: " << sequence <<
|
qDebug() << "Adding stats to packet at " << now << " [" << _totalPackets <<"]: sequence: " << sequence <<
|
||||||
" timestamp: " << timestamp <<
|
" timestamp: " << timestamp <<
|
||||||
" statsMessageLength: " << statsPacket->getSizeWithHeader() <<
|
" statsMessageLength: " << statsPacket.getSizeWithHeader() <<
|
||||||
" original size: " << nodeData->getPacket()->getSizeWithHeader() << " [" << _totalBytes <<
|
" original size: " << nodeData->getPacket().getSizeWithHeader() << " [" << _totalBytes <<
|
||||||
"] wasted bytes:" << thisWastedBytes << " [" << _totalWastedBytes << "]";
|
"] wasted bytes:" << thisWastedBytes << " [" << _totalWastedBytes << "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,33 +184,33 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
|
||||||
} else {
|
} else {
|
||||||
// not enough room in the packet, send two packets
|
// not enough room in the packet, send two packets
|
||||||
OctreeServer::didCallWriteDatagram(this);
|
OctreeServer::didCallWriteDatagram(this);
|
||||||
DependencyManager::get<NodeList>()-sendUnreliablePacket(statsPacket, _node);
|
DependencyManager::get<NodeList>()->sendUnreliablePacket(statsPacket, _node);
|
||||||
|
|
||||||
// since a stats message is only included on end of scene, don't consider any of these bytes "wasted", since
|
// since a stats message is only included on end of scene, don't consider any of these bytes "wasted", since
|
||||||
// there was nothing else to send.
|
// there was nothing else to send.
|
||||||
int thisWastedBytes = 0;
|
int thisWastedBytes = 0;
|
||||||
_totalWastedBytes += thisWastedBytes;
|
_totalWastedBytes += thisWastedBytes;
|
||||||
_totalBytes += statsPacket->getSizeWithHeader();
|
_totalBytes += statsPacket.getSizeWithHeader();
|
||||||
_totalPackets++;
|
_totalPackets++;
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
NLPacket& sentPacket = nodeData->getPacket();
|
NLPacket& sentPacket = nodeData->getPacket();
|
||||||
|
|
||||||
sentPacket->seek(sizeof(OCTREE_PACKET_FLAGS));
|
sentPacket.seek(sizeof(OCTREE_PACKET_FLAGS));
|
||||||
|
|
||||||
OCTREE_PACKET_SEQUENCE sequence;
|
OCTREE_PACKET_SEQUENCE sequence;
|
||||||
sentPacket->read(&sequence, sizeof(sequence));
|
sentPacket.readPrimitive(&sequence);
|
||||||
|
|
||||||
OCTREE_PACKET_SENT_TIME timestamp;
|
OCTREE_PACKET_SENT_TIME timestamp;
|
||||||
sentPacket->read(×tamp, sizeof(timestamp));
|
sentPacket.readPrimitive(×tamp);
|
||||||
|
|
||||||
qDebug() << "Sending separate stats packet at " << now << " [" << _totalPackets <<"]: sequence: " << sequence <<
|
qDebug() << "Sending separate stats packet at " << now << " [" << _totalPackets <<"]: sequence: " << sequence <<
|
||||||
" timestamp: " << timestamp <<
|
" timestamp: " << timestamp <<
|
||||||
" size: " << statsPacket->getSizeWithHeader() << " [" << _totalBytes <<
|
" size: " << statsPacket.getSizeWithHeader() << " [" << _totalBytes <<
|
||||||
"] wasted bytes:" << thisWastedBytes << " [" << _totalWastedBytes << "]";
|
"] wasted bytes:" << thisWastedBytes << " [" << _totalWastedBytes << "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
trueBytesSent += statsPacket->getSizeWithHeader();
|
trueBytesSent += statsPacket.getSizeWithHeader();
|
||||||
truePacketsSent++;
|
truePacketsSent++;
|
||||||
packetsSent++;
|
packetsSent++;
|
||||||
|
|
||||||
|
@ -218,26 +218,26 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
|
||||||
DependencyManager::get<NodeList>()->sendUnreliablePacket(nodeData->getPacket(), _node);
|
DependencyManager::get<NodeList>()->sendUnreliablePacket(nodeData->getPacket(), _node);
|
||||||
packetSent = true;
|
packetSent = true;
|
||||||
|
|
||||||
int packetSizeWithHeader = nodeData->getPacket()->getSizeWithHeader();
|
int packetSizeWithHeader = nodeData->getPacket().getSizeWithHeader();
|
||||||
thisWastedBytes = MAX_PACKET_SIZE - packetSizeWithHeader;
|
thisWastedBytes = MAX_PACKET_SIZE - packetSizeWithHeader;
|
||||||
_totalWastedBytes += thisWastedBytes;
|
_totalWastedBytes += thisWastedBytes;
|
||||||
_totalBytes += nodeData->getPacket()->getSizeWithHeader();
|
_totalBytes += nodeData->getPacket().getSizeWithHeader();
|
||||||
_totalPackets++;
|
_totalPackets++;
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
NLPacket& sentPacket = nodeData->getPacket();
|
NLPacket& sentPacket = nodeData->getPacket();
|
||||||
|
|
||||||
sentPacket->seek(sizeof(OCTREE_PACKET_FLAGS));
|
sentPacket.seek(sizeof(OCTREE_PACKET_FLAGS));
|
||||||
|
|
||||||
OCTREE_PACKET_SEQUENCE sequence;
|
OCTREE_PACKET_SEQUENCE sequence;
|
||||||
sentPacket->read(&sequence, sizeof(sequence));
|
sentPacket.readPrimitive(&sequence);
|
||||||
|
|
||||||
OCTREE_PACKET_SENT_TIME timestamp;
|
OCTREE_PACKET_SENT_TIME timestamp;
|
||||||
sentPacket->read(×tamp, sizeof(timestamp));
|
sentPacket.readPrimitive(×tamp);
|
||||||
|
|
||||||
qDebug() << "Sending packet at " << now << " [" << _totalPackets <<"]: sequence: " << sequence <<
|
qDebug() << "Sending packet at " << now << " [" << _totalPackets <<"]: sequence: " << sequence <<
|
||||||
" timestamp: " << timestamp <<
|
" timestamp: " << timestamp <<
|
||||||
" size: " << nodeData->getPacket()->getSizeWithHeader() << " [" << _totalBytes <<
|
" size: " << nodeData->getPacket().getSizeWithHeader() << " [" << _totalBytes <<
|
||||||
"] wasted bytes:" << thisWastedBytes << " [" << _totalWastedBytes << "]";
|
"] wasted bytes:" << thisWastedBytes << " [" << _totalWastedBytes << "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,8 +250,8 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
|
||||||
DependencyManager::get<NodeList>()->sendUnreliablePacket(nodeData->getPacket(), _node);
|
DependencyManager::get<NodeList>()->sendUnreliablePacket(nodeData->getPacket(), _node);
|
||||||
packetSent = true;
|
packetSent = true;
|
||||||
|
|
||||||
int packetSizeWithHeader = nodeData->getPacket()->getSizeWithHeader();
|
int packetSizeWithHeader = nodeData->getPacket().getSizeWithHeader();
|
||||||
int thisWastedBytes = MAX_PACKET_SIZE -;
|
int thisWastedBytes = MAX_PACKET_SIZE - packetSizeWithHeader;
|
||||||
_totalWastedBytes += thisWastedBytes;
|
_totalWastedBytes += thisWastedBytes;
|
||||||
_totalBytes += packetSizeWithHeader;
|
_totalBytes += packetSizeWithHeader;
|
||||||
_totalPackets++;
|
_totalPackets++;
|
||||||
|
@ -259,13 +259,13 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
|
||||||
if (debug) {
|
if (debug) {
|
||||||
NLPacket& sentPacket = nodeData->getPacket();
|
NLPacket& sentPacket = nodeData->getPacket();
|
||||||
|
|
||||||
sentPacket->seek(sizeof(OCTREE_PACKET_FLAGS));
|
sentPacket.seek(sizeof(OCTREE_PACKET_FLAGS));
|
||||||
|
|
||||||
OCTREE_PACKET_SEQUENCE sequence;
|
OCTREE_PACKET_SEQUENCE sequence;
|
||||||
sentPacket->read(&sequence, sizeof(sequence));
|
sentPacket.readPrimitive(&sequence);
|
||||||
|
|
||||||
OCTREE_PACKET_SENT_TIME timestamp;
|
OCTREE_PACKET_SENT_TIME timestamp;
|
||||||
sentPacket->read(×tamp, sizeof(timestamp));
|
sentPacket.readPrimitive(×tamp);
|
||||||
|
|
||||||
qDebug() << "Sending packet at " << now << " [" << _totalPackets <<"]: sequence: " << sequence <<
|
qDebug() << "Sending packet at " << now << " [" << _totalPackets <<"]: sequence: " << sequence <<
|
||||||
" timestamp: " << timestamp <<
|
" timestamp: " << timestamp <<
|
||||||
|
@ -277,8 +277,8 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
|
||||||
|
|
||||||
// remember to track our stats
|
// remember to track our stats
|
||||||
if (packetSent) {
|
if (packetSent) {
|
||||||
nodeData->stats.packetSent(nodeData->getPacket()->getSizeUsed());
|
nodeData->stats.packetSent(nodeData->getPacket().getSizeUsed());
|
||||||
trueBytesSent += nodeData->getPacket()->getSizeUsed();
|
trueBytesSent += nodeData->getPacket().getSizeUsed();
|
||||||
truePacketsSent++;
|
truePacketsSent++;
|
||||||
packetsSent++;
|
packetsSent++;
|
||||||
nodeData->octreePacketSent();
|
nodeData->octreePacketSent();
|
||||||
|
@ -528,7 +528,7 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're not running compressed, then we know we can just send now. Or if we're running compressed, but
|
// If we're not running compressed, then we know we can just send now. Or if we're running compressed, but
|
||||||
// the packet doesn't have enough space to bother attempting to pack more...
|
// the packet doesn't have enough space to bother attempting to pack more...packet
|
||||||
bool sendNow = true;
|
bool sendNow = true;
|
||||||
|
|
||||||
if (nodeData->getCurrentPacketIsCompressed() &&
|
if (nodeData->getCurrentPacketIsCompressed() &&
|
||||||
|
|
|
@ -144,11 +144,16 @@ public:
|
||||||
// qint64 writeUnverifiedDatagram(const char* data, qint64 size, const SharedNodePointer& destinationNode,
|
// qint64 writeUnverifiedDatagram(const char* data, qint64 size, const SharedNodePointer& destinationNode,
|
||||||
// const HifiSockAddr& overridenSockAddr = HifiSockAddr());
|
// const HifiSockAddr& overridenSockAddr = HifiSockAddr());
|
||||||
//
|
//
|
||||||
|
|
||||||
|
qint64 sendUnreliablePacket(const NLPacket& packet, const SharedNodePointer& destinationNode)
|
||||||
|
{ assert(false); return 0; }
|
||||||
|
qint64 sendUnreliablePacket(const NLPacket& packet, const HifiSockAddr& sockAddr)
|
||||||
|
{ assert(false); return 0; }
|
||||||
|
// TODO remove those
|
||||||
qint64 sendUnreliablePacket(std::unique_ptr<NLPacket>& packet, const SharedNodePointer& destinationNode)
|
qint64 sendUnreliablePacket(std::unique_ptr<NLPacket>& packet, const SharedNodePointer& destinationNode)
|
||||||
{ assert(false); return 0; }
|
{ assert(false); return 0; }
|
||||||
qint64 sendUnreliablePacket(std::unique_ptr<NLPacket>& packet, const HifiSockAddr& sockAddr)
|
qint64 sendUnreliablePacket(std::unique_ptr<NLPacket>& packet, const HifiSockAddr& sockAddr)
|
||||||
{ assert(false); return 0; }
|
{ assert(false); return 0; }
|
||||||
|
|
||||||
qint64 sendPacket(std::unique_ptr<NLPacket> packet, const SharedNodePointer& destinationNode)
|
qint64 sendPacket(std::unique_ptr<NLPacket> packet, const SharedNodePointer& destinationNode)
|
||||||
{ assert(false); return 0; }
|
{ assert(false); return 0; }
|
||||||
|
|
Loading…
Reference in a new issue