[Speex-dev] ARM7 Speex decoder

pberna at iol.it pberna at iol.it
Tue Mar 21 12:56:04 PST 2006

Dear Jan

My intention is to read a piece at time of an .ogg file (stored in and external Multimedia card) decompress it and render it on and LPC2000 DAC. Because I don't have enough RAM memory to load the complete ogg file, I must read only a piece of file at certain time, then decompress and render it, and repeat the previous process until the end of the file. The problem is that I don't know what is the minimum file block size that I must consider.

 I red,of course, the example that exist in the speex manual, however I have some doubt. I got the FRAME_SIZE from the function

   /* Get frame size */
    speex_decoder_ctl(state, SPEEX_GET_FRAME_SIZE, &nbBytes);


    lb = file_read(&file, nbBytes, (void *)cbits);
    /*Copy the data into the bit-stream struct*/

    speex_bits_read_from(&bits, cbits, nbBytes);
    /*Decode the data*/

     speex_decode(state, &bits, output);

until EOF

(I get the number 160) that I use it in my file_read function to get a block of nbBytes (SPEEX_GET_FRAME_SIZE) bytes with which I feed the speex_bits_read_from(&bits, cbits, nbBytes). Then I call the and the speex_decode(state, &bits, output);

The problem is that I receive the error message 

warning: Invalid mode encountered: corrupted stream?

And the decode process doesn't continue.

I have the suspect that the fetched block is too small. What is the minimum block side that speex_bits_read_from(&bits, cbits, nbBytes) accept ?

Thank you

More information about the Speex-dev mailing list