mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 07:47:30 +02:00
Added JS access to the variables
Stats.audioPacketlossUpstream Stats.audioPacketlossDownstream Which contain a floating point with the value between 0.0f and 1.0f which is the percentage of packet loss.
This commit is contained in:
parent
a820682816
commit
14fc39ffa3
2 changed files with 9 additions and 0 deletions
|
@ -46,6 +46,7 @@ Stats::Stats(QQuickItem* parent) : QQuickItem(parent) {
|
|||
INSTANCE = this;
|
||||
const QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||
_monospaceFont = font.family();
|
||||
_audioStats = &DependencyManager::get<AudioClient>()->getStats();
|
||||
}
|
||||
|
||||
bool Stats::includeTimingRecord(const QString& name) {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <OffscreenQmlElement.h>
|
||||
#include <RenderArgs.h>
|
||||
#include <QVector3D>
|
||||
#include <AudioIOStats.h>
|
||||
|
||||
#define STATS_PROPERTY(type, name, initialValue) \
|
||||
Q_PROPERTY(type name READ name NOTIFY name##Changed) \
|
||||
|
@ -27,6 +28,8 @@ class Stats : public QQuickItem {
|
|||
Q_PROPERTY(bool expanded READ isExpanded WRITE setExpanded NOTIFY expandedChanged)
|
||||
Q_PROPERTY(bool timingExpanded READ isTimingExpanded NOTIFY timingExpandedChanged)
|
||||
Q_PROPERTY(QString monospaceFont READ monospaceFont CONSTANT)
|
||||
Q_PROPERTY(float audioPacketlossUpstream READ getAudioPacketLossUpstream)
|
||||
Q_PROPERTY(float audioPacketlossDownstream READ getAudioPacketLossDownstream)
|
||||
|
||||
STATS_PROPERTY(int, serverCount, 0)
|
||||
STATS_PROPERTY(int, framerate, 0)
|
||||
|
@ -81,6 +84,10 @@ public:
|
|||
const QString& monospaceFont() {
|
||||
return _monospaceFont;
|
||||
}
|
||||
|
||||
float getAudioPacketLossUpstream() { return _audioStats->getMixerAvatarStreamStats()._packetStreamStats.getLostRate(); }
|
||||
float getAudioPacketLossDownstream() { return _audioStats->getMixerDownstreamStats()._packetStreamStats.getLostRate(); }
|
||||
|
||||
void updateStats(bool force = false);
|
||||
|
||||
bool isExpanded() { return _expanded; }
|
||||
|
@ -149,6 +156,7 @@ private:
|
|||
bool _expanded{ false };
|
||||
bool _timingExpanded{ false };
|
||||
QString _monospaceFont;
|
||||
const AudioIOStats* _audioStats;
|
||||
};
|
||||
|
||||
#endif // hifi_Stats_h
|
||||
|
|
Loading…
Reference in a new issue