|
|
@@ -592,9 +592,8 @@ StatsCollector.prototype.processStatsReport = function () {
|
|
592
|
592
|
var packetsBefore = getStatValue(before, key);
|
|
593
|
593
|
if (!packetsBefore || packetsBefore < 0)
|
|
594
|
594
|
packetsBefore = 0;
|
|
595
|
|
- var packetRate = packetsNow - packetsBefore;
|
|
596
|
|
- if (!packetRate || packetRate < 0)
|
|
597
|
|
- packetRate = 0;
|
|
|
595
|
+ var packetsDiff = Math.max(0, packetsNow - packetsBefore);
|
|
|
596
|
+
|
|
598
|
597
|
var currentLoss = getStatValue(now, 'packetsLost');
|
|
599
|
598
|
if (!currentLoss || currentLoss < 0)
|
|
600
|
599
|
currentLoss = 0;
|
|
|
@@ -604,7 +603,7 @@ StatsCollector.prototype.processStatsReport = function () {
|
|
604
|
603
|
var lossRate = currentLoss - previousLoss;
|
|
605
|
604
|
if (!lossRate || lossRate < 0)
|
|
606
|
605
|
lossRate = 0;
|
|
607
|
|
- var packetsTotal = (packetRate + lossRate);
|
|
|
606
|
+ var packetsTotal = (packetsDiff + lossRate);
|
|
608
|
607
|
|
|
609
|
608
|
ssrcStats.setSsrcLoss({
|
|
610
|
609
|
packetsTotal: packetsTotal,
|