Bug 943461. Part 18: Ensure AudioBufferSourceNode's engine always produces an audio block when ProduceAudioBlock is called, and add an assertion to catch this kind of error directly. r=karl

--HG--
extra : rebase_source : e6ae51dc34f5567998af3b299acd48dd10e8394e
This commit is contained in:
Robert O'Callahan 2013-12-13 01:33:01 +13:00
Родитель 5966c18438
Коммит 9d41dd625c
2 изменённых файлов: 11 добавлений и 4 удалений

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

@ -412,10 +412,6 @@ AudioNodeStream::ProduceOutput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags)
mLastChunks[i].SetNull(WEBAUDIO_BLOCK_SIZE);
}
} else {
for (uint16_t i = 0; i < outputCount; ++i) {
mLastChunks[i].SetNull(0);
}
// We need to generate at least one input
uint16_t maxInputs = std::max(uint16_t(1), mEngine->InputCount());
OutputChunks inputChunks;
@ -424,11 +420,21 @@ AudioNodeStream::ProduceOutput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags)
ObtainInputBlock(inputChunks[i], i);
}
bool finished = false;
#ifdef DEBUG
for (uint16_t i = 0; i < outputCount; ++i) {
// Clear chunks so we can detect if ProduceAudioBlock fails to set them.
mLastChunks[i].SetNull(0);
}
#endif
if (maxInputs <= 1 && mEngine->OutputCount() <= 1) {
mEngine->ProduceAudioBlock(this, inputChunks[0], &mLastChunks[0], &finished);
} else {
mEngine->ProduceAudioBlocksOnPorts(this, inputChunks, mLastChunks, &finished);
}
for (uint16_t i = 0; i < outputCount; ++i) {
NS_ASSERTION(mLastChunks[i].GetDuration() == WEBAUDIO_BLOCK_SIZE,
"Invalid WebAudio chunk size");
}
if (finished) {
mMarkAsFinishedAfterThisBlock = true;
}

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

@ -392,6 +392,7 @@ public:
bool* aFinished)
{
if (!mBuffer || !mDuration) {
aOutput->SetNull(WEBAUDIO_BLOCK_SIZE);
return;
}