Bug 1180535 - Dispatch the media-playback notification when navigating away from a page that has a media element playing; r=baku

When navigating away from a document, we mute the playing media elements
through the NotifyOwnerDocumentActivityChanged() notification.
Sometimes, that function may notify the audio channel agent through its
call to AddRemoveSelfReference() which may call
UpdateAudioChannelPlayingState() and notify the agent, but when we're
navigating away from the page, playingThroughTheAudioChannel will always
be equal to mPlayingThroughTheAudioChannel, which causes us to not
notify the audio channel agent.

This patch fixes this by separating NotifyOwnerDocumentActivityChanged()
from its internal consumers, and forcefully notifying the audio channel
agent when we navigate away.
This commit is contained in:
Ehsan Akhgari
2015-07-05 18:36:49 -04:00
parent 9561182acb
commit 37a45c793d
7 changed files with 130 additions and 22 deletions

View File

@@ -192,11 +192,12 @@ HTMLVideoElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
return HTMLVideoElementBinding::Wrap(aCx, this, aGivenProto);
}
void
HTMLVideoElement::NotifyOwnerDocumentActivityChanged()
bool
HTMLVideoElement::NotifyOwnerDocumentActivityChangedInternal()
{
HTMLMediaElement::NotifyOwnerDocumentActivityChanged();
bool pauseElement = HTMLMediaElement::NotifyOwnerDocumentActivityChangedInternal();
UpdateScreenWakeLock();
return pauseElement;
}
already_AddRefed<VideoPlaybackQuality>