Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: speex_encoder_ctl always returning 0 (DTX) (Read 5684 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

speex_encoder_ctl always returning 0 (DTX)

I'm currently playing with the Asterisk source code getting it to support Speex DTX mode.  There are a few bugs left to sort out but one of the problems I've got is determining if a given frame in DTX is silent and need not be transmitted.

The libspeex API reference guide says that a call (any call?) to speex_encoder_ctl should return 0 in the case of silence (and 1 otherwise) but every time I call it I get a return value of 0, regardless of whether there's silence or not.

I'm currently trying to doing a:
Code: [Select]
int dtx_transmit = speex_encoder_ctl(tmp->speex, SPEEX_GET_FRAME_SIZE, &tmp->framesize);


After every call to:
Code: [Select]
speex_encode(tmp->speex, fbuf, &tmp->bits);


Has anyone been able to determine silence status using speex_encoder_ctl?  Please let me know if I'm using it incorrectly.

Thanks,

James

speex_encoder_ctl always returning 0 (DTX)

Reply #1
Hold the phone...

It seems that speex_encode returns the dtx-silence flag, as would make sense, rather than speex_encoder_ctl as claimed in the documentation.

The lesson here?  Never trust an API

speex_encoder_ctl always returning 0 (DTX)

Reply #2
Quote
Hold the phone...

It seems that speex_encode returns the dtx-silence flag, as would make sense, rather than speex_encoder_ctl as claimed in the documentation.

The lesson here?  Never trust an API
[a href="index.php?act=findpost&pid=308286"][{POST_SNAPBACK}][/a]


Sorry about that. I fixed it in SVN. Any other stpuid thing in the API doc?

speex_encoder_ctl always returning 0 (DTX)

Reply #3
Quote
Sorry about that. I fixed it in SVN. Any other stpuid thing in the API doc?
[a href="index.php?act=findpost&pid=308494"][{POST_SNAPBACK}][/a]


No worries Jean-Marc.

The only other problem I noticed in the codec manual is in section 4.5
Quote
That terminator consists of the code 15 (decimal), encoded with 5 bits, as shown in figure 4.
  with no figure 4 shown.  Not that we need a figure anyway.

Thanks for all your work putting Speex together - great piece of software!

 

speex_encoder_ctl always returning 0 (DTX)

Reply #4
Quote
The only other problem I noticed in the codec manual is in section 4.5
Quote
That terminator consists of the code 15 (decimal), encoded with 5 bits, as shown in figure 4.
  with no figure 4 shown.  Not that we need a figure anyway.

Thanks for all your work putting Speex together - great piece of software!
[a href="index.php?act=findpost&pid=308495"][{POST_SNAPBACK}][/a]


Oops... I meant *Table* 4.