quickblox 2.23.1-beta.4 → 2.23.1-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -550,34 +550,38 @@ function _getStats(peer, lastResults, successCallback, errorCallback) {
|
|
|
550
550
|
|
|
551
551
|
function _applyStatReport(statistic, result, lastResults) {
|
|
552
552
|
var item;
|
|
553
|
+
// mediaType is deprecated in the W3C webrtc-stats spec and replaced by kind.
|
|
554
|
+
// Safari/WebKit omits mediaType on some reports and provides only kind, so we
|
|
555
|
+
// normalize once and use it for both the statistic lookup and the 'video' check.
|
|
556
|
+
var mediaType = result.mediaType || result.kind;
|
|
553
557
|
|
|
554
558
|
if (result.bytesReceived && result.type === 'inbound-rtp') {
|
|
555
|
-
item = statistic.remote[
|
|
559
|
+
item = statistic.remote[mediaType];
|
|
556
560
|
|
|
557
561
|
if (item) {
|
|
558
562
|
item.bitrate = _getBitratePerSecond(result, lastResults, false);
|
|
559
563
|
item.bytesReceived = result.bytesReceived;
|
|
560
564
|
item.packetsReceived = result.packetsReceived;
|
|
561
565
|
item.timestamp = result.timestamp;
|
|
562
|
-
if (
|
|
566
|
+
if (mediaType === 'video' && result.framerateMean) {
|
|
563
567
|
item.framesPerSecond = Math.round(result.framerateMean * 10) / 10;
|
|
564
568
|
}
|
|
565
569
|
} else {
|
|
566
|
-
Helpers.traceWarning('_getStats: skipping inbound-rtp report with unknown mediaType: ' +
|
|
570
|
+
Helpers.traceWarning('_getStats: skipping inbound-rtp report with unknown mediaType/kind: ' + mediaType);
|
|
567
571
|
}
|
|
568
572
|
} else if (result.bytesSent && result.type === 'outbound-rtp') {
|
|
569
|
-
item = statistic.local[
|
|
573
|
+
item = statistic.local[mediaType];
|
|
570
574
|
|
|
571
575
|
if (item) {
|
|
572
576
|
item.bitrate = _getBitratePerSecond(result, lastResults, true);
|
|
573
577
|
item.bytesSent = result.bytesSent;
|
|
574
578
|
item.packetsSent = result.packetsSent;
|
|
575
579
|
item.timestamp = result.timestamp;
|
|
576
|
-
if (
|
|
580
|
+
if (mediaType === 'video' && result.framerateMean) {
|
|
577
581
|
item.framesPerSecond = Math.round(result.framerateMean * 10) / 10;
|
|
578
582
|
}
|
|
579
583
|
} else {
|
|
580
|
-
Helpers.traceWarning('_getStats: skipping outbound-rtp report with unknown mediaType: ' +
|
|
584
|
+
Helpers.traceWarning('_getStats: skipping outbound-rtp report with unknown mediaType/kind: ' + mediaType);
|
|
581
585
|
}
|
|
582
586
|
} else if (result.type === 'local-candidate') {
|
|
583
587
|
item = statistic.local.candidate;
|