No-op CVT

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

SDL_BuildAudioCVT generates a no-op CVT in this case. The culprit is
this piece of code :

This is a known bug in 1.2, which we’re correcting in 1.3.

Resample it to 44.1KHz yourself before giving it to SDL. This is the
worst answer, ever, but it’s the fastest fix.

–ryan.