Commit 365b3cb3 authored by aymeric's avatar aymeric

add capability to set max gain for conference on mic

add callback for speex preprocessor on ec


git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@258 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent e6f2a94d
......@@ -391,9 +391,11 @@ the method index (_cnt_) and the argument size */
#define MS_FILTER_ENABLE_HALFDUPLEX MS_FILTER_BASE_METHOD(22,int)
#define MS_FILTER_SET_VAD_PROB_START MS_FILTER_BASE_METHOD(23,int)
#define MS_FILTER_SET_VAD_PROB_CONTINUE MS_FILTER_BASE_METHOD(24,int)
#define MS_FILTER_SET_MAX_GAIN MS_FILTER_BASE_METHOD(25,int)
#define MS_CONF_SPEEX_PREPROCESS_MIC MS_FILTER_EVENT(MS_CONF_ID, 1, void*)
#define MS_SPEEX_EC_ECHO_STATE MS_FILTER_EVENT(MS_SPEEX_EC_ID, 1, void*)
#define MS_SPEEX_EC_PREPROCESS_MIC MS_FILTER_EVENT(MS_SPEEX_EC_ID, 1, void*)
#define MS_SPEEX_EC_ECHO_STATE MS_FILTER_EVENT(MS_SPEEX_EC_ID, 2, void*)
/** @} */
/*private methods*/
......
......@@ -71,6 +71,7 @@ typedef struct ConfState{
int vad_prob_continue;
int agc_level;
int max_gain;
int mix_mode;
int samplerate;
......@@ -134,10 +135,8 @@ static void channel_init(ConfState *s, Channel *chan, int pos){
speex_preprocess_ctl(chan->speex_pp, SPEEX_PREPROCESS_SET_AGC, &val);
speex_preprocess_ctl(chan->speex_pp, SPEEX_PREPROCESS_SET_AGC_LEVEL, &f);
#if 0
val=15;
val=s->max_gain;
speex_preprocess_ctl(chan->speex_pp, SPEEX_PREPROCESS_SET_AGC_MAX_GAIN, &val);
#endif
val=0;
#if 0
......@@ -172,6 +171,7 @@ static void conf_init(MSFilter *f){
s->enable_directmode=FALSE;
s->enable_vad=TRUE;
s->agc_level=0;
s->max_gain=30;
s->mix_mode=TRUE;
s->adaptative_msconf_buf=2;
f->data=s;
......@@ -300,7 +300,6 @@ static void conf_sum(MSFilter *f, ConfState *s){
if (chan->speex_pp!=NULL && s->enable_vad==TRUE)
{
vad = speex_preprocess(chan->speex_pp, (short*)chan->input, NULL);
ms_filter_notify(f, MS_CONF_SPEEX_PREPROCESS_MIC, (void*)chan->speex_pp);
if (vad==1)
break; /* voice detected: process as usual */
if (ms_bufferizer_get_avail(&chan->buff)<s->conf_gran)
......@@ -359,7 +358,7 @@ static void conf_sum(MSFilter *f, ConfState *s){
{
int vad;
vad = speex_preprocess(chan->speex_pp, (short*)chan->input, NULL);
//ms_filter_notify(f, MS_CONF_SPEEX_PREPROCESS_MIC, (void*)chan->speex_pp);
ms_filter_notify(f, MS_CONF_SPEEX_PREPROCESS_MIC, (void*)chan->speex_pp);
}
else if (chan->speex_pp!=NULL && s->enable_vad==TRUE)
{
......@@ -370,7 +369,6 @@ static void conf_sum(MSFilter *f, ConfState *s){
if (s->enable_halfduplex>0)
{
vad = speex_preprocess(chan->speex_pp, (short*)chan->input, NULL);
ms_filter_notify(f, MS_CONF_SPEEX_PREPROCESS_MIC, (void*)chan->speex_pp);
#if 0
speex_preprocess_ctl(chan->speex_pp, SPEEX_PREPROCESS_GET_AGC_LOUDNESS, &loudness);
ms_message("prob=%i", loudness);
......@@ -400,7 +398,6 @@ static void conf_sum(MSFilter *f, ConfState *s){
{
vad = speex_preprocess(chan->speex_pp, (short*)chan->input, NULL);
//speex_preprocess_estimate_update(chan->speex_pp, (short*)chan->input);
ms_filter_notify(f, MS_CONF_SPEEX_PREPROCESS_MIC, (void*)chan->speex_pp);
}
}
#endif
......@@ -595,6 +592,19 @@ static int msconf_enable_agc(MSFilter *f, void *arg){
return 0;
}
static int msconf_set_max_gain(MSFilter *f, void *arg){
ConfState *s=(ConfState*)f->data;
int i;
s->max_gain = *(int*)arg;
for (i=0;i<CONF_MAX_PINS;i++)
channel_uninit(&s->channels[i]);
for (i=0;i<CONF_MAX_PINS;i++)
channel_init(s, &s->channels[i], i);
return 0;
}
static int msconf_enable_halfduplex(MSFilter *f, void *arg){
ConfState *s=(ConfState*)f->data;
int i;
......@@ -696,6 +706,8 @@ static MSFilterMethod msconf_methods[]={
{ MS_FILTER_ENABLE_DIRECTMODE, msconf_enable_directmode },
{ MS_FILTER_ENABLE_VAD, msconf_enable_vad },
{ MS_FILTER_ENABLE_AGC, msconf_enable_agc },
{ MS_FILTER_SET_MAX_GAIN, msconf_set_max_gain },
{ MS_FILTER_GET_STAT_DISCARDED, msconf_get_stat_discarded },
{ MS_FILTER_GET_STAT_MISSED, msconf_get_stat_missed },
{ MS_FILTER_GET_STAT_OUTPUT, msconf_get_stat_processed },
......
......@@ -150,6 +150,7 @@ static void speex_ec_process(MSFilter *f){
speex_echo_cancel(s->ecstate,(short*)in1,(short*)om0->b_rptr,(short*)om1->b_wptr,NULL);
speex_preprocess_run(s->den, (short*)om1->b_wptr);
ms_filter_notify(f, MS_SPEEX_EC_ECHO_STATE, (void*)s->ecstate);
ms_filter_notify(f, MS_SPEEX_EC_PREPROCESS_MIC, (void*)s->den);
om1->b_wptr+=nbytes;
ms_queue_put(f->outputs[1],om1);
......
Markdown is supported
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