Bug 1324311 - window-less agent can't own audio focus. r=baku a=gchang
authorAlastor Wu <alwu@mozilla.com>
Mon, 19 Dec 2016 15:04:16 +0800
changeset 353164 7b1a631ae717c5d4af9e72400ea61a4095d1f051
parent 353163 46fdbb0954b9c34f9795361c234077952293cf88
child 353165 ffcb1f3d8cbe58eb612c4578d9ad70c81eff864f
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, gchang
bugs1324311
milestone52.0a2
Bug 1324311 - window-less agent can't own audio focus. r=baku a=gchang MozReview-Commit-ID: HBieQMoIGOv
dom/audiochannel/AudioChannelService.cpp
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -1066,16 +1066,21 @@ AudioChannelService::RefreshAgentsAudioF
   }
 }
 
 void
 AudioChannelService::AudioChannelWindow::RequestAudioFocus(AudioChannelAgent* aAgent)
 {
   MOZ_ASSERT(aAgent);
 
+  // Don't need to check audio focus for window-less agent.
+  if (!aAgent->Window()) {
+    return;
+  }
+
   // We already have the audio focus. No operation is needed.
   if (mOwningAudioFocus) {
     return;
   }
 
   // Only foreground window can request audio focus, but it would still own the
   // audio focus even it goes to background. Audio focus would be abandoned
   // only when other foreground window starts audio competing.