I’ve run into a weird probiel with SDL_AudioCVT. I’m trying to build a
converter from 48000/16/2 (which comes from a Vorbis stream) to 44100/16/2
(the rate of the mixer). The problem is that SDL_BuildAudioCVT generates a
no-op CVT in this case. The culprit is this piece of code :
/* The problem with this is that if the input buffer is
say 1K, and the conversion rate is say 1.1, then the
output buffer is 1.1K, which may not be an acceptable
buffer size for the audio driver (not a power of 2)
/
/ For now, punt and hope the rate distortion isn’t great.
*/
To answer that comment - the distorsion is clear (the Vorbis I’m resampling
has human voices) and the lenght of the audio stream ends up being
480/441ths (1.088, or 8.8%) longer than should it be, killing sync between
audio and video as a side effect.
I need to fix this somehow, in SDL or in my framework. Does anyone know why
this is here, or what to do about it?
–Gabriel