Bug 1242843 - Make MDSM::mDecodedVideoEndTime zero-based. r=kikuo. draft
authorJW Wang <jwwang@mozilla.com>
Tue, 26 Jan 2016 11:37:16 +0800
changeset 325629 b6575b2adaa19725ae8b5f3e937c73f9c3f72b80
parent 325628 4e740b7bd18c7e88094703a2237185c93bb67a07
child 325630 e10d611ba89ac2c0e6a5c4b14287ccb5c5d8795f
push id10016
push userjwwang@mozilla.com
push dateTue, 26 Jan 2016 03:37:58 +0000
reviewerskikuo
bugs1242843
milestone47.0a1
Bug 1242843 - Make MDSM::mDecodedVideoEndTime zero-based. r=kikuo.
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -209,17 +209,17 @@ MediaDecoderStateMachine::MediaDecoderSt
   mDispatchedStateMachine(false),
   mDelayedScheduler(mTaskQueue),
   mState(DECODER_STATE_DECODING_NONE, "MediaDecoderStateMachine::mState"),
   mCurrentFrameID(0),
   mObservedDuration(TimeUnit(), "MediaDecoderStateMachine::mObservedDuration"),
   mFragmentEndTime(-1),
   mReader(aReader),
   mDecodedAudioEndTime(0),
-  mDecodedVideoEndTime(-1),
+  mDecodedVideoEndTime(0),
   mPlaybackRate(1.0),
   mLowAudioThresholdUsecs(detail::LOW_AUDIO_USECS),
   mAmpleAudioThresholdUsecs(detail::AMPLE_AUDIO_USECS),
   mQuickBufferingLowDataThresholdUsecs(detail::QUICK_BUFFERING_LOW_DATA_USECS),
   mIsAudioPrerolling(false),
   mIsVideoPrerolling(false),
   mAudioCaptured(false),
   mAudioCompleted(false, "MediaDecoderStateMachine::mAudioCompleted"),
@@ -896,17 +896,17 @@ MediaDecoderStateMachine::MaybeFinishDec
 void
 MediaDecoderStateMachine::OnVideoDecoded(MediaData* aVideoSample)
 {
   MOZ_ASSERT(OnTaskQueue());
   RefPtr<MediaData> video(aVideoSample);
   MOZ_ASSERT(video);
   mVideoDataRequest.Complete();
   aVideoSample->AdjustForStartTime(StartTime());
-  mDecodedVideoEndTime = video ? video->GetEndTime() : mDecodedVideoEndTime;
+  mDecodedVideoEndTime = video->GetEndTime();
 
   SAMPLE_LOG("OnVideoDecoded [%lld,%lld] disc=%d",
              (video ? video->mTime : -1),
              (video ? video->GetEndTime() : -1),
              (video ? video->mDiscontinuity : 0));
 
   // Check frame validity here for every decoded frame in order to have a
   // better chance to make the decision of turning off HW acceleration.
@@ -2384,17 +2384,17 @@ MediaDecoderStateMachine::Reset()
              mState == DECODER_STATE_DORMANT ||
              mState == DECODER_STATE_DECODING_NONE);
 
   // Stop the audio thread. Otherwise, MediaSink might be accessing AudioQueue
   // outside of the decoder monitor while we are clearing the queue and causes
   // crash for no samples to be popped.
   StopMediaSink();
 
-  mDecodedVideoEndTime = -1;
+  mDecodedVideoEndTime = 0;
   mDecodedAudioEndTime = 0;
   mAudioCompleted = false;
   mVideoCompleted = false;
   AudioQueue().Reset();
   VideoQueue().Reset();
   mFirstVideoFrameAfterSeek = nullptr;
   mDropAudioUntilNextDiscontinuity = true;
   mDropVideoUntilNextDiscontinuity = true;