Commit dade295b authored by Karl Tomlinson's avatar Karl Tomlinson
Browse files

b=923301 skip delay processing when nothing is buffered and input is null r=roc

--HG--
extra : transplant_source : %60%1B%88Z%BD%9AoAI%92%FA%B1%E4%A1%EFg%2A%FE%05%8F
parent c0875227
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -84,7 +84,6 @@ public:
                                 mProcessor.BufferChannelCount() :
                                 aInput.mChannelData.Length();

    bool playedBackAllLeftOvers = false;
    if (!aInput.IsNull()) {
      if (mLeftOverData <= 0) {
        nsRefPtr<PlayingRefChanged> refchanged =
@@ -97,12 +96,15 @@ public:
    } else {
      if (mLeftOverData != INT32_MIN) {
        mLeftOverData = INT32_MIN;
        playedBackAllLeftOvers = true;
        // Delete our buffered data now we no longer need it
        mProcessor.Reset();

        nsRefPtr<PlayingRefChanged> refchanged =
          new PlayingRefChanged(aStream, PlayingRefChanged::RELEASE);
        NS_DispatchToMainThread(refchanged);
      }
      *aOutput = aInput;
      return;
    }

    AllocateAudioBlock(numChannels, aOutput);
@@ -149,12 +151,6 @@ public:
      mProcessor.Process(computedDelay, inputChannels, outputChannels,
                         numChannels, WEBAUDIO_BLOCK_SIZE);
    }


    if (playedBackAllLeftOvers) {
      // Delete our buffered data once we no longer need it
      mProcessor.Reset();
    }
  }

  AudioNodeStream* mSource;