Hi,
I'm trying to use TI g.722 codec downloaded from TI speech codecs product page. The binary has been integrated codec server (combo). My user space code look like this:
SPHENC1_Params params;
SPHENC1_DynamicParams dyn_params;
Buffer_Attrs buf_attrs;
aenc_engine = Engine_open(ENGINE_NAME, NULL, NULL);
params = Senc1_Params_DEFAULT;
dyn_params = Senc1_DynamicParams_DEFAULT;
aenc = Senc1_create(aenc_engine, "g722enc", ¶ms, &dyn_params);
buf_attrs = Buffer_Attrs_DEFAULT;
aenc_inbuf = Buffer_create(640, &buf_attrs);
aenc_outbuf = Buffer_create(160, &buf_attrs);
{ // test a simple sine wave
int i;
short *data = (short *)Buffer_getUserPtr(aenc_inbuf);
for (i = 0; i < 160;) {
*data = 0; data ++; i++;
*data = 30000; data ++; i++;
*data = 0; data ++; i++;
*data = -30000; data ++; i++;
}
Buffer_setNumBytesUsed(aenc_inbuf, 320);
}
Senc1_process(aenc, aenc_inbuf, aenc_outbuf);
Buffer_delete(adec_inbuf);
Buffer_delete(adec_outbuf);
Sdec1_delete(adec);
Engine_close(adec_engine);
The code seems OK to run but the encoded data could not be played by other g.722 decoder. Any idea about what part I should look into?
Another issue is, in the user guide pdf file, I noticed that codec can be configured up to 10ms/160 samples. So how can I create a 20ms packet widely used in VOIP application? Do I have to create 2x10ms buffer and then link them together?
Thanks in advance.