From 8cd3fc9bfa1c2c51e2fc558787bb99dfd594cbb8 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 16 May 2016 17:14:38 +0200 Subject: [PATCH] Fix linphone_core_create_call_params(), who should set avpf_rr_interval in all cases. This solves bugs lots of RTCP spam when call params are not created appropriately. --- coreapi/linphonecall.c | 11 +++++------ coreapi/linphonecore.c | 1 + coreapi/offeranswer.c | 4 ++-- tester/call_tester.c | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 516bc0150..4ed02e948 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1187,13 +1187,12 @@ static void linphone_call_incoming_select_ip_version(LinphoneCall *call, Linphon void linphone_call_set_compatible_incoming_call_parameters(LinphoneCall *call, SalMediaDescription *md) { /* Handle AVPF, SRTP and DTLS. */ 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 = linphone_core_get_avpf_rr_interval(call->core)*1000; - } + 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 = linphone_core_get_avpf_rr_interval(call->core)*1000; } + if ((sal_media_description_has_zrtp(md) == TRUE) && (ms_zrtp_available() == TRUE)) { call->params->media_encryption = LinphoneMediaEncryptionZRTP; }else if ((sal_media_description_has_dtls(md) == TRUE) && (media_stream_dtls_supported() == TRUE)) { diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index fb7de0796..2541bd1a0 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -7296,6 +7296,7 @@ void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *para params->privacy=LinphonePrivacyDefault; params->avpf_enabled=linphone_core_get_avpf_mode(lc); params->implicit_rtcp_fb = lp_config_get_int(lc->config,"rtp","rtcp_fb_implicit_rtcp_fb",TRUE); + params->avpf_rr_interval = linphone_core_get_avpf_rr_interval(lc); params->audio_dir=LinphoneMediaDirectionSendRecv; params->video_dir=LinphoneMediaDirectionSendRecv; params->real_early_media=lp_config_get_int(lc->config,"misc","real_early_media",FALSE); diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index c8926d8aa..08f3505d5 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -205,8 +205,8 @@ static MSList *match_payloads(MSFactory *factory, const MSList *local, const MSL matched->avpf.features &= p2->avpf.features; matched->avpf.rpsi_compatibility = p2->avpf.rpsi_compatibility; /* Take bigger AVPF trr interval */ - if (p2->avpf.trr_interval < matched->avpf.trr_interval) { - matched->avpf.trr_interval = matched->avpf.trr_interval; + if (p2->avpf.trr_interval > matched->avpf.trr_interval) { + matched->avpf.trr_interval = p2->avpf.trr_interval; } }else{ payload_type_unset_flag(matched, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED); diff --git a/tester/call_tester.c b/tester/call_tester.c index 4827fe046..1be87acb4 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -233,6 +233,17 @@ static void setup_sdp_handling(const LinphoneCallTestParams* params, LinphoneCor } } +/* + * CAUTION this function is error prone. you should not use it anymore in new tests. + * Creating callee call params before the call is actually received is not the good way + * to use the Liblinphone API. Indeed, call params used for receiving calls shall be created by linphone_core_create_call_params() by passing + * the call object for which params are to be created. + * This function should be used only in test case where the programmer exactly knows the caller params, and then can deduce how + * callee params will be set by linphone_core_create_call_params(). + * This function was developped at a time where the use of the API about incoming params was not yet clarified. + * Tests relying on this function are then not testing the correct way to use the api (through linphone_core_create_call_params()), and so + * it is not a so good idea to build new tests based on this function. +**/ bool_t call_with_params2(LinphoneCoreManager* caller_mgr ,LinphoneCoreManager* callee_mgr , const LinphoneCallTestParams *caller_test_params @@ -382,6 +393,17 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr return result; } +/* + * CAUTION this function is error prone. you should not use it anymore in new tests. + * Creating callee call params before the call is actually received is not the good way + * to use the Liblinphone API. Indeed, call params used for receiving calls shall be created by linphone_core_create_call_params() by passing + * the call object for which params are to be created. + * This function should be used only in test case where the programmer exactly knows the caller params, and then can deduce how + * callee params will be set by linphone_core_create_call_params(). + * This function was developped at a time where the use of the API about incoming params was not yet clarified. + * Tests relying on this function are then not testing the correct way to use the api (through linphone_core_create_call_params()), and so + * it is not a so good idea to build new tests based on this function. +**/ bool_t call_with_params(LinphoneCoreManager* caller_mgr ,LinphoneCoreManager* callee_mgr ,const LinphoneCallParams *caller_params @@ -392,6 +414,17 @@ bool_t call_with_params(LinphoneCoreManager* caller_mgr return call_with_params2(caller_mgr,callee_mgr,&caller_test_params,&callee_test_params,FALSE); } +/* + * CAUTION this function is error prone. you should not use it anymore in new tests. + * Creating callee call params before the call is actually received is not the good way + * to use the Liblinphone API. Indeed, call params used for receiving calls shall be created by linphone_core_create_call_params() by passing + * the call object for which params are to be created. + * This function should be used only in test case where the programmer exactly knows the caller params, and then can deduce how + * callee params will be set by linphone_core_create_call_params(). + * This function was developped at a time where the use of the API about incoming params was not yet clarified. + * Tests relying on this function are then not testing the correct way to use the api (through linphone_core_create_call_params()), and so + * it is not a so good idea to build new tests based on this function. +**/ bool_t call_with_test_params(LinphoneCoreManager* caller_mgr ,LinphoneCoreManager* callee_mgr ,const LinphoneCallTestParams *caller_test_params