From 7bc0486b57d646ecce175280bf4f098a376eaf00 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 14 Oct 2014 15:21:43 +0200 Subject: [PATCH] Apply microphone mute to all calls. --- coreapi/linphonecall.c | 2 +- coreapi/linphonecore.c | 34 ++++++++++++++++++---------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index a838fabdc..5e7f9e5af 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2176,7 +2176,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut call, linphone_core_get_upload_bandwidth(lc),linphone_core_get_download_bandwidth(lc)); if (call->audiostream!=NULL) { - linphone_call_start_audio_stream(call,cname,all_inputs_muted,send_ringbacktone,use_arc); + linphone_call_start_audio_stream(call,cname,all_inputs_muted||call->audio_muted,send_ringbacktone,use_arc); } call->current_params->has_video=FALSE; if (call->videostream!=NULL) { diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 801eb7a43..fa1adf331 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4584,26 +4584,28 @@ bool_t linphone_core_echo_limiter_enabled(const LinphoneCore *lc){ return lc->sound_conf.ea; } +static void linphone_core_mute_audio_stream(LinphoneCore *lc, AudioStream *st, bool_t val) { + audio_stream_set_mic_gain(st, + (val==TRUE) ? 0 : pow(10,lc->sound_conf.soft_mic_lev/10)); + if ( linphone_core_get_rtp_no_xmit_on_audio_mute(lc) ){ + audio_stream_mute_rtp(st,val); + } +} + void linphone_core_mute_mic(LinphoneCore *lc, bool_t val){ - LinphoneCall *call=linphone_core_get_current_call(lc); - AudioStream *st=NULL; + LinphoneCall *call; + const MSList *list; + const MSList *elem; + if (linphone_core_is_in_conference(lc)){ lc->conf_ctx.local_muted=val; - st=lc->conf_ctx.local_participant; - }else if (call==NULL){ - ms_warning("linphone_core_mute_mic(): No current call !"); - return; - }else{ - st=call->audiostream; - call->audio_muted=val; + linphone_core_mute_audio_stream(lc, lc->conf_ctx.local_participant, val); } - if (st!=NULL){ - audio_stream_set_mic_gain(st, - (val==TRUE) ? 0 : pow(10,lc->sound_conf.soft_mic_lev/10)); - if ( linphone_core_get_rtp_no_xmit_on_audio_mute(lc) ){ - audio_stream_mute_rtp(st,val); - } - + list = linphone_core_get_calls(lc); + for (elem = list; elem != NULL; elem = elem->next) { + call = (LinphoneCall *)elem->data; + call->audio_muted = val; + linphone_core_mute_audio_stream(lc, call->audiostream, val); } }