diff --git a/dom/media/webrtc/WebrtcGlobal.h b/dom/media/webrtc/WebrtcGlobal.h index ac45de3293b7..aa5ab6d801e9 100644 --- a/dom/media/webrtc/WebrtcGlobal.h +++ b/dom/media/webrtc/WebrtcGlobal.h @@ -119,7 +119,7 @@ DEFINE_IPC_SERIALIZER_WITH_FIELDS( DEFINE_IPC_SERIALIZER_WITH_SUPER_CLASS_AND_FIELDS( mozilla::dom::RTCStatsReportInternal, mozilla::dom::RTCStatsCollection, - mClosed, mLocalSdp, mSdpHistory, mPcid, mRemoteSdp, mTimestamp, + mClosed, mLocalSdp, mSdpHistory, mPcid, mBrowserId, mRemoteSdp, mTimestamp, mCallDurationMs, mIceRestarts, mIceRollbacks, mOfferer, mConfiguration); typedef mozilla::dom::RTCStats RTCStats; diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 975cb45fcc71..e2831f20f9d0 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -2789,6 +2789,7 @@ RefPtr PeerConnectionImpl::GetStats( UniquePtr report( new dom::RTCStatsReportInternal); report->mPcid = NS_ConvertASCIItoUTF16(mName.c_str()); + report->mBrowserId = mWindow->GetBrowsingContext()->BrowserId(); report->mConfiguration.Construct(mJsConfiguration); // TODO(bug 1589416): We need to do better here. if (!mIceStartTime.IsNull()) { diff --git a/toolkit/content/aboutwebrtc/aboutWebrtc.js b/toolkit/content/aboutwebrtc/aboutWebrtc.js index 8a8ea05e51fd..c13259789901 100644 --- a/toolkit/content/aboutwebrtc/aboutWebrtc.js +++ b/toolkit/content/aboutwebrtc/aboutWebrtc.js @@ -181,6 +181,27 @@ class AecLogging extends Control { } } +class ShowTab extends Control { + constructor(browserId) { + super(); + this.label = string("show_tab_label"); + this.message = null; + this.browserId = browserId; + } + + onClick() { + const gBrowser = + window.ownerGlobal.browsingContext.topChromeWindow.gBrowser; + for (const tab of gBrowser.visibleTabs) { + if (tab.linkedBrowser && tab.linkedBrowser.browserId == this.browserId) { + gBrowser.selectedTab = tab; + return; + } + } + this.ctrl.disabled = true; + } +} + (async () => { // Setup. Retrieve reports & log while page loads. const haveReports = getStats(); @@ -207,6 +228,8 @@ class AecLogging extends Control { let reports = await haveReports; let log = await haveLog; + reports.sort((a, b) => a.browserId - b.browserId); + let peerConnections = renderElement("div"); let connectionLog = renderElement("div"); let userPrefs = renderElement("div"); @@ -283,7 +306,7 @@ class AecLogging extends Control { })(); function renderPeerConnection(report) { - const { pcid, closed, timestamp, configuration } = report; + const { pcid, browserId, closed, timestamp, configuration } = report; const pcDiv = renderElement("div", { className: "peer-connection" }); { @@ -292,7 +315,10 @@ function renderPeerConnection(report) { const closedStr = closed ? `(${string("connection_closed")})` : ""; const now = new Date(timestamp).toString(); - pcDiv.append(renderText("h3", `[ ${id} ] ${url} ${closedStr} ${now}`)); + pcDiv.append( + renderText("h3", `[ ${browserId} | ${id} ] ${url} ${closedStr} ${now}`) + ); + pcDiv.append(new ShowTab(browserId).render()[0]); } { const section = renderFoldableSection(pcDiv); diff --git a/toolkit/locales/en-US/chrome/global/aboutWebrtc.properties b/toolkit/locales/en-US/chrome/global/aboutWebrtc.properties index 926bd46459c3..44cc09b0919f 100644 --- a/toolkit/locales/en-US/chrome/global/aboutWebrtc.properties +++ b/toolkit/locales/en-US/chrome/global/aboutWebrtc.properties @@ -144,6 +144,7 @@ packets = packets lost_label = Lost jitter_label = Jitter sent_label = Sent +show_tab_label = Show tab frame_stats_heading = Video Frame Statistics n_a = N/A