bug 1205540 mark BufferSource finished only when producing silent output block r=padenot

This allows simpler processing of the finished state to mark the node as an
inactive input of any downstream nodes.  Otherwise the input could not be
considered inactive until after downstream nodes have finished processing,
but ProcessInput() may not be called again on finished streams.

AudioBufferSourceNode now behaves the same as OscillatorNode and similarly
to nodes that release a playing ref.

--HG--
extra : rebase_source : 0b3c7123f916fce36f852785c1e0b2a7c7013600
This commit is contained in:
Karl Tomlinson 2015-09-18 00:00:17 +12:00
Родитель d7b9ada3a0
Коммит 985811fe37
1 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -466,12 +466,21 @@ public:
return;
}
StreamTime streamPosition = aStream->GetCurrentPosition();
// We've finished if we've gone past mStop, or if we're past mDuration when
// looping is disabled.
if (streamPosition >= mStop ||
(!mLoop && mBufferPosition >= mBufferEnd && !mRemainingResamplerTail)) {
*aFinished = true;
aOutput->SetNull(WEBAUDIO_BLOCK_SIZE);
return;
}
uint32_t channels = mBuffer ? mBuffer->GetChannels() : 0;
UpdateSampleRateIfNeeded(channels);
uint32_t written = 0;
StreamTime streamPosition = aStream->GetCurrentPosition();
while (written < WEBAUDIO_BLOCK_SIZE) {
if (mStop != STREAM_TIME_MAX &&
streamPosition >= mStop) {
@ -499,13 +508,6 @@ public:
}
}
}
// We've finished if we've gone past mStop, or if we're past mDuration when
// looping is disabled.
if (streamPosition >= mStop ||
(!mLoop && mBufferPosition >= mBufferEnd && !mRemainingResamplerTail)) {
*aFinished = true;
}
}
virtual bool IsActive() const override