From c838f88f22c269d2bd98c429ab163514df89a0d2 Mon Sep 17 00:00:00 2001 From: Nico Grunbaum Date: Tue, 12 Feb 2019 23:39:49 +0000 Subject: [PATCH] Bug 1526512 - remote-inbound-rtp stat roundTripTime should be expressed in seconds r=jib,smaug Changing the units roundTripTime is reported in from milliseconds to seconds Differential Revision: https://phabricator.services.mozilla.com/D19544 --HG-- extra : moz-landing-system : lando --- dom/media/tests/mochitest/pc.js | 4 ++-- dom/webidl/RTCStatsReport.webidl | 2 +- .../webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp | 2 +- .../signaling/src/peerconnection/PeerConnectionImpl.cpp | 4 ++-- toolkit/content/aboutwebrtc/aboutWebrtc.js | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index c39cc5bf76552..a9f7a9c628b02 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -1854,9 +1854,9 @@ PeerConnectionWrapper.prototype = { } ok(rem.jitter !== undefined, "Rtcp jitter"); if (rem.roundTripTime) { - ok(rem.roundTripTime > 0, + ok(rem.roundTripTime >= 0, "Rtcp rtt " + rem.roundTripTime + " >= 0"); - ok(rem.roundTripTime < 60000, + ok(rem.roundTripTime < 60, "Rtcp rtt " + rem.roundTripTime + " < 1 min"); } } else { diff --git a/dom/webidl/RTCStatsReport.webidl b/dom/webidl/RTCStatsReport.webidl index f7c1d00d4029c..a5f809ed501b2 100644 --- a/dom/webidl/RTCStatsReport.webidl +++ b/dom/webidl/RTCStatsReport.webidl @@ -57,7 +57,7 @@ dictionary RTCInboundRTPStreamStats : RTCRtpStreamStats { unsigned long long bytesReceived; double jitter; unsigned long packetsLost; - long roundTripTime; + double roundTripTime; // Video decoder measurement, not present in RTCP case unsigned long discardedPackets; diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp index 0fd69b6cc20d6..c6f797196e5d3 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp @@ -239,7 +239,7 @@ void PeerConnectionCtx::DeliverStats(RTCStatsQuery& aQuery) { MOZ_ASSERT(isRemote); HistogramID id = isAudio ? WEBRTC_AUDIO_QUALITY_OUTBOUND_RTT : WEBRTC_VIDEO_QUALITY_OUTBOUND_RTT; - Accumulate(id, s.mRoundTripTime.Value()); + Accumulate(id, s.mRoundTripTime.Value() * 1000); } if (lastReport && lastReport->mInboundRTPStreamStats.WasPassed() && s.mBytesReceived.WasPassed()) { diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 147973f433ecd..e5e9a7c5ea1eb 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -2842,8 +2842,8 @@ RefPtr PeerConnectionImpl::ExecuteStatsQuery_s( s.mPacketsReceived.Construct(packetsReceived); s.mBytesReceived.Construct(bytesReceived); s.mPacketsLost.Construct(packetsLost); - if (rtt > 0) { - s.mRoundTripTime.Construct(rtt); + if (rtt > 0) { // RTT is not reported when it is zero + s.mRoundTripTime.Construct(static_cast(rtt) / 1000); } query->report->mInboundRTPStreamStats.Value().AppendElement( s, fallible); diff --git a/toolkit/content/aboutwebrtc/aboutWebrtc.js b/toolkit/content/aboutwebrtc/aboutWebrtc.js index 486751e69bf99..2a462bd855fcb 100644 --- a/toolkit/content/aboutwebrtc/aboutWebrtc.js +++ b/toolkit/content/aboutwebrtc/aboutWebrtc.js @@ -564,7 +564,7 @@ RTPStats.prototype = { statsString += ` ${getString("lost_label")}: ${stats.packetsLost} ${getString("jitter_label")}: ${stats.jitter}`; if (stats.roundTripTime) { - statsString += ` RTT: ${stats.roundTripTime} ms`; + statsString += ` RTT: ${stats.roundTripTime * 1000} ms`; } } else if (stats.packetsSent) { statsString += ` ${getString("sent_label")}: ${stats.packetsSent} ${getString("packets")}`;