Bug 1182928 - Disable dormant mode for EME videos in Firefox Beta and Release. r=sotaro

This commit is contained in:
Chris Pearce 2015-07-14 12:17:07 +12:00
parent c61c2ce747
commit 2ea27c7e30
2 changed files with 23 additions and 4 deletions

View File

@ -159,6 +159,19 @@ void MediaDecoder::NotifyOwnerActivityChanged()
StartDormantTimer();
}
bool
MediaDecoder::IsHeuristicDormantSupported() const
{
return
#if defined(MOZ_EME) && defined(RELEASE_BUILD)
// We disallow dormant for encrypted media on Beta and Release until
// bug 1181864 is fixed.
mInfo &&
!mInfo->IsEncrypted() &&
#endif
mIsHeuristicDormantSupported;
}
void MediaDecoder::UpdateDormantState(bool aDormantTimeout, bool aActivity)
{
MOZ_ASSERT(NS_IsMainThread());
@ -174,9 +187,11 @@ void MediaDecoder::UpdateDormantState(bool aDormantTimeout, bool aActivity)
}
DECODER_LOG("UpdateDormantState aTimeout=%d aActivity=%d mIsDormant=%d "
"ownerActive=%d ownerHidden=%d mIsHeuristicDormant=%d mPlayState=%s",
"ownerActive=%d ownerHidden=%d mIsHeuristicDormant=%d "
"mPlayState=%s encrypted=%s",
aDormantTimeout, aActivity, mIsDormant, mOwner->IsActive(),
mOwner->IsHidden(), mIsHeuristicDormant, PlayStateStr());
mOwner->IsHidden(), mIsHeuristicDormant, PlayStateStr(),
(!mInfo ? "Unknown" : (mInfo->IsEncrypted() ? "1" : "0")));
bool prevDormant = mIsDormant;
mIsDormant = false;
@ -188,10 +203,11 @@ void MediaDecoder::UpdateDormantState(bool aDormantTimeout, bool aActivity)
mIsDormant = true;
}
#endif
// Try to enable dormant by idle heuristic, when the owner is hidden.
bool prevHeuristicDormant = mIsHeuristicDormant;
mIsHeuristicDormant = false;
if (mIsHeuristicDormantSupported && mOwner->IsHidden()) {
if (IsHeuristicDormantSupported() && mOwner->IsHidden()) {
if (aDormantTimeout && !aActivity &&
(mPlayState == PLAY_STATE_PAUSED || IsEnded())) {
// Enable heuristic dormant
@ -252,7 +268,7 @@ void MediaDecoder::DormantTimerExpired(nsITimer* aTimer, void* aClosure)
void MediaDecoder::StartDormantTimer()
{
MOZ_ASSERT(NS_IsMainThread());
if (!mIsHeuristicDormantSupported) {
if (!IsHeuristicDormantSupported()) {
return;
}

View File

@ -1057,6 +1057,9 @@ protected:
virtual void CallSeek(const SeekTarget& aTarget);
// Returns true if heuristic dormant is supported.
bool IsHeuristicDormantSupported() const;
MediaPromiseRequestHolder<SeekPromise> mSeekRequest;
// True when seeking or otherwise moving the play position around in