|
|
@@ -53,28 +53,6 @@ KEYS_BY_BROWSER_TYPE[browsers.CHROME] = {
|
|
53
|
53
|
'port': 'port',
|
|
54
|
54
|
'protocol': 'protocol'
|
|
55
|
55
|
};
|
|
56
|
|
-KEYS_BY_BROWSER_TYPE[browsers.EDGE] = {
|
|
57
|
|
- 'sendBandwidth': 'googAvailableSendBandwidth',
|
|
58
|
|
- 'remoteAddress': 'remoteAddress',
|
|
59
|
|
- 'transportType': 'protocol',
|
|
60
|
|
- 'localAddress': 'localAddress',
|
|
61
|
|
- 'activeConnection': 'activeConnection',
|
|
62
|
|
- 'ssrc': 'ssrc',
|
|
63
|
|
- 'packetsReceived': 'packetsReceived',
|
|
64
|
|
- 'packetsSent': 'packetsSent',
|
|
65
|
|
- 'packetsLost': 'packetsLost',
|
|
66
|
|
- 'bytesReceived': 'bytesReceived',
|
|
67
|
|
- 'bytesSent': 'bytesSent',
|
|
68
|
|
- 'googFrameHeightReceived': 'frameHeight',
|
|
69
|
|
- 'googFrameWidthReceived': 'frameWidth',
|
|
70
|
|
- 'googFrameHeightSent': 'frameHeight',
|
|
71
|
|
- 'googFrameWidthSent': 'frameWidth',
|
|
72
|
|
- 'googFrameRateReceived': 'framesPerSecond',
|
|
73
|
|
- 'googFrameRateSent': 'framesPerSecond',
|
|
74
|
|
- 'audioInputLevel': 'audioLevel',
|
|
75
|
|
- 'audioOutputLevel': 'audioLevel',
|
|
76
|
|
- 'currentRoundTripTime': 'roundTripTime'
|
|
77
|
|
-};
|
|
78
|
56
|
KEYS_BY_BROWSER_TYPE[browsers.OPERA]
|
|
79
|
57
|
= KEYS_BY_BROWSER_TYPE[browsers.CHROME];
|
|
80
|
58
|
KEYS_BY_BROWSER_TYPE[browsers.NWJS]
|
|
|
@@ -339,43 +317,41 @@ StatsCollector.prototype.start = function(startAudioLevelStats) {
|
|
339
|
317
|
);
|
|
340
|
318
|
}
|
|
341
|
319
|
|
|
342
|
|
- if (browser.supportsRtpStatistics()) {
|
|
343
|
|
- this.statsIntervalId = setInterval(
|
|
344
|
|
- () => {
|
|
345
|
|
- // Interval updates
|
|
346
|
|
- self.peerconnection.getStats(
|
|
347
|
|
- report => {
|
|
348
|
|
- let results = null;
|
|
|
320
|
+ this.statsIntervalId = setInterval(
|
|
|
321
|
+ () => {
|
|
|
322
|
+ // Interval updates
|
|
|
323
|
+ self.peerconnection.getStats(
|
|
|
324
|
+ report => {
|
|
|
325
|
+ let results = null;
|
|
|
326
|
+
|
|
|
327
|
+ if (!report || !report.result
|
|
|
328
|
+ || typeof report.result !== 'function') {
|
|
|
329
|
+ // firefox
|
|
|
330
|
+ results = report;
|
|
|
331
|
+ } else {
|
|
|
332
|
+ // chrome
|
|
|
333
|
+ results = report.result();
|
|
|
334
|
+ }
|
|
349
|
335
|
|
|
350
|
|
- if (!report || !report.result
|
|
351
|
|
- || typeof report.result !== 'function') {
|
|
352
|
|
- // firefox
|
|
353
|
|
- results = report;
|
|
|
336
|
+ self.currentStatsReport = results;
|
|
|
337
|
+ try {
|
|
|
338
|
+ if (this._usesPromiseGetStats) {
|
|
|
339
|
+ self.processNewStatsReport();
|
|
354
|
340
|
} else {
|
|
355
|
|
- // chrome
|
|
356
|
|
- results = report.result();
|
|
357
|
|
- }
|
|
358
|
|
-
|
|
359
|
|
- self.currentStatsReport = results;
|
|
360
|
|
- try {
|
|
361
|
|
- if (this._usesPromiseGetStats) {
|
|
362
|
|
- self.processNewStatsReport();
|
|
363
|
|
- } else {
|
|
364
|
|
- self.processStatsReport();
|
|
365
|
|
- }
|
|
366
|
|
- } catch (e) {
|
|
367
|
|
- GlobalOnErrorHandler.callErrorHandler(e);
|
|
368
|
|
- logger.error(`Unsupported key:${e}`, e);
|
|
|
341
|
+ self.processStatsReport();
|
|
369
|
342
|
}
|
|
|
343
|
+ } catch (e) {
|
|
|
344
|
+ GlobalOnErrorHandler.callErrorHandler(e);
|
|
|
345
|
+ logger.error(`Unsupported key:${e}`, e);
|
|
|
346
|
+ }
|
|
370
|
347
|
|
|
371
|
|
- self.previousStatsReport = self.currentStatsReport;
|
|
372
|
|
- },
|
|
373
|
|
- error => self.errorCallback(error)
|
|
374
|
|
- );
|
|
375
|
|
- },
|
|
376
|
|
- self.statsIntervalMilis
|
|
377
|
|
- );
|
|
378
|
|
- }
|
|
|
348
|
+ self.previousStatsReport = self.currentStatsReport;
|
|
|
349
|
+ },
|
|
|
350
|
+ error => self.errorCallback(error)
|
|
|
351
|
+ );
|
|
|
352
|
+ },
|
|
|
353
|
+ self.statsIntervalMilis
|
|
|
354
|
+ );
|
|
379
|
355
|
};
|
|
380
|
356
|
|
|
381
|
357
|
/**
|
|
|
@@ -441,9 +417,6 @@ StatsCollector.prototype._defineGetStatValueMethod = function(keys) {
|
|
441
|
417
|
return value;
|
|
442
|
418
|
};
|
|
443
|
419
|
break;
|
|
444
|
|
- case browsers.EDGE:
|
|
445
|
|
- itemStatByKey = (item, key) => item[key];
|
|
446
|
|
- break;
|
|
447
|
420
|
default:
|
|
448
|
421
|
itemStatByKey = (item, key) => item[key];
|
|
449
|
422
|
}
|
|
|
@@ -573,28 +546,11 @@ StatsCollector.prototype.processStatsReport = function() {
|
|
573
|
546
|
});
|
|
574
|
547
|
}
|
|
575
|
548
|
|
|
576
|
|
- // NOTE: Edge's proprietary stats via RTCIceTransport.msGetStats().
|
|
577
|
|
- if (now.msType === 'transportdiagnostics') {
|
|
578
|
|
- this.conferenceStats.transport.push({
|
|
579
|
|
- ip: now.remoteAddress,
|
|
580
|
|
- type: now.protocol,
|
|
581
|
|
- localip: now.localAddress,
|
|
582
|
|
- p2p: this.peerconnection.isP2P
|
|
583
|
|
- });
|
|
584
|
|
- }
|
|
585
|
|
-
|
|
586
|
549
|
if (now.type !== 'ssrc' && now.type !== 'outboundrtp'
|
|
587
|
550
|
&& now.type !== 'inboundrtp' && now.type !== 'track') {
|
|
588
|
551
|
continue;
|
|
589
|
552
|
}
|
|
590
|
553
|
|
|
591
|
|
- // NOTE: In Edge, stats with type "inboundrtp" and "outboundrtp" are
|
|
592
|
|
- // completely useless, so ignore them.
|
|
593
|
|
- if (browser.isEdge()
|
|
594
|
|
- && (now.type === 'inboundrtp' || now.type === 'outboundrtp')) {
|
|
595
|
|
- continue;
|
|
596
|
|
- }
|
|
597
|
|
-
|
|
598
|
554
|
const before = this.previousStatsReport[idx];
|
|
599
|
555
|
let ssrc = this.getNonNegativeStat(now, 'ssrc');
|
|
600
|
556
|
|
|
|
@@ -616,9 +572,7 @@ StatsCollector.prototype.processStatsReport = function() {
|
|
616
|
572
|
// the sent bytes to the local download bitrate.
|
|
617
|
573
|
// In new W3 stats spec, type="track" has a remoteSource boolean
|
|
618
|
574
|
// property.
|
|
619
|
|
- // Edge uses the new format, so skip this check.
|
|
620
|
|
- if (!browser.isEdge()
|
|
621
|
|
- && (now.isRemote === true || now.remoteSource === true)) {
|
|
|
575
|
+ if (now.isRemote === true || now.remoteSource === true) {
|
|
622
|
576
|
continue;
|
|
623
|
577
|
}
|
|
624
|
578
|
|
|
|
@@ -955,18 +909,9 @@ StatsCollector.prototype.processAudioLevelReport = function() {
|
|
955
|
909
|
// According to the W3C WebRTC Stats spec, audioLevel should be in
|
|
956
|
910
|
// 0..1 range (0 == silence). However browsers don't behave that
|
|
957
|
911
|
// way so we must convert it to 0..1.
|
|
958
|
|
- //
|
|
959
|
|
- // In Edge the range is -100..0 (-100 == silence) measured in dB,
|
|
960
|
|
- // so convert to linear. The levels are set to 0 for remote tracks,
|
|
961
|
|
- // so don't convert those, since 0 means "the maximum" in Edge.
|
|
962
|
|
- if (browser.isEdge()) {
|
|
963
|
|
- audioLevel = audioLevel < 0 ? Math.pow(10, audioLevel / 20) : 0;
|
|
964
|
|
-
|
|
965
|
912
|
// TODO: Can't find specs about what this value really is, but it
|
|
966
|
913
|
// seems to vary between 0 and around 32k.
|
|
967
|
|
- } else {
|
|
968
|
|
- audioLevel = audioLevel / 32767;
|
|
969
|
|
- }
|
|
|
914
|
+ audioLevel = audioLevel / 32767;
|
|
970
|
915
|
|
|
971
|
916
|
if (!(ssrc in this.audioLevelReportHistory)) {
|
|
972
|
917
|
this.audioLevelReportHistory[ssrc] = {
|