diff options
author | Chocobozzz <me@florianbigard.com> | 2023-07-13 10:52:47 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-07-17 11:31:46 +0200 |
commit | 9bb541bec7003b791cfbbf5622b2d2af47156de8 (patch) | |
tree | 1663edbf94a6bdc3161e0b1066d4bbf6c7a7598f /client | |
parent | 9bc85bd2f8b5ae1c6675014e2eb0175d2a76ce1a (diff) | |
download | PeerTube-9bb541bec7003b791cfbbf5622b2d2af47156de8.tar.gz PeerTube-9bb541bec7003b791cfbbf5622b2d2af47156de8.tar.zst PeerTube-9bb541bec7003b791cfbbf5622b2d2af47156de8.zip |
Round HTTP/P2P network stats
Diffstat (limited to 'client')
-rw-r--r-- | client/src/assets/player/shared/metrics/metrics-plugin.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/client/src/assets/player/shared/metrics/metrics-plugin.ts b/client/src/assets/player/shared/metrics/metrics-plugin.ts index 48363a724..c8b61592c 100644 --- a/client/src/assets/player/shared/metrics/metrics-plugin.ts +++ b/client/src/assets/player/shared/metrics/metrics-plugin.ts | |||
@@ -134,16 +134,16 @@ class MetricsPlugin extends Plugin { | |||
134 | 134 | ||
135 | private trackBytes () { | 135 | private trackBytes () { |
136 | this.player.on('p2p-info', (_event, data: PlayerNetworkInfo) => { | 136 | this.player.on('p2p-info', (_event, data: PlayerNetworkInfo) => { |
137 | this.downloadedBytesHTTP += data.http.downloaded - (this.lastPlayerNetworkInfo?.http.downloaded || 0) | 137 | this.downloadedBytesHTTP += Math.round(data.http.downloaded - (this.lastPlayerNetworkInfo?.http.downloaded || 0)) |
138 | this.downloadedBytesP2P += data.p2p.downloaded - (this.lastPlayerNetworkInfo?.p2p.downloaded || 0) | 138 | this.downloadedBytesP2P += Math.round(data.p2p.downloaded - (this.lastPlayerNetworkInfo?.p2p.downloaded || 0)) |
139 | 139 | ||
140 | this.uploadedBytesP2P += data.p2p.uploaded - (this.lastPlayerNetworkInfo?.p2p.uploaded || 0) | 140 | this.uploadedBytesP2P += Math.round(data.p2p.uploaded - (this.lastPlayerNetworkInfo?.p2p.uploaded || 0)) |
141 | 141 | ||
142 | this.lastPlayerNetworkInfo = data | 142 | this.lastPlayerNetworkInfo = data |
143 | }) | 143 | }) |
144 | 144 | ||
145 | this.player.on('http-info', (_event, data: PlayerNetworkInfo) => { | 145 | this.player.on('http-info', (_event, data: PlayerNetworkInfo) => { |
146 | this.downloadedBytesHTTP += data.http.downloaded - (this.lastPlayerNetworkInfo?.http.downloaded || 0) | 146 | this.downloadedBytesHTTP += Math.round(data.http.downloaded - (this.lastPlayerNetworkInfo?.http.downloaded || 0)) |
147 | }) | 147 | }) |
148 | } | 148 | } |
149 | 149 | ||