[Speex-dev] Encoding frame limit

David Barrett dbarrett
Fri Jul 30 13:20:43 PDT 2004

When encoding many frames, I get a write access exception.  It appears
the "bits" structure has a fixed-size buffer (allocated in
speex_bits_init()), and speex-encode() pukes when it overruns it.

I understand I could just initialize bits with a bigger buffer, or watch
the buffer and stop encoding when it gets full.

But I don't want to care about compressed frame sizes, nor *can* I know
when VBR is enabled.

Is there any way to make speex_encode() automatically reallocate the
"bits" buffer if its too small?  Then it'd "just work" without me caring
about the size of the internal bits buffer.

Alternatively, am I'm not supposed to encode many (>100) frames into a
single bits buffer?  The docs say to call speex_encode() multiple times,
and it doesn't specify a limit.  It works great for up to 53 frames, and
I see no reason why more shouldn't work fine.

So, am I doing something wrong, or is this a bug, or should the library
be enhanced to auto-resize the internal bits buffer (or at least return
a pretty error code) rather than blindly overwriting it?

Thanks!  Speex rox!


More information about the Speex-dev mailing list