Bug 1283370. Part 4 - remove HasAudio(). r=kaku
authorJW Wang <jwwang@mozilla.com>
Thu, 30 Jun 2016 17:42:57 +0800
changeset 384955 bba3e109af220753f5a2729b0c4831182aef7e51
parent 384954 030c194e154d3c09d5467904f8e457e9851c3154
child 384956 29b0c523b59a10d418a3d5086ce43b2a373f3057
push id22385
push userbmo:wpan@mozilla.com
push dateThu, 07 Jul 2016 12:18:17 +0000
reviewerskaku
bugs1283370
milestone50.0a1
Bug 1283370. Part 4 - remove HasAudio(). r=kaku We guarantee to have |!mReader->IsRequestingAudioData() && !mReader->IsWaitingAudioData()| when there is no audio at all. We can remove the check for HasAudio(). MozReview-Commit-ID: KYYIq6n06Vr
dom/media/NextFrameSeekTask.cpp
dom/media/NextFrameSeekTask.h
--- a/dom/media/NextFrameSeekTask.cpp
+++ b/dom/media/NextFrameSeekTask.cpp
@@ -45,39 +45,31 @@ NextFrameSeekTask::NextFrameSeekTask(con
                                    const media::TimeUnit& aDuration,
                                    int64_t aCurrentMediaTime,
                                    MediaQueue<MediaData>& aAudioQueue,
                                    MediaQueue<MediaData>& aVideoQueue)
   : SeekTask(aDecoderID, aThread, aReader, Move(aSeekJob))
   , mAudioQueue(aAudioQueue)
   , mVideoQueue(aVideoQueue)
   , mCurrentTimeBeforeSeek(aCurrentMediaTime)
-  , mHasAudio(aInfo.HasAudio())
   , mDuration(aDuration)
 {
   AssertOwnerThread();
   MOZ_ASSERT(aInfo.HasVideo());
 
   // Configure MediaDecoderReaderWrapper.
   SetCallbacks();
 }
 
 NextFrameSeekTask::~NextFrameSeekTask()
 {
   AssertOwnerThread();
   MOZ_ASSERT(mIsDiscarded);
 }
 
-bool
-NextFrameSeekTask::HasAudio() const
-{
-  AssertOwnerThread();
-  return mHasAudio;
-}
-
 void
 NextFrameSeekTask::Discard()
 {
   AssertOwnerThread();
 
   // Disconnect MediaDecoder.
   mSeekJob.RejectIfExists(__func__);
 
@@ -235,18 +227,17 @@ NextFrameSeekTask::IsAudioSeekComplete()
 {
   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.
-  return !HasAudio() ||
-         (!mReader->IsRequestingAudioData() && !mReader->IsWaitingAudioData());
+  return !mReader->IsRequestingAudioData() && !mReader->IsWaitingAudioData();
 }
 
 bool
 NextFrameSeekTask::IsVideoSeekComplete()
 {
   AssertOwnerThread();
   SAMPLE_LOG("IsVideoSeekComplete() curTarVal=%d vqFin=%d vqSz=%d",
       mSeekJob.Exists(), mIsVideoQueueFinished, !!mSeekedVideoData);
--- a/dom/media/NextFrameSeekTask.h
+++ b/dom/media/NextFrameSeekTask.h
@@ -38,18 +38,16 @@ public:
 
   RefPtr<SeekTaskPromise> Seek(const media::TimeUnit& aDuration) override;
 
   bool NeedToResetMDSM() const override;
 
 private:
   ~NextFrameSeekTask();
 
-  bool HasAudio() const;
-
   bool IsVideoDecoding() const;
 
   nsresult EnsureVideoDecodeTaskQueued();
 
   const char* VideoRequestStatus();
 
   void RequestVideoData();
 
@@ -80,17 +78,16 @@ private:
    */
   MediaQueue<MediaData>& mAudioQueue;
   MediaQueue<MediaData>& mVideoQueue;
 
   /*
    * Internal state.
    */
   const int64_t mCurrentTimeBeforeSeek;
-  const bool mHasAudio;
   media::TimeUnit mDuration;
 
   MediaEventListener mAudioCallback;
   MediaEventListener mVideoCallback;
   MediaEventListener mAudioWaitCallback;
   MediaEventListener mVideoWaitCallback;
 };