Bug 1183033 - Don't mute the system channel type. r=baku
authorAlastor Wu <alwu@mozilla.com>
Tue, 20 Oct 2015 20:42:24 +0800
changeset 268867 4084fa04400bba8f8d7c7f779c0984c6464a1394
parent 268866 333ffce7d713923276f1934b3144c1e73414ba30
child 268868 a1059127579d6aaf3bce6ec534edea09c7f59860
push id18223
push usercbook@mozilla.com
push dateThu, 22 Oct 2015 07:01:46 +0000
treeherderb2g-inbound@a1059127579d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1183033
milestone44.0a1
Bug 1183033 - Don't mute the system channel type. r=baku
dom/audiochannel/AudioChannelService.cpp
dom/audiochannel/AudioChannelService.h
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -769,16 +769,21 @@ void
 AudioChannelService::SetAudioChannelMuted(nsPIDOMWindow* aWindow,
                                           AudioChannel aAudioChannel,
                                           bool aMuted)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aWindow);
   MOZ_ASSERT(aWindow->IsOuterWindow());
 
+  if (aAudioChannel == AudioChannel::System) {
+    // Workaround for bug1183033, system channel type can always playback.
+    return;
+  }
+
   AudioChannelWindow* winData = GetOrCreateWindowData(aWindow);
   winData->mChannels[(uint32_t)aAudioChannel].mMuted = aMuted;
   RefreshAgentsVolume(aWindow);
 }
 
 NS_IMETHODIMP
 AudioChannelService::SetAudioChannelMuted(nsIDOMWindow* aWindow,
                                           unsigned short aAudioChannel,
--- a/dom/audiochannel/AudioChannelService.h
+++ b/dom/audiochannel/AudioChannelService.h
@@ -170,17 +170,20 @@ private:
 
     uint32_t mNumberOfAgents;
   };
 
   struct AudioChannelWindow final
   {
     explicit AudioChannelWindow(uint64_t aWindowID)
       : mWindowID(aWindowID)
-    {}
+    {
+      // Workaround for bug1183033, system channel type can always playback.
+      mChannels[(int16_t)AudioChannel::System].mMuted = false;
+    }
 
     uint64_t mWindowID;
     AudioChannelConfig mChannels[NUMBER_OF_AUDIO_CHANNELS];
 
     // Raw pointer because the AudioChannelAgent must unregister itself.
     nsTObserverArray<AudioChannelAgent*> mAgents;
   };