bug 1199560 finish offline audio context processing even when allocation fails r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Mon, 24 Aug 2015 19:29:15 +1200
changeset 259956 31aa13a7722fdfa38657b78dcfe1a5311efa4833
parent 259955 c08ff32574885c792c362ca4bb9b429eac9ccf0d
child 259957 1f5364722693c688a5d33c184e2a7bc9b1359826
push id64381
push userktomlinson@mozilla.com
push dateSun, 30 Aug 2015 19:35:52 +0000
treeherdermozilla-inbound@1f5364722693 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1199560
milestone43.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 1199560 finish offline audio context processing even when allocation fails r=padenot ProcessBlock() needs to return aFinished = true at some point.
dom/media/webaudio/AudioDestinationNode.cpp
--- a/dom/media/webaudio/AudioDestinationNode.cpp
+++ b/dom/media/webaudio/AudioDestinationNode.cpp
@@ -61,31 +61,23 @@ public:
       // gracefully.
       mBuffer = ThreadSharedFloatArrayBufferList::
         Create(mNumberOfChannels, mLength, fallible);
 
       mBufferAllocated = true;
     }
 
     // Handle the case of allocation failure in the input buffer
-    if (mBuffer) {
-      return;
-    }
-
-    if (mWriteIndex >= mLength) {
-      NS_ASSERTION(mWriteIndex == mLength, "Overshot length");
-      // Don't record any more.
-      return;
-    }
+    uint32_t outputChannelCount = mBuffer ? mNumberOfChannels : 0;
 
     // Record our input buffer
     MOZ_ASSERT(mWriteIndex < mLength, "How did this happen?");
     const uint32_t duration = std::min(WEBAUDIO_BLOCK_SIZE, mLength - mWriteIndex);
     const uint32_t inputChannelCount = aInput.mChannelData.Length();
-    for (uint32_t i = 0; i < mNumberOfChannels; ++i) {
+    for (uint32_t i = 0; i < outputChannelCount; ++i) {
       float* outputData = mBuffer->GetDataForWrite(i) + mWriteIndex;
       if (aInput.IsNull() || i >= inputChannelCount) {
         PodZero(outputData, duration);
       } else {
         const float* inputBuffer = static_cast<const float*>(aInput.mChannelData[i]);
         if (duration == WEBAUDIO_BLOCK_SIZE) {
           // Use the optimized version of the copy with scale operation
           AudioBlockCopyChannelWithScale(inputBuffer, aInput.mVolume,