Bug 1299074. Part 2 - simplify the handling of pending seek in StartDecoding(). draft
authorJW Wang <jwwang@mozilla.com>
Tue, 30 Aug 2016 16:21:43 +0800
changeset 407886 a9f838f051da7d7a47c7a34cec418410465a8853
parent 407885 95903dbbbef092b7730a404538a1725a5ab76f24
child 407887 ad3c12fa404884b94ba04833ba6932f4b15e0242
push id28075
push userjwwang@mozilla.com
push dateWed, 31 Aug 2016 06:38:23 +0000
bugs1299074
milestone51.0a1
Bug 1299074. Part 2 - simplify the handling of pending seek in StartDecoding(). mSentFirstFrameLoadedEvent is sufficient to tell us whether we can handle the pending seek now or later. MozReview-Commit-ID: KzDd2brvKPA
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1255,29 +1255,21 @@ MediaDecoderStateMachine::Shutdown()
 }
 
 void
 MediaDecoderStateMachine::StartDecoding()
 {
   MOZ_ASSERT(OnTaskQueue());
   MOZ_ASSERT(mState == DECODER_STATE_DECODING);
 
-  if (mDecodingFirstFrame && mSentFirstFrameLoadedEvent) {
-    // We're resuming from dormant state, so we don't need to request
-    // the first samples in order to determine the media start time,
-    // we have the start time from last time we loaded.
-    // FinishDecodeFirstFrame will be launched upon completion of the seek when
-    // we have data ready to play.
-    MOZ_ASSERT(mQueuedSeek.Exists() && mSentFirstFrameLoadedEvent,
-               "Return from dormant must have queued seek");
-
-    if (mQueuedSeek.Exists()) {
-      InitiateSeek(Move(mQueuedSeek));
-      return;
-    }
+  // Handle the pending seek now if we've decoded first frames. Otherwise it
+  // will be handled after decoding first frames.
+  if (mSentFirstFrameLoadedEvent && mQueuedSeek.Exists()) {
+    InitiateSeek(Move(mQueuedSeek));
+    return;
   }
 
   if (CheckIfDecodeComplete()) {
     SetState(DECODER_STATE_COMPLETED);
     return;
   }
 
   mDecodeStartTime = TimeStamp::Now();