From 0d636e1301d6076d935489f0530179db5890ef37 Mon Sep 17 00:00:00 2001 From: smorlat Date: Fri, 28 Aug 2009 16:02:20 +0000 Subject: [PATCH] reads echo canceler params from config file. git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@607 3f6dc0c8-ddfe-455d-9043-3cd528dc4637 --- linphone/coreapi/linphonecore.c | 7 +++++++ .../include/mediastreamer2/mediastream.h | 3 +++ linphone/mediastreamer2/src/audiostream.c | 13 +++++++++++++ 3 files changed, 23 insertions(+) diff --git a/linphone/coreapi/linphonecore.c b/linphone/coreapi/linphonecore.c index 7d66f90db..4bf15eed7 100644 --- a/linphone/coreapi/linphonecore.c +++ b/linphone/coreapi/linphonecore.c @@ -1475,6 +1475,13 @@ void linphone_core_init_media_streams(LinphoneCore *lc){ } } + if (linphone_core_echo_cancelation_enabled(lc)){ + int len,delay,framesize; + len=lp_config_get_int(lc->config,"sound","ec_tail_len",0); + delay=lp_config_get_int(lc->config,"sound","ec_delay",0); + framesize=lp_config_get_int(lc->config,"sound","ec_framesize",0); + audio_stream_set_echo_canceler_params(lc->audiostream,len,delay,framesize); + } audio_stream_enable_automatic_gain_control(lc->audiostream,linphone_core_agc_enabled(lc)); #ifdef VIDEO_ENABLED if (lc->video_conf.display || lc->video_conf.capture) diff --git a/linphone/mediastreamer2/include/mediastreamer2/mediastream.h b/linphone/mediastreamer2/include/mediastreamer2/mediastream.h index 5a3347ee6..88544f655 100644 --- a/linphone/mediastreamer2/include/mediastreamer2/mediastream.h +++ b/linphone/mediastreamer2/include/mediastreamer2/mediastream.h @@ -116,6 +116,9 @@ void audio_stream_enable_gain_control(AudioStream *stream, bool_t val); /*enable automatic gain control, to be done before start() */ void audio_stream_enable_automatic_gain_control(AudioStream *stream, bool_t val); +/*to be done before start */ +void audio_stream_set_echo_canceler_params(AudioStream *st, int tail_len_ms, int delay_ms, int framesize); + void audio_stream_set_mic_gain(AudioStream *stream, float gain); /*enable noise gate, must be done before start()*/ diff --git a/linphone/mediastreamer2/src/audiostream.c b/linphone/mediastreamer2/src/audiostream.c index 4eec84a1b..fd5c3d3bc 100644 --- a/linphone/mediastreamer2/src/audiostream.c +++ b/linphone/mediastreamer2/src/audiostream.c @@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "mediastreamer2/msfilerec.h" #include "mediastreamer2/msvolume.h" #include "mediastreamer2/msequalizer.h" +#include "mediastreamer2/msspeexec.h" #ifdef INET6 #include @@ -248,6 +249,12 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char if (use_ec) { stream->ec=ms_filter_new(MS_SPEEX_EC_ID); ms_filter_call_method(stream->ec,MS_FILTER_SET_SAMPLE_RATE,&pt->clock_rate); + if (stream->ec_tail_len!=0) + ms_filter_call_method(stream->ec,MS_SPEEX_EC_SET_TAIL_LENGTH,&stream->ec_tail_len); + if (stream->ec_delay!=0) + ms_filter_call_method(stream->ec,MS_SPEEX_EC_SET_DELAY,&stream->ec_delay); + if (stream->ec_framesize!=0) + ms_filter_call_method(stream->ec,MS_SPEEX_EC_SET_FRAME_SIZE,&stream->ec_framesize); } if (stream->el_type!=ELInactive || stream->use_gc || stream->use_ng){ @@ -430,6 +437,12 @@ void audio_stream_set_relay_session_id(AudioStream *stream, const char *id){ ms_filter_call_method(stream->rtpsend, MS_RTP_SEND_SET_RELAY_SESSION_ID,(void*)id); } +void audio_stream_set_echo_canceler_params(AudioStream *st, int tail_len_ms, int delay_ms, int framesize){ + st->ec_tail_len=tail_len_ms; + st->ec_delay=delay_ms; + st->ec_framesize=framesize; +} + void audio_stream_enable_echo_limiter(AudioStream *stream, EchoLimiterType type){ stream->el_type=type; }