Bug 1283718. Part 1 - fix comments and constify IsAudioSeekComplete(). r=kaku draft
authorJW Wang <jwwang@mozilla.com>
Fri, 01 Jul 2016 11:43:06 +0800
changeset 386075 35ceb5ffd735878431764f34ea51892f82ed7ac8
parent 386010 679118259e91f40d4a8f968f03ec4cff066cdb5b
child 386076 670e70671e5e2449371b270303d933b6c044d091
push id22615
push userjwwang@mozilla.com
push dateMon, 11 Jul 2016 03:16:53 +0000
reviewerskaku
bugs1283718
milestone50.0a1
Bug 1283718. Part 1 - fix comments and constify IsAudioSeekComplete(). r=kaku MozReview-Commit-ID: 8NCyAURQ1RQ
dom/media/NextFrameSeekTask.cpp
dom/media/NextFrameSeekTask.h
--- a/dom/media/NextFrameSeekTask.cpp
+++ b/dom/media/NextFrameSeekTask.cpp
@@ -217,25 +217,21 @@ NextFrameSeekTask::RequestVideoData()
   AssertOwnerThread();
   SAMPLE_LOG("Queueing video task - queued=%i, decoder-queued=%o",
              !!mSeekedVideoData, mReader->SizeOfVideoQueueInFrames());
 
   mReader->RequestVideoData(false, media::TimeUnit());
 }
 
 bool
-NextFrameSeekTask::IsAudioSeekComplete()
+NextFrameSeekTask::IsAudioSeekComplete() const
 {
   AssertOwnerThread();
-  SAMPLE_LOG("IsAudioSeekComplete() curTarVal=%d aqFin=%d aqSz=%d req=%d wait=%d",
-    mSeekJob.Exists(), mIsAudioQueueFinished, !!mSeekedAudioData,
-    mReader->IsRequestingAudioData(), mReader->IsWaitingAudioData());
-
-  // Just make sure that we are not requesting or waiting for audio data. We
-  // don't really need to get an decoded audio data or get EOS here.
+  // Don't finish seek until there are no pending requests. Otherwise, we might
+  // lose audio samples for the promise is resolved asynchronously.
   return !mReader->IsRequestingAudioData() && !mReader->IsWaitingAudioData();
 }
 
 bool
 NextFrameSeekTask::IsVideoSeekComplete()
 {
   AssertOwnerThread();
   SAMPLE_LOG("IsVideoSeekComplete() curTarVal=%d vqFin=%d vqSz=%d",
--- a/dom/media/NextFrameSeekTask.h
+++ b/dom/media/NextFrameSeekTask.h
@@ -46,17 +46,17 @@ private:
   bool IsVideoDecoding() const;
 
   void EnsureVideoDecodeTaskQueued();
 
   const char* VideoRequestStatus();
 
   void RequestVideoData();
 
-  bool IsAudioSeekComplete();
+  bool IsAudioSeekComplete() const;
 
   bool IsVideoSeekComplete();
 
   void CheckIfSeekComplete();
 
   void OnAudioDecoded(MediaData* aAudioSample);
 
   void OnAudioNotDecoded(MediaDecoderReader::NotDecodedReason aReason);