Bug 1136877 - Collect telemetry on SPS.max_num_ref_frames. r=jya, a=lsblakk
authorMike Taylor <miket@mozilla.com>
Fri, 06 Mar 2015 08:18:00 -0500
changeset 250385 99fe61cb246f
parent 250384 027a0ac06377
child 250386 ec555c9715d2
push id4570
push userryanvm@gmail.com
push date2015-03-16 16:03 +0000
treeherdermozilla-beta@ad1f181d8593 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya, lsblakk
bugs1136877
milestone37.0
Bug 1136877 - Collect telemetry on SPS.max_num_ref_frames. r=jya, a=lsblakk
dom/media/fmp4/MP4Reader.cpp
toolkit/components/telemetry/Histograms.json
--- a/dom/media/fmp4/MP4Reader.cpp
+++ b/dom/media/fmp4/MP4Reader.cpp
@@ -15,16 +15,17 @@
 #include "Layers.h"
 #include "SharedThreadPool.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/dom/TimeRanges.h"
 #include "mp4_demuxer/AnnexB.h"
 #include "mp4_demuxer/H264.h"
 #include "SharedDecoderManager.h"
+#include <algorithm>
 
 #ifdef MOZ_EME
 #include "mozilla/CDMProxy.h"
 #endif
 
 using mozilla::layers::Image;
 using mozilla::layers::LayerManager;
 using mozilla::layers::LayersBackend;
@@ -86,16 +87,21 @@ AccumulateSPSTelemetry(const ByteBuffer*
                           spsdata.profile_idc <= 244 ? spsdata.profile_idc : 0);
 
     // Make sure level_idc represents a value between levels 1 and 5.2,
     // otherwise collect 0 for unknown level.
     Telemetry::Accumulate(Telemetry::VIDEO_DECODED_H264_SPS_LEVEL,
                           (spsdata.level_idc >= 10 && spsdata.level_idc <= 52) ?
                           spsdata.level_idc : 0);
 
+    // max_num_ref_frames should be between 0 and 16, anything larger will
+    // be treated as invalid.
+    Telemetry::Accumulate(Telemetry::VIDEO_H264_SPS_MAX_NUM_REF_FRAMES,
+                          std::min(spsdata.max_num_ref_frames, 17u));
+
     return true;
   }
 
   return false;
 }
 
 // MP4Demuxer wants to do various blocking reads, which cause deadlocks while
 // mDemuxerMonitor is held. This stuff should really be redesigned, but we don't
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -5453,16 +5453,22 @@
     "description": "The H.264 level (level_idc) as extracted from the decoded SPS, from levels 1 (10) to 5.2 (51), with the addition of 0 for unknown values."
   },
   "VIDEO_DECODED_H264_SPS_PROFILE": {
     "expires_in_version": "40",
     "kind": "enumerated",
     "n_values": 244,
     "description": "The H.264 profile number (profile_idc) as extracted from the decoded SPS."
   },
+  "VIDEO_H264_SPS_MAX_NUM_REF_FRAMES": {
+    "expires_in_version": "40",
+    "kind": "enumerated",
+    "n_values": 17,
+    "description": "SPS.max_num_ref_frames indicates how deep the H.264 queue is going to be, and as such the minimum memory usage by the decoder, from 0 to 16. 17 indicates an invalid value."
+  },
   "WEBRTC_ICE_FINAL_CONNECTION_STATE": {
     "expires_in_version": "never",
     "kind": "enumerated",
     "n_values": 7,
     "description": "The ICE connection state when the PC was closed"
   },
   "WEBRTC_ICE_ON_TIME_TRICKLE_ARRIVAL_TIME": {
     "expires_in_version": "never",