Sound_DecodeAll() vs. FLAC decoder

Torbjörn Andersson torbjorn.e.andersson at
Thu Nov 29 02:39:19 EST 2001

It turns out the FLAC decoder doesn't play well with Sound_DecodeAll(), 
because it always makes sure the sample buffer is large enough for an 
entire frame to be decoded directly into it. This means that the size of 
the sample buffer may increase after Sound_DecodeAll() reallocs 
newBufSize + sample->buffer_size bytes for its own buffer.

The included patch should work, but on my way to the office I realized 
that it would probably be better if it did

     buf = realloc(buf, newBufSize + br);

instead of

     buf = realloc(buf, newBufSize + sample->buffer_size);

Unfortunately I won't be able to test that until I get home. Apart from 
that, does it look reasonable to you?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: SDL_sound.diff.gz
Type: application/x-gzip
Size: 546 bytes
Desc: not available
URL: <>

More information about the sdlsound mailing list