]> sjero.net Git - linphone/commitdiff
Fix crash on INVITE without SDP.
authorGuillaume Beraudo <guillaume.beraudo@linphone.org>
Tue, 4 Dec 2012 15:23:07 +0000 (16:23 +0100)
committerGuillaume Beraudo <guillaume.beraudo@linphone.org>
Tue, 4 Dec 2012 15:23:07 +0000 (16:23 +0100)
coreapi/linphonecall.c
coreapi/linphonecore.c

index f08227905f1c0a6c9c5774c6978ce0e957ecb1c6..5a18a052547ef6649a8b23e415a94c7bb0995fed 100644 (file)
@@ -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();
index 998fd9ec9b06bd331790a4f864cb8ab4d74ff563..e52bef3f7c13d995638f9c7403b160dcee108b31 100644 (file)
@@ -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);