mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
fix repeated pushing of avatar identity seq nums
This commit is contained in:
parent
50b56ec761
commit
ddb6db9f6a
2 changed files with 18 additions and 11 deletions
|
@ -1495,15 +1495,18 @@ void AvatarData::processAvatarIdentity(const QByteArray& identityData, bool& ide
|
|||
udt::SequenceNumber incomingSequenceNumber(incomingSequenceNumberType);
|
||||
|
||||
if (!_hasProcessedFirstIdentity) {
|
||||
_identitySequenceNumber = incomingSequenceNumber - 1;
|
||||
_lastIncomingSequenceNumber = incomingSequenceNumber - 1;
|
||||
_hasProcessedFirstIdentity = true;
|
||||
qCDebug(avatars) << "Processing first identity packet for" << avatarSessionID << "-"
|
||||
<< (udt::SequenceNumber::Type) incomingSequenceNumber;
|
||||
}
|
||||
|
||||
if (incomingSequenceNumber > _identitySequenceNumber) {
|
||||
if (incomingSequenceNumber > _lastIncomingSequenceNumber) {
|
||||
Identity identity;
|
||||
|
||||
qCDebug(avatars) << "Processing an identity packet from" << avatarSessionID
|
||||
<< "-" << (udt::SequenceNumber::Type) incomingSequenceNumber;
|
||||
|
||||
packetStream >> identity.skeletonModelURL
|
||||
>> identity.attachmentData
|
||||
>> identity.displayName
|
||||
|
@ -1511,7 +1514,7 @@ void AvatarData::processAvatarIdentity(const QByteArray& identityData, bool& ide
|
|||
>> identity.avatarEntityData;
|
||||
|
||||
// set the store identity sequence number to match the incoming identity
|
||||
_identitySequenceNumber = incomingSequenceNumber;
|
||||
_lastIncomingSequenceNumber = incomingSequenceNumber;
|
||||
|
||||
if (_firstSkeletonCheck || (identity.skeletonModelURL != cannonicalSkeletonModelURL(emptyURL))) {
|
||||
setSkeletonModelURL(identity.skeletonModelURL);
|
||||
|
@ -1554,7 +1557,7 @@ void AvatarData::processAvatarIdentity(const QByteArray& identityData, bool& ide
|
|||
|
||||
} else {
|
||||
qCDebug(avatars) << "Refusing to process identity for" << uuidStringWithoutCurlyBraces(avatarSessionID) << "since"
|
||||
<< (udt::SequenceNumber::Type) _identitySequenceNumber
|
||||
<< (udt::SequenceNumber::Type) _lastIncomingSequenceNumber
|
||||
<< "is later than" << (udt::SequenceNumber::Type) incomingSequenceNumber;
|
||||
}
|
||||
}
|
||||
|
@ -1566,7 +1569,7 @@ QByteArray AvatarData::identityByteArray() const {
|
|||
|
||||
_avatarEntitiesLock.withReadLock([&] {
|
||||
identityStream << getSessionUUID()
|
||||
<< (udt::SequenceNumber::Type) _identitySequenceNumber
|
||||
<< (udt::SequenceNumber::Type) _lastOutgoingSequenceNumber
|
||||
<< urlToSend
|
||||
<< _attachmentData
|
||||
<< _displayName
|
||||
|
@ -1747,6 +1750,12 @@ void AvatarData::sendAvatarDataPacket() {
|
|||
|
||||
void AvatarData::sendIdentityPacket() {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
if (_identityDataChanged) {
|
||||
// if the identity data has changed, push the sequence number forwards
|
||||
++_lastOutgoingSequenceNumber;
|
||||
}
|
||||
|
||||
QByteArray identityData = identityByteArray();
|
||||
|
||||
auto packetList = NLPacketList::create(PacketType::AvatarIdentity, QByteArray(), true, true);
|
||||
|
@ -1757,7 +1766,7 @@ void AvatarData::sendIdentityPacket() {
|
|||
},
|
||||
[&](const SharedNodePointer& node) {
|
||||
nodeList->sendPacketList(std::move(packetList), *node);
|
||||
});
|
||||
});
|
||||
|
||||
_avatarEntityDataLocallyEdited = false;
|
||||
_identityDataChanged = false;
|
||||
|
|
|
@ -621,10 +621,7 @@ public:
|
|||
static float _avatarSortCoefficientAge;
|
||||
|
||||
bool getIdentityDataChanged() const { return _identityDataChanged; } // has the identity data changed since the last time sendIdentityPacket() was called
|
||||
void markIdentityDataChanged() {
|
||||
_identityDataChanged = true;
|
||||
++_identitySequenceNumber;
|
||||
}
|
||||
void markIdentityDataChanged() { _identityDataChanged = true; }
|
||||
|
||||
float getDensity() const { return _density; }
|
||||
|
||||
|
@ -783,7 +780,8 @@ protected:
|
|||
float _audioAverageLoudness { 0.0f };
|
||||
|
||||
bool _identityDataChanged { false };
|
||||
udt::SequenceNumber _identitySequenceNumber { 0 };
|
||||
udt::SequenceNumber _lastIncomingSequenceNumber { 0 };
|
||||
udt::SequenceNumber _lastOutgoingSequenceNumber { 0 };
|
||||
bool _hasProcessedFirstIdentity { false };
|
||||
float _density;
|
||||
|
||||
|
|
Loading…
Reference in a new issue