Bug 1286454 part 1 - remove MediaData::mDiscontinuity; r=jwwang
authorKaku Kuo <kaku@mozilla.com>
Thu, 25 Aug 2016 20:30:02 +0800
changeset 311729 4cb4952bbbdebd8ac0d2dccaf3a6b09bacc68f24
parent 311728 e2ae7e9e8260d2c5078c54de11080fca31d8e6d4
child 311730 78979124b83af5fa87081285f4e9a9d151137c76
push id20417
push userryanvm@gmail.com
push dateTue, 30 Aug 2016 13:55:34 +0000
treeherderfx-team@b18c8bcdc116 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang
bugs1286454
milestone51.0a1
Bug 1286454 part 1 - remove MediaData::mDiscontinuity; r=jwwang This member is only assigned but never used now. MozReview-Commit-ID: IbuAbRaXzc4
dom/media/AccurateSeekTask.cpp
dom/media/AccurateSeekTask.h
dom/media/MediaData.cpp
dom/media/MediaData.h
dom/media/MediaDecoderReader.cpp
dom/media/MediaDecoderStateMachine.cpp
dom/media/MediaFormatReader.cpp
dom/media/NextFrameSeekTask.cpp
--- a/dom/media/AccurateSeekTask.cpp
+++ b/dom/media/AccurateSeekTask.cpp
@@ -287,32 +287,26 @@ AccurateSeekTask::OnAudioDecoded(MediaDa
   MOZ_ASSERT(!mSeekTaskPromise.IsEmpty(), "Seek shouldn't be finished");
 
   RefPtr<MediaData> audio(aAudioSample);
   MOZ_ASSERT(audio);
 
   // The MDSM::mDecodedAudioEndTime will be updated once the whole SeekTask is
   // resolved.
 
-  SAMPLE_LOG("OnAudioDecoded [%lld,%lld] disc=%d",
-    audio->mTime, audio->GetEndTime(), audio->mDiscontinuity);
+  SAMPLE_LOG("OnAudioDecoded [%lld,%lld]", audio->mTime, audio->GetEndTime());
 
   // Video-only seek doesn't reset audio decoder. There might be pending audio
   // requests when AccurateSeekTask::Seek() begins. We will just store the data
   // without checking |mDiscontinuity| or calling DropAudioUpToSeekTarget().
   if (mTarget.IsVideoOnly()) {
     mSeekedAudioData = audio.forget();
     return;
   }
 
-  if (mFirstAudioSample) {
-    mFirstAudioSample = false;
-    MOZ_ASSERT(audio->mDiscontinuity);
-  }
-
   AdjustFastSeekIfNeeded(audio);
 
   if (mTarget.IsFast()) {
     // Non-precise seek; we can stop the seek at the first sample.
     mSeekedAudioData = audio;
     mDoneAudioSeeking = true;
   } else if (NS_FAILED(DropAudioUpToSeekTarget(audio))) {
     CancelCallbacks();
@@ -388,23 +382,17 @@ AccurateSeekTask::OnVideoDecoded(MediaDa
   MOZ_ASSERT(!mSeekTaskPromise.IsEmpty(), "Seek shouldn't be finished");
 
   RefPtr<MediaData> video(aVideoSample);
   MOZ_ASSERT(video);
 
   // The MDSM::mDecodedVideoEndTime will be updated once the whole SeekTask is
   // resolved.
 
-  SAMPLE_LOG("OnVideoDecoded [%lld,%lld] disc=%d",
-    video->mTime, video->GetEndTime(), video->mDiscontinuity);
-
-  if (mFirstVideoSample) {
-    mFirstVideoSample = false;
-    MOZ_ASSERT(video->mDiscontinuity);
-  }
+  SAMPLE_LOG("OnVideoDecoded [%lld,%lld]", video->mTime, video->GetEndTime());
 
   AdjustFastSeekIfNeeded(video);
 
   if (mTarget.IsFast()) {
     // Non-precise seek. We can stop the seek at the first sample.
     mSeekedVideoData = video;
     mDoneVideoSeeking = true;
   } else if (NS_FAILED(DropVideoUpToSeekTarget(video.get()))) {
--- a/dom/media/AccurateSeekTask.h
+++ b/dom/media/AccurateSeekTask.h
@@ -60,18 +60,16 @@ private:
 
   /*
    * Internal state.
    */
   const media::TimeUnit mCurrentTimeBeforeSeek;
   const uint32_t mAudioRate;  // Audio sample rate.
   bool mDoneAudioSeeking;
   bool mDoneVideoSeeking;
-  bool mFirstAudioSample = true;
-  bool mFirstVideoSample = true;
 
   // This temporarily stores the first frame we decode after we seek.
   // This is so that if we hit end of stream while we're decoding to reach
   // the seek target, we will still have a frame that we can display as the
   // last frame in the media.
   RefPtr<MediaData> mFirstVideoFrameAfterSeek;
 
   /*
--- a/dom/media/MediaData.cpp
+++ b/dom/media/MediaData.cpp
@@ -80,18 +80,16 @@ AudioData::TransferAndUpdateTimestampAnd
   NS_ENSURE_TRUE(aOther, nullptr);
   RefPtr<AudioData> v = new AudioData(aOther->mOffset,
                                       aTimestamp,
                                       aDuration,
                                       aOther->mFrames,
                                       Move(aOther->mAudioData),
                                       aOther->mChannels,
                                       aOther->mRate);
-  v->mDiscontinuity = aOther->mDiscontinuity;
-
   return v.forget();
 }
 
 static bool
 ValidatePlane(const VideoData::YCbCrBuffer::Plane& aPlane)
 {
   return aPlane.mWidth <= PlanarYCbCrImage::MAX_DIMENSION &&
          aPlane.mHeight <= PlanarYCbCrImage::MAX_DIMENSION &&
@@ -168,17 +166,16 @@ VideoData::ShallowCopyUpdateDuration(con
 {
   RefPtr<VideoData> v = new VideoData(aOther->mOffset,
                                         aOther->mTime,
                                         aDuration,
                                         aOther->mKeyframe,
                                         aOther->mTimecode,
                                         aOther->mDisplay,
                                         aOther->mFrameID);
-  v->mDiscontinuity = aOther->mDiscontinuity;
   v->mImage = aOther->mImage;
   return v.forget();
 }
 
 /* static */
 already_AddRefed<VideoData>
 VideoData::ShallowCopyUpdateTimestamp(const VideoData* aOther,
                                       int64_t aTimestamp)
@@ -186,17 +183,16 @@ VideoData::ShallowCopyUpdateTimestamp(co
   NS_ENSURE_TRUE(aOther, nullptr);
   RefPtr<VideoData> v = new VideoData(aOther->mOffset,
                                         aTimestamp,
                                         aOther->GetEndTime() - aTimestamp,
                                         aOther->mKeyframe,
                                         aOther->mTimecode,
                                         aOther->mDisplay,
                                         aOther->mFrameID);
-  v->mDiscontinuity = aOther->mDiscontinuity;
   v->mImage = aOther->mImage;
   return v.forget();
 }
 
 /* static */
 already_AddRefed<VideoData>
 VideoData::ShallowCopyUpdateTimestampAndDuration(const VideoData* aOther,
                                                  int64_t aTimestamp,
@@ -205,17 +201,16 @@ VideoData::ShallowCopyUpdateTimestampAnd
   NS_ENSURE_TRUE(aOther, nullptr);
   RefPtr<VideoData> v = new VideoData(aOther->mOffset,
                                         aTimestamp,
                                         aDuration,
                                         aOther->mKeyframe,
                                         aOther->mTimecode,
                                         aOther->mDisplay,
                                         aOther->mFrameID);
-  v->mDiscontinuity = aOther->mDiscontinuity;
   v->mImage = aOther->mImage;
   return v.forget();
 }
 
 /* static */
 bool VideoData::SetVideoDataToImage(PlanarYCbCrImage* aVideoImage,
                                     const VideoInfo& aInfo,
                                     const YCbCrBuffer &aBuffer,
--- a/dom/media/MediaData.h
+++ b/dom/media/MediaData.h
@@ -284,17 +284,16 @@ public:
             uint32_t aFrames)
     : mType(aType)
     , mOffset(aOffset)
     , mTime(aTimestamp)
     , mTimecode(aTimestamp)
     , mDuration(aDuration)
     , mFrames(aFrames)
     , mKeyframe(false)
-    , mDiscontinuity(false)
   {}
 
   // Type of contained data.
   const Type mType;
 
   // Approximate byte offset where this data was demuxed from its media.
   int64_t mOffset;
 
@@ -308,20 +307,16 @@ public:
   // Duration of sample, in microseconds.
   int64_t mDuration;
 
   // Amount of frames for contained data.
   const uint32_t mFrames;
 
   bool mKeyframe;
 
-  // True if this is the first sample after a gap or discontinuity in
-  // the stream. This is true for the first sample in a stream after a seek.
-  bool mDiscontinuity;
-
   int64_t GetEndTime() const { return mTime + mDuration; }
 
   bool AdjustForStartTime(int64_t aStartTime)
   {
     mTime = mTime - aStartTime;
     return mTime >= 0;
   }
 
@@ -343,17 +338,16 @@ protected:
   MediaData(Type aType, uint32_t aFrames)
     : mType(aType)
     , mOffset(0)
     , mTime(0)
     , mTimecode(0)
     , mDuration(0)
     , mFrames(aFrames)
     , mKeyframe(false)
-    , mDiscontinuity(false)
   {}
 
   virtual ~MediaData() {}
 
 };
 
 // NullData is for decoder generating a sample which doesn't need to be
 // rendered.
--- a/dom/media/MediaDecoderReader.cpp
+++ b/dom/media/MediaDecoderReader.cpp
@@ -454,17 +454,16 @@ MediaDecoderReader::RequestVideoData(boo
       RefPtr<nsIRunnable> task(new ReRequestVideoWithSkipTask(this, aTimeThreshold));
       mTaskQueue->Dispatch(task.forget());
       return p;
     }
   }
   if (VideoQueue().GetSize() > 0) {
     RefPtr<VideoData> v = VideoQueue().PopFront();
     if (v && mVideoDiscontinuity) {
-      v->mDiscontinuity = true;
       mVideoDiscontinuity = false;
     }
     mBaseVideoPromise.Resolve(v, __func__);
   } else if (VideoQueue().IsFinished()) {
     mBaseVideoPromise.Reject(END_OF_STREAM, __func__);
   } else {
     MOZ_ASSERT(false, "Dropping this promise on the floor");
   }
@@ -490,17 +489,16 @@ MediaDecoderReader::RequestAudioData()
       RefPtr<nsIRunnable> task(new ReRequestAudioTask(this));
       mTaskQueue->Dispatch(task.forget());
       return p;
     }
   }
   if (AudioQueue().GetSize() > 0) {
     RefPtr<AudioData> a = AudioQueue().PopFront();
     if (mAudioDiscontinuity) {
-      a->mDiscontinuity = true;
       mAudioDiscontinuity = false;
     }
     mBaseAudioPromise.Resolve(a, __func__);
   } else if (AudioQueue().IsFinished()) {
     mBaseAudioPromise.Reject(mHitAudioDecodeError ? DECODE_ERROR : END_OF_STREAM, __func__);
     mHitAudioDecodeError = false;
   } else {
     MOZ_ASSERT(false, "Dropping this promise on the floor");
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -568,18 +568,17 @@ MediaDecoderStateMachine::OnAudioDecoded
   MOZ_ASSERT(mState != DECODER_STATE_SEEKING);
 
   RefPtr<MediaData> audio(aAudioSample);
   MOZ_ASSERT(audio);
 
   // audio->GetEndTime() is not always mono-increasing in chained ogg.
   mDecodedAudioEndTime = std::max(audio->GetEndTime(), mDecodedAudioEndTime);
 
-  SAMPLE_LOG("OnAudioDecoded [%lld,%lld] disc=%d",
-             audio->mTime, audio->GetEndTime(), audio->mDiscontinuity);
+  SAMPLE_LOG("OnAudioDecoded [%lld,%lld]", audio->mTime, audio->GetEndTime());
 
   switch (mState) {
     case DECODER_STATE_BUFFERING: {
       // If we're buffering, this may be the sample we need to stop buffering.
       // Save it and schedule the state machine.
       Push(audio, MediaData::AUDIO_DATA);
       ScheduleStateMachine();
       return;
@@ -755,18 +754,17 @@ MediaDecoderStateMachine::OnVideoDecoded
   MOZ_ASSERT(mState != DECODER_STATE_SEEKING);
 
   RefPtr<MediaData> video(aVideoSample);
   MOZ_ASSERT(video);
 
   // Handle abnormal or negative timestamps.
   mDecodedVideoEndTime = std::max(mDecodedVideoEndTime, video->GetEndTime());
 
-  SAMPLE_LOG("OnVideoDecoded [%lld,%lld] disc=%d",
-             video->mTime, video->GetEndTime(), video->mDiscontinuity);
+  SAMPLE_LOG("OnVideoDecoded [%lld,%lld]", video->mTime, video->GetEndTime());
 
   switch (mState) {
     case DECODER_STATE_BUFFERING: {
       // If we're buffering, this may be the sample we need to stop buffering.
       // Save it and schedule the state machine.
       Push(video, MediaData::VIDEO_DATA);
       ScheduleStateMachine();
       return;
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -1321,17 +1321,16 @@ void
 MediaFormatReader::ReturnOutput(MediaData* aData, TrackType aTrack)
 {
   auto& decoder = GetDecoderData(aTrack);
   MOZ_ASSERT(decoder.HasPromise());
   MOZ_DIAGNOSTIC_ASSERT(aData->mType != MediaData::NULL_DATA);
   if (decoder.mDiscontinuity) {
     LOGV("Setting discontinuity flag");
     decoder.mDiscontinuity = false;
-    aData->mDiscontinuity = true;
   }
 
   LOG("Resolved data promise for %s [%lld, %lld]", TrackTypeToStr(aTrack),
       aData->mTime, aData->GetEndTime());
 
   if (aTrack == TrackInfo::kAudioTrack) {
     if (aData->mType != MediaData::RAW_DATA) {
       AudioData* audioData = static_cast<AudioData*>(aData);
--- a/dom/media/NextFrameSeekTask.cpp
+++ b/dom/media/NextFrameSeekTask.cpp
@@ -167,20 +167,19 @@ NextFrameSeekTask::OnAudioDecoded(MediaD
 {
   AssertOwnerThread();
   MOZ_ASSERT(aAudioSample);
   MOZ_ASSERT(!mSeekTaskPromise.IsEmpty(), "Seek shouldn't be finished");
 
   // The MDSM::mDecodedAudioEndTime will be updated once the whole SeekTask is
   // resolved.
 
-  SAMPLE_LOG("OnAudioDecoded [%lld,%lld] disc=%d",
+  SAMPLE_LOG("OnAudioDecoded [%lld,%lld]",
              aAudioSample->mTime,
-             aAudioSample->GetEndTime(),
-             aAudioSample->mDiscontinuity);
+             aAudioSample->GetEndTime());
 
   // We accept any audio data here.
   mSeekedAudioData = aAudioSample;
 
   MaybeFinishSeek();
 }
 
 void
@@ -203,20 +202,19 @@ NextFrameSeekTask::OnVideoDecoded(MediaD
 {
   AssertOwnerThread();
   MOZ_ASSERT(aVideoSample);
   MOZ_ASSERT(!mSeekTaskPromise.IsEmpty(), "Seek shouldn't be finished");
 
   // The MDSM::mDecodedVideoEndTime will be updated once the whole SeekTask is
   // resolved.
 
-  SAMPLE_LOG("OnVideoDecoded [%lld,%lld] disc=%d",
+  SAMPLE_LOG("OnVideoDecoded [%lld,%lld]",
              aVideoSample->mTime,
-             aVideoSample->GetEndTime(),
-             aVideoSample->mDiscontinuity);
+             aVideoSample->GetEndTime());
 
   if (aVideoSample->mTime > mCurrentTime) {
     mSeekedVideoData = aVideoSample;
   }
 
   if (NeedMoreVideo()) {
     RequestVideoData();
     return;