Commit 6b8f740e authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#936] speex 32 khz integration completed

parent df90af1e
......@@ -113,12 +113,9 @@ class Speex : public AudioCodec{
{
int ratio = 320 / _speex_frame_size;
printf("Codec::codecDecode() size %i\n", size);
printf("Codec::codecDecode() ratio %i\n", ratio);
printf("Codec::codecDecode() _speex_frame_size %i\n", _speex_frame_size);
speex_bits_read_from(&_speex_dec_bits, (char*)src, size);
speex_decode_int(_speex_dec_state, &_speex_dec_bits, dst);
printf("Codec::codecDecode() _speex_frame_size * ratio %i\n", _speex_frame_size * ratio);
return _speex_frame_size * ratio;
}
......@@ -131,10 +128,10 @@ class Speex : public AudioCodec{
speex_preprocess_run(_preprocess_state, src);
#endif
printf("Codec::codecEncode() size %i\n", size);
speex_encode_int(_speex_enc_state, src, &_speex_enc_bits);
int nbBytes = speex_bits_write(&_speex_enc_bits, (char*)dst, size);
printf("Codec::codecEncode() nbBytes %i\n", nbBytes);
return nbBytes;
}
......
......@@ -113,13 +113,11 @@ class Speex : public AudioCodec{
{
// int ratio = 320 / _speex_frame_size;
printf("Codec::codecDecode() size %i\n", size);
// printf("Codec::codecDecode() ratio %i\n", ratio);
printf("Codec::codecDecode() _speex_frame_size %i\n", _speex_frame_size);
speex_bits_read_from(&_speex_dec_bits, (char*)src, size);
speex_decode_int(_speex_dec_state, &_speex_dec_bits, dst);
// printf("Codec::codecEncode() _speex_frame_size * ratio %i\n", _speex_frame_size * ratio);
return 640;
// return the nuber of byte, not the number of sample
return _speex_frame_size * 2;
}
virtual int codecEncode (unsigned char *dst, short *src, unsigned int size)
......@@ -131,12 +129,11 @@ class Speex : public AudioCodec{
speex_preprocess_run(_preprocess_state, src);
#endif
printf("Codec::codecEncode() size: %i \n",size);
printf("Codec::codecEncode() _speex_frame_size %i\n", _speex_frame_size);
speex_encode_int(_speex_enc_state, src, &_speex_enc_bits);
int speex_nbByte = speex_bits_nbytes(&_speex_enc_bits);
speex_bits_nbytes(&_speex_enc_bits);
int nbBytes = speex_bits_write(&_speex_enc_bits, (char*)dst, size);
printf("Codec::codecEncode() nbBytes: %i \n",nbBytes);
return nbBytes;
}
......
......@@ -111,14 +111,11 @@ class Speex : public AudioCodec{
virtual int codecDecode (short *dst, unsigned char *src, unsigned int size)
{
int ratio = 320 / _speex_frame_size;
printf("Codec::codecDecode() size %i\n", size);
printf("Codec::codecDecode() ratio %i\n", ratio);
printf("Codec::codecDecode() _speex_frame_size %i\n", _speex_frame_size);
speex_bits_read_from(&_speex_dec_bits, (char*)src, size);
speex_decode_int(_speex_dec_state, &_speex_dec_bits, dst);
printf("Codec::codecDecode() _speex_frame_size * ratio %i\n", _speex_frame_size * ratio);
return 2 * _speex_frame_size * ratio;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment