Bug 1489375 - part1 : do not recreate AudioChannelAgent. r=padenot a=pascalc
authoralwu <alwu@mozilla.com>
Tue, 18 Sep 2018 14:57:30 +0000
changeset 492625 9bad6b73be9d38192d0ac295518db33efae24e54
parent 492624 2ebd5b9976ddca10fd121e97cccd3b3fc09769d1
child 492626 d63bc2e27b831a90854bbb01cca7f173a758a269
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot, pascalc
bugs1489375
milestone63.0
Bug 1489375 - part1 : do not recreate AudioChannelAgent. r=padenot a=pascalc When calling resume() on a running AudioContext, there is no need to discard current AudioChannelAgent and then create a new one. Differential Revision: https://phabricator.services.mozilla.com/D5799
dom/media/webaudio/AudioDestinationNode.cpp
--- a/dom/media/webaudio/AudioDestinationNode.cpp
+++ b/dom/media/webaudio/AudioDestinationNode.cpp
@@ -591,30 +591,22 @@ AudioDestinationNode::WindowAudioCapture
   }
 
   return NS_OK;
 }
 
 nsresult
 AudioDestinationNode::CreateAudioChannelAgent()
 {
-  if (mIsOffline) {
+  if (mIsOffline || mAudioChannelAgent) {
     return NS_OK;
   }
 
-  nsresult rv = NS_OK;
-  if (mAudioChannelAgent) {
-    rv = mAudioChannelAgent->NotifyStoppedPlaying();
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      return rv;
-    }
-  }
-
   mAudioChannelAgent = new AudioChannelAgent();
-  rv = mAudioChannelAgent->InitWithWeakCallback(GetOwner(), this);
+  nsresult rv = mAudioChannelAgent->InitWithWeakCallback(GetOwner(), this);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return NS_OK;
 }
 
 void