[Speex-dev] decode problem
Stefano Falasca
fala70 at alice.it
Wed Apr 30 03:59:52 PDT 2008
Hi
I am using first time speex library, and this is my first problem. I need to
decode AMR-NB packet to PCM. I read all manual instruction and I wrote these
simple lines of code.
bool CMMediaObj::AmrInit()
{
speex_bits_init(&bits);
destate = speex_decoder_init(&speex_nb_mode);
int tmp=1;
speex_decoder_ctl(destate, SPEEX_SET_ENH, &tmp);
return true;
}
void CMMediaObj::AmrFreeMemory()
{
if (destate){
speex_bits_destroy(&bits);
speex_decoder_destroy(destate);
}
}
#define FRAME_SIZE 320
int CMMediaObj::AmrDecodeOneFrame(char *src,char *dst)
{
speex_bits_read_from(&bits, src, 14);
speex_decode_int(destate, &bits, (short*)dst);
return FRAME_SIZE;
}
My problem is that I hear only strange sound. I receive packet of 14 bytes
for each frame and I call AmrDecodeOneFrame for each frame. Then 14 bytes
amr packet should be 320 bytes uncompress data. speex_decode_int return 0
then good result.
Where is the problem ????
Thanks
Stefano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20080430/0c8f682a/attachment.htm
More information about the Speex-dev
mailing list