Bug 1448705 - Use input latency for draining. r=jya, a=RyanVM

--HG--
extra : source : b2904f128f854a71216f299b835da5a422ceb3cd
extra : intermediate-source : eae4410ea11d83feed90ca9d3b6bd5a9c67c17a7
This commit is contained in:
Randell Jesup 2018-04-05 17:15:07 -04:00 committed by Roy Tam
commit 55bde34653

View file

@ -362,15 +362,13 @@ size_t
AudioConverter::ResampleRecipientFrames(size_t aFrames) const
{
if (!aFrames && mIn.Rate() != mOut.Rate()) {
// The resampler will be drained, account for frames currently buffered
// in the resampler.
if (!mResampler) {
return 0;
}
return speex_resampler_get_output_latency(mResampler);
} else {
return (uint64_t)aFrames * mOut.Rate() / mIn.Rate() + 1;
// We drain by pushing in get_input_latency() samples of 0
aFrames = speex_resampler_get_input_latency(mResampler);
}
return (uint64_t)aFrames * mOut.Rate() / mIn.Rate() + 1;
}
size_t