From 787e9d2a3d342cfc30a692caa6f27d7a87304f3d Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 13 Oct 2011 15:59:23 +0200 Subject: [PATCH] fix for early media and multi call --- coreapi/linphonecall.c | 11 +++++++++++ coreapi/linphonecore.c | 4 +++- coreapi/private.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index ba7c71182..15b1aa723 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -975,6 +975,13 @@ static void setup_ring_player(LinphoneCore *lc, LinphoneCall *call){ #define LINPHONE_RTCP_SDES_TOOL "Linphone-" LINPHONE_VERSION +static bool_t linphone_call_sound_resources_available(LinphoneCall *call){ + LinphoneCore *lc=call->core; + LinphoneCall *current=linphone_core_get_current_call(lc); + return !linphone_core_is_in_conference(lc) && + (current==NULL || current==call); +} + static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cname, bool_t muted, bool_t send_ringbacktone, bool_t use_arc){ LinphoneCore *lc=call->core; int jitt_comp=lc->rtp_conf.audio_jitt_comp; @@ -1023,6 +1030,10 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna /* first create the graph without soundcard resources*/ captcard=playcard=NULL; } + if (!linphone_call_sound_resources_available(call)){ + ms_message("Sound resources are used by another call, not using soundcard."); + captcard=playcard=NULL; + } use_ec=captcard==NULL ? FALSE : linphone_core_echo_cancellation_enabled(lc); audio_stream_enable_adaptive_bitrate_control(call->audiostream,use_arc); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 75cc94f38..3a21ae701 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2562,8 +2562,10 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call) linphone_core_preempt_sound_resources(lc); ms_message("Resuming call %p",call); } + 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); - if (call->params.in_conference) subject="Resuming conference"; + if (call->params.in_conference && !call->current_params.in_conference) subject="Conference"; if(sal_call_update(call->op,subject) != 0){ return -1; } diff --git a/coreapi/private.h b/coreapi/private.h index e662c8e75..d2b78942e 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -516,6 +516,7 @@ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t mute void linphone_call_add_to_conf(LinphoneCall *call); 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); #define HOLD_OFF (0) #define HOLD_ON (1)