[Home]

Summary:ASTERISK-04135: codec_speex.c preventing VAD in CBR mode - very minor code change required
Reporter:James Cowling (jcowling)Labels:
Date Opened:2005-05-10 20:40:34Date Closed:2005-05-15 19:54:17
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/Configuration
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Minor change required in codec_speex.c:

Line 391 incorrectly sets the VAD setting based on vbr variable, instead of vad.

Should be changed from:
ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: VAD Mode. [%s]\n",vbr ? "on" : "off");

to:
ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: VAD Mode. [%s]\n",vad ? "on" : "off");


(I'd fix it myself if I knew how to get write access to the CVS - mail me "james at jcowling.net" if you wish to bestow such powers)
Comments:By: stevekstevek (stevekstevek) 2005-05-12 14:02:15

OK:

1) It looks like you're saying that the diagnostic message is printed incorrectly, where it prints the VBR status when it should be printing the VAD status..   In other words, except for the diagnostic message, it is still doing the correct thing?

The change you describe fixes this.


2) You don't need CVS access to make a proper patch..  Just "diff" and a disclaimer (although, I'd expect that this change doesn't really require a disclaimer)


3) I think that the code is actually incorrect for VAD:  You can't really use speex' vad _unless_ you have VBR or ABR mode in use -- it's not meaningful in CBR mode.  DTX is similar.

By: James Cowling (jcowling) 2005-05-12 19:42:02

Actually the bug causes VAD not to be used *at all*, not just preventing a log message.  The 'vad' variable is never set when parsing the config file and hence VAD is never enabled.

As for your point 3, rather VAD is *only* useful for CBR - VAD is implicit for VBR and ABR streams and need not be set.  VAD will reduce bandwidth requirements for CBR streams and is worthwhile enabling.  DTX on the other hand adds additional functionality to VBR and is hence applicable for CBR, VBR and ABR.

Took me a lot of research to figure that out tho :)

I've since discovered a few more bugs in codec_speex.c, including one which prevents VBR from working entirely (a pointer to an int rather than a pointer to  a float is passed as the VBR quality parameter).  I'm surprised no one picked this up earlier... is it possible I'm the only one who's ever used Speex VBR in Asterisk?!  Try listening to VBR quality in the current (buggy) implementation - it's completely unintelligible.

I'll try my hand at putting together a patch and post it as a separate thread - the VBR problem is far more significant than VAD not working after all.

By: stevekstevek (stevekstevek) 2005-05-12 19:53:58

I actually find that the ABR mode is most useful.

There's not too many people using speex with asterisk, and it's unfortunate.  It's because:

1) Most people don't even have it compiled, because it requires the speex-devel package be installed before asterisk is built.

2) The default settings (i.e. complexity=4 or whatever it is), make speex very slow.  Using complexity=2, and a speex package built with sse support make it much faster than iLBC.


I usually recommend people use 8kbps ABR mode;

By: James Cowling (jcowling) 2005-05-12 20:18:57

I agree with that Steve - ABR seems to work best for my purposes too (in my case 5.9kbps).

I've submitted a patch in another thread so this one may be closed.

Thanks,

James

By: Michael Jerris (mikej) 2005-05-15 19:54:16

Duplicate of 4253