Backed out changeset e11a8496bf63 (bug 1180535)

This commit is contained in:
Carsten "Tomcat" Book
2015-07-11 14:13:32 +02:00
parent cf487e58dc
commit 79edbab44c
7 changed files with 22 additions and 130 deletions

View File

@@ -945,7 +945,7 @@ void HTMLMediaElement::NotifyMediaStreamTracksAvailable(DOMMediaStream* aStream)
if (videoHasChanged) {
// We are a video element and HasVideo() changed so update the screen
// wakelock
NotifyOwnerDocumentActivityChangedInternal();
NotifyOwnerDocumentActivityChanged();
}
mWatchManager.ManualNotify(&HTMLMediaElement::UpdateReadyStateInternal);
@@ -2101,7 +2101,7 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNo
mPaused.SetOuter(this);
RegisterActivityObserver();
NotifyOwnerDocumentActivityChangedInternal();
NotifyOwnerDocumentActivityChanged();
MOZ_ASSERT(NS_IsMainThread());
mWatchManager.Watch(mDownloadSuspendedByCache, &HTMLMediaElement::UpdateReadyStateInternal);
@@ -2857,7 +2857,7 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
// We may want to suspend the new stream now.
// This will also do an AddRemoveSelfReference.
NotifyOwnerDocumentActivityChangedInternal();
NotifyOwnerDocumentActivityChanged();
if (!mPaused) {
SetPlayedOrSeeked(true);
@@ -3270,7 +3270,7 @@ void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
if (IsVideo() && aInfo->HasVideo()) {
// We are a video element playing video so update the screen wakelock
NotifyOwnerDocumentActivityChangedInternal();
NotifyOwnerDocumentActivityChanged();
}
}
@@ -4027,17 +4027,6 @@ bool HTMLMediaElement::IsBeingDestroyed()
}
void HTMLMediaElement::NotifyOwnerDocumentActivityChanged()
{
bool pauseElement = NotifyOwnerDocumentActivityChangedInternal();
if (pauseElement && mAudioChannelAgent) {
// If the element is being paused since we are navigating away from the
// document, notify the audio channel agent.
NotifyAudioChannelAgent(false);
}
}
bool
HTMLMediaElement::NotifyOwnerDocumentActivityChangedInternal()
{
nsIDocument* ownerDoc = OwnerDoc();
if (mDecoder && !IsBeingDestroyed()) {
@@ -4058,8 +4047,6 @@ HTMLMediaElement::NotifyOwnerDocumentActivityChangedInternal()
}
AddRemoveSelfReference();
return pauseElement;
}
void HTMLMediaElement::AddRemoveSelfReference()
@@ -4523,26 +4510,20 @@ void HTMLMediaElement::UpdateAudioChannelPlayingState()
this);
}
NotifyAudioChannelAgent(mPlayingThroughTheAudioChannel);
}
}
// This is needed to pass nsContentUtils::IsCallerChrome().
// AudioChannel API should not called from content but it can happen that
// this method has some content JS in its stack.
AutoNoJSAPI nojsapi;
void
HTMLMediaElement::NotifyAudioChannelAgent(bool aPlaying)
{
// This is needed to pass nsContentUtils::IsCallerChrome().
// AudioChannel API should not called from content but it can happen that
// this method has some content JS in its stack.
AutoNoJSAPI nojsapi;
if (aPlaying) {
float volume = 0.0;
bool muted = true;
mAudioChannelAgent->StartPlaying(&volume, &muted);
WindowVolumeChanged(volume, muted);
} else {
mAudioChannelAgent->StopPlaying();
mAudioChannelAgent = nullptr;
if (mPlayingThroughTheAudioChannel) {
float volume = 0.0;
bool muted = true;
mAudioChannelAgent->StartPlaying(&volume, &muted);
WindowVolumeChanged(volume, muted);
} else {
mAudioChannelAgent->StopPlaying();
mAudioChannelAgent = nullptr;
}
}
}