bug 930257 finish Oscillator on processing last non-null block r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 23 Oct 2015 09:23:52 +1300
changeset 271163 ff4b05caac7f1c24f6f72ab82e09e25916ed2498
parent 271162 ea6714b89f5c7d705df80e9ee666096a49467dd5
child 271164 e4cf5dc1ab2c3c51a39655039ee0865303acdb1c
push id29634
push usercbook@mozilla.com
push dateThu, 05 Nov 2015 10:59:26 +0000
treeherdermozilla-central@59c648a3f955 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs930257
milestone45.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 930257 finish Oscillator on processing last non-null block r=padenot
dom/media/webaudio/OscillatorNode.cpp
--- a/dom/media/webaudio/OscillatorNode.cpp
+++ b/dom/media/webaudio/OscillatorNode.cpp
@@ -309,49 +309,46 @@ public:
     MOZ_ASSERT(mSource == aStream, "Invalid source stream");
 
     StreamTime ticks = mDestination->GraphTimeToStreamTime(aFrom);
     if (mStart == -1) {
       ComputeSilence(aOutput);
       return;
     }
 
-    if (ticks >= mStop) {
-      // We've finished playing.
+    if (ticks + WEBAUDIO_BLOCK_SIZE <= mStart || ticks >= mStop) {
       ComputeSilence(aOutput);
-      *aFinished = true;
-      return;
-    }
-    if (ticks + WEBAUDIO_BLOCK_SIZE <= mStart) {
-      // We're not playing yet.
-      ComputeSilence(aOutput);
-      return;
+
+    } else {
+      aOutput->AllocateChannels(1);
+      float* output = aOutput->ChannelFloatsForWrite(0);
+
+      uint32_t start, end;
+      FillBounds(output, ticks, start, end);
+
+      // Synthesize the correct waveform.
+      switch(mType) {
+        case OscillatorType::Sine:
+          ComputeSine(output, ticks, start, end);
+          break;
+        case OscillatorType::Square:
+        case OscillatorType::Triangle:
+        case OscillatorType::Sawtooth:
+        case OscillatorType::Custom:
+          ComputeCustom(output, ticks, start, end);
+          break;
+        default:
+          ComputeSilence(aOutput);
+      };
     }
 
-    aOutput->AllocateChannels(1);
-    float* output = aOutput->ChannelFloatsForWrite(0);
-
-    uint32_t start, end;
-    FillBounds(output, ticks, start, end);
-
-    // Synthesize the correct waveform.
-    switch(mType) {
-      case OscillatorType::Sine:
-        ComputeSine(output, ticks, start, end);
-        break;
-      case OscillatorType::Square:
-      case OscillatorType::Triangle:
-      case OscillatorType::Sawtooth:
-      case OscillatorType::Custom:
-        ComputeCustom(output, ticks, start, end);
-        break;
-      default:
-        ComputeSilence(aOutput);
-    };
-
+    if (ticks + WEBAUDIO_BLOCK_SIZE >= mStop) {
+      // We've finished playing.
+      *aFinished = true;
+    }
   }
 
   virtual bool IsActive() const override
   {
     // start() has been called.
     return mStart != -1;
   }