Bug 1309162 - part3 : modify the place calling UpdateAudioChannelPlayingState(). r=baku

UpdateAudioChannelPlayingState() should only be called when following attributes changed.
eg. pause/ready state/error/owner document's visibility/exteral source stream.

Therefore, we don't need to call this function in FinishDecoderSetup() and AddRemoveSelfReference().

Remove AutoNotifyAudioChannelAgent is because now we don't check HasAudio() for IsPlayingThroughTheAudioChannel().

MozReview-Commit-ID: 4VTHIAdAqX1
This commit is contained in:
Alastor Wu
2016-11-29 12:40:39 +08:00
parent 6f4b863655
commit 0b306ad6ba
2 changed files with 0 additions and 29 deletions

View File

@@ -123,24 +123,6 @@ static mozilla::LazyLogModule gMediaElementEventsLog("nsMediaElementEvents");
using namespace mozilla::layers;
using mozilla::net::nsMediaFragmentURIParser;
class MOZ_STACK_CLASS AutoNotifyAudioChannelAgent
{
RefPtr<mozilla::dom::HTMLMediaElement> mElement;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER;
public:
explicit AutoNotifyAudioChannelAgent(mozilla::dom::HTMLMediaElement* aElement
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mElement(aElement)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~AutoNotifyAudioChannelAgent()
{
mElement->UpdateAudioChannelPlayingState();
}
};
namespace mozilla {
namespace dom {
@@ -4441,7 +4423,6 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
// We may want to suspend the new stream now.
// This will also do an AddRemoveSelfReference.
NotifyOwnerDocumentActivityChanged();
UpdateAudioChannelPlayingState();
if (!mPaused) {
SetPlayedOrSeeked(true);
@@ -4875,11 +4856,6 @@ void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
{
MOZ_ASSERT(NS_IsMainThread());
// If the element is gaining or losing an audio track, we need to notify
// the audio channel agent so that the correct audio-playback events will
// get dispatched.
AutoNotifyAudioChannelAgent autoNotify(this);
SetMediaInfo(*aInfo);
mIsEncrypted = aInfo->IsEncrypted() || mPendingEncryptedInitData.IsEncrypted();
@@ -5946,8 +5922,6 @@ void HTMLMediaElement::AddRemoveSelfReference()
NS_DispatchToMainThread(event);
}
}
UpdateAudioChannelPlayingState();
}
void HTMLMediaElement::DoRemoveSelfReference()