Bug 1237806 - update playback position before entering buffering mode so the currentTime of the media element is more accurate during buffering. r=jya.
authorJW Wang <jwwang@mozilla.com>
Tue, 12 Jan 2016 10:25:23 +0800
changeset 279423 7ea8e549a96fcd0fdd2b24b929323de0a47b84ad
parent 279422 10164991b6ccb99d91eb70a21c229f35a643e444
child 279424 aa57c1fd4a6dada23581149974439d3a483fab86
push id70086
push userjwwang@mozilla.com
push dateTue, 12 Jan 2016 02:35:11 +0000
treeherdermozilla-inbound@7ea8e549a96f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1237806
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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.