Bug 1578615 - part5 : notify media block when we append agent. r=chunmin
authoralwu <alwu@mozilla.com>
Wed, 25 Sep 2019 18:12:33 +0000
changeset 495047 34b256af59d62cfef82cd88296a7dde9da326a8f
parent 495046 7ade7615fccf02a0126bb3821448c0a444694386
child 495048 2c7f0d54cda8988325680a271fe8fbfb70a3a681
push id36621
push userdluca@mozilla.com
push dateThu, 26 Sep 2019 09:42:00 +0000
treeherdermozilla-central@1dc1a755079a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschunmin
bugs1578615
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1578615 - part5 : notify media block when we append agent. r=chunmin As we would show delay media playback icon for `eNotAudible` and `eMaybeAudible`, we should call `AudioChannelWindow::AudioAudibleChanged()` when we register the agent in order to notify a delaying start. In the past, as we use `AudioChannelWrapper` to handle delaying, which would call `HTMLMediaElement::AudioChannelWrapper::WindowSuspendChanged()` immediately when we delay autoplay, and finally triggers `AudioChannelWindow::AudioAudibleChanged()` to notify sending block-start event. It's very unclear, so we should set it in the beginning if we have already know the audible state of delayed media. Differential Revision: https://phabricator.services.mozilla.com/D44748
dom/audiochannel/AudioChannelService.cpp
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -717,21 +717,20 @@ uint32_t AudioChannelService::AudioChann
 }
 
 void AudioChannelService::AudioChannelWindow::AppendAgent(
     AudioChannelAgent* aAgent, AudibleState aAudible) {
   MOZ_ASSERT(aAgent);
 
   RequestAudioFocus(aAgent);
   AppendAgentAndIncreaseAgentsNum(aAgent);
-  if (aAudible == AudibleState::eAudible) {
-    AudioAudibleChanged(aAgent, AudibleState::eAudible,
-                        AudibleChangedReasons::eDataAudibleChanged);
-  } else if (IsEnableAudioCompetingForAllAgents() &&
-             aAudible != AudibleState::eAudible) {
+  AudioAudibleChanged(aAgent, aAudible,
+                      AudibleChangedReasons::eDataAudibleChanged);
+  if (IsEnableAudioCompetingForAllAgents() &&
+      aAudible != AudibleState::eAudible) {
     NotifyAudioCompetingChanged(aAgent);
   }
 }
 
 void AudioChannelService::AudioChannelWindow::RemoveAgent(
     AudioChannelAgent* aAgent) {
   MOZ_ASSERT(aAgent);