Merge pull request #6018 from hyperlogic/tony/avatar-mixer-stats-improvements

Separated AvatarMixer inbound and outbound bandwidth on stats overlay
This commit is contained in:
Brad Hefta-Gaub 2015-10-07 16:04:13 -07:00
commit a86e34f9f9
4 changed files with 31 additions and 20 deletions

View file

@ -142,8 +142,15 @@ Item {
color: root.fontColor; color: root.fontColor;
font.pixelSize: root.fontSize font.pixelSize: root.fontSize
visible: root.expanded; visible: root.expanded;
text: "Avatar Mixer: " + root.avatarMixerKbps + " kbps, " + text: "Avatar Mixer In: " + root.avatarMixerInKbps + " kbps, " +
root.avatarMixerPps + "pps"; root.avatarMixerInPps + "pps";
}
Text {
color: root.fontColor;
font.pixelSize: root.fontSize
visible: root.expanded;
text: "Avatar Mixer Out: " + root.avatarMixerOutKbps + " kbps, " +
root.avatarMixerOutPps + "pps";
} }
Text { Text {
color: root.fontColor; color: root.fontColor;

View file

@ -167,15 +167,15 @@ void Stats::updateStats(bool force) {
if (_expanded || force) { if (_expanded || force) {
SharedNodePointer avatarMixer = nodeList->soloNodeOfType(NodeType::AvatarMixer); SharedNodePointer avatarMixer = nodeList->soloNodeOfType(NodeType::AvatarMixer);
if (avatarMixer) { if (avatarMixer) {
STAT_UPDATE(avatarMixerKbps, roundf( STAT_UPDATE(avatarMixerInKbps, roundf(bandwidthRecorder->getAverageInputKilobitsPerSecond(NodeType::AvatarMixer)));
bandwidthRecorder->getAverageInputKilobitsPerSecond(NodeType::AvatarMixer) + STAT_UPDATE(avatarMixerInPps, roundf(bandwidthRecorder->getAverageInputPacketsPerSecond(NodeType::AvatarMixer)));
bandwidthRecorder->getAverageOutputKilobitsPerSecond(NodeType::AvatarMixer))); STAT_UPDATE(avatarMixerOutKbps, roundf(bandwidthRecorder->getAverageOutputKilobitsPerSecond(NodeType::AvatarMixer)));
STAT_UPDATE(avatarMixerPps, roundf( STAT_UPDATE(avatarMixerOutPps, roundf(bandwidthRecorder->getAverageOutputPacketsPerSecond(NodeType::AvatarMixer)));
bandwidthRecorder->getAverageInputPacketsPerSecond(NodeType::AvatarMixer) +
bandwidthRecorder->getAverageOutputPacketsPerSecond(NodeType::AvatarMixer)));
} else { } else {
STAT_UPDATE(avatarMixerKbps, -1); STAT_UPDATE(avatarMixerInKbps, -1);
STAT_UPDATE(avatarMixerPps, -1); STAT_UPDATE(avatarMixerInPps, -1);
STAT_UPDATE(avatarMixerOutKbps, -1);
STAT_UPDATE(avatarMixerOutPps, -1);
} }
SharedNodePointer audioMixerNode = nodeList->soloNodeOfType(NodeType::AudioMixer); SharedNodePointer audioMixerNode = nodeList->soloNodeOfType(NodeType::AudioMixer);
if (audioMixerNode || force) { if (audioMixerNode || force) {

View file

@ -47,8 +47,10 @@ class Stats : public QQuickItem {
STATS_PROPERTY(QVector3D, position, QVector3D(0, 0, 0) ) STATS_PROPERTY(QVector3D, position, QVector3D(0, 0, 0) )
STATS_PROPERTY(float, velocity, 0) STATS_PROPERTY(float, velocity, 0)
STATS_PROPERTY(float, yaw, 0) STATS_PROPERTY(float, yaw, 0)
STATS_PROPERTY(int, avatarMixerKbps, 0) STATS_PROPERTY(int, avatarMixerInKbps, 0)
STATS_PROPERTY(int, avatarMixerPps, 0) STATS_PROPERTY(int, avatarMixerInPps, 0)
STATS_PROPERTY(int, avatarMixerOutKbps, 0)
STATS_PROPERTY(int, avatarMixerOutPps, 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)
@ -122,8 +124,10 @@ signals:
void positionChanged(); void positionChanged();
void velocityChanged(); void velocityChanged();
void yawChanged(); void yawChanged();
void avatarMixerKbpsChanged(); void avatarMixerInKbpsChanged();
void avatarMixerPpsChanged(); void avatarMixerInPpsChanged();
void avatarMixerOutKbpsChanged();
void avatarMixerOutPpsChanged();
void audioMixerKbpsChanged(); void audioMixerKbpsChanged();
void audioMixerPpsChanged(); void audioMixerPpsChanged();
void downloadsChanged(); void downloadsChanged();

View file

@ -19,17 +19,17 @@ BandwidthRecorder::Channel::Channel() {
} }
float BandwidthRecorder::Channel::getAverageInputPacketsPerSecond() { float BandwidthRecorder::Channel::getAverageInputPacketsPerSecond() {
float delt = _input.getEventDeltaAverage(); float averageTimeBetweenPackets = _input.getEventDeltaAverage();
if (delt > 0.0f) { if (averageTimeBetweenPackets > 0.0f) {
return (1.0f / delt); return (1.0f / averageTimeBetweenPackets);
} }
return 0.0f; return 0.0f;
} }
float BandwidthRecorder::Channel::getAverageOutputPacketsPerSecond() { float BandwidthRecorder::Channel::getAverageOutputPacketsPerSecond() {
float delt = _input.getEventDeltaAverage(); float averageTimeBetweenPackets = _output.getEventDeltaAverage();
if (delt > 0.0f) { if (averageTimeBetweenPackets > 0.0f) {
return (1.0f / _output.getEventDeltaAverage()); return (1.0f / averageTimeBetweenPackets);
} }
return 0.0f; return 0.0f;
} }