Bug 1286041 - Ignore AudioContext state change to Suspended when in Closed. r=padenot
☠☠ backed out by 6a8fbd7e5e9f ☠ ☠
authorAlex Chronopoulos <achronop@gmail.com>
Tue, 06 Sep 2016 13:40:36 +0200
changeset 312825 232069c626269a71a3c2c0cd5d9cc3d4f2327338
parent 312824 71b9d48efac6b0034ee7a653eb73f99ebb077055
child 312826 42eb493a3791e810e5f248f8d0db20fdb680727a
push id30661
push userkwierso@gmail.com
push dateWed, 07 Sep 2016 00:28:11 +0000
treeherdermozilla-central@3ba67e3bb588 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1286041
milestone51.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 1286041 - Ignore AudioContext state change to Suspended when in Closed. r=padenot MozReview-Commit-ID: 2VCBMCdx5xz
dom/media/webaudio/AudioContext.cpp
--- a/dom/media/webaudio/AudioContext.cpp
+++ b/dom/media/webaudio/AudioContext.cpp
@@ -836,16 +836,25 @@ AudioContext::OnStateChanged(void* aProm
   // This can happen if close() was called right after creating the
   // AudioContext, before the context has switched to "running".
   if (mAudioContextState == AudioContextState::Closed &&
       aNewState == AudioContextState::Running &&
       !aPromise) {
     return;
   }
 
+  // This can happen if this is called in reaction to a
+  // MediaStreamGraph shutdown, and a AudioContext was being
+  // suspended at the same time, for example if a page was being
+  // closed.
+  if (mAudioContextState == AudioContextState::Closed &&
+      aNewState == AudioContextState::Suspended) {
+    return;
+  }
+
 #ifndef WIN32 // Bug 1170547
 #ifndef XP_MACOSX
 #ifdef DEBUG
 
   if (!((mAudioContextState == AudioContextState::Suspended &&
        aNewState == AudioContextState::Running)   ||
       (mAudioContextState == AudioContextState::Running   &&
        aNewState == AudioContextState::Suspended) ||