From 037a46e71fe282a586da5e4f09ef1b32b03ab042 Mon Sep 17 00:00:00 2001 From: Andreas Pehrson Date: Mon, 30 Nov 2020 14:16:23 +0000 Subject: [PATCH] Bug 1605134 - Assert that the callback buffer is indeed filled fully. r=padenot Differential Revision: https://phabricator.services.mozilla.com/D97407 --- dom/media/AudioBufferUtils.h | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/dom/media/AudioBufferUtils.h b/dom/media/AudioBufferUtils.h index 573c8729a4f5..bb50fe37282b 100644 --- a/dom/media/AudioBufferUtils.h +++ b/dom/media/AudioBufferUtils.h @@ -103,22 +103,7 @@ class AudioCallbackBufferWrapper { * instance can be reused. */ void BufferFilled() { - // It's okay to have exactly zero samples here, it can happen we have an - // audio callback driver because of a hint on MTG creation, but the - // AudioOutputStream has not been created yet, or if all the tracks have - // finished but we're still running. Note: it's also ok if we had data in - // the scratch buffer - and we usually do - and all the tracks were ended - // (no mixer callback occured). - // XXX Remove this warning, or find a way to avoid it if the mixer callback - // isn't called. - NS_WARNING_ASSERTION( - Available() == 0 || mSampleWriteOffset == 0, - "Audio Buffer is not full by the end of the callback."); - // Make sure the data returned is always set and not random! - if (Available()) { - PodZero(mBuffer + mSampleWriteOffset, - FramesToSamples(mChannels, Available())); - } + MOZ_ASSERT(Available() == 0, "Frames should have been written"); MOZ_ASSERT(mSamples, "Buffer not set."); mSamples = 0; mSampleWriteOffset = 0;