Bug 1323931. Part 3 - remove mIsAudioQueueFinished/mIsVideoQueueFinished and finish queues in place. r?kaku draft
authorJW Wang <jwwang@mozilla.com>
Fri, 16 Dec 2016 15:28:09 +0800
changeset 450844 f65ea76ae5b908a522b66aebdf29da61d700b871
parent 450843 856d8edf743c111f7588fd88aaa0f551bb6edff8
child 450845 3d4da26171b70a406252edfd522a79ee2d7c9d3f
push id38961
push userjwwang@mozilla.com
push dateMon, 19 Dec 2016 03:21:27 +0000
reviewerskaku
bugs1323931
milestone53.0a1
Bug 1323931. Part 3 - remove mIsAudioQueueFinished/mIsVideoQueueFinished and finish queues in place. r?kaku MozReview-Commit-ID: 2MDZSa3g7cj
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -946,20 +946,20 @@ public:
       } else {
         RequestVideoData();
       }
       return;
     }
 
     if (aError == NS_ERROR_DOM_MEDIA_END_OF_STREAM) {
       if (aType == MediaData::AUDIO_DATA) {
-        mIsAudioQueueFinished = true;
+        AudioQueue().Finish();
         mDoneAudioSeeking = true;
       } else {
-        mIsVideoQueueFinished = true;
+        VideoQueue().Finish();
         mDoneVideoSeeking = true;
         if (mFirstVideoFrameAfterSeek) {
           // Hit the end of stream. Move mFirstVideoFrameAfterSeek into
           // mSeekedVideoData so we have something to display after seeking.
           mSeekedVideoData = mFirstVideoFrameAfterSeek.forget();
         }
       }
       MaybeFinishSeek();
@@ -1233,37 +1233,21 @@ private:
     }
 
     if (mSeekedVideoData) {
       mMaster->Push(mSeekedVideoData);
       mMaster->mDecodedVideoEndTime = std::max(
         mSeekedVideoData->GetEndTime(), mMaster->mDecodedVideoEndTime);
     }
 
-    if (mIsAudioQueueFinished) {
-      AudioQueue().Finish();
-    }
-
-    if (mIsVideoQueueFinished) {
-      VideoQueue().Finish();
-    }
-
     SeekCompleted();
   }
 
   void OnSeekTaskRejected(const MediaResult& aError)
   {
-    if (mIsAudioQueueFinished) {
-      AudioQueue().Finish();
-    }
-
-    if (mIsVideoQueueFinished) {
-      VideoQueue().Finish();
-    }
-
     mMaster->DecodeError(aError);
   }
 
   /*
    * Track the current seek promise made by the reader.
    */
   MozPromiseRequestHolder<MediaDecoderReader::SeekPromise> mSeekRequest;
 
@@ -1280,18 +1264,16 @@ private:
   // last frame in the media.
   RefPtr<MediaData> mFirstVideoFrameAfterSeek;
 
   /*
    * Information which are going to be returned to MDSM.
    */
   RefPtr<MediaData> mSeekedAudioData;
   RefPtr<MediaData> mSeekedVideoData;
-  bool mIsAudioQueueFinished = false;
-  bool mIsVideoQueueFinished = false;
 };
 
 /*
  * Remove samples from the queue until aCompare() returns false.
  * aCompare A function object with the signature bool(int64_t) which returns
  *          true for samples that should be removed.
  */
 template <typename Function> static void