SDL_sound: Decoding of MP3 is extremely slow on Windows

I have an MP3 that I need to fully decode into a Sound_Sample. The code
to do this is pretty straightforward (‘rwops’ has already been setup
from const mem containing the MP3):

Sound_AudioInfo wantedFormat;
wantedFormat.channels = 2;
wantedFormat.rate = 44100;
wantedFormat.format = AUDIO_S16LSB;

Sound_Sample* sample =
Sound_NewSample(rwops, “MP3”, &wantedFormat, 65536);

if (sample == 0) {
// Error handling.
}

Uint32 bytes = Sound_DecodeAll(sample);

The last line (the call to Sound_DecodeAll()) takes about 1 second on
Linux and OS X to complete. On Windows (Windows 7 here), it needs about
5 minutes! This only happens with big MP3s (this one is about 6 minutes
long).

Anyone else noticing this? Anything I can do about it? It’s a complete
show stopper on Windows for me right now :-/

Shotgun debugging turned up a workaround:

Sound_NewSample(rwops, “MP3”, &wantedFormat, 8388608);

Using a buffer size of 8MB (which I think is otherwise totally silly),
makes the decoding faster by about 10 orders of magnitude. I wonder
what’s going on here.On 10/08/2010 01:42 AM, Nikos Chantziaras wrote:

I have an MP3 that I need to fully decode into a Sound_Sample. The code
to do this is pretty straightforward (‘rwops’ has already been setup
from const mem containing the MP3):

Sound_AudioInfo wantedFormat;
wantedFormat.channels = 2;
wantedFormat.rate = 44100;
wantedFormat.format = AUDIO_S16LSB;

Sound_Sample* sample =
Sound_NewSample(rwops, “MP3”, &wantedFormat, 65536);

if (sample == 0) {
// Error handling.
}

Uint32 bytes = Sound_DecodeAll(sample);

The last line (the call to Sound_DecodeAll()) takes about 1 second on
Linux and OS X to complete. On Windows (Windows 7 here), it needs about
5 minutes! This only happens with big MP3s (this one is about 6 minutes
long).