Bug 1414167 - Add offer/answer labels to local and remote sdp headings on about:webrtc. r?drno,smaug
Add a new |offerer| field to RTCStatsReport.
Based on offerer, label the local sdp as offer or answer.
Based on offerer, label the remote sdp as offer or answer.
MozReview-Commit-ID: 4jdWP8tpr9w
--- a/dom/media/webrtc/WebrtcGlobal.h
+++ b/dom/media/webrtc/WebrtcGlobal.h
@@ -75,16 +75,17 @@ struct ParamTraits<mozilla::dom::RTCStat
WriteParam(aMsg, aParam.mOutboundRTPStreamStats);
WriteParam(aMsg, aParam.mPcid);
WriteParam(aMsg, aParam.mRemoteSdp);
WriteParam(aMsg, aParam.mTimestamp);
WriteParam(aMsg, aParam.mIceRestarts);
WriteParam(aMsg, aParam.mIceRollbacks);
WriteParam(aMsg, aParam.mTransportStats);
WriteParam(aMsg, aParam.mRtpContributingSourceStats);
+ WriteParam(aMsg, aParam.mOfferer);
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
{
if (!ReadParam(aMsg, aIter, &(aResult->mClosed)) ||
!ReadParam(aMsg, aIter, &(aResult->mCodecStats)) ||
!ReadParam(aMsg, aIter, &(aResult->mIceCandidatePairStats)) ||
!ReadParam(aMsg, aIter, &(aResult->mIceCandidateStats)) ||
@@ -95,17 +96,18 @@ struct ParamTraits<mozilla::dom::RTCStat
!ReadParam(aMsg, aIter, &(aResult->mMediaStreamTrackStats)) ||
!ReadParam(aMsg, aIter, &(aResult->mOutboundRTPStreamStats)) ||
!ReadParam(aMsg, aIter, &(aResult->mPcid)) ||
!ReadParam(aMsg, aIter, &(aResult->mRemoteSdp)) ||
!ReadParam(aMsg, aIter, &(aResult->mTimestamp)) ||
!ReadParam(aMsg, aIter, &(aResult->mIceRestarts)) ||
!ReadParam(aMsg, aIter, &(aResult->mIceRollbacks)) ||
!ReadParam(aMsg, aIter, &(aResult->mTransportStats)) ||
- !ReadParam(aMsg, aIter, &(aResult->mRtpContributingSourceStats))) {
+ !ReadParam(aMsg, aIter, &(aResult->mRtpContributingSourceStats)) ||
+ !ReadParam(aMsg, aIter, &(aResult->mOfferer))) {
return false;
}
return true;
}
};
typedef mozilla::dom::RTCStats RTCStats;
--- a/dom/webidl/RTCStatsReport.webidl
+++ b/dom/webidl/RTCStatsReport.webidl
@@ -180,16 +180,17 @@ dictionary RTCStatsReportInternal {
sequence<RTCIceCandidatePairStats> iceCandidatePairStats;
sequence<RTCIceCandidateStats> iceCandidateStats;
sequence<RTCCodecStats> codecStats;
DOMString localSdp;
DOMString remoteSdp;
DOMHighResTimeStamp timestamp;
unsigned long iceRestarts;
unsigned long iceRollbacks;
+ boolean offerer; // Is the PC the offerer
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"]
interface RTCStatsReport {
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -3668,16 +3668,17 @@ PeerConnectionImpl::BuildStatsQuery_m(
std::string localDescription = mJsepSession->GetLocalDescription(
kJsepDescriptionPendingOrCurrent);
std::string remoteDescription = mJsepSession->GetRemoteDescription(
kJsepDescriptionPendingOrCurrent);
query->report->mLocalSdp.Construct(
NS_ConvertASCIItoUTF16(localDescription.c_str()));
query->report->mRemoteSdp.Construct(
NS_ConvertASCIItoUTF16(remoteDescription.c_str()));
+ query->report->mOfferer.Construct(mJsepSession->IsOfferer());
}
}
// Gather up pipelines from mMedia so they may be inspected on STS
std::string trackId;
if (aSelector) {
trackId = PeerConnectionImpl::GetTrackId(*aSelector);
--- a/toolkit/content/aboutwebrtc/aboutWebrtc.js
+++ b/toolkit/content/aboutwebrtc/aboutWebrtc.js
@@ -474,29 +474,36 @@ function SDPStats(report) {
this._report = report;
}
SDPStats.prototype = {
render() {
let div = document.createElement("div");
let elem = document.createElement("h4");
+ let localSdpHeading = getString("local_sdp_heading");
+ let remoteSdpHeading = getString("remote_sdp_heading");
+ let offerLabel = `(${getString("offer")})`;
+ let answerLabel = `(${getString("answer")})`;
+
elem.textContent = getString("sdp_heading");
div.appendChild(elem);
elem = document.createElement("h5");
- elem.textContent = getString("local_sdp_heading");
+ elem.textContent =
+ `${localSdpHeading} ${this._report.offerer ? offerLabel : answerLabel}`;
div.appendChild(elem);
elem = document.createElement("pre");
elem.textContent = this._report.localSdp;
div.appendChild(elem);
elem = document.createElement("h5");
- elem.textContent = getString("remote_sdp_heading");
+ elem.textContent =
+ `${remoteSdpHeading} ${this._report.offerer ? answerLabel : offerLabel}`;
div.appendChild(elem);
elem = document.createElement("pre");
elem.textContent = this._report.remoteSdp;
div.appendChild(elem);
return div;
}
--- a/toolkit/locales/en-US/chrome/global/aboutWebrtc.properties
+++ b/toolkit/locales/en-US/chrome/global/aboutWebrtc.properties
@@ -44,16 +44,23 @@ peer_connection_id_label = PeerConnectio
# LOCALIZATION NOTE (sdp_heading, local_sdp_heading, remote_sdp_heading):
# "SDP" is an abbreviation for Session Description Protocol, an IETF standard.
# See http://wikipedia.org/wiki/Session_Description_Protocol
sdp_heading = SDP
local_sdp_heading = Local SDP
remote_sdp_heading = Remote SDP
+# LOCALIZATION NOTE (offer, answer):
+# offer and answer describe whether the local sdp is an offer or answer or
+# the remote sdp is an offer or answer. These are appended to the local and
+# remote sdp headings.
+offer = Offer
+answer = Answer
+
# LOCALIZATION NOTE (rtp_stats_heading): "RTP" is an abbreviation for the
# Real-time Transport Protocol, an IETF specification, and should not
# normally be translated. "Stats" is an abbreviation for Statistics.
rtp_stats_heading = RTP Stats
# LOCALIZATION NOTE (ice_state, ice_stats_heading): "ICE" is an abbreviation
# for Interactive Connectivity Establishment, which is an IETF protocol,
# and should not normally be translated. "Stats" is an abbreviation for