Index: codec_speex.c =================================================================== RCS file: /usr/cvsroot/asterisk/codecs/codec_speex.c,v retrieving revision 1.12 diff -u -r1.12 codec_speex.c --- codec_speex.c 21 Apr 2005 06:02:44 -0000 1.12 +++ codec_speex.c 13 May 2005 00:48:51 -0000 @@ -19,7 +19,7 @@ static int enhancement = 0; static int vad = 0; static int vbr = 0; -static int vbr_quality = 0; +static float vbr_quality = 0; static int abr = 0; static int dtx = 0; @@ -85,10 +85,8 @@ if(!abr && !vbr) { speex_encoder_ctl(tmp->speex, SPEEX_SET_QUALITY, &quality); - if (vad) + if (vad) /* VAD is implicit for ABR and VBR */ speex_encoder_ctl(tmp->speex, SPEEX_SET_VAD, &vad); - if (dtx) - speex_encoder_ctl(tmp->speex, SPEEX_SET_DTX, &vad); } if (vbr) { speex_encoder_ctl(tmp->speex, SPEEX_SET_VBR, &vbr); @@ -97,6 +95,9 @@ if (abr) { speex_encoder_ctl(tmp->speex, SPEEX_SET_ABR, &abr); } + if (dtx) { /* DTX may apply to CBR, VBR and ABR */ + speex_encoder_ctl(tmp->speex, SPEEX_SET_DTX, &dtx); + } tmp->tail = 0; } localusecnt++; @@ -322,6 +323,7 @@ struct ast_config *cfg; struct ast_variable *var; int res; + float res_f; if ((cfg = ast_config_load("codecs.conf"))) { if ((var = ast_variable_browse(cfg, "speex"))) { @@ -347,12 +349,12 @@ } else ast_log(LOG_ERROR,"Error! Complexity must be 0-10\n"); } else if (!strcasecmp(var->name, "vbr_quality")) { - res = abs(atoi(var->value)); + res_f = abs(atof(var->value)); if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Setting VBR Quality to %d\n",res); - if (res > -1 && res < 11) { + ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Setting VBR Quality to %d\n",res_f); + if (res_f >= 0 && res_f <= 10) { ast_mutex_lock(&localuser_lock); - vbr_quality = res; + vbr_quality = res_f; ast_mutex_unlock(&localuser_lock); } else ast_log(LOG_ERROR,"Error! VBR Quality must be 0-10\n"); @@ -388,7 +390,7 @@ ast_mutex_lock(&localuser_lock); vad = ast_true(var->value) ? 1 : 0; if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: VAD Mode. [%s]\n",vbr ? "on" : "off"); + ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: VAD Mode. [%s]\n",vad ? "on" : "off"); ast_mutex_unlock(&localuser_lock); } else if (!strcasecmp(var->name, "dtx")) { ast_mutex_lock(&localuser_lock);