bug 1205540 don't send more null chunks than necessary to AnalyserNode r=padenot

--HG--
extra : rebase_source : f758d172fbbdba3288c71f690411175a41a822cc
This commit is contained in:
Karl Tomlinson 2015-09-09 08:52:39 +12:00
Родитель 29f415af35
Коммит e182c00028
1 изменённых файлов: 15 добавлений и 0 удалений

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

@ -65,6 +65,19 @@ public:
{
*aOutput = aInput;
if (aInput.IsNull()) {
// If AnalyserNode::mChunks has only null chunks, then there is no need
// to send further null chunks.
if (mChunksToProcess == 0) {
return;
}
--mChunksToProcess;
} else {
// This many null chunks will be required to empty AnalyserNode::mChunks.
mChunksToProcess = CHUNK_COUNT;
}
nsRefPtr<TransferBuffer> transfer =
new TransferBuffer(aStream, aInput.AsAudioChunk());
NS_DispatchToMainThread(transfer);
@ -74,6 +87,8 @@ public:
{
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
size_t mChunksToProcess = 0;
};
AnalyserNode::AnalyserNode(AudioContext* aContext)