Bug 1299074. Part 3 - check |mSentFirstFrameLoadedEvent| to know whether we can finish decoding first frames. draft
authorJW Wang <jwwang@mozilla.com>
Tue, 30 Aug 2016 16:32:36 +0800
changeset 407887 ad3c12fa404884b94ba04833ba6932f4b15e0242
parent 407886 a9f838f051da7d7a47c7a34cec418410465a8853
child 407888 74bbb822ac75372e19cf0c1de9ba6bc3095d3f94
push id28075
push userjwwang@mozilla.com
push dateWed, 31 Aug 2016 06:38:23 +0000
bugs1299074
milestone51.0a1
Bug 1299074. Part 3 - check |mSentFirstFrameLoadedEvent| to know whether we can finish decoding first frames. MozReview-Commit-ID: 10VNH3rhPpy
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2160,19 +2160,21 @@ MediaDecoderStateMachine::SeekCompleted(
   // Reset the MediaDecoderReaderWrapper's callbask.
   DiscardSeekTaskIfExist();
 
   // NOTE: Discarding the mSeekTask must be done before here. The following code
   // might ask the MediaDecoderReaderWrapper to request media data, however, the
   // SeekTask::Discard() will ask MediaDecoderReaderWrapper to discard media
   // data requests.
 
-  if (mDecodingFirstFrame) {
-    // We were resuming from dormant, or initiated a seek early.
-    // We can fire loadeddata now.
+  // Notify FirstFrameLoaded now if we haven't since we've decoded some data
+  // for readyState to transition to HAVE_CURRENT_DATA and fire 'loadeddata'.
+  if (!mSentFirstFrameLoadedEvent) {
+    // Only MSE can start seeking before finishing decoding first frames.
+    MOZ_ASSERT(mReader->ForceZeroStartTime());
     FinishDecodeFirstFrame();
   }
 
   // Ensure timestamps are up to date.
   UpdatePlaybackPositionInternal(newCurrentTime);
 
   // Try to decode another frame to detect if we're at the end...
   DECODER_LOG("Seek completed, mCurrentPosition=%lld", mCurrentPosition.Ref());