mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 03:58:07 +02:00
Control UUID inclusion in avatar data with new param
Increase estimate of avatars to be sent; remove start/end segment in avatar identity writes.
This commit is contained in:
parent
6f659db3b5
commit
0b77eb5e9c
3 changed files with 17 additions and 14 deletions
|
@ -72,9 +72,7 @@ int AvatarMixerSlave::sendIdentityPacket(NLPacketList& packetList, const AvatarM
|
||||||
if (destinationNode.getType() == NodeType::Agent && !destinationNode.isUpstream()) {
|
if (destinationNode.getType() == NodeType::Agent && !destinationNode.isUpstream()) {
|
||||||
QByteArray individualData = nodeData->getConstAvatarData()->identityByteArray();
|
QByteArray individualData = nodeData->getConstAvatarData()->identityByteArray();
|
||||||
individualData.replace(0, NUM_BYTES_RFC4122_UUID, nodeData->getNodeID().toRfc4122()); // FIXME, this looks suspicious
|
individualData.replace(0, NUM_BYTES_RFC4122_UUID, nodeData->getNodeID().toRfc4122()); // FIXME, this looks suspicious
|
||||||
packetList.startSegment();
|
|
||||||
packetList.write(individualData);
|
packetList.write(individualData);
|
||||||
packetList.endSegment();
|
|
||||||
_stats.numIdentityPackets++;
|
_stats.numIdentityPackets++;
|
||||||
return individualData.size();
|
return individualData.size();
|
||||||
} else {
|
} else {
|
||||||
|
@ -248,7 +246,7 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
|
||||||
distribution.reset();
|
distribution.reset();
|
||||||
|
|
||||||
// Estimate number to sort on number sent last frame (with min. of 20).
|
// Estimate number to sort on number sent last frame (with min. of 20).
|
||||||
const int numToSendEst = std::max(nodeData->getNumAvatarsSentLastFrame() * 2, 20);
|
const int numToSendEst = std::max(int(nodeData->getNumAvatarsSentLastFrame() * 2.5f), 20);
|
||||||
|
|
||||||
// reset the number of sent avatars
|
// reset the number of sent avatars
|
||||||
nodeData->resetNumAvatarsSentLastFrame();
|
nodeData->resetNumAvatarsSentLastFrame();
|
||||||
|
@ -455,6 +453,7 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
|
||||||
const bool distanceAdjust = true;
|
const bool distanceAdjust = true;
|
||||||
const bool dropFaceTracking = false;
|
const bool dropFaceTracking = false;
|
||||||
AvatarDataPacket::SendStatus sendStatus;
|
AvatarDataPacket::SendStatus sendStatus;
|
||||||
|
sendStatus.sendUUID = true;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
auto startSerialize = chrono::high_resolution_clock::now();
|
auto startSerialize = chrono::high_resolution_clock::now();
|
||||||
|
|
|
@ -229,8 +229,7 @@ QByteArray AvatarData::toByteArrayStateful(AvatarDataDetail dataDetail, bool dro
|
||||||
AvatarDataPacket::SendStatus sendStatus;
|
AvatarDataPacket::SendStatus sendStatus;
|
||||||
auto avatarByteArray = AvatarData::toByteArray(dataDetail, lastSentTime, getLastSentJointData(),
|
auto avatarByteArray = AvatarData::toByteArray(dataDetail, lastSentTime, getLastSentJointData(),
|
||||||
sendStatus, dropFaceTracking, false, glm::vec3(0), nullptr, 0, &_outboundDataRate);
|
sendStatus, dropFaceTracking, false, glm::vec3(0), nullptr, 0, &_outboundDataRate);
|
||||||
// Strip UUID
|
return avatarByteArray;
|
||||||
return avatarByteArray.right(avatarByteArray.size() - NUM_BYTES_RFC4122_UUID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSentTime,
|
QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSentTime,
|
||||||
|
@ -255,7 +254,11 @@ QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSent
|
||||||
if (dataDetail == NoData) {
|
if (dataDetail == NoData) {
|
||||||
sendStatus.itemFlags = wantedFlags;
|
sendStatus.itemFlags = wantedFlags;
|
||||||
|
|
||||||
QByteArray avatarDataByteArray(getSessionUUID().toRfc4122().data(), NUM_BYTES_RFC4122_UUID + sizeof wantedFlags);
|
QByteArray avatarDataByteArray;
|
||||||
|
if (sendStatus.sendUUID) {
|
||||||
|
avatarDataByteArray.append(getSessionUUID().toRfc4122().data(), NUM_BYTES_RFC4122_UUID);
|
||||||
|
}
|
||||||
|
|
||||||
avatarDataByteArray.append((char*) &wantedFlags, sizeof wantedFlags);
|
avatarDataByteArray.append((char*) &wantedFlags, sizeof wantedFlags);
|
||||||
return avatarDataByteArray;
|
return avatarDataByteArray;
|
||||||
}
|
}
|
||||||
|
@ -392,13 +395,6 @@ QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSent
|
||||||
const unsigned char* const startPosition = destinationBuffer;
|
const unsigned char* const startPosition = destinationBuffer;
|
||||||
const unsigned char* const packetEnd = destinationBuffer + maxDataSize;
|
const unsigned char* const packetEnd = destinationBuffer + maxDataSize;
|
||||||
|
|
||||||
// Packets always have UUID.
|
|
||||||
memcpy(destinationBuffer, getSessionUUID().toRfc4122(), NUM_BYTES_RFC4122_UUID);
|
|
||||||
destinationBuffer += NUM_BYTES_RFC4122_UUID;
|
|
||||||
|
|
||||||
unsigned char * packetFlagsLocation = destinationBuffer;
|
|
||||||
destinationBuffer += sizeof(wantedFlags);
|
|
||||||
|
|
||||||
#define AVATAR_MEMCPY(src) \
|
#define AVATAR_MEMCPY(src) \
|
||||||
memcpy(destinationBuffer, &(src), sizeof(src)); \
|
memcpy(destinationBuffer, &(src), sizeof(src)); \
|
||||||
destinationBuffer += sizeof(src);
|
destinationBuffer += sizeof(src);
|
||||||
|
@ -409,6 +405,14 @@ QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSent
|
||||||
&& (packetEnd - destinationBuffer) >= (ptrdiff_t)(space) \
|
&& (packetEnd - destinationBuffer) >= (ptrdiff_t)(space) \
|
||||||
&& (includedFlags |= AvatarDataPacket::flag))
|
&& (includedFlags |= AvatarDataPacket::flag))
|
||||||
|
|
||||||
|
if (sendStatus.sendUUID) {
|
||||||
|
memcpy(destinationBuffer, getSessionUUID().toRfc4122(), NUM_BYTES_RFC4122_UUID);
|
||||||
|
destinationBuffer += NUM_BYTES_RFC4122_UUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char * packetFlagsLocation = destinationBuffer;
|
||||||
|
destinationBuffer += sizeof(wantedFlags);
|
||||||
|
|
||||||
IF_AVATAR_SPACE(PACKET_HAS_AVATAR_GLOBAL_POSITION, sizeof _globalPosition) {
|
IF_AVATAR_SPACE(PACKET_HAS_AVATAR_GLOBAL_POSITION, sizeof _globalPosition) {
|
||||||
auto startSection = destinationBuffer;
|
auto startSection = destinationBuffer;
|
||||||
if (_overrideGlobalPosition) {
|
if (_overrideGlobalPosition) {
|
||||||
|
@ -417,7 +421,6 @@ QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSent
|
||||||
AVATAR_MEMCPY(_globalPosition);
|
AVATAR_MEMCPY(_globalPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int numBytes = destinationBuffer - startSection;
|
int numBytes = destinationBuffer - startSection;
|
||||||
|
|
||||||
if (outboundDataRateOut) {
|
if (outboundDataRateOut) {
|
||||||
|
|
|
@ -302,6 +302,7 @@ namespace AvatarDataPacket {
|
||||||
|
|
||||||
struct SendStatus {
|
struct SendStatus {
|
||||||
HasFlags itemFlags { 0 };
|
HasFlags itemFlags { 0 };
|
||||||
|
bool sendUUID { false };
|
||||||
int rotationsSent { 0 }; // ie: index of next unsent joint
|
int rotationsSent { 0 }; // ie: index of next unsent joint
|
||||||
int translationsSent { 0 };
|
int translationsSent { 0 };
|
||||||
operator bool() { return itemFlags == 0; }
|
operator bool() { return itemFlags == 0; }
|
||||||
|
|
Loading…
Reference in a new issue