diff --git a/content/media/AudioNodeStream.cpp b/content/media/AudioNodeStream.cpp index c86b4b38a76f..aaf383521831 100644 --- a/content/media/AudioNodeStream.cpp +++ b/content/media/AudioNodeStream.cpp @@ -238,18 +238,6 @@ AudioNodeStream::SetChannelMixingParametersImpl(uint32_t aNumberOfChannels, mChannelInterpretation = aChannelInterpretation; } -bool -AudioNodeStream::AllInputsFinished() const -{ - uint32_t inputCount = mInputs.Length(); - for (uint32_t i = 0; i < inputCount; ++i) { - if (!mInputs[i]->GetSource()->IsFinishedOnGraphThread()) { - return false; - } - } - return !!inputCount; -} - uint32_t AudioNodeStream::ComputeFinalOuputChannelCount(uint32_t aInputChannelCount) { diff --git a/content/media/AudioNodeStream.h b/content/media/AudioNodeStream.h index 376f587a5bfc..7b6439815484 100644 --- a/content/media/AudioNodeStream.h +++ b/content/media/AudioNodeStream.h @@ -100,7 +100,6 @@ public: dom::ChannelInterpretation aChannelInterpretation); virtual void ProduceOutput(GraphTime aFrom, GraphTime aTo); TrackTicks GetCurrentPosition(); - bool AllInputsFinished() const; bool IsAudioParamStream() const { return mAudioParamStream; diff --git a/content/media/webaudio/DelayNode.cpp b/content/media/webaudio/DelayNode.cpp index 2223af211ef8..ff7c5f6535d7 100644 --- a/content/media/webaudio/DelayNode.cpp +++ b/content/media/webaudio/DelayNode.cpp @@ -85,16 +85,13 @@ public: aInput.mChannelData.Length(); bool playedBackAllLeftOvers = false; - if (mProcessor.BufferChannelCount() && - mLeftOverData == INT32_MIN && - aStream->AllInputsFinished()) { - mLeftOverData = mProcessor.MaxDelayFrames() - WEBAUDIO_BLOCK_SIZE; - - if (mLeftOverData > 0) { + if (!aInput.IsNull()) { + if (mLeftOverData <= 0) { nsRefPtr refchanged = new PlayingRefChanged(aStream, PlayingRefChanged::ADDREF); NS_DispatchToMainThread(refchanged); } + mLeftOverData = mProcessor.MaxDelayFrames(); } else if (mLeftOverData != INT32_MIN) { mLeftOverData -= WEBAUDIO_BLOCK_SIZE; if (mLeftOverData <= 0) { diff --git a/content/media/webaudio/test/mochitest.ini b/content/media/webaudio/test/mochitest.ini index 7b876e943868..7d757148f9a4 100644 --- a/content/media/webaudio/test/mochitest.ini +++ b/content/media/webaudio/test/mochitest.ini @@ -77,6 +77,8 @@ support-files = [test_delayNodeCycles.html] [test_delayNodeSmallMaxDelay.html] [test_delayNodeTailIncrease.html] +[test_delayNodeTailWithGain.html] +[test_delayNodeTailWithReconnect.html] [test_delayNodeWithGain.html] [test_dynamicsCompressorNode.html] [test_gainNode.html] diff --git a/content/media/webaudio/test/test_delayNodeTailWithGain.html b/content/media/webaudio/test/test_delayNodeTailWithGain.html new file mode 100644 index 000000000000..3808145c2da5 --- /dev/null +++ b/content/media/webaudio/test/test_delayNodeTailWithGain.html @@ -0,0 +1,72 @@ + + + + Test tail time lifetime of DelayNode indirectly connected to source + + + + + +
+
+
+ + diff --git a/content/media/webaudio/test/test_delayNodeTailWithReconnect.html b/content/media/webaudio/test/test_delayNodeTailWithReconnect.html new file mode 100644 index 000000000000..b0aa981d646c --- /dev/null +++ b/content/media/webaudio/test/test_delayNodeTailWithReconnect.html @@ -0,0 +1,138 @@ + + + + Test tail time lifetime of DelayNode after input finishes and new input added + + + + + +
+
+
+ +