Bug 1286444 - Use correct types to construct VideoPlaybackQuality - r=kinetik
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 14 Jul 2016 15:18:36 +1000
changeset 330015 4667487b0da2abde2e6960fca75fcbde9d114812
parent 330014 63c2807a44393a652c63953909d96ecfa87811ad
child 330016 9f1fccf586fb87ab5553a0c4c0f501ad3b7b5c71
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1286444
milestone50.0a1
Bug 1286444 - Use correct types to construct VideoPlaybackQuality - r=kinetik VideoPlaybackQuality was fed uint64_t's, now it should be given uint32_t's. Note that FrameStatistics currently provide uint32_t's, so we are fine now; nevertheless I added a static_assert to verify that and ensure it stays true. MozReview-Commit-ID: I0dgP1K4lg3
dom/html/HTMLVideoElement.cpp
--- a/dom/html/HTMLVideoElement.cpp
+++ b/dom/html/HTMLVideoElement.cpp
@@ -224,30 +224,32 @@ HTMLVideoElement::NotifyOwnerDocumentAct
   UpdateScreenWakeLock();
   return pauseElement;
 }
 
 already_AddRefed<VideoPlaybackQuality>
 HTMLVideoElement::GetVideoPlaybackQuality()
 {
   DOMHighResTimeStamp creationTime = 0;
-  uint64_t totalFrames = 0;
-  uint64_t droppedFrames = 0;
-  uint64_t corruptedFrames = 0;
+  uint32_t totalFrames = 0;
+  uint32_t droppedFrames = 0;
+  uint32_t corruptedFrames = 0;
 
   if (sVideoStatsEnabled) {
     if (nsPIDOMWindowInner* window = OwnerDoc()->GetInnerWindow()) {
       Performance* perf = window->GetPerformance();
       if (perf) {
         creationTime = perf->Now();
       }
     }
 
     if (mDecoder) {
       FrameStatistics& stats = mDecoder->GetFrameStatistics();
+      static_assert(sizeof(uint32_t) >= sizeof (stats.GetParsedFrames()),
+                    "possible truncation from FrameStatistics to VideoPlaybackQuality");
       totalFrames = stats.GetParsedFrames();
       droppedFrames = stats.GetDroppedFrames();
       corruptedFrames = 0;
     }
   }
 
   RefPtr<VideoPlaybackQuality> playbackQuality =
     new VideoPlaybackQuality(this, creationTime, totalFrames, droppedFrames,