mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-26 02:15:08 +02:00
drop avatar data rate to 45hz
This commit is contained in:
parent
a2ba03284e
commit
e3bc49c302
6 changed files with 20 additions and 5 deletions
|
@ -32,7 +32,8 @@
|
||||||
|
|
||||||
const QString AVATAR_MIXER_LOGGING_NAME = "avatar-mixer";
|
const QString AVATAR_MIXER_LOGGING_NAME = "avatar-mixer";
|
||||||
|
|
||||||
const int AVATAR_MIXER_BROADCAST_FRAMES_PER_SECOND = 60;
|
// FIXME - what we'd actually like to do is send to users at ~50% of their present rate down to 30hz. Assume 90 for now.
|
||||||
|
const int AVATAR_MIXER_BROADCAST_FRAMES_PER_SECOND = 45;
|
||||||
const unsigned int AVATAR_DATA_SEND_INTERVAL_MSECS = (1.0f / (float) AVATAR_MIXER_BROADCAST_FRAMES_PER_SECOND) * 1000;
|
const unsigned int AVATAR_DATA_SEND_INTERVAL_MSECS = (1.0f / (float) AVATAR_MIXER_BROADCAST_FRAMES_PER_SECOND) * 1000;
|
||||||
|
|
||||||
AvatarMixer::AvatarMixer(ReceivedMessage& message) :
|
AvatarMixer::AvatarMixer(ReceivedMessage& message) :
|
||||||
|
|
|
@ -154,7 +154,8 @@ Item {
|
||||||
StatText {
|
StatText {
|
||||||
visible: root.expanded;
|
visible: root.expanded;
|
||||||
text: "Avatar Mixer Out: " + root.avatarMixerOutKbps + " kbps, " +
|
text: "Avatar Mixer Out: " + root.avatarMixerOutKbps + " kbps, " +
|
||||||
root.avatarMixerOutPps + "pps";
|
root.avatarMixerOutPps + "pps, " +
|
||||||
|
root.myAvatarSendRate.toFixed(2) + "hz";
|
||||||
}
|
}
|
||||||
StatText {
|
StatText {
|
||||||
visible: root.expanded;
|
visible: root.expanded;
|
||||||
|
|
|
@ -41,9 +41,11 @@
|
||||||
#include "MyAvatar.h"
|
#include "MyAvatar.h"
|
||||||
#include "SceneScriptingInterface.h"
|
#include "SceneScriptingInterface.h"
|
||||||
|
|
||||||
// 70 times per second - target is 60hz, but this helps account for any small deviations
|
// 50 times per second - target is 45hz, but this helps account for any small deviations
|
||||||
// in the update loop
|
// in the update loop - this also results in ~30hz when in desktop mode which is essentially
|
||||||
static const quint64 MIN_TIME_BETWEEN_MY_AVATAR_DATA_SENDS = (1000 * 1000) / 70;
|
// what we want
|
||||||
|
const int CLIENT_TO_AVATAR_MIXER_BROADCAST_FRAMES_PER_SECOND = 50;
|
||||||
|
static const quint64 MIN_TIME_BETWEEN_MY_AVATAR_DATA_SENDS = USECS_PER_SECOND / CLIENT_TO_AVATAR_MIXER_BROADCAST_FRAMES_PER_SECOND;
|
||||||
|
|
||||||
// We add _myAvatar into the hash with all the other AvatarData, and we use the default NULL QUid as the key.
|
// We add _myAvatar into the hash with all the other AvatarData, and we use the default NULL QUid as the key.
|
||||||
const QUuid MY_AVATAR_KEY; // NULL key
|
const QUuid MY_AVATAR_KEY; // NULL key
|
||||||
|
@ -118,6 +120,7 @@ void AvatarManager::updateMyAvatar(float deltaTime) {
|
||||||
PerformanceTimer perfTimer("send");
|
PerformanceTimer perfTimer("send");
|
||||||
_myAvatar->sendAvatarDataPacket();
|
_myAvatar->sendAvatarDataPacket();
|
||||||
_lastSendAvatarDataTime = now;
|
_lastSendAvatarDataTime = now;
|
||||||
|
_myAvatarSendRate.increment();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <PhysicsEngine.h>
|
#include <PhysicsEngine.h>
|
||||||
#include <PIDController.h>
|
#include <PIDController.h>
|
||||||
#include <SimpleMovingAverage.h>
|
#include <SimpleMovingAverage.h>
|
||||||
|
#include <shared/RateCounter.h>
|
||||||
|
|
||||||
#include "Avatar.h"
|
#include "Avatar.h"
|
||||||
#include "AvatarMotionState.h"
|
#include "AvatarMotionState.h"
|
||||||
|
@ -74,6 +75,8 @@ public:
|
||||||
const QScriptValue& avatarIdsToInclude = QScriptValue(),
|
const QScriptValue& avatarIdsToInclude = QScriptValue(),
|
||||||
const QScriptValue& avatarIdsToDiscard = QScriptValue());
|
const QScriptValue& avatarIdsToDiscard = QScriptValue());
|
||||||
|
|
||||||
|
float getMyAvatarSendRate() const { return _myAvatarSendRate.rate(); }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setShouldShowReceiveStats(bool shouldShowReceiveStats) { _shouldShowReceiveStats = shouldShowReceiveStats; }
|
void setShouldShowReceiveStats(bool shouldShowReceiveStats) { _shouldShowReceiveStats = shouldShowReceiveStats; }
|
||||||
void updateAvatarRenderStatus(bool shouldRenderAvatars);
|
void updateAvatarRenderStatus(bool shouldRenderAvatars);
|
||||||
|
@ -106,6 +109,9 @@ private:
|
||||||
SetOfAvatarMotionStates _motionStatesThatMightUpdate;
|
SetOfAvatarMotionStates _motionStatesThatMightUpdate;
|
||||||
SetOfMotionStates _motionStatesToAddToPhysics;
|
SetOfMotionStates _motionStatesToAddToPhysics;
|
||||||
VectorOfMotionStates _motionStatesToRemoveFromPhysics;
|
VectorOfMotionStates _motionStatesToRemoveFromPhysics;
|
||||||
|
|
||||||
|
RateCounter<> _myAvatarSendRate;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(AvatarManager::LocalLight)
|
Q_DECLARE_METATYPE(AvatarManager::LocalLight)
|
||||||
|
|
|
@ -188,11 +188,13 @@ void Stats::updateStats(bool force) {
|
||||||
STAT_UPDATE(avatarMixerInPps, roundf(bandwidthRecorder->getAverageInputPacketsPerSecond(NodeType::AvatarMixer)));
|
STAT_UPDATE(avatarMixerInPps, roundf(bandwidthRecorder->getAverageInputPacketsPerSecond(NodeType::AvatarMixer)));
|
||||||
STAT_UPDATE(avatarMixerOutKbps, roundf(bandwidthRecorder->getAverageOutputKilobitsPerSecond(NodeType::AvatarMixer)));
|
STAT_UPDATE(avatarMixerOutKbps, roundf(bandwidthRecorder->getAverageOutputKilobitsPerSecond(NodeType::AvatarMixer)));
|
||||||
STAT_UPDATE(avatarMixerOutPps, roundf(bandwidthRecorder->getAverageOutputPacketsPerSecond(NodeType::AvatarMixer)));
|
STAT_UPDATE(avatarMixerOutPps, roundf(bandwidthRecorder->getAverageOutputPacketsPerSecond(NodeType::AvatarMixer)));
|
||||||
|
STAT_UPDATE(myAvatarSendRate, avatarManager->getMyAvatarSendRate());
|
||||||
} else {
|
} else {
|
||||||
STAT_UPDATE(avatarMixerInKbps, -1);
|
STAT_UPDATE(avatarMixerInKbps, -1);
|
||||||
STAT_UPDATE(avatarMixerInPps, -1);
|
STAT_UPDATE(avatarMixerInPps, -1);
|
||||||
STAT_UPDATE(avatarMixerOutKbps, -1);
|
STAT_UPDATE(avatarMixerOutKbps, -1);
|
||||||
STAT_UPDATE(avatarMixerOutPps, -1);
|
STAT_UPDATE(avatarMixerOutPps, -1);
|
||||||
|
STAT_UPDATE(myAvatarSendRate, avatarManager->getMyAvatarSendRate());
|
||||||
}
|
}
|
||||||
SharedNodePointer audioMixerNode = nodeList->soloNodeOfType(NodeType::AudioMixer);
|
SharedNodePointer audioMixerNode = nodeList->soloNodeOfType(NodeType::AudioMixer);
|
||||||
if (audioMixerNode || force) {
|
if (audioMixerNode || force) {
|
||||||
|
|
|
@ -62,6 +62,7 @@ class Stats : public QQuickItem {
|
||||||
STATS_PROPERTY(int, avatarMixerInPps, 0)
|
STATS_PROPERTY(int, avatarMixerInPps, 0)
|
||||||
STATS_PROPERTY(int, avatarMixerOutKbps, 0)
|
STATS_PROPERTY(int, avatarMixerOutKbps, 0)
|
||||||
STATS_PROPERTY(int, avatarMixerOutPps, 0)
|
STATS_PROPERTY(int, avatarMixerOutPps, 0)
|
||||||
|
STATS_PROPERTY(float, myAvatarSendRate, 0)
|
||||||
STATS_PROPERTY(int, audioMixerKbps, 0)
|
STATS_PROPERTY(int, audioMixerKbps, 0)
|
||||||
STATS_PROPERTY(int, audioMixerPps, 0)
|
STATS_PROPERTY(int, audioMixerPps, 0)
|
||||||
STATS_PROPERTY(int, downloads, 0)
|
STATS_PROPERTY(int, downloads, 0)
|
||||||
|
@ -164,6 +165,7 @@ signals:
|
||||||
void avatarMixerInPpsChanged();
|
void avatarMixerInPpsChanged();
|
||||||
void avatarMixerOutKbpsChanged();
|
void avatarMixerOutKbpsChanged();
|
||||||
void avatarMixerOutPpsChanged();
|
void avatarMixerOutPpsChanged();
|
||||||
|
void myAvatarSendRateChanged();
|
||||||
void audioMixerKbpsChanged();
|
void audioMixerKbpsChanged();
|
||||||
void audioMixerPpsChanged();
|
void audioMixerPpsChanged();
|
||||||
void downloadsChanged();
|
void downloadsChanged();
|
||||||
|
|
Loading…
Reference in a new issue