Bug 1237806 - update playback position before entering buffering mode so the currentTime of the media element is more accurate during buffering. r=jya.
--- 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.