mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-18 03:28:07 +00:00
fix crash in SAL, because of late 180/200 response arriving once the call is cancelled.
This commit is contained in:
parent
6594a22dfb
commit
e1867cbe4e
3 changed files with 26 additions and 23 deletions
|
|
@ -63,12 +63,12 @@ int lc_callback_obj_invoke(LCCallbackObj *obj, LinphoneCore *lc){
|
|||
}
|
||||
|
||||
|
||||
static MSList *make_codec_list(const MSList *codecs, bool_t only_one_codec){
|
||||
static MSList *make_codec_list(LinphoneCore *lc, const MSList *codecs, bool_t only_one_codec){
|
||||
MSList *l=NULL;
|
||||
const MSList *it;
|
||||
for(it=codecs;it!=NULL;it=it->next){
|
||||
PayloadType *pt=(PayloadType*)it->data;
|
||||
if (pt->flags & PAYLOAD_TYPE_ENABLED){
|
||||
if ((pt->flags & PAYLOAD_TYPE_ENABLED) && linphone_core_check_payload_type_usability(lc,pt)){
|
||||
l=ms_list_append(l,payload_type_clone(pt));
|
||||
if (only_one_codec) break;
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ static SalMediaDescription *create_local_media_description(LinphoneCore *lc,
|
|||
md->streams[0].proto=SalProtoRtpAvp;
|
||||
md->streams[0].type=SalAudio;
|
||||
md->streams[0].ptime=lc->net_conf.down_ptime;
|
||||
l=make_codec_list(lc->codecs_conf.audio_codecs,only_one_codec);
|
||||
l=make_codec_list(lc,lc->codecs_conf.audio_codecs,only_one_codec);
|
||||
pt=payload_type_clone(rtp_profile_get_payload_from_mime(&av_profile,"telephone-event"));
|
||||
l=ms_list_append(l,pt);
|
||||
md->streams[0].payloads=l;
|
||||
|
|
@ -103,7 +103,7 @@ static SalMediaDescription *create_local_media_description(LinphoneCore *lc,
|
|||
md->streams[1].port=linphone_core_get_video_port(lc);
|
||||
md->streams[1].proto=SalProtoRtpAvp;
|
||||
md->streams[1].type=SalVideo;
|
||||
l=make_codec_list(lc->codecs_conf.video_codecs,only_one_codec);
|
||||
l=make_codec_list(lc,lc->codecs_conf.video_codecs,only_one_codec);
|
||||
md->streams[1].payloads=l;
|
||||
if (lc->dw_video_bw)
|
||||
md->streams[1].bandwidth=lc->dw_video_bw;
|
||||
|
|
|
|||
|
|
@ -276,6 +276,12 @@ bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, PayloadType
|
|||
case PAYLOAD_AUDIO_PACKETIZED:
|
||||
codec_band=get_audio_payload_bandwidth(lc,pt);
|
||||
ret=bandwidth_is_greater(min_audio_bw*1000,codec_band);
|
||||
/*hack to avoid using uwb codecs when having low bitrate and video*/
|
||||
if (bandwidth_is_greater(199,min_audio_bw)){
|
||||
if (linphone_core_video_enabled(lc) && pt->clock_rate>16000){
|
||||
ret=FALSE;
|
||||
}
|
||||
}
|
||||
//ms_message("Payload %s: %g",pt->mime_type,codec_band);
|
||||
break;
|
||||
case PAYLOAD_VIDEO:
|
||||
|
|
|
|||
|
|
@ -593,6 +593,16 @@ static void set_network_origin(SalOp *op, osip_message_t *req){
|
|||
__sal_op_set_network_origin(op,origin);
|
||||
}
|
||||
|
||||
static SalOp *find_op(Sal *sal, eXosip_event_t *ev){
|
||||
if (ev->cid>0)
|
||||
return (SalOp*)eXosip_call_get_reference(ev->cid);;
|
||||
if (ev->rid>0){
|
||||
return sal_find_register(sal,ev->rid);
|
||||
}
|
||||
if (ev->response) return sal_find_other(sal,ev->response);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void inc_new_call(Sal *sal, eXosip_event_t *ev){
|
||||
SalOp *op=sal_op_new(sal);
|
||||
osip_from_t *from,*to;
|
||||
|
|
@ -626,7 +636,7 @@ static void inc_new_call(Sal *sal, eXosip_event_t *ev){
|
|||
}
|
||||
|
||||
static void handle_reinvite(Sal *sal, eXosip_event_t *ev){
|
||||
SalOp *op=(SalOp*)ev->external_reference;
|
||||
SalOp *op=find_op(sal,ev);
|
||||
sdp_message_t *sdp;
|
||||
osip_message_t *msg=NULL;
|
||||
|
||||
|
|
@ -669,7 +679,7 @@ static void handle_reinvite(Sal *sal, eXosip_event_t *ev){
|
|||
}
|
||||
|
||||
static void handle_ack(Sal *sal, eXosip_event_t *ev){
|
||||
SalOp *op=(SalOp*)ev->external_reference;
|
||||
SalOp *op=find_op(sal,ev);
|
||||
sdp_message_t *sdp;
|
||||
|
||||
if (op==NULL) {
|
||||
|
|
@ -714,7 +724,7 @@ static void update_contact_from_response(SalOp *op, osip_message_t *response){
|
|||
}
|
||||
|
||||
static int call_proceeding(Sal *sal, eXosip_event_t *ev){
|
||||
SalOp *op=(SalOp*)ev->external_reference;
|
||||
SalOp *op=find_op(sal,ev);
|
||||
|
||||
if (op==NULL) {
|
||||
ms_warning("This call has been canceled.");
|
||||
|
|
@ -750,10 +760,9 @@ static void call_ringing(Sal *sal, eXosip_event_t *ev){
|
|||
static void call_accepted(Sal *sal, eXosip_event_t *ev){
|
||||
sdp_message_t *sdp;
|
||||
osip_message_t *msg=NULL;
|
||||
SalOp *op;
|
||||
SalOp *op=find_op(sal,ev);
|
||||
const char *contact;
|
||||
|
||||
op=(SalOp*)ev->external_reference;
|
||||
if (op==NULL){
|
||||
ms_error("A closed call is accepted ?");
|
||||
return;
|
||||
|
|
@ -778,9 +787,8 @@ static void call_accepted(Sal *sal, eXosip_event_t *ev){
|
|||
}
|
||||
|
||||
static void call_terminated(Sal *sal, eXosip_event_t *ev){
|
||||
SalOp *op;
|
||||
char *from;
|
||||
op=(SalOp*)ev->external_reference;
|
||||
SalOp *op=find_op(sal,ev);
|
||||
if (op==NULL){
|
||||
ms_warning("Call terminated for already closed call ?");
|
||||
return;
|
||||
|
|
@ -793,8 +801,7 @@ static void call_terminated(Sal *sal, eXosip_event_t *ev){
|
|||
}
|
||||
|
||||
static void call_released(Sal *sal, eXosip_event_t *ev){
|
||||
SalOp *op;
|
||||
op=(SalOp*)ev->external_reference;
|
||||
SalOp *op=find_op(sal,ev);
|
||||
if (op==NULL){
|
||||
return;
|
||||
}
|
||||
|
|
@ -857,16 +864,6 @@ int sal_op_get_auth_requested(SalOp *op, const char **realm, const char **userna
|
|||
return -1;
|
||||
}
|
||||
|
||||
static SalOp *find_op(Sal *sal, eXosip_event_t *ev){
|
||||
if (ev->external_reference)
|
||||
return (SalOp*)ev->external_reference;
|
||||
if (ev->rid>0){
|
||||
return sal_find_register(sal,ev->rid);
|
||||
}
|
||||
if (ev->response) return sal_find_other(sal,ev->response);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool_t process_authentication(Sal *sal, eXosip_event_t *ev){
|
||||
SalOp *op;
|
||||
const char *username,*realm;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue