Bug 1656438 - Only raise the FramesProcessedEvent once there is no silence. r=padenot

Because an audio driver starts out with its fallback driver running the graph,
we might use unnecessary amounts of silence for the verification. Especially
with the `GoFaster()` mode turned on, as the fallback driver's thread runs
rarely compared to how often we are feeding the graph audio data from the
MockCubebStream.

Differential Revision: https://phabricator.services.mozilla.com/D89753
This commit is contained in:
Andreas Pehrson 2020-09-15 14:41:56 +00:00
Родитель 0d8d6e6a2d
Коммит 9962c2e6af
2 изменённых файлов: 6 добавлений и 1 удалений

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

@ -56,6 +56,9 @@ class AudioVerifier {
sin(2 * M_PI * mFrequency / mRate));
}
bool PreSilenceEnded() const {
return mTotalFramesSoFar > mPreSilenceSamples;
}
uint64_t PreSilenceSamples() const { return mPreSilenceSamples; }
uint32_t CountDiscontinuities() const { return mDiscontinuitiesCount; }

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

@ -225,7 +225,9 @@ class MockCubebStream {
mAudioVerifier.AppendDataInterleaved(mOutputBuffer, outframes,
NUM_OF_CHANNELS);
mFramesProcessedEvent.Notify(outframes);
if (mAudioVerifier.PreSilenceEnded()) {
mFramesProcessedEvent.Notify(outframes);
}
if (outframes < NUM_OF_FRAMES) {
mStateCallback(stream, mUserPtr, CUBEB_STATE_DRAINED);