Bug 1652460 - part1 : always store the audible state change. r=bryce

Whenever the audible state changes, we should always store the latest state but only notify the change after playing starts.

Differential Revision: https://phabricator.services.mozilla.com/D83549
This commit is contained in:
alwu
2020-07-14 22:01:43 +00:00
parent 4724a8c0b6
commit 671a611a88

View File

@@ -1533,17 +1533,20 @@ class HTMLMediaElement::AudioChannelAgentCallback final
void NotifyAudioPlaybackChanged(AudibleChangedReasons aReason) {
MOZ_ASSERT(!mIsShutDown);
if (!IsPlayingStarted()) {
return;
}
AudibleState newAudibleState = IsOwnerAudible();
MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
("HTMLMediaElement::AudioChannelAgentCallback, "
"NotifyAudioPlaybackChanged, this=%p, current=%s, new=%s",
this, AudibleStateToStr(mIsOwnerAudible),
AudibleStateToStr(newAudibleState)));
if (mIsOwnerAudible == newAudibleState) {
return;
}
mIsOwnerAudible = newAudibleState;
mAudioChannelAgent->NotifyStartedAudible(mIsOwnerAudible, aReason);
if (IsPlayingStarted()) {
mAudioChannelAgent->NotifyStartedAudible(mIsOwnerAudible, aReason);
}
}
void Shutdown() {