Bug 1526512 - remote-inbound-rtp stat roundTripTime should be expressed in seconds r=jib,smaug
authorNico Grunbaum <na-g@nostrum.com>
Tue, 12 Feb 2019 23:39:49 +0000
changeset 458843 5f38e97f40ef
parent 458842 dcabcaa944f5
child 458844 6d9b468951ce
push id35548
push useropoprus@mozilla.com
push dateWed, 13 Feb 2019 09:48:26 +0000
treeherdermozilla-central@93e37c529818 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib, smaug
bugs1526512
milestone67.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 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
dom/media/tests/mochitest/pc.js
dom/webidl/RTCStatsReport.webidl
media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
toolkit/content/aboutwebrtc/aboutWebrtc.js
--- a/dom/media/tests/mochitest/pc.js
+++ b/dom/media/tests/mochitest/pc.js
@@ -1849,19 +1849,19 @@ PeerConnectionWrapper.prototype = {
                   info("REVERSED timestamps: rec:" +
                     rem.packetsReceived + " time:" + rem.timestamp + " sent:" + res.packetsSent + " time:" + res.timestamp);
                 }
                 // Else we may have received more than outdated Rtcp packetsSent
                 ok(rem.bytesReceived <= res.bytesSent, "No more than sent bytes");
               }
               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 {
               ok(rem.type == "remote-outbound-rtp", "Rtcp is outbound");
               ok(rem.packetsSent !== undefined, "Rtcp packetsSent");
               // We may have received more than outdated Rtcp packetsSent
               ok(rem.bytesSent >= rem.packetsSent, "Rtcp bytesSent");
             }
--- a/dom/webidl/RTCStatsReport.webidl
+++ b/dom/webidl/RTCStatsReport.webidl
@@ -52,17 +52,17 @@ dictionary RTCRtpStreamStats : RTCStats 
   double framerateStdDev;
 };
 
 dictionary RTCInboundRTPStreamStats : RTCRtpStreamStats {
   unsigned long packetsReceived;
   unsigned long long bytesReceived;
   double jitter;
   unsigned long packetsLost;
-  long roundTripTime;
+  double roundTripTime;
 
   // Video decoder measurement, not present in RTCP case
   unsigned long discardedPackets;
   unsigned long framesDecoded;
 };
 
 
 dictionary RTCOutboundRTPStreamStats : RTCRtpStreamStats {
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
@@ -234,17 +234,17 @@ void PeerConnectionCtx::DeliverStats(RTC
                        : WEBRTC_VIDEO_QUALITY_INBOUND_JITTER;
         }
         Accumulate(id, s.mJitter.Value());
       }
       if (s.mRoundTripTime.WasPassed()) {
         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()) {
         auto& laststats = lastReport->mInboundRTPStreamStats.Value();
         auto i = FindId(laststats, s.mId.Value());
         if (i != laststats.NoIndex) {
           auto& lasts = laststats[i];
           if (lasts.mBytesReceived.WasPassed()) {
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -2837,18 +2837,18 @@ RefPtr<RTCStatsQueryPromise> PeerConnect
             s.mMediaType.Construct(
                 kind);  // mediaType is the old name for kind.
             s.mKind.Construct(kind);
             s.mJitter.Construct(double(jitterMs) / 1000);
             s.mLocalId.Construct(localId);
             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<double>(rtt) / 1000);
             }
             query->report->mInboundRTPStreamStats.Value().AppendElement(
                 s, fallible);
           }
         }
         // Then, fill in local side (with cross-link to remote only if present)
         {
           RTCOutboundRTPStreamStats s;
--- a/toolkit/content/aboutwebrtc/aboutWebrtc.js
+++ b/toolkit/content/aboutwebrtc/aboutWebrtc.js
@@ -559,17 +559,17 @@ RTPStats.prototype = {
 
       if (stats.bytesReceived) {
         statsString += ` (${(stats.bytesReceived / 1024).toFixed(2)} Kb)`;
       }
 
       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")}`;
       if (stats.bytesSent) {
         statsString += ` (${(stats.bytesSent / 1024).toFixed(2)} Kb)`;
       }
     }