diff --git a/coreapi/bellesip_sal/sal_sdp.c b/coreapi/bellesip_sal/sal_sdp.c index 90f38af19..5f71dba0e 100644 --- a/coreapi/bellesip_sal/sal_sdp.c +++ b/coreapi/bellesip_sal/sal_sdp.c @@ -68,7 +68,7 @@ static void add_ice_remote_candidates(belle_sdp_media_description_t *md, const S if (buffer[0] != '\0') belle_sdp_media_description_add_attribute(md,belle_sdp_attribute_create("remote-candidates",buffer)); } -static bool_t is_rtcp_fb_trr_int_the_same_for_all_payloads(const SalStreamDescription *stream, uint8_t *trr_int) { +static bool_t is_rtcp_fb_trr_int_the_same_for_all_payloads(const SalStreamDescription *stream, uint16_t *trr_int) { MSList *pt_it; bool_t first = TRUE; for (pt_it = stream->payloads; pt_it != NULL; pt_it = pt_it->next) { @@ -85,7 +85,7 @@ static bool_t is_rtcp_fb_trr_int_the_same_for_all_payloads(const SalStreamDescri return TRUE; } -static void add_rtcp_fb_trr_int_attribute(belle_sdp_media_description_t *media_desc, int8_t id, uint8_t trr_int) { +static void add_rtcp_fb_trr_int_attribute(belle_sdp_media_description_t *media_desc, int8_t id, uint16_t trr_int) { belle_sdp_rtcp_fb_attribute_t *attribute = belle_sdp_rtcp_fb_attribute_new(); belle_sdp_rtcp_fb_attribute_set_id(attribute, id); belle_sdp_rtcp_fb_attribute_set_type(attribute, BELLE_SDP_RTCP_FB_TRR_INT); @@ -106,7 +106,7 @@ static void add_rtcp_fb_attributes(belle_sdp_media_description_t *media_desc, co PayloadType *pt; PayloadTypeAvpfParams avpf_params; bool_t general_trr_int; - uint8_t trr_int = 0; + uint16_t trr_int = 0; general_trr_int = is_rtcp_fb_trr_int_the_same_for_all_payloads(stream, &trr_int); if (general_trr_int == TRUE) { @@ -485,7 +485,6 @@ static void enable_avpf_for_stream(SalStreamDescription *stream) { if (stream->type == SalVideo) { avpf_params.features |= PAYLOAD_TYPE_AVPF_FIR; } - avpf_params.trr_interval = 0; payload_type_set_avpf_params(pt, avpf_params); } } @@ -509,7 +508,7 @@ static void apply_rtcp_fb_attribute_to_payload(belle_sdp_rtcp_fb_attribute_t *fb } break; case BELLE_SDP_RTCP_FB_TRR_INT: - avpf_params.trr_interval = (unsigned char)belle_sdp_rtcp_fb_attribute_get_trr_int(fb_attribute); + avpf_params.trr_interval = belle_sdp_rtcp_fb_attribute_get_trr_int(fb_attribute); break; case BELLE_SDP_RTCP_FB_ACK: default: diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 2a98afef1..218bf86fd 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -132,9 +132,9 @@ static bool_t linphone_call_all_streams_avpf_enabled(const LinphoneCall *call) { return ((nb_active_streams > 0) && (nb_active_streams == nb_avpf_enabled_streams)); } -static uint8_t linphone_call_get_avpf_rr_interval(const LinphoneCall *call) { - uint8_t rr_interval = 0; - uint8_t stream_rr_interval; +static uint16_t linphone_call_get_avpf_rr_interval(const LinphoneCall *call) { + uint16_t rr_interval = 0; + uint16_t stream_rr_interval; if (call) { if (call->audiostream && media_stream_get_state((MediaStream *)call->audiostream) == MSStreamStarted) { stream_rr_interval = media_stream_get_avpf_rr_interval((MediaStream *)call->audiostream); @@ -145,7 +145,7 @@ static uint8_t linphone_call_get_avpf_rr_interval(const LinphoneCall *call) { if (stream_rr_interval > rr_interval) rr_interval = stream_rr_interval; } } else { - rr_interval = 5; + rr_interval = 5000; } return rr_interval; } @@ -682,6 +682,26 @@ static void linphone_call_incoming_select_ip_version(LinphoneCall *call){ }else call->af=AF_INET; } +/** + * Fix call parameters on incoming call to eg. enable AVPF if the incoming call propose it and it is not enabled locally. + */ +void linphone_call_set_compatible_incoming_call_parameters(LinphoneCall *call, const SalMediaDescription *md) { + call->params.has_video &= linphone_core_media_description_contains_video_stream(md); + + /* Handle AVPF and SRTP. */ + call->params.avpf_enabled = sal_media_description_has_avpf(md); + if (call->params.avpf_enabled == TRUE) { + if (call->dest_proxy != NULL) { + call->params.avpf_rr_interval = linphone_proxy_config_get_avpf_rr_interval(call->dest_proxy) * 1000; + } else { + call->params.avpf_rr_interval = 5000; + } + } + if ((sal_media_description_has_srtp(md) == TRUE) && (media_stream_srtp_supported() == TRUE)) { + call->params.media_encryption = LinphoneMediaEncryptionSRTP; + } +} + LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op){ LinphoneCall *call=ms_new0(LinphoneCall,1); char *from_str; @@ -716,6 +736,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_core_get_local_ip(lc,call->af,call->localip); 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*/ + call->dest_proxy = linphone_core_lookup_known_proxy(call->core, to); linphone_core_init_default_params(lc, &call->params); /* @@ -730,13 +751,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro 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); - - /* Handle AVPF and SRTP. */ - call->params.avpf_enabled = sal_media_description_has_avpf(md); - if ((sal_media_description_has_srtp(md) == TRUE) && (media_stream_srtp_supported() == TRUE)) { - call->params.media_encryption = LinphoneMediaEncryptionSRTP; - } + linphone_call_set_compatible_incoming_call_parameters(call, md); } fpol=linphone_core_get_firewall_policy(call->core); /*create the ice session now if ICE is required*/ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 452447232..9f4cfbd9c 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2845,7 +2845,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const if (proxy!=NULL) { from=linphone_proxy_config_get_identity(proxy); cp->avpf_enabled = linphone_proxy_config_avpf_enabled(proxy); - cp->avpf_rr_interval = linphone_proxy_config_get_avpf_rr_interval(proxy); + cp->avpf_rr_interval = linphone_proxy_config_get_avpf_rr_interval(proxy) * 1000; } /* if no proxy or no identity defined for this proxy, default to primary contact*/ @@ -3428,12 +3428,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, // 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); - /* Handle AVPF and SRTP. */ - call->params.avpf_enabled = sal_media_description_has_avpf(md); - if ((sal_media_description_has_srtp(md) == TRUE) && (media_stream_srtp_supported() == TRUE)) { - call->params.media_encryption = LinphoneMediaEncryptionSRTP; - } + linphone_call_set_compatible_incoming_call_parameters(call, md); } linphone_call_prepare_ice(call,TRUE); linphone_call_make_local_media_description(lc,call); diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index 779e7ae65..d7d2e6e84 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -101,7 +101,11 @@ static MSList *match_payloads(const MSList *local, const MSList *remote, bool_t newp->flags|=PAYLOAD_TYPE_FLAG_CAN_RECV|PAYLOAD_TYPE_FLAG_CAN_SEND; if (p2->flags & PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED) { newp->flags |= PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED; - newp->avpf = payload_type_get_avpf_params(p2); + newp->avpf = payload_type_get_avpf_params(p2); /* Take remote AVPF features */ + /* Take bigger AVPF trr interval */ + if (p2->avpf.trr_interval < matched->avpf.trr_interval) { + newp->avpf.trr_interval = matched->avpf.trr_interval; + } } res=ms_list_append(res,newp); /* we should use the remote numbering even when parsing a response */ diff --git a/coreapi/private.h b/coreapi/private.h index b59ccd906..9cb1b45da 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -100,7 +100,7 @@ struct _LinphoneCallParams{ bool_t in_conference; /*in conference mode */ bool_t low_bandwidth; LinphonePrivacyMask privacy; - uint8_t avpf_rr_interval; + uint16_t avpf_rr_interval; }; struct _LinphoneQualityReporting{ @@ -255,6 +255,7 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr LinphoneCall * linphone_call_new_incoming(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op); void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const char *message); void linphone_call_set_contact_op(LinphoneCall* call); +void linphone_call_set_compatible_incoming_call_parameters(LinphoneCall *call, const SalMediaDescription *md); /* private: */ LinphoneCallLog * linphone_call_log_new(LinphoneCall *call, LinphoneAddress *local, LinphoneAddress * remote); void linphone_call_log_completed(LinphoneCall *call); diff --git a/mediastreamer2 b/mediastreamer2 index d09fd38aa..e4ee08232 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit d09fd38aa00d38a99eb9470c0f9e117027f4dc50 +Subproject commit e4ee08232c70023bf772b6499752bd682671b99c diff --git a/oRTP b/oRTP index 8d9a4ac29..e4a235076 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 8d9a4ac29b80f6dbb16ef6ca9ed68727a0c7d759 +Subproject commit e4a235076787acef6e97eb7a15b400f91fd4f481