Bug 1288344. Part 2 - Remove MediaDecoder::mWasEndedWhenEnteredDormant. r?cpearce
MozReview-Commit-ID: edGkP9mv6L
--- 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;