[Speex-dev] Multiple frame encode and decode

Reza Fatahillah ezhot_95 at yahoo.com
Tue Sep 19 23:55:15 PDT 2006


Hi,

I have one rtp packet with multiple frame inside e.g 6
speex frames. I packed those frames manually by
concating them into a buffer(memcpy at certain array
index).

Then at the other side, i decode them in a while loop
using speex_decode_int(), and hoping that this
function will decode one frame at a time. 
But when i inspected nbBits, it seemed all of 6 frames
decoded at once. I guess the decoder didn`t find the
terminator bits. And no sound at all.

Did I do anything wrong?

Speex setting: narrow band, 8000 khz,20ms,8000 bps.
1 frame encoded size = 20 bytes
1 frame decoded size = 160 bytes, but i got 960
bytes(160 x 6 frames)

Code sample:
Encode:
speex_encode_int(mEncState, input, &mSpxBits);
length = speex_bits_write(&mSpxBits, encodedData,
200);
memcpy(&mRtpBuffer[mCopyIndex],encodedData,length);

Decode:
------
speex_bits_read_from(&mSpxBits, input, inputLength);
while(speex_decode_int(decState, &spxBits, buff) !=
-1)
{
written = mSpxBits.nbBits; //hope i get 160 bytes
}
speex_bits_reset(&mSpxBits);

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Speex-dev mailing list