Bug 1759325 - Only drain the converter at the end of the queue. r=alwu

Before this change, the converter would be drained after each packet would be
pushed to the queue, introducing discontinuities in the audio, at the end, after
all the decoding operations were finished, but before all the audio packets were
pushed to the queue.

This went unnoticed because there is no converter most of the time, with audio
that has a sample-rate higher or equal to the common 44100Hz value.

Depends on D141356

Differential Revision: https://phabricator.services.mozilla.com/D141357
This commit is contained in:
Paul Adenot 2022-03-22 11:43:45 +00:00
Родитель 6ce58a96c5
Коммит 50a93923a0
1 изменённых файлов: 1 добавлений и 1 удалений

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

@ -420,7 +420,7 @@ void AudioSink::NotifyAudioNeeded() {
}
}
if (mAudioQueue.IsFinished()) {
if (mAudioQueue.IsFinished() && mAudioQueue.GetSize() == 0) {
// We have reached the end of the data, drain the resampler.
DrainConverter(SampleToFrame(mProcessedSPSCQueue->AvailableWrite()));
mProcessedQueueFinished = true;