Bug 1325004. Part 5 - let BufferingState call Push{Audio,Video} instead. r?kikuo draft
authorJW Wang <jwwang@mozilla.com>
Wed, 21 Dec 2016 16:03:16 +0800
changeset 453988 a78448164d29a9f71880250db2a73b61b0d7d47d
parent 453987 2efcae21b115fd37b596030d1ade5a3e98450888
child 453989 273b3cba9c28081a87f49243b3773c48a6b1febb
push id39788
push userjwwang@mozilla.com
push dateTue, 27 Dec 2016 03:48:35 +0000
reviewerskikuo
bugs1325004
milestone53.0a1
Bug 1325004. Part 5 - let BufferingState call Push{Audio,Video} instead. r?kikuo BufferingState will call DispatchDecodeTasksIfNeeded() if not done buffering. MozReview-Commit-ID: Kzqqn8lXPLm
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1545,25 +1545,25 @@ public:
   {
     return DECODER_STATE_BUFFERING;
   }
 
   void HandleAudioDecoded(MediaData* aAudio) override
   {
     // This might be the sample we need to exit buffering.
     // Schedule Step() to check it.
-    mMaster->Push(aAudio);
+    mMaster->PushAudio(aAudio);
     mMaster->ScheduleStateMachine();
   }
 
   void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) override
   {
     // This might be the sample we need to exit buffering.
     // Schedule Step() to check it.
-    mMaster->Push(aVideo);
+    mMaster->PushVideo(aVideo);
     mMaster->ScheduleStateMachine();
   }
 
   void HandleEndOfStream() override;
 
   void HandleVideoSuspendTimeout() override
   {
     if (mMaster->HasVideo()) {
@@ -2158,16 +2158,17 @@ BufferingState::Step()
     bool isLiveStream = Resource()->IsLiveStream();
     if ((isLiveStream || !mMaster->CanPlayThrough()) &&
         elapsed < TimeDuration::FromSeconds(mBufferingWait * mMaster->mPlaybackRate) &&
         mMaster->HasLowBufferedData(mBufferingWait * USECS_PER_S) &&
         IsExpectingMoreData()) {
       SLOG("Buffering: wait %ds, timeout in %.3lfs",
            mBufferingWait, mBufferingWait - elapsed.ToSeconds());
       mMaster->ScheduleStateMachineIn(USECS_PER_S);
+      mMaster->DispatchDecodeTasksIfNeeded();
       return;
     }
   } else if (mMaster->OutOfDecodedAudio() || mMaster->OutOfDecodedVideo()) {
     MOZ_ASSERT(Reader()->IsWaitForDataSupported(),
                "Don't yet have a strategy for non-heuristic + non-WaitForData");
     mMaster->DispatchDecodeTasksIfNeeded();
     MOZ_ASSERT(mMaster->mMinimizePreroll ||
                !mMaster->OutOfDecodedAudio() ||