Bug 1371205 - MEDIACACHESTREAM_NOTIFIED_LENGTH captures the HTTP header length given to MediaCacheStream - r?cpearce,francois draft
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 08 Jun 2017 20:26:24 +1200
changeset 590899 38eea3b1941eb4889071101b59a6d75c145cdaed
parent 590317 a49112c7a5765802096b3fc298069b9495436107
child 632344 3e1c319ab5d3b14fea7d2c6d2d46855496255222
push id62871
push usergsquelart@mozilla.com
push dateThu, 08 Jun 2017 09:04:10 +0000
reviewerscpearce, francois
bugs1371205
milestone55.0a1
Bug 1371205 - MEDIACACHESTREAM_NOTIFIED_LENGTH captures the HTTP header length given to MediaCacheStream - r?cpearce,francois MozReview-Commit-ID: 9muZcpfD2vG
dom/media/MediaCache.cpp
toolkit/components/telemetry/Histograms.json
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -1758,16 +1758,26 @@ MediaCache::NoteSeek(MediaCacheStream* a
   }
 }
 
 void
 MediaCacheStream::NotifyDataLength(int64_t aLength)
 {
   NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
 
+  if (mStreamLength < 0 && aLength >= 0) {
+    uint32_t length = uint32_t(std::min(aLength, int64_t(UINT32_MAX)));
+    LOG("MediaCacheStream::NotifyDataLength(this=%p) "
+        "MEDIACACHESTREAM_NOTIFIED_LENGTH=%" PRIu32,
+        this,
+        length);
+    Telemetry::Accumulate(
+      Telemetry::HistogramID::MEDIACACHESTREAM_NOTIFIED_LENGTH, length);
+  }
+
   ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
   mStreamLength = aLength;
 }
 
 void
 MediaCacheStream::NotifyDataStarted(int64_t aOffset)
 {
   NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -8436,16 +8436,26 @@
     "alert_emails": ["gsquelart@mozilla.com"],
     "bug_numbers": [1369538],
     "expires_in_version": "60",
     "kind": "linear",
     "high": 520000,
     "n_buckets": 66,
     "description": "MediaCacheStream stream length size in KB; Either known size from the HTTP header if available, or otherwise the size actually downloaded. Recorded at every MediaCacheStream destruction."
   },
+  "MEDIACACHESTREAM_NOTIFIED_LENGTH": {
+    "record_in_processes": ["main", "content"],
+    "alert_emails": ["gsquelart@mozilla.com"],
+    "bug_numbers": [1371205],
+    "expires_in_version": "60",
+    "kind": "linear",
+    "high": 16777216,
+    "n_buckets": 66,
+    "description": "MediaCacheStream stream notified length size in bytes, from the HTTP header. Recorded when each MediaCacheStream is first notified."
+  },
   "VIDEO_MFT_OUTPUT_NULL_SAMPLES": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["cpearce@mozilla.com"],
     "expires_in_version": "53",
     "kind": "enumerated",
     "n_values": 10,
     "description": "Does the WMF video decoder return success but null output? 0 = playback successful, 1 = excessive null output but able to decode some frames, 2 = excessive null output and gave up, 3 = null output but recovered, 4 = non-excessive null output without being able to decode frames.",
     "bug_numbers": [1176071]