mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:51:20 +02:00
use correct timestamp of avatar's outgoin data
This commit is contained in:
parent
e212ac67c1
commit
eb120b1bc1
3 changed files with 25 additions and 10 deletions
|
@ -25,6 +25,23 @@ AvatarMixerClientData::AvatarMixerClientData(const QUuid& nodeID) :
|
||||||
_avatar->setID(nodeID);
|
_avatar->setID(nodeID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t AvatarMixerClientData::getLastOtherAvatarEncodeTime(QUuid otherAvatar) const {
|
||||||
|
std::unordered_map<QUuid, uint64_t>::const_iterator itr = _lastOtherAvatarEncodeTime.find(otherAvatar);
|
||||||
|
if (itr != _lastOtherAvatarEncodeTime.end()) {
|
||||||
|
return itr->second;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AvatarMixerClientData::setLastOtherAvatarEncodeTime(const QUuid& otherAvatar, const uint64_t& time) {
|
||||||
|
std::unordered_map<QUuid, uint64_t>::iterator itr = _lastOtherAvatarEncodeTime.find(otherAvatar);
|
||||||
|
if (itr != _lastOtherAvatarEncodeTime.end()) {
|
||||||
|
itr->second = time;
|
||||||
|
} else {
|
||||||
|
_lastOtherAvatarEncodeTime.emplace(std::pair<QUuid, uint64_t>(otherAvatar, time));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AvatarMixerClientData::queuePacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer node) {
|
void AvatarMixerClientData::queuePacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer node) {
|
||||||
if (!_packetQueue.node) {
|
if (!_packetQueue.node) {
|
||||||
_packetQueue.node = node;
|
_packetQueue.node = node;
|
||||||
|
|
|
@ -112,14 +112,8 @@ public:
|
||||||
|
|
||||||
ViewFrustum getViewFrustum() const { return _currentViewFrustum; }
|
ViewFrustum getViewFrustum() const { return _currentViewFrustum; }
|
||||||
|
|
||||||
quint64 getLastOtherAvatarEncodeTime(QUuid otherAvatar) {
|
uint64_t getLastOtherAvatarEncodeTime(QUuid otherAvatar) const;
|
||||||
quint64 result = 0;
|
void setLastOtherAvatarEncodeTime(const QUuid& otherAvatar, const uint64_t& time);
|
||||||
if (_lastOtherAvatarEncodeTime.find(otherAvatar) != _lastOtherAvatarEncodeTime.end()) {
|
|
||||||
result = _lastOtherAvatarEncodeTime[otherAvatar];
|
|
||||||
}
|
|
||||||
_lastOtherAvatarEncodeTime[otherAvatar] = usecTimestampNow();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVector<JointData>& getLastOtherAvatarSentJoints(QUuid otherAvatar) {
|
QVector<JointData>& getLastOtherAvatarSentJoints(QUuid otherAvatar) {
|
||||||
_lastOtherAvatarSentJoints[otherAvatar].resize(_avatar->getJointCount());
|
_lastOtherAvatarSentJoints[otherAvatar].resize(_avatar->getJointCount());
|
||||||
|
@ -143,7 +137,7 @@ private:
|
||||||
|
|
||||||
// this is a map of the last time we encoded an "other" avatar for
|
// this is a map of the last time we encoded an "other" avatar for
|
||||||
// sending to "this" node
|
// sending to "this" node
|
||||||
std::unordered_map<QUuid, quint64> _lastOtherAvatarEncodeTime;
|
std::unordered_map<QUuid, uint64_t> _lastOtherAvatarEncodeTime;
|
||||||
std::unordered_map<QUuid, QVector<JointData>> _lastOtherAvatarSentJoints;
|
std::unordered_map<QUuid, QVector<JointData>> _lastOtherAvatarSentJoints;
|
||||||
|
|
||||||
uint64_t _identityChangeTimestamp;
|
uint64_t _identityChangeTimestamp;
|
||||||
|
|
|
@ -208,7 +208,7 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
|
||||||
PrioritySortUtil::getAvatarAgeCallback = [&] (const AvatarSharedPointer& avatar) {
|
PrioritySortUtil::getAvatarAgeCallback = [&] (const AvatarSharedPointer& avatar) {
|
||||||
auto avatarNode = avatarDataToNodes[avatar];
|
auto avatarNode = avatarDataToNodes[avatar];
|
||||||
assert(avatarNode); // we can't have gotten here without the avatarData being a valid key in the map
|
assert(avatarNode); // we can't have gotten here without the avatarData being a valid key in the map
|
||||||
return nodeData->getLastBroadcastTime(avatarNode->getUUID());
|
return nodeData->getLastOtherAvatarEncodeTime(avatarNode->getUUID());
|
||||||
};
|
};
|
||||||
|
|
||||||
class SortableAvatar: public PrioritySortUtil::Sortable {
|
class SortableAvatar: public PrioritySortUtil::Sortable {
|
||||||
|
@ -429,7 +429,11 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
|
||||||
// set the last sent sequence number for this sender on the receiver
|
// set the last sent sequence number for this sender on the receiver
|
||||||
nodeData->setLastBroadcastSequenceNumber(otherNode->getUUID(),
|
nodeData->setLastBroadcastSequenceNumber(otherNode->getUUID(),
|
||||||
otherNodeData->getLastReceivedSequenceNumber());
|
otherNodeData->getLastReceivedSequenceNumber());
|
||||||
|
nodeData->setLastOtherAvatarEncodeTime(otherNode->getUUID(), usecTimestampNow());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// TODO? this avatar is not included now, and will probably not be included next frame.
|
||||||
|
// It would be nice if we could tweak its future sort priority to put it at the back of the list.
|
||||||
}
|
}
|
||||||
|
|
||||||
avatarPacketList->endSegment();
|
avatarPacketList->endSegment();
|
||||||
|
|
Loading…
Reference in a new issue