Bug 1218396 - By default window-less AudioChannelAgents should be muted, r=alwu
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 27 Oct 2015 06:57:38 +0000
changeset 304845 57acb7a0a53f66359887e8315b68b638eb96d273
parent 304844 cab34e0b0a7b02fa3b4e86e89c24d48cd96c1cbe
child 304846 5d5c5ddddff156f2f3f23e3da041ddd091c3dabc
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersalwu
bugs1218396
milestone44.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 1218396 - By default window-less AudioChannelAgents should be muted, r=alwu
dom/audiochannel/AudioChannelService.cpp
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -318,23 +318,26 @@ AudioChannelService::UnregisterAudioChan
 void
 AudioChannelService::GetState(nsPIDOMWindow* aWindow, uint32_t aAudioChannel,
                               float* aVolume, bool* aMuted)
 {
   MOZ_ASSERT(!aWindow || aWindow->IsOuterWindow());
   MOZ_ASSERT(aVolume && aMuted);
   MOZ_ASSERT(aAudioChannel < NUMBER_OF_AUDIO_CHANNELS);
 
+
+  if (!aWindow || !aWindow->IsOuterWindow()) {
+    *aVolume = 0.0;
+    *aMuted = true;
+    return;
+  }
+
   *aVolume = 1.0;
   *aMuted = false;
 
-  if (!aWindow || !aWindow->IsOuterWindow()) {
-    return;
-  }
-
   AudioChannelWindow* winData = nullptr;
   nsCOMPtr<nsPIDOMWindow> window = aWindow;
 
   // The volume must be calculated based on the window hierarchy. Here we go up
   // to the top window and we calculate the volume and the muted flag.
   do {
     winData = GetWindowData(window->WindowID());
     if (winData) {