Bug 1237806 - update playback position before entering buffering mode so the currentTime of the media element is more accurate during buffering. r=jya. draft
authorJW Wang <jwwang@mozilla.com>
Mon, 11 Jan 2016 17:14:20 +0800
changeset 320383 d930e0c4c8e1348065a08e5dbba8fa4afbe08139
parent 320335 bcfa8145cff388644453df36b8891c40cff8d3c0
child 512735 d1cff5079773d309f97d44d950c49928ce2370bb
push id9189
push userjwwang@mozilla.com
push dateMon, 11 Jan 2016 09:18:47 +0000
reviewersjya
bugs1237806
milestone46.0a1
Bug 1237806 - update playback position before entering buffering mode so the currentTime of the media element is more accurate during buffering. r=jya.
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2674,16 +2674,20 @@ void MediaDecoderStateMachine::StartBuff
     // We only move into BUFFERING state if we're actually decoding.
     // If we're currently doing something else, we don't need to buffer,
     // and more importantly, we shouldn't overwrite mState to interrupt
     // the current operation, as that could leave us in an inconsistent
     // state!
     return;
   }
 
+  // Update playback position again before entering BUFFERING so the currentTime
+  // of the media element is more accurate during buffering.
+  UpdatePlaybackPositionPeriodically();
+
   if (IsPlaying()) {
     StopPlayback();
   }
 
   TimeDuration decodeDuration = TimeStamp::Now() - mDecodeStartTime;
   // Go into quick buffering mode provided we've not just left buffering using
   // a "quick exit". This stops us flip-flopping between playing and buffering
   // when the download speed is similar to the decode speed.