From 3a5af31fab516d247d777f56e0ea2249680fcd0c Mon Sep 17 00:00:00 2001 From: Ryan Alderete Date: Fri, 2 Aug 2019 20:04:59 +0000 Subject: [PATCH] Bug 1571027 - Fix RTP stats section in about:webrtc r=ng When the RTP stats were refactored to match the specifications, the code that displays them on about:webrtc was left unchanged. Update that code to reflect the new stats types. Differential Revision: https://phabricator.services.mozilla.com/D40458 --HG-- extra : moz-landing-system : lando --- toolkit/content/aboutwebrtc/aboutWebrtc.js | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/toolkit/content/aboutwebrtc/aboutWebrtc.js b/toolkit/content/aboutwebrtc/aboutWebrtc.js index 167b9da78f95..d6c0d3b3d539 100644 --- a/toolkit/content/aboutwebrtc/aboutWebrtc.js +++ b/toolkit/content/aboutwebrtc/aboutWebrtc.js @@ -527,18 +527,20 @@ RTPStats.prototype = { }, generateRTPStats() { - let remoteRtpStats = {}; + const remoteRtpStatsMap = {}; let rtpStats = [].concat( - this._report.inboundRTPStreamStats || [], - this._report.outboundRTPStreamStats || [] + this._report.inboundRtpStreamStats || [], + this._report.outboundRtpStreamStats || [] + ); + let remoteRtpStats = [].concat( + this._report.remoteInboundRtpStreamStats || [], + this._report.remoteOutboundRtpStreamStats || [] ); - // Generate an id-to-streamStat index for each streamStat that is marked - // as a remote. This will be used next to link the remote to its local side. - for (let stats of rtpStats) { - if (stats.isRemote) { - remoteRtpStats[stats.id] = stats; - } + // Generate an id-to-streamStat index for each remote streamStat. This will + // be used next to link the remote to its local side. + for (let stats of remoteRtpStats) { + remoteRtpStatsMap[stats.id] = stats; } // If a streamStat has a remoteId attribute, create a remoteRtpStats @@ -546,11 +548,11 @@ RTPStats.prototype = { // That is, the index generated above is merged into the returned list. for (let stats of rtpStats) { if (stats.remoteId) { - stats.remoteRtpStats = remoteRtpStats[stats.remoteId]; + stats.remoteRtpStats = remoteRtpStatsMap[stats.remoteId]; } } - this._stats = rtpStats; + this._stats = rtpStats.concat(remoteRtpStats); }, renderCoderStats(stats) {