Bug 1288344. Part 2 - Remove MediaDecoder::mWasEndedWhenEnteredDormant. r?cpearce draft
authorJW Wang <jwwang@mozilla.com>
Tue, 12 Jul 2016 14:34:06 +0800
changeset 390527 48b058fc4eef1ede1949b6c670b92dc4caf4f693
parent 390526 d830d576becccbdc0415a4e2c0b76aa5b17c5d61
child 526014 1c37afb93cccdc6ed3b459f88503cf13b30d207d
push id23686
push userjwwang@mozilla.com
push dateThu, 21 Jul 2016 09:27:03 +0000
reviewerscpearce
bugs1288344
milestone50.0a1
Bug 1288344. Part 2 - Remove MediaDecoder::mWasEndedWhenEnteredDormant. r?cpearce MozReview-Commit-ID: edGkP9mv6L
dom/media/MediaDecoder.cpp
dom/media/MediaDecoder.h
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -505,17 +505,16 @@ MediaDecoder::MediaDecoder(MediaDecoderO
   , mPlaybackStatistics(new MediaChannelStatistics())
   , mPinnedForSeek(false)
   , mShuttingDown(false)
   , mPausedForPlaybackRateNull(false)
   , mMinimizePreroll(false)
   , mMediaTracksConstructed(false)
   , mFiredMetadataLoaded(false)
   , mIsDormant(false)
-  , mWasEndedWhenEnteredDormant(false)
   , mIsHeuristicDormantSupported(
       Preferences::GetBool("media.decoder.heuristic.dormant.enabled", false))
   , mHeuristicDormantTimeout(
       Preferences::GetInt("media.decoder.heuristic.dormant.timeout",
                           DEFAULT_HEURISTIC_DORMANT_TIMEOUT_MSECS))
   , mIsHeuristicDormant(false)
   , mStateMachineIsShutdown(AbstractThread::MainThread(), true,
                             "MediaDecoder::mStateMachineIsShutdown (Mirror)")
@@ -813,17 +812,16 @@ MediaDecoder::Seek(double aTime, SeekTar
   UpdateDormantState(false /* aDormantTimeout */, true /* aActivity */);
 
   MOZ_ASSERT(!mIsDormant, "should be out of dormant by now");
   MOZ_ASSERT(aTime >= 0.0, "Cannot seek to a negative value.");
 
   int64_t timeUsecs = TimeUnit::FromSeconds(aTime).ToMicroseconds();
 
   mLogicalPosition = aTime;
-  mWasEndedWhenEnteredDormant = false;
 
   mLogicallySeeking = true;
   SeekTarget target = SeekTarget(timeUsecs, aSeekType);
   CallSeek(target, aPromise);
 
   if (mPlayState == PLAY_STATE_ENDED) {
     PinForSeek();
     ChangeState(mOwner->GetPaused() ? PLAY_STATE_PAUSED : PLAY_STATE_PLAYING);
@@ -1117,18 +1115,17 @@ MediaDecoder::GetCrashHelper()
   return mOwner->GetMediaElement() ?
     MakeAndAddRef<MediaElementGMPCrashHelper>(mOwner->GetMediaElement()) : nullptr;
 }
 
 bool
 MediaDecoder::IsEnded() const
 {
   MOZ_ASSERT(NS_IsMainThread());
-  return mPlayState == PLAY_STATE_ENDED ||
-         (mWasEndedWhenEnteredDormant && (mPlayState != PLAY_STATE_SHUTDOWN));
+  return mPlayState == PLAY_STATE_ENDED;
 }
 
 void
 MediaDecoder::PlaybackEnded()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (mShuttingDown ||
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -710,22 +710,16 @@ protected:
 
   // Stores media info, including info of audio tracks and video tracks, should
   // only be accessed from main thread.
   nsAutoPtr<MediaInfo> mInfo;
 
   // True if MediaDecoder is in dormant state.
   bool mIsDormant;
 
-  // True if MediaDecoder was PLAY_STATE_ENDED state, when entering to dormant.
-  // When MediaCodec is in dormant during PLAY_STATE_ENDED state, PlayState
-  // becomes different from PLAY_STATE_ENDED. But the MediaDecoder need to act
-  // as in PLAY_STATE_ENDED state to MediaDecoderOwner.
-  bool mWasEndedWhenEnteredDormant;
-
   // True if heuristic dormant is supported.
   const bool mIsHeuristicDormantSupported;
 
   // Timeout ms of heuristic dormant timer.
   const int mHeuristicDormantTimeout;
 
   // True if MediaDecoder is in dormant by heuristic.
   bool mIsHeuristicDormant;