Bug 1290809 - Remove MediaDecoder::IsEndedOrShutdown(). r=gerald

MozReview-Commit-ID: 4XUcJyQlmfk
This commit is contained in:
JW Wang
2016-08-01 15:22:32 +08:00
parent f8d8d27fdb
commit 3d9cb4536f
3 changed files with 10 additions and 25 deletions

View File

@@ -870,11 +870,7 @@ HTMLMediaElement::Ended()
return stream->IsFinished();
}
if (mDecoder) {
return mDecoder->IsEndedOrShutdown();
}
return false;
return mDecoder && mDecoder->IsEnded();
}
NS_IMETHODIMP HTMLMediaElement::GetEnded(bool* aEnded)
@@ -2670,7 +2666,7 @@ HTMLMediaElement::PlayInternal(bool aCallerIsChrome)
// Even if we just did Load() or ResumeLoad(), we could already have a decoder
// here if we managed to clone an existing decoder.
if (mDecoder) {
if (mDecoder->IsEndedOrShutdown()) {
if (mDecoder->IsEnded()) {
SetCurrentTime(0);
}
if (!mPausedForInactiveDocumentOrChannel) {
@@ -4083,7 +4079,7 @@ void HTMLMediaElement::PlaybackEnded()
// We changed state which can affect AddRemoveSelfReference
AddRemoveSelfReference();
NS_ASSERTION(!mDecoder || mDecoder->IsEndedOrShutdown(),
NS_ASSERTION(!mDecoder || mDecoder->IsEnded(),
"Decoder fired ended, but not in ended state");
// Discard all output streams that have finished now.
@@ -4350,7 +4346,8 @@ HTMLMediaElement::UpdateReadyStateInternal()
return;
}
if (mDownloadSuspendedByCache && mDecoder && !mDecoder->IsEndedOrShutdown() &&
if (mDownloadSuspendedByCache &&
mDecoder && !mDecoder->IsEnded() &&
mFirstFrameLoaded) {
// The decoder has signaled that the download has been suspended by the
// media cache. So move readyState into HAVE_ENOUGH_DATA, in case there's
@@ -4756,7 +4753,7 @@ bool HTMLMediaElement::IsPlaybackEnded() const
// the current playback position is equal to the effective end of the media resource.
// See bug 449157.
return mReadyState >= nsIDOMHTMLMediaElement::HAVE_METADATA &&
mDecoder ? mDecoder->IsEndedOrShutdown() : false;
mDecoder && mDecoder->IsEnded();
}
already_AddRefed<nsIPrincipal> HTMLMediaElement::GetCurrentPrincipal()
@@ -4870,7 +4867,7 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE
#endif
if (mDecoder) {
mDecoder->Resume();
if (!mPaused && !mDecoder->IsEndedOrShutdown()) {
if (!mPaused && !mDecoder->IsEnded()) {
mDecoder->Play();
}
}
@@ -4956,7 +4953,7 @@ void HTMLMediaElement::AddRemoveSelfReference()
bool needSelfReference = !mShuttingDown &&
ownerDoc->IsActive() &&
(mDelayingLoadEvent ||
(!mPaused && mDecoder && !mDecoder->IsEndedOrShutdown()) ||
(!mPaused && mDecoder && !mDecoder->IsEnded()) ||
(!mPaused && mSrcStream && !mSrcStream->IsFinished()) ||
(mDecoder && mDecoder->IsSeeking()) ||
CanActivateAutoplay() ||