Bug 1002831 - Display remote and local SDP on about:webrtc. r=smaug, r=jib
authorByron Campen [:bwc] <docfaraday@gmail.com>
Mon, 05 May 2014 11:13:24 -0700
changeset 182003 fc5a504138485d2009e41f3476fe98aa8cdca867
parent 182002 35a9cc17dd0c40758db742f27b3a940d4f37ac77
child 182004 7202bd8d3e1555912543af39a40322c6f280a9a0
push id43187
push userryanvm@gmail.com
push dateWed, 07 May 2014 18:03:55 +0000
treeherdermozilla-inbound@7202bd8d3e15 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, jib
bugs1002831
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1002831 - Display remote and local SDP on about:webrtc. r=smaug, r=jib
dom/webidl/RTCStatsReport.webidl
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
toolkit/content/aboutWebrtc.xhtml
--- a/dom/webidl/RTCStatsReport.webidl
+++ b/dom/webidl/RTCStatsReport.webidl
@@ -136,16 +136,18 @@ dictionary RTCStatsReportInternal {
   sequence<RTCOutboundRTPStreamStats> outboundRTPStreamStats;
   sequence<RTCMediaStreamTrackStats>  mediaStreamTrackStats;
   sequence<RTCMediaStreamStats>       mediaStreamStats;
   sequence<RTCTransportStats>         transportStats;
   sequence<RTCIceComponentStats>      iceComponentStats;
   sequence<RTCIceCandidatePairStats>  iceCandidatePairStats;
   sequence<RTCIceCandidateStats>      iceCandidateStats;
   sequence<RTCCodecStats>             codecStats;
+  DOMString                           localSdp;
+  DOMString                           remoteSdp;
   DOMHighResTimeStamp                 timestamp;
   boolean                             closed; // Is the PC now closed
 };
 
 [Pref="media.peerconnection.enabled",
 // TODO: Use MapClass here once it's available (Bug 928114)
 // MapClass(DOMString, object)
  JSImplementation="@mozilla.org/dom/rtcstatsreport;1"]
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -2119,16 +2119,24 @@ PeerConnectionImpl::BuildStatsQuery_m(
     return rv;
   }
 
   // We do not use the pcHandle here, since that's risky to expose to content.
   query->report = RTCStatsReportInternalConstruct(
       NS_ConvertASCIItoUTF16(mName.c_str()),
       query->now);
 
+  // Populate SDP on main
+  if (query->internalStats) {
+    query->report.mLocalSdp.Construct(
+        NS_ConvertASCIItoUTF16(mLocalSDP.c_str()));
+    query->report.mRemoteSdp.Construct(
+        NS_ConvertASCIItoUTF16(mRemoteSDP.c_str()));
+  }
+
   // Gather up pipelines from mMedia so they may be inspected on STS
   TrackID trackId = aSelector ? aSelector->GetTrackID() : 0;
 
   for (int i = 0, len = mMedia->LocalStreamsLength(); i < len; i++) {
     PushBackSelect(query->pipelines,
                    mMedia->GetLocalStream(i)->GetPipelines(),
                    trackId);
   }
--- a/toolkit/content/aboutWebrtc.xhtml
+++ b/toolkit/content/aboutWebrtc.xhtml
@@ -243,16 +243,36 @@ function buildPcDiv(stats, pcDivHeading)
       newPcDiv.appendChild(tables.candidatePairTable);
       newPcDiv.appendChild(tables.localCandidateTable);
       newPcDiv.appendChild(tables.remoteCandidateTable);
     }
   }
 
   // end of ICE stats
 
+  // Now, SDP
+  var localSdpHeading = document.createElement('h4');
+  localSdpHeading.appendChild(document.createTextNode("Local SDP"));
+  newPcDiv.appendChild(localSdpHeading);
+
+  var localSdpDiv = document.createElement('pre');
+  localSdpDiv.appendChild(document.createTextNode(stats.localSdp));
+
+  newPcDiv.appendChild(localSdpDiv);
+
+  var remoteSdpHeading = document.createElement('h4');
+  remoteSdpHeading.appendChild(document.createTextNode("Remote SDP"));
+  newPcDiv.appendChild(remoteSdpHeading);
+
+  var remoteSdpDiv = document.createElement('pre');
+  remoteSdpDiv.appendChild(document.createTextNode(stats.remoteSdp));
+
+  newPcDiv.appendChild(remoteSdpDiv);
+  // End of SDP
+
   // Now, RTP stats
   var rtpHeading = document.createElement('h4');
   rtpHeading.appendChild(document.createTextNode("RTP statistics"));
   newPcDiv.appendChild(rtpHeading);
 
   // Build map from id -> remote RTP stats (ie; stats obtained from RTCP
   // from the other end). This allows us to pair up local/remote stats for
   // the same stream more easily.