Bug 1306551 - don't update playback position for video-only seek when seek is completed.
MozReview-Commit-ID: 7vByX0pPNo
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -958,17 +958,22 @@ private:
// for readyState to transition to HAVE_CURRENT_DATA and fire 'loadeddata'.
if (!mMaster->mSentFirstFrameLoadedEvent) {
// Only MSE can start seeking before finishing decoding first frames.
MOZ_ASSERT(Reader()->ForceZeroStartTime());
mMaster->FinishDecodeFirstFrame();
}
// Ensure timestamps are up to date.
- mMaster->UpdatePlaybackPositionInternal(newCurrentTime);
+ if (!mSeekJob.mTarget.IsVideoOnly()) {
+ // Don't update playback position for video-only seek.
+ // Otherwise we might have |newCurrentTime > mMediaSink->GetPosition()|
+ // and fail the assertion in GetClock() since we didn't stop MediaSink.
+ mMaster->UpdatePlaybackPositionInternal(newCurrentTime);
+ }
// Try to decode another frame to detect if we're at the end...
SLOG("Seek completed, mCurrentPosition=%lld", mMaster->mCurrentPosition.Ref());
if (video) {
mMaster->mMediaSink->Redraw(Info().mVideo);
mMaster->mOnPlaybackEvent.Notify(MediaEventType::Invalidate);
}