mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-10 08:12:08 +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()) {
|
||||
QByteArray individualData = nodeData->getConstAvatarData()->identityByteArray();
|
||||
individualData.replace(0, NUM_BYTES_RFC4122_UUID, nodeData->getNodeID().toRfc4122()); // FIXME, this looks suspicious
|
||||
packetList.startSegment();
|
||||
packetList.write(individualData);
|
||||
packetList.endSegment();
|
||||
_stats.numIdentityPackets++;
|
||||
return individualData.size();
|
||||
} else {
|
||||
|
@ -248,7 +246,7 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
|
|||
distribution.reset();
|
||||
|
||||
// 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
|
||||
nodeData->resetNumAvatarsSentLastFrame();
|
||||
|
@ -455,6 +453,7 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
|
|||
const bool distanceAdjust = true;
|
||||
const bool dropFaceTracking = false;
|
||||
AvatarDataPacket::SendStatus sendStatus;
|
||||
sendStatus.sendUUID = true;
|
||||
|
||||
do {
|
||||
auto startSerialize = chrono::high_resolution_clock::now();
|
||||
|
|
|
@ -229,8 +229,7 @@ QByteArray AvatarData::toByteArrayStateful(AvatarDataDetail dataDetail, bool dro
|
|||
AvatarDataPacket::SendStatus sendStatus;
|
||||
auto avatarByteArray = AvatarData::toByteArray(dataDetail, lastSentTime, getLastSentJointData(),
|
||||
sendStatus, dropFaceTracking, false, glm::vec3(0), nullptr, 0, &_outboundDataRate);
|
||||
// Strip UUID
|
||||
return avatarByteArray.right(avatarByteArray.size() - NUM_BYTES_RFC4122_UUID);
|
||||
return avatarByteArray;
|
||||
}
|
||||
|
||||
QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSentTime,
|
||||
|
@ -255,7 +254,11 @@ QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSent
|
|||
if (dataDetail == NoData) {
|
||||
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);
|
||||
return avatarDataByteArray;
|
||||
}
|
||||
|
@ -392,13 +395,6 @@ QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSent
|
|||
const unsigned char* const startPosition = destinationBuffer;
|
||||
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) \
|
||||
memcpy(destinationBuffer, &(src), sizeof(src)); \
|
||||
destinationBuffer += sizeof(src);
|
||||
|
@ -409,6 +405,14 @@ QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSent
|
|||
&& (packetEnd - destinationBuffer) >= (ptrdiff_t)(space) \
|
||||
&& (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) {
|
||||
auto startSection = destinationBuffer;
|
||||
if (_overrideGlobalPosition) {
|
||||
|
@ -417,7 +421,6 @@ QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSent
|
|||
AVATAR_MEMCPY(_globalPosition);
|
||||
}
|
||||
|
||||
|
||||
int numBytes = destinationBuffer - startSection;
|
||||
|
||||
if (outboundDataRateOut) {
|
||||
|
|
|
@ -302,6 +302,7 @@ namespace AvatarDataPacket {
|
|||
|
||||
struct SendStatus {
|
||||
HasFlags itemFlags { 0 };
|
||||
bool sendUUID { false };
|
||||
int rotationsSent { 0 }; // ie: index of next unsent joint
|
||||
int translationsSent { 0 };
|
||||
operator bool() { return itemFlags == 0; }
|
||||
|
|
Loading…
Reference in a new issue