Bug 1500238 output null from StereoPannerNode when input is null r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 19 Oct 2018 09:25:25 +0000
changeset 500705 17f777b161890b63b207c412549e4afc7129fa32
parent 500704 cc7ddb5861a8de34ad979db33ebb46ff1bbfd8c5
child 500706 01b1f806550b9a8c610c653b842305e1f3e9ad3a
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1500238
milestone64.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 1500238 output null from StereoPannerNode when input is null r=padenot This is necessary for efficient processing of silence, and is consistent with behavior of other nodes. A null block current has a single channel of silence, which isn't aligned with the current spec, but is consistent with the direction of https://github.com/WebAudio/web-audio-api/issues/1471#issuecomment-405668690 Depends on D9210 Differential Revision: https://phabricator.services.mozilla.com/D9211
dom/media/webaudio/StereoPannerNode.cpp
--- a/dom/media/webaudio/StereoPannerNode.cpp
+++ b/dom/media/webaudio/StereoPannerNode.cpp
@@ -108,23 +108,23 @@ public:
   virtual void ProcessBlock(AudioNodeStream* aStream,
                             GraphTime aFrom,
                             const AudioBlock& aInput,
                             AudioBlock* aOutput,
                             bool *aFinished) override
   {
     // The output of this node is always stereo, no matter what the inputs are.
     MOZ_ASSERT(aInput.ChannelCount() <= 2);
-    aOutput->AllocateChannels(2);
     bool monoToStereo = aInput.ChannelCount() == 1;
 
     if (aInput.IsNull()) {
       // If input is silent, so is the output
-      SetToSilentStereoBlock(aOutput);
+      aOutput->SetNull(WEBAUDIO_BLOCK_SIZE);
     } else if (mPan.HasSimpleValue()) {
+      aOutput->AllocateChannels(2);
       float panning = mPan.GetValue();
       // If the panning is 0.0, we can simply copy the input to the
       // output with gain applied, up-mixing to stereo if needed.
       if (panning == 0.0f) {
         UpmixToStereoIfNeeded(aInput, aOutput);
       } else {
         // Optimize the case where the panning is constant for this processing
         // block: we can just apply a constant gain on the left and right
@@ -133,16 +133,17 @@ public:
 
         GetGainValuesForPanning(panning, monoToStereo, gainL, gainR);
         ApplyStereoPanning(aInput, aOutput,
                            gainL * aInput.mVolume,
                            gainR * aInput.mVolume,
                            panning <= 0);
       }
     } else {
+      aOutput->AllocateChannels(2);
       float computedGain[2*WEBAUDIO_BLOCK_SIZE + 4];
       bool onLeft[WEBAUDIO_BLOCK_SIZE];
 
       float values[WEBAUDIO_BLOCK_SIZE];
       StreamTime tick = mDestination->GraphTimeToStreamTime(aFrom);
       mPan.GetValuesAtTime(tick, values, WEBAUDIO_BLOCK_SIZE);
 
       float* alignedComputedGain = ALIGNED16(computedGain);