Bug 1283910 - Fix initialization of WaveShaperNode output buffer in null input case; r=padenot
authorDan Minor <dminor@mozilla.com>
Mon, 04 Jul 2016 13:38:35 -0400
changeset 303733 30c40d0d1149fbce098472a61ce9042462bdd1c8
parent 303684 9b428173a0889f5a25e7a6e855f2d1726207a723
child 303734 00d17f539a2bbe54a530f43dea01448e10391bdc
push id30401
push usercbook@mozilla.com
push dateWed, 06 Jul 2016 09:40:34 +0000
treeherdermozilla-central@a7d6bb9e7d12 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1283910
milestone50.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 1283910 - Fix initialization of WaveShaperNode output buffer in null input case; r=padenot MozReview-Commit-ID: 1YtpEvTa5vd
dom/media/webaudio/WaveShaperNode.cpp
dom/media/webaudio/test/test_waveShaperGain.html
--- a/dom/media/webaudio/WaveShaperNode.cpp
+++ b/dom/media/webaudio/WaveShaperNode.cpp
@@ -257,17 +257,17 @@ public:
               static_cast<const float*>(aInput.mChannelData[i]),
                                         aInput.mVolume,
                                         alignedScaledInput);
           inputSamples = alignedScaledInput;
         } else {
           inputSamples = static_cast<const float*>(aInput.mChannelData[i]);
         }
       } else {
-        PodZero(alignedScaledInput);
+        PodZero(alignedScaledInput, WEBAUDIO_BLOCK_SIZE);
         inputSamples = alignedScaledInput;
       }
       float* outputBuffer = aOutput->ChannelFloatsForWrite(i);
       float* sampleBuffer;
 
       switch (mType) {
       case OverSampleType::None:
         mResampler.Reset(channelCount, aStream->SampleRate(), OverSampleType::None);
--- a/dom/media/webaudio/test/test_waveShaperGain.html
+++ b/dom/media/webaudio/test/test_waveShaperGain.html
@@ -50,18 +50,19 @@ context.startRendering().then(buffer => 
 
   oscillator.start(0);
   oscillator.connect(gain);
 
   // to silence
   gain.gain.value = 0;
   gain.connect(waveShaper);
 
-  // convert all signal into 1.0
-  waveShaper.curve = new Float32Array([ 1, 1 ]);
+  // convert all signal into 1.0. The non unity values are to detect the use
+  // of uninitialized buffers (see Bug 1283910).
+  waveShaper.curve = new Float32Array([ 0.5, 0.5, 0.5, 0.5, 0.5, 1, 1, 0.5, 0.5, 0.5, 0.5, 0.5 ]);
   waveShaper.connect(context.destination);
 
   context.startRendering().then((buffer) => {
     var result = buffer.getChannelData(0);
     ok(result.every(x => x === 1), "WaveShaper handles zero gain properly");
     SimpleTest.finish();
   });
 });