Bug 1042672 - Avoid mixing in uninitialized buffers in AudioSegment::WriteTo. r=jesup

This commit is contained in:
Paul Adenot 2014-07-23 16:02:31 +02:00
Родитель 6dfd9b3bbd
Коммит e993ffd6b5
1 изменённых файлов: 4 добавлений и 1 удалений

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

@ -212,7 +212,10 @@ AudioSegment::WriteTo(uint64_t aID, AudioStream* aOutput, AudioMixer* aMixer)
aOutput->Write(buf.Elements(), offset / outputChannels, &(mChunks[mChunks.Length() - 1].mTimeStamp));
if (aMixer) {
// `offset` is zero when all the chunks above are null (silence). We can
// safely skip the mixing here because filling `buf` with zero and then mixing
// it would have absolutly no effect in the mix.
if (aMixer && offset) {
aMixer->Mix(buf.Elements(), outputChannels, GetDuration(), aOutput->GetRate());
}
aOutput->Start();