Commit 9322a761 authored by smorlat's avatar smorlat
Browse files

enable echo limiter in the other side (control mic)



git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@360 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 65c0b5a6
......@@ -1414,7 +1414,11 @@ int linphone_core_change_qos(LinphoneCore *lc, int answer)
void linphone_core_init_media_streams(LinphoneCore *lc){
lc->audiostream=audio_stream_new(linphone_core_get_audio_port(lc),linphone_core_ipv6_enabled(lc));
if (linphone_core_echo_limiter_enabled(lc)){
audio_stream_enable_echo_limiter(lc->audiostream,TRUE);
const char * type=lp_config_get_string(lc->config,"sound","el_type","mic");
if (strcasecmp(type,"mic")==0)
audio_stream_enable_echo_limiter(lc->audiostream,ELControlMic);
else if (strcasecmp(type,"speaker")==0)
audio_stream_enable_echo_limiter(lc->audiostream,ELControlSpeaker);
}
#ifdef VIDEO_ENABLED
if (lc->video_conf.display || lc->video_conf.capture)
......@@ -1435,10 +1439,14 @@ static void post_configure_audio_streams(LinphoneCore *lc){
if (st->volrecv && st->volsend){
float speed=lp_config_get_float(lc->config,"sound","el_speed",-1);
float thres=lp_config_get_float(lc->config,"sound","el_thres",-1);
MSFilter *f;
if (st->el_type==ELControlMic)
f=st->volrecv;
else f=st->volsend;
if (speed!=-1)
ms_filter_call_method(st->volrecv,MS_VOLUME_SET_EA_SPEED,&speed);
ms_filter_call_method(f,MS_VOLUME_SET_EA_SPEED,&speed);
if (thres!=-1)
ms_filter_call_method(st->volrecv,MS_VOLUME_SET_EA_THRESHOLD,&thres);
ms_filter_call_method(f,MS_VOLUME_SET_EA_THRESHOLD,&thres);
}
if (lc->vtable.dtmf_received!=NULL){
/* replace by our default action*/
......
......@@ -29,6 +29,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "ortp/ortp.h"
#include "ortp/event.h"
typedef enum EchoLimiterType{
ELInactive,
ELControlMic,
ELControlSpeaker
} EchoLimiterType;
struct _AudioStream
{
MSTicker *ticker;
......@@ -44,8 +50,8 @@ struct _AudioStream
MSFilter *volsend,*volrecv; /*MSVolumes*/
unsigned int last_packet_count;
time_t last_packet_time;
EchoLimiterType el_type; /*use echo limiter: two MSVolume, measured input level controlling local output level*/
bool_t play_dtmfs;
bool_t use_ea; /*use echo limiter: two MSVolume, measured input level controlling local output level*/
};
#ifdef __cplusplus
......@@ -93,7 +99,7 @@ void audio_stream_set_relay_session_id(AudioStream *stream, const char *relay_se
bool_t audio_stream_alive(AudioStream * stream, int timeout);
/*enable echo-limiter dispositve: one MSVolume in input branch controls a MSVolume in the output branch*/
void audio_stream_enable_echo_limiter(AudioStream *stream, bool_t enabled);
void audio_stream_enable_echo_limiter(AudioStream *stream, EchoLimiterType type);
/* stop the above process*/
void audio_stream_stop (AudioStream * stream);
......
......@@ -247,10 +247,12 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
ms_filter_call_method(stream->ec,MS_FILTER_SET_SAMPLE_RATE,&pt->clock_rate);
}
if (stream->use_ea){
if (stream->el_type!=ELInactive){
stream->volsend=ms_filter_new(MS_VOLUME_ID);
stream->volrecv=ms_filter_new(MS_VOLUME_ID);
ms_filter_call_method(stream->volrecv,MS_VOLUME_SET_PEER,stream->volsend);
if (stream->el_type==ELControlSpeaker)
ms_filter_call_method(stream->volrecv,MS_VOLUME_SET_PEER,stream->volsend);
else ms_filter_call_method(stream->volsend,MS_VOLUME_SET_PEER,stream->volrecv);
}
/* give the sound filters some properties */
......@@ -393,8 +395,8 @@ 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_enable_echo_limiter(AudioStream *stream, bool_t enabled){
stream->use_ea=enabled;
void audio_stream_enable_echo_limiter(AudioStream *stream, EchoLimiterType type){
stream->el_type=type;
}
void audio_stream_stop(AudioStream * stream)
......
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