Bug 1328547. part 3 - inline NeedToDecode{Audio,Video} and remove some checks. r?kaku draft
authorJW Wang <jwwang@mozilla.com>
Wed, 04 Jan 2017 17:23:28 +0800
changeset 456113 6f1fc91c5e6f34a7acca338aa09ed785a6a8035b
parent 456112 3428e7f7994cce42e7a0d2feb8be6e0b8d618cd7
child 456127 2cac1779a77dd3e36c980300b6e5beb21c2ccc94
push id40407
push userjwwang@mozilla.com
push dateThu, 05 Jan 2017 02:19:26 +0000
reviewerskaku
bugs1328547
milestone53.0a1
Bug 1328547. part 3 - inline NeedToDecode{Audio,Video} and remove some checks. r?kaku 1. |mState != DECODER_STATE_SEEKING| is true in DecodingState. 2. mSentFirstFrameLoadedEvent is true in DecodingState. 3. mMinimizePreroll is false because pop events fire only after MDSM starts playing. MozReview-Commit-ID: FTkXmtEnzY5
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1993,23 +1993,23 @@ DecodingState::Enter()
 
   if (mMaster->CheckIfDecodeComplete()) {
     SetState<CompletedState>();
     return;
   }
 
   mOnAudioPopped = AudioQueue().PopEvent().Connect(
     OwnerThread(), [this] () {
-    if (mMaster->NeedToDecodeAudio()) {
+    if (mMaster->IsAudioDecoding() && !mMaster->HaveEnoughDecodedAudio()) {
       mMaster->EnsureAudioDecodeTaskQueued();
     }
   });
   mOnVideoPopped = VideoQueue().PopEvent().Connect(
     OwnerThread(), [this] () {
-    if (mMaster->NeedToDecodeVideo()) {
+    if (mMaster->IsVideoDecoding() && !mMaster->HaveEnoughDecodedVideo()) {
       mMaster->EnsureVideoDecodeTaskQueued();
     }
   });
 
   mMaster->UpdateNextFrameStatus(MediaDecoderOwner::NEXT_FRAME_AVAILABLE);
 
   mDecodeStartTime = TimeStamp::Now();