mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:51:20 +02:00
Merge pull request #4107 from huffman/fix-update-my-avatar
Fix issue with avatar data being sent too often
This commit is contained in:
commit
67c3f9a3db
2 changed files with 12 additions and 1 deletions
|
@ -2137,12 +2137,17 @@ void Application::updateMyAvatar(float deltaTime) {
|
||||||
|
|
||||||
_myAvatar->update(deltaTime);
|
_myAvatar->update(deltaTime);
|
||||||
|
|
||||||
{
|
quint64 now = usecTimestampNow();
|
||||||
|
quint64 dt = now - _lastSendAvatarDataTime;
|
||||||
|
|
||||||
|
if (dt > MIN_TIME_BETWEEN_MY_AVATAR_DATA_SENDS) {
|
||||||
// send head/hand data to the avatar mixer and voxel server
|
// send head/hand data to the avatar mixer and voxel server
|
||||||
PerformanceTimer perfTimer("send");
|
PerformanceTimer perfTimer("send");
|
||||||
QByteArray packet = byteArrayWithPopulatedHeader(PacketTypeAvatarData);
|
QByteArray packet = byteArrayWithPopulatedHeader(PacketTypeAvatarData);
|
||||||
packet.append(_myAvatar->toByteArray());
|
packet.append(_myAvatar->toByteArray());
|
||||||
controlledBroadcastToNodes(packet, NodeSet() << NodeType::AvatarMixer);
|
controlledBroadcastToNodes(packet, NodeSet() << NodeType::AvatarMixer);
|
||||||
|
|
||||||
|
_lastSendAvatarDataTime = now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,10 @@ static const float MIRROR_REARVIEW_DISTANCE = 0.722f;
|
||||||
static const float MIRROR_REARVIEW_BODY_DISTANCE = 2.56f;
|
static const float MIRROR_REARVIEW_BODY_DISTANCE = 2.56f;
|
||||||
static const float MIRROR_FIELD_OF_VIEW = 30.0f;
|
static const float MIRROR_FIELD_OF_VIEW = 30.0f;
|
||||||
|
|
||||||
|
// 70 times per second - target is 60hz, but this helps account for any small deviations
|
||||||
|
// in the update loop
|
||||||
|
static const quint64 MIN_TIME_BETWEEN_MY_AVATAR_DATA_SENDS = (1000 * 1000) / 70;
|
||||||
|
|
||||||
static const quint64 TOO_LONG_SINCE_LAST_SEND_DOWNSTREAM_AUDIO_STATS = 1 * USECS_PER_SECOND;
|
static const quint64 TOO_LONG_SINCE_LAST_SEND_DOWNSTREAM_AUDIO_STATS = 1 * USECS_PER_SECOND;
|
||||||
|
|
||||||
static const QString INFO_HELP_PATH = "html/interface-welcome-allsvg.html";
|
static const QString INFO_HELP_PATH = "html/interface-welcome-allsvg.html";
|
||||||
|
@ -567,6 +571,8 @@ private:
|
||||||
quint64 _lastNackTime;
|
quint64 _lastNackTime;
|
||||||
quint64 _lastSendDownstreamAudioStats;
|
quint64 _lastSendDownstreamAudioStats;
|
||||||
|
|
||||||
|
quint64 _lastSendAvatarDataTime;
|
||||||
|
|
||||||
bool _isVSyncOn;
|
bool _isVSyncOn;
|
||||||
|
|
||||||
bool _aboutToQuit;
|
bool _aboutToQuit;
|
||||||
|
|
Loading…
Reference in a new issue