mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-20 20:09:20 +02:00
block and wait for bytes to be written during broadcastAvatarData loop
This commit is contained in:
parent
68d55152b9
commit
4e77afb4b2
2 changed files with 3 additions and 11 deletions
|
@ -54,10 +54,6 @@ const float BILLBOARD_AND_IDENTITY_SEND_PROBABILITY = 1.0f / 300.0f;
|
||||||
// NOTE: some additional optimizations to consider.
|
// NOTE: some additional optimizations to consider.
|
||||||
// 1) use the view frustum to cull those avatars that are out of view. Since avatar data doesn't need to be present
|
// 1) use the view frustum to cull those avatars that are out of view. Since avatar data doesn't need to be present
|
||||||
// if the avatar is not in view or in the keyhole.
|
// if the avatar is not in view or in the keyhole.
|
||||||
// 2) after culling for view frustum, sort order the avatars by distance, send the closest ones first.
|
|
||||||
// 3) if we need to rate limit the amount of data we send, we can use a distance weighted "semi-random" function to
|
|
||||||
// determine which avatars are included in the packet stream
|
|
||||||
// 4) we should optimize the avatar data format to be more compact (100 bytes is pretty wasteful).
|
|
||||||
void AvatarMixer::broadcastAvatarData() {
|
void AvatarMixer::broadcastAvatarData() {
|
||||||
static QByteArray mixedAvatarByteArray;
|
static QByteArray mixedAvatarByteArray;
|
||||||
|
|
||||||
|
@ -139,6 +135,8 @@ void AvatarMixer::broadcastAvatarData() {
|
||||||
|
|
||||||
++_sumIdentityPackets;
|
++_sumIdentityPackets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nodeList->getNodeSocket().waitForBytesWritten(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,13 +171,7 @@ qint64 NodeList::writeDatagram(const QByteArray& datagram, const HifiSockAddr& d
|
||||||
++_numCollectedPackets;
|
++_numCollectedPackets;
|
||||||
_numCollectedBytes += datagram.size();
|
_numCollectedBytes += datagram.size();
|
||||||
|
|
||||||
qint64 bytesWritten = _nodeSocket.writeDatagram(datagramCopy,
|
return _nodeSocket.writeDatagram(datagramCopy, destinationSockAddr.getAddress(), destinationSockAddr.getPort());
|
||||||
destinationSockAddr.getAddress(),
|
|
||||||
destinationSockAddr.getPort());
|
|
||||||
|
|
||||||
// ask the underlying QUdpSocket to flush its buffers to avoid filling them up
|
|
||||||
_nodeSocket.flush();
|
|
||||||
return bytesWritten;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue