|
|
@@ -79,7 +79,14 @@ PeerStats.prototype.setSsrcResolution = function (ssrc, resolution)
|
|
79
|
79
|
*/
|
|
80
|
80
|
PeerStats.prototype.setSsrcBitrate = function (ssrc, bitrate)
|
|
81
|
81
|
{
|
|
82
|
|
- this.ssrc2bitrate[ssrc] = bitrate;
|
|
|
82
|
+ if(this.ssrc2bitrate[ssrc])
|
|
|
83
|
+ {
|
|
|
84
|
+ this.ssrc2bitrate[ssrc].download += bitrate.download;
|
|
|
85
|
+ this.ssrc2bitrate[ssrc].upload += bitrate.upload;
|
|
|
86
|
+ }
|
|
|
87
|
+ else {
|
|
|
88
|
+ this.ssrc2bitrate[ssrc] = bitrate;
|
|
|
89
|
+ }
|
|
83
|
90
|
};
|
|
84
|
91
|
|
|
85
|
92
|
/**
|
|
|
@@ -392,6 +399,7 @@ StatsCollector.prototype.processStatsReport = function () {
|
|
392
|
399
|
"packetsLost": lossRate,
|
|
393
|
400
|
"isDownloadStream": isDownloadStream});
|
|
394
|
401
|
|
|
|
402
|
+
|
|
395
|
403
|
var bytesReceived = 0, bytesSent = 0;
|
|
396
|
404
|
if(getStatValue(now, "bytesReceived"))
|
|
397
|
405
|
{
|
|
|
@@ -401,7 +409,8 @@ StatsCollector.prototype.processStatsReport = function () {
|
|
401
|
409
|
|
|
402
|
410
|
if(getStatValue(now, "bytesSent"))
|
|
403
|
411
|
{
|
|
404
|
|
- bytesSent = getStatValue(now, "bytesSent") - getStatValue(before, "bytesSent");
|
|
|
412
|
+ bytesSent = getStatValue(now, "bytesSent") -
|
|
|
413
|
+ getStatValue(before, "bytesSent");
|
|
405
|
414
|
}
|
|
406
|
415
|
|
|
407
|
416
|
var time = Math.round((now.timestamp - before.timestamp) / 1000);
|
|
|
@@ -426,6 +435,7 @@ StatsCollector.prototype.processStatsReport = function () {
|
|
426
|
435
|
jidStats.setSsrcBitrate(ssrc, {
|
|
427
|
436
|
"download": bytesReceived,
|
|
428
|
437
|
"upload": bytesSent});
|
|
|
438
|
+
|
|
429
|
439
|
var resolution = {height: null, width: null};
|
|
430
|
440
|
try {
|
|
431
|
441
|
if (getStatValue(now, "googFrameHeightReceived") &&
|
|
|
@@ -481,13 +491,14 @@ StatsCollector.prototype.processStatsReport = function () {
|
|
481
|
491
|
self.jid2stats[jid].ssrc2bitrate[ssrc].download;
|
|
482
|
492
|
bitrateUpload +=
|
|
483
|
493
|
self.jid2stats[jid].ssrc2bitrate[ssrc].upload;
|
|
|
494
|
+
|
|
|
495
|
+ delete self.jid2stats[jid].ssrc2bitrate[ssrc];
|
|
484
|
496
|
}
|
|
485
|
497
|
);
|
|
486
|
498
|
resolutions[jid] = self.jid2stats[jid].ssrc2resolution;
|
|
487
|
499
|
}
|
|
488
|
500
|
);
|
|
489
|
501
|
|
|
490
|
|
- console.log("!!!!!!!!!! " + bitrateDownload + " - " + bitrateUpload);
|
|
491
|
502
|
PeerStats.bitrate = {"upload": bitrateUpload, "download": bitrateDownload};
|
|
492
|
503
|
|
|
493
|
504
|
PeerStats.packetLoss = {
|