Bug 1298594: P3. Ensure currentTime is updated prior changing readyState. r=jwwang
authorJean-Yves Avenard <jyavenard@mozilla.com>
Sun, 28 Aug 2016 21:20:52 +1000
changeset 407042 ded582db991fcbedb51f42980f9bc1aca93d8a5f
parent 407041 ce7dae2a0f061a4605bfc5102189fa6823ce9cb0
child 407043 2cdde44ebcc788af1a875217dc3022b1812d6538
push id27893
push userbmo:gasolin@mozilla.com
push dateTue, 30 Aug 2016 03:41:38 +0000
reviewersjwwang
bugs1298594
milestone51.0a1
Bug 1298594: P3. Ensure currentTime is updated prior changing readyState. r=jwwang Otherwise we get intermittent in mochitests checking the value of currenTime when events are fired MozReview-Commit-ID: AVktWrXochp
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2537,16 +2537,22 @@ void MediaDecoderStateMachine::UpdateNex
     statusString = "NEXT_FRAME_AVAILABLE";
   } else {
     status = MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE;
     statusString = "NEXT_FRAME_UNAVAILABLE";
   }
 
   if (status != mNextFrameStatus) {
     DECODER_LOG("Changed mNextFrameStatus to %s", statusString);
+    if(status == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_BUFFERING ||
+       status == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE) {
+      // Ensure currentTime is up to date prior updating mNextFrameStatus so that
+      // the MediaDecoderOwner fire events at correct currentTime.
+      UpdatePlaybackPositionPeriodically();
+    }
   }
 
   mNextFrameStatus = status;
 }
 
 bool MediaDecoderStateMachine::JustExitedQuickBuffering()
 {
   MOZ_ASSERT(OnTaskQueue());