- fix audio resampler

This commit is contained in:
Dmytro Bogovych 2025-03-04 07:53:20 +03:00
parent efbf9c5bf8
commit 933d52b297
1 changed files with 3 additions and 2 deletions

View File

@ -125,12 +125,13 @@ int SpeexResampler::destRate()
size_t SpeexResampler::getDestLength(size_t sourceLen)
{
return size_t(sourceLen * (float(mDestRate) / mSourceRate) + 0.5f) / 2 * 2;
return size_t(sourceLen * (float(mDestRate) / mSourceRate) + 0.5f);
}
size_t SpeexResampler::getSourceLength(size_t destLen)
{
return size_t(destLen * (float(mSourceRate) / mDestRate) + 0.5f) / 2 * 2;
// Here we want to get 'destLen' number of samples
return size_t(destLen * (float(mSourceRate) / mDestRate) + 0.5f);
}
// Returns instance + speex resampler size in bytes