Bug 1656438 - Prune chunks after 50ms without imagining the samplerate. r=padenot

In a CrossGraphReceiver there is 100ms worth of buffering in AudioChunks.
Without this patch the graph will buffer 2400 frames in each track before
removing data from them. If a graph contains a CrossGraphReceiver and runs at a
sample rate lower than 24000Hz, that CrossGraphReceiver will run out of chunks
and an assertion failure happens at best.

Differential Revision: https://phabricator.services.mozilla.com/D89755
This commit is contained in:
Andreas Pehrson 2020-09-15 14:41:58 +00:00
Родитель d85a980ee9
Коммит 5366c0d06e
1 изменённых файлов: 3 добавлений и 3 удалений

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

@ -2404,9 +2404,9 @@ void MediaTrack::AdvanceTimeVaryingValuesToCurrentTime(GraphTime aCurrentTime,
}
TrackTime time = aCurrentTime - mStartTime;
// Only prune if there is a reasonable chunk (50ms @ 48kHz) to forget, so we
// don't spend too much time pruning segments.
const TrackTime minChunkSize = 2400;
// Only prune if there is a reasonable chunk (50ms) to forget, so we don't
// spend too much time pruning segments.
const TrackTime minChunkSize = mSampleRate * 50 / 1000;
if (time < mForgottenTime + minChunkSize) {
return;
}