Commit d06faa91 authored by Simon Morlat's avatar Simon Morlat
Browse files

keep local payload types offered in call profile in case the remote end wants...

keep local payload types offered in call profile in case the remote end wants to use them despite it didn't accepted them.
parent c9710073
......@@ -783,9 +783,6 @@ static void post_configure_audio_streams(LinphoneCall*call){
}
}
static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *md, const SalStreamDescription *desc, int *used_pt){
int bw;
const MSList *elem;
......@@ -800,7 +797,7 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m
PayloadType *pt=(PayloadType*)elem->data;
int number;
if (first) {
if ((pt->flags & PAYLOAD_TYPE_FLAG_CAN_SEND) && first) {
if (desc->type==SalAudio){
linphone_core_update_allocated_audio_bandwidth_in_call(call,pt);
up_ptime=linphone_core_get_upload_ptime(lc);
......
......@@ -61,7 +61,7 @@ static PayloadType * find_payload_type_best_match(const MSList *l, const Payload
}
static MSList *match_payloads(const MSList *local, const MSList *remote, bool_t reading_response, bool_t one_matching_codec){
const MSList *e2;
const MSList *e2,*e1;
MSList *res=NULL;
PayloadType *matched;
bool_t found_codec=FALSE;
......@@ -85,6 +85,7 @@ static MSList *match_payloads(const MSList *local, const MSList *remote, bool_t
newp=payload_type_clone(matched);
if (p2->send_fmtp)
payload_type_set_send_fmtp(newp,p2->send_fmtp);
newp->flags|=PAYLOAD_TYPE_FLAG_CAN_RECV|PAYLOAD_TYPE_FLAG_CAN_SEND;
res=ms_list_append(res,newp);
/* we should use the remote numbering even when parsing a response */
payload_type_set_number(newp,remote_number);
......@@ -104,6 +105,26 @@ static MSList *match_payloads(const MSList *local, const MSList *remote, bool_t
ms_message("No match for %s/%i",p2->mime_type,p2->clock_rate);
}
}
if (reading_response){
/* add remaning local payload as CAN_RECV only so that if we are in front of a non-compliant equipment we are still able to decode the RTP stream*/
for(e1=local;e1!=NULL;e1=e1->next){
PayloadType *p1=(PayloadType*)e1->data;
bool_t found=FALSE;
for(e2=res;e2!=NULL;e2=e2->next){
PayloadType *p2=(PayloadType*)e2->data;
if (payload_type_get_number(p2)==payload_type_get_number(p1)){
found=TRUE;
break;
}
}
if (!found){
ms_message("Adding %s/%i for compatibility, just in case.",p1->mime_type,p1->clock_rate);
p1=payload_type_clone(p1);
p1->flags|=PAYLOAD_TYPE_FLAG_CAN_RECV;
res=ms_list_append(res,p1);
}
}
}
return res;
}
......
......@@ -319,6 +319,7 @@ int sal_call_send_dtmf(SalOp *h, char dtmf);
int sal_call_terminate(SalOp *h);
bool_t sal_call_autoanswer_asked(SalOp *op);
void sal_call_send_vfu_request(SalOp *h);
int sal_call_is_offerer(const SalOp *h);
/*Registration*/
int sal_register(SalOp *op, const char *proxy, const char *from, int expires);
......@@ -343,6 +344,9 @@ int sal_publish(SalOp *op, const char *from, const char *to, SalPresenceStatus s
/*ping: main purpose is to obtain its own contact address behind firewalls*/
int sal_ping(SalOp *op, const char *from, const char *to);
#define PAYLOAD_TYPE_FLAG_CAN_RECV PAYLOAD_TYPE_USER_FLAG_1
#define PAYLOAD_TYPE_FLAG_CAN_SEND PAYLOAD_TYPE_USER_FLAG_2
#define payload_type_set_number(pt,n) (pt)->user_data=(void*)((long)n);
#define payload_type_get_number(pt) ((int)(long)(pt)->user_data)
......
......@@ -509,6 +509,10 @@ static void sdp_process(SalOp *h){
}
int sal_call_is_offerer(const SalOp *h){
return h->sdp_offering;
}
int sal_call_set_local_media_description(SalOp *h, SalMediaDescription *desc){
if (desc)
sal_media_description_ref(desc);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment