Don't subtract too much from nonSilentFramesToProcess
[WebKit-https.git] / Source / WebCore / Modules / webaudio / AudioScheduledSourceNode.cpp
index d78bf797c0ba593f949b0a5f9bb0b55e9a53a2a1..f157fb7e20e027c1db8a13ad526c1848612afcb3 100644 (file)
@@ -117,7 +117,11 @@ void AudioScheduledSourceNode::updateSchedulingInfo(size_t quantumFrameSize,
         ASSERT(isSafe);
 
         if (isSafe) {
-            nonSilentFramesToProcess -= framesToZero;
+            if (framesToZero > nonSilentFramesToProcess)
+                nonSilentFramesToProcess = 0;
+            else
+                nonSilentFramesToProcess -= framesToZero;
+
             for (unsigned i = 0; i < outputBus->numberOfChannels(); ++i)
                 memset(outputBus->channel(i)->mutableData() + zeroStartFrame, 0, sizeof(float) * framesToZero);
         }