Bug 1306551 - don't update playback position for video-only seek when seek is completed. draft
authorJW Wang <jwwang@mozilla.com>
Thu, 06 Oct 2016 17:06:58 +0800
changeset 424562 264f163758d75bb18622cc2fbc7b59d96514d89c
parent 424560 1856f7181503742d9bcbe48b919501a93c90d113
child 424563 05b26b205b82732c865f5df6eb73f8a2eeb546bf
push id32192
push userjwwang@mozilla.com
push dateThu, 13 Oct 2016 01:48:28 +0000
bugs1306551
milestone52.0a1
Bug 1306551 - don't update playback position for video-only seek when seek is completed. MozReview-Commit-ID: 7vByX0pPNo
dom/media/MediaDecoderStateMachine.cpp
--- 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);
     }