Bug 1188407 - Switch packetloss to a rate from total-packets-lost-per-update. r=jib, a=sledru
authorRandell Jesup <rjesup@jesup.org>
Tue, 11 Aug 2015 15:15:06 -0400
changeset 288741 cfcd91bd5aa22a097c4f0d21f9f740fd557e5d37
parent 288740 eecbf4d2cfe4f4a8135d3c64be32674a5f4be069
child 288742 eb10f5d032197d1cbfef8bd33780d5227026f3a3
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib, sledru
bugs1188407
milestone42.0a2
Bug 1188407 - Switch packetloss to a rate from total-packets-lost-per-update. r=jib, a=sledru
media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
toolkit/components/telemetry/Histograms.json
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
@@ -215,31 +215,41 @@ EverySecondTelemetryCallback_s(nsAutoPtr
           lastInboundStats = &ctx->mLastReports[i]->mInboundRTPStreamStats.Value();
         }
       }
       // Then, look for the things we want telemetry on
       auto& array = r.mInboundRTPStreamStats.Value();
       for (decltype(array.Length()) i = 0; i < array.Length(); i++) {
         auto& s = array[i];
         bool isAudio = (s.mId.Value().Find("audio") != -1);
-        if (s.mPacketsLost.WasPassed()) {
-          Accumulate(s.mIsRemote?
-                     (isAudio? WEBRTC_AUDIO_QUALITY_OUTBOUND_PACKETLOSS :
-                               WEBRTC_VIDEO_QUALITY_OUTBOUND_PACKETLOSS) :
-                     (isAudio? WEBRTC_AUDIO_QUALITY_INBOUND_PACKETLOSS :
-                               WEBRTC_VIDEO_QUALITY_INBOUND_PACKETLOSS),
-                      s.mPacketsLost.Value());
+        if (s.mPacketsLost.WasPassed() && s.mPacketsReceived.WasPassed() &&
+            (s.mPacketsLost.Value() + s.mPacketsReceived.Value()) != 0) {
+          ID id;
+          if (s.mIsRemote) {
+            id = isAudio ? WEBRTC_AUDIO_QUALITY_OUTBOUND_PACKETLOSS_RATE :
+                           WEBRTC_VIDEO_QUALITY_OUTBOUND_PACKETLOSS_RATE;
+          } else {
+            id = isAudio ? WEBRTC_AUDIO_QUALITY_INBOUND_PACKETLOSS_RATE :
+                           WEBRTC_VIDEO_QUALITY_INBOUND_PACKETLOSS_RATE;
+          }
+          // *1000 so we can read in 10's of a percent (permille)
+          Accumulate(id,
+                     (s.mPacketsLost.Value() * 1000) /
+                     (s.mPacketsLost.Value() + s.mPacketsReceived.Value()));
         }
         if (s.mJitter.WasPassed()) {
-          Accumulate(s.mIsRemote?
-                     (isAudio? WEBRTC_AUDIO_QUALITY_OUTBOUND_JITTER :
-                               WEBRTC_VIDEO_QUALITY_OUTBOUND_JITTER) :
-                     (isAudio? WEBRTC_AUDIO_QUALITY_INBOUND_JITTER :
-                               WEBRTC_VIDEO_QUALITY_INBOUND_JITTER),
-                      s.mJitter.Value());
+          ID id;
+          if (s.mIsRemote) {
+            id = isAudio ? WEBRTC_AUDIO_QUALITY_OUTBOUND_JITTER :
+                           WEBRTC_VIDEO_QUALITY_OUTBOUND_JITTER;
+          } else {
+            id = isAudio ? WEBRTC_AUDIO_QUALITY_INBOUND_JITTER :
+                           WEBRTC_VIDEO_QUALITY_INBOUND_JITTER;
+          }
+          Accumulate(id, s.mJitter.Value());
         }
         if (s.mMozRtt.WasPassed()) {
           MOZ_ASSERT(s.mIsRemote);
           ID id;
           if (isAudio) {
             id = isHello ? LOOP_AUDIO_QUALITY_OUTBOUND_RTT :
                            WEBRTC_AUDIO_QUALITY_OUTBOUND_RTT;
           } else {
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -6189,38 +6189,38 @@
   },
   "WEBRTC_AUDIO_QUALITY_OUTBOUND_BANDWIDTH_KBITS": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 1000000,
     "n_buckets": 1000,
     "description": "Data rate deduced from RTCP from remote recipient of outbound audio (kbit/s). Computed every second of a call (for easy comparison)."
   },
-  "WEBRTC_VIDEO_QUALITY_INBOUND_PACKETLOSS": {
+  "WEBRTC_VIDEO_QUALITY_INBOUND_PACKETLOSS_RATE": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 1000,
     "n_buckets": 100,
     "description": "Locally measured packet loss on inbound video (permille). Sampled every second of a call."
   },
-  "WEBRTC_AUDIO_QUALITY_INBOUND_PACKETLOSS": {
+  "WEBRTC_AUDIO_QUALITY_INBOUND_PACKETLOSS_RATE": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 1000,
     "n_buckets": 100,
     "description": "Locally measured packet loss on inbound audio (permille). Sampled every second of a call."
   },
-  "WEBRTC_VIDEO_QUALITY_OUTBOUND_PACKETLOSS": {
+  "WEBRTC_VIDEO_QUALITY_OUTBOUND_PACKETLOSS_RATE": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 1000,
     "n_buckets": 100,
     "description": "RTCP-reported packet loss by remote recipient of outbound video (permille). Sampled every second of a call (for easy comparison)."
   },
-  "WEBRTC_AUDIO_QUALITY_OUTBOUND_PACKETLOSS": {
+  "WEBRTC_AUDIO_QUALITY_OUTBOUND_PACKETLOSS_RATE": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 1000,
     "n_buckets": 100,
     "description": "RTCP-reported packet loss by remote recipient of outbound audio (permille). Sampled every second of a call (for easy comparison)."
   },
   "WEBRTC_VIDEO_QUALITY_INBOUND_JITTER": {
     "expires_in_version": "never",