Bug 1347758 - part3 : should notify media block for audible agent in the first time. draft
authorAlastor Wu <alwu@mozilla.com>
Fri, 24 Mar 2017 14:43:55 +0800
changeset 504486 886020b5f8987cc097f264df2243a3e19a7a7368
parent 504485 763e82a4003a646e35d0f6592cdadba1ad878283
child 504487 404e60a081f5fb251a33855a5db4a07fdcb91a13
push id50804
push useralwu@mozilla.com
push dateFri, 24 Mar 2017 09:03:46 +0000
bugs1347758
milestone55.0a1
Bug 1347758 - part3 : should notify media block for audible agent in the first time. When the agent is audible, we should check whether need to notify "blockStart" immediately. MozReview-Commit-ID: KmYLo9cEt4X
dom/audiochannel/AudioChannelService.cpp
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -1391,23 +1391,22 @@ void
 AudioChannelService::AudioChannelWindow::AudioAudibleChanged(AudioChannelAgent* aAgent,
                                                              AudibleState aAudible,
                                                              AudibleChangedReasons aReason)
 {
   MOZ_ASSERT(aAgent);
 
   if (aAudible == AudibleState::eAudible) {
     AppendAudibleAgentIfNotContained(aAgent, aReason);
+    NotifyAudioCompetingChanged(aAgent);
   } else {
     RemoveAudibleAgentIfContained(aAgent, aReason);
   }
 
-  if (aAudible == AudibleState::eAudible) {
-    NotifyAudioCompetingChanged(aAgent);
-  } else if (aAudible != AudibleState::eNotAudible) {
+  if (aAudible != AudibleState::eNotAudible) {
     MaybeNotifyMediaBlockStart(aAgent);
   }
 }
 
 void
 AudioChannelService::AudioChannelWindow::AppendAudibleAgentIfNotContained(AudioChannelAgent* aAgent,
                                                                           AudibleChangedReasons aReason)
 {