b=923301 send only one release message when delay buffer is drained r=roc
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 25 Oct 2013 12:12:13 +1300
changeset 165843 5be14790a6ffc83078aa13d9c1a82f7e4142dd83
parent 165842 0b0a112e86d9a5c8868546c036f20cebba8ba62d
child 165844 5c1ebb917518c2a387f1abc1f13639f26f4a257a
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs923301
milestone27.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
b=923301 send only one release message when delay buffer is drained r=roc
content/media/webaudio/DelayNode.cpp
--- a/content/media/webaudio/DelayNode.cpp
+++ b/content/media/webaudio/DelayNode.cpp
@@ -87,28 +87,27 @@ public:
     bool playedBackAllLeftOvers = false;
     if (!aInput.IsNull()) {
       if (mLeftOverData <= 0) {
         nsRefPtr<PlayingRefChanged> refchanged =
           new PlayingRefChanged(aStream, PlayingRefChanged::ADDREF);
         NS_DispatchToMainThread(refchanged);
       }
       mLeftOverData = mProcessor.MaxDelayFrames();
-    } else if (mLeftOverData != INT32_MIN) {
-      if (mLeftOverData <= 0) {
-        // Continue spamming the main thread with messages until we are destroyed.
-        // This isn't great.
-        mLeftOverData = 0;
+    } else if (mLeftOverData > 0) {
+      mLeftOverData -= WEBAUDIO_BLOCK_SIZE;
+    } else {
+      if (mLeftOverData != INT32_MIN) {
+        mLeftOverData = INT32_MIN;
         playedBackAllLeftOvers = true;
 
         nsRefPtr<PlayingRefChanged> refchanged =
           new PlayingRefChanged(aStream, PlayingRefChanged::RELEASE);
         NS_DispatchToMainThread(refchanged);
       }
-      mLeftOverData -= WEBAUDIO_BLOCK_SIZE;
     }
 
     AllocateAudioBlock(numChannels, aOutput);
 
     AudioChunk input = aInput;
     if (!aInput.IsNull() && aInput.mVolume != 1.0f) {
       // Pre-multiply the input's volume
       AllocateAudioBlock(numChannels, &input);