Bug 1179662 - Call UnregisterAudioBufferSourceNode only once. r=padenot, a=kglazko
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 02 Jul 2015 18:14:54 +1200
changeset 281455 6e0a8c7779275ff6217279e705a1e74e21dd6b12
parent 281454 54c223db64700ed64d7bbd7e53af60668cd99fe6
child 281456 d7eea16d75d9034d297d9aa7ad08b4d631ef6d08
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot, kglazko
bugs1179662
milestone41.0a2
Bug 1179662 - Call UnregisterAudioBufferSourceNode only once. r=padenot, a=kglazko Because these nodes are only registered on PannerNodes if they have a stream, they need only be unregistered once after the stream is destroyed. Previously unregistration happened on finish, unlink, and destructor.
dom/media/webaudio/AudioBufferSourceNode.cpp
--- a/dom/media/webaudio/AudioBufferSourceNode.cpp
+++ b/dom/media/webaudio/AudioBufferSourceNode.cpp
@@ -566,21 +566,22 @@ AudioBufferSourceNode::AudioBufferSource
 
 AudioBufferSourceNode::~AudioBufferSourceNode()
 {
 }
 
 void
 AudioBufferSourceNode::DestroyMediaStream()
 {
-  if (mStream) {
+  bool hadStream = mStream;
+  if (hadStream) {
     mStream->RemoveMainThreadListener(this);
   }
   AudioNode::DestroyMediaStream();
-  if (Context()) {
+  if (hadStream && Context()) {
     Context()->UnregisterAudioBufferSourceNode(this);
   }
 }
 
 size_t
 AudioBufferSourceNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
 {
   size_t amount = AudioNode::SizeOfExcludingThis(aMallocSizeOf);