Bug 865234 - Part 5: Don't mark a stream as finished when there are streams following it; r=roc

Without this patch, if we have an AudioBufferSourceNode which is finished, the
nodes following it will not see its mLastChunk.  This breaks the Web Audio
block processing logic since we rely on the assumption that the buffer for the
last output of AudioBufferSourceNode is correctly passed to the following
engines.
This commit is contained in:
Ehsan Akhgari 2013-04-29 16:58:19 -04:00
parent a61aa7a132
commit 1d867d0441
2 changed files with 13 additions and 2 deletions

View File

@ -353,6 +353,13 @@ AudioNodeStream::ObtainInputBlock(AudioChunk* aTmpChunk)
void
AudioNodeStream::ProduceOutput(GraphTime aFrom, GraphTime aTo)
{
if (mMarkAsFinishedAfterThisBlock) {
// This stream was finished the last time that we looked at it, and all
// of the depending streams have finished their output as well, so now
// it's time to mark this stream as finished.
FinishOutput();
}
StreamBuffer::Track* track = EnsureTrack();
AudioChunk outputChunk;
@ -369,7 +376,7 @@ AudioNodeStream::ProduceOutput(GraphTime aFrom, GraphTime aTo)
bool finished = false;
mEngine->ProduceAudioBlock(this, *inputChunk, &outputChunk, &finished);
if (finished) {
FinishOutput();
mMarkAsFinishedAfterThisBlock = true;
}
}

View File

@ -48,7 +48,8 @@ public:
: ProcessedMediaStream(nullptr),
mEngine(aEngine),
mKind(aKind),
mNumberOfInputChannels(2)
mNumberOfInputChannels(2),
mMarkAsFinishedAfterThisBlock(false)
{
mMixingMode.mChannelCountMode = dom::ChannelCountMode::Max;
mMixingMode.mChannelInterpretation = dom::ChannelInterpretation::Speakers;
@ -108,6 +109,9 @@ protected:
dom::ChannelCountMode mChannelCountMode : 16;
dom::ChannelInterpretation mChannelInterpretation : 16;
} mMixingMode;
// Whether the stream should be marked as finished as soon
// as the current time range has been computed block by block.
bool mMarkAsFinishedAfterThisBlock;
};
}