fixed multiple gsm frames per packet bug (hopefully this was the last one)

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@20 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 21 years ago
parent eabcee45c5
commit e36bceded8

@ -59,6 +59,7 @@ END_EXPORTS
static int pcm16_2_gsm(unsigned char* out_buf, unsigned char* in_buf, unsigned int size,
unsigned int channels, unsigned int rate, long h_codec )
{
int i;
div_t blocks;
blocks = div(size,320);
@ -67,13 +68,16 @@ static int pcm16_2_gsm(unsigned char* out_buf, unsigned char* in_buf, unsigned i
return -1;
}
gsm_encode((gsm)h_codec,(gsm_signal*)in_buf,out_buf);
for (i=0;i<blocks.quot;i++)
gsm_encode((gsm)h_codec,(gsm_signal*)in_buf + i*320,out_buf + i*33);
return blocks.quot * 33;
}
static int gsm_2_pcm16(unsigned char* out_buf, unsigned char* in_buf, unsigned int size,
unsigned int channels, unsigned int rate, long h_codec )
{
int i;
div_t blocks;
unsigned int out_size;
@ -94,7 +98,8 @@ static int gsm_2_pcm16(unsigned char* out_buf, unsigned char* in_buf, unsigned i
return -1;
}
gsm_decode((gsm)h_codec,in_buf,(gsm_signal*)out_buf);
for (i=0;i<blocks.quot;i++)
gsm_decode((gsm)h_codec,in_buf + i*320,(gsm_signal*)out_buf + i*33);
return out_size;
}

Loading…
Cancel
Save