From b59cdd29c04d9bd626a76ef1c8944168039b6f1c Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 1 Dec 2011 15:48:22 +0100 Subject: [PATCH] Handle conference and on hold music. When hosting a conference, mute conference participant when he pauses us to prevent his holding music to be played to all participants. When resuming a call, stop immediately sending the hold music, even before receiving the 200OK. When the paused call is a conference, it prevents the conference participants to hear the hold music while the 200OK is back. --- coreapi/conference.c | 4 ++-- coreapi/linphonecall.c | 3 ++- coreapi/linphonecore.c | 5 +++++ coreapi/private.h | 6 +++++- mediastreamer2 | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/coreapi/conference.c b/coreapi/conference.c index 7efed4f2d..288ab2b46 100644 --- a/coreapi/conference.c +++ b/coreapi/conference.c @@ -60,8 +60,7 @@ void linphone_core_conference_check_uninit(LinphoneConference *ctx){ } } - -void linphone_call_add_to_conf(LinphoneCall *call){ +void linphone_call_add_to_conf(LinphoneCall *call, bool_t muted){ LinphoneCore *lc=call->core; LinphoneConference *conf=&lc->conf_ctx; MSAudioEndpoint *ep; @@ -69,6 +68,7 @@ void linphone_call_add_to_conf(LinphoneCall *call){ call->camera_active = FALSE; ep=ms_audio_endpoint_get_from_stream(call->audiostream,TRUE); ms_audio_conference_add_member(conf->conf,ep); + ms_audio_conference_mute_member(conf->conf,ep,muted); call->endpoint=ep; } diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 84b4b1232..712d98062 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1140,7 +1140,8 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna }else call->audiostream_encrypted=FALSE; if (call->params.in_conference){ /*transform the graph to connect it to the conference filter */ - linphone_call_add_to_conf(call); + bool_t mute=stream->dir==SalStreamRecvOnly; + linphone_call_add_to_conf(call, mute); } call->current_params.in_conference=call->params.in_conference; }else ms_warning("No audio stream accepted ?"); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index cf827dd25..6bd1b6e9b 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2581,6 +2581,11 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call) linphone_core_preempt_sound_resources(lc); ms_message("Resuming call %p",call); } + + // Stop playing music immediately. If remote side is a conference it + // prevents the participants to hear it while the 200OK comes back. + audio_stream_play(call->audiostream, NULL); + update_local_media_description(lc,the_call,&call->localdesc); sal_call_set_local_media_description(call->op,call->localdesc); sal_media_description_set_dir(call->localdesc,SalStreamSendRecv); diff --git a/coreapi/private.h b/coreapi/private.h index 685390689..93b1f459f 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -520,7 +520,11 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse void linphone_core_preempt_sound_resources(LinphoneCore *lc); /*conferencing subsystem*/ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t muted); -void linphone_call_add_to_conf(LinphoneCall *call); +/* When a conference participant pause the conference he may send a music. + * We don't want to hear that music or to send it to the other participants. + * Use muted=yes to handle this case. + */ +void linphone_call_add_to_conf(LinphoneCall *call, bool_t muted); void linphone_call_remove_from_conf(LinphoneCall *call); void linphone_core_conference_check_uninit(LinphoneConference *ctx); bool_t linphone_core_sound_resources_available(LinphoneCore *lc); diff --git a/mediastreamer2 b/mediastreamer2 index f27d83cdf..c53138bdb 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit f27d83cdfd08bd590d73a3e6f632a6237acbf0e7 +Subproject commit c53138bdb19b50f7357d0bee621de0a7be9bd601