From: Guillaume Beraudo Date: Tue, 4 Dec 2012 15:23:07 +0000 (+0100) Subject: Fix crash on INVITE without SDP. X-Git-Url: http://sjero.net/git/?a=commitdiff_plain;h=ba478b89e88f5b60f6f3ee5bfe9c636cd8648f3e;p=linphone Fix crash on INVITE without SDP. --- diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index f0822790..5a18a052 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -462,6 +462,7 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op){ LinphoneCall *call=ms_new0(LinphoneCall,1); char *from_str; + const SalMediaDescription *md; call->dir=LinphoneCallIncoming; sal_op_set_user_pointer(op,call); @@ -484,8 +485,13 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_call_init_common(call, from, to); call->log->call_id=ms_strdup(sal_op_get_call_id(op)); /*must be known at that time*/ linphone_core_init_default_params(lc, &call->params); + md=sal_call_get_remote_media_description(op); call->params.has_video &= !!lc->video_policy.automatically_accept; - call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(op)); + if (md) { + // It is licit to receive an INVITE without SDP + // In this case WE chose the media parameters according to policy. + call->params.has_video &= linphone_core_media_description_contains_video_stream(md); + } switch (linphone_core_get_firewall_policy(call->core)) { case LinphonePolicyUseIce: call->ice_session = ice_session_new(); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 998fd9ec..e52bef3f 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2882,8 +2882,11 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, sal_op_set_contact(call->op,contact); if (params){ + const SalMediaDescription *md = sal_call_get_remote_media_description(call->op); call->params=*params; - call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(call->op)); + // There might not be a md if the INVITE was lacking an SDP + // In this case we use the parameters as is. + if (md) call->params.has_video &= linphone_core_media_description_contains_video_stream(md); call->camera_active=call->params.has_video; linphone_call_make_local_media_description(lc,call); sal_call_set_local_media_description(call->op,call->localdesc);