diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 620fbba04..538100c1d 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -738,7 +738,7 @@ void linphone_call_set_compatible_incoming_call_parameters(LinphoneCall *call, c 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; + call->params->avpf_rr_interval = linphone_core_get_avpf_rr_interval(call->core)*1000; } } if ((sal_media_description_has_srtp(md) == TRUE) && (media_stream_srtp_supported() == TRUE)) { diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 240149837..9f21533ee 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -507,6 +507,7 @@ static void rtp_config_read(LinphoneCore *lc) adaptive_jitt_comp_enabled = lp_config_get_int(lc->config, "rtp", "video_adaptive_jitt_comp_enabled", TRUE); linphone_core_enable_video_adaptive_jittcomp(lc, adaptive_jitt_comp_enabled); lc->rtp_conf.disable_upnp = lp_config_get_int(lc->config, "rtp", "disable_upnp", FALSE); + linphone_core_set_avpf_mode(lc,lp_config_get_int(lc->config,"rtp","avpf",0)); } static PayloadType * find_payload(RtpProfile *prof, const char *mime_type, int clock_rate, int channels, const char *recv_fmtp){ @@ -2579,6 +2580,9 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const 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) * 1000; + }else{ + cp->avpf_enabled=linphone_core_get_avpf_mode(lc)==LinphoneAVPFEnabled; + if (cp->avpf_enabled) cp->avpf_rr_interval=linphone_core_get_avpf_rr_interval(lc) * 1000; } /* if no proxy or no identity defined for this proxy, default to primary contact*/ @@ -2599,7 +2603,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const /* this call becomes now the current one*/ lc->current_call=call; linphone_call_set_state (call,LinphoneCallOutgoingInit,"Starting outgoing call"); - call->log->start_date_time=time(NULL); + call->log->start_date_time=ms_time(NULL); linphone_call_init_media_streams(call); if (_linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) { @@ -6428,6 +6432,47 @@ void linphone_core_remove_supported_tag(LinphoneCore *lc, const char *tag){ lp_config_set_string(lc->config,"sip","supported",sal_get_supported_tags(lc->sal)); } +/** + * Enable RTCP feedback (also known as RTP/AVPF profile). + * Setting LinphoneAVPFDefault is equivalent to LinphoneAVPFDisabled. + * This setting can be overriden per LinphoneProxyConfig with linphone_proxy_config_set_avpf_mode(). + * The value set here is used for calls placed or received out of any proxy configured, or if the proxy config is configured with LinphoneAVPFDefault. + * @param lc the LinphoneCore + * @param mode the mode. +**/ +void linphone_core_set_avpf_mode(LinphoneCore *lc, LinphoneAVPFMode mode){ + if (mode==LinphoneAVPFDefault) mode=LinphoneAVPFDisabled; + lc->rtp_conf.avpf_mode=mode; + if (linphone_core_ready(lc)) lp_config_set_int(lc->config,"rtp","avpf",mode); +} + +/** + * Return AVPF enablement. See linphone_core_set_avpf_mode() . + * @param lc the core + * @return the avpf enablement mode. +**/ +LinphoneAVPFMode linphone_core_get_avpf_mode(const LinphoneCore *lc){ + return lc->rtp_conf.avpf_mode; +} + +/** + * Return the avpf report interval in seconds. + * @param lc the LinphoneCore + * @return the avpf report interval in seconds. +**/ +int linphone_core_get_avpf_rr_interval(const LinphoneCore *lc){ + return lp_config_get_int(lc->config,"rtp","avpf_rr_interval",5); +} + +/** + * Set the avpf report interval in seconds. + * This value can be overriden by the proxy config using linphone_proxy_config_set_avpf_rr_interval(). + * @param lc the core + * @param interval interval in seconds. +**/ +void linphone_core_set_avpf_rr_interval(LinphoneCore *lc, int interval){ + return lp_config_set_int(lc->config,"rtp","avpf_rr_interval",interval); +} int linphone_payload_type_get_type(const LinphonePayloadType *pt) { return pt->type; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 0977c8790..39a1efd49 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -287,6 +287,20 @@ LINPHONE_PUBLIC char * linphone_payload_type_get_mime_type(const LinphonePayload LINPHONE_PUBLIC int linphone_payload_type_get_channels(const LinphonePayloadType *pt); +/** + * Enum describing RTP AVPF activation modes. +**/ +enum _LinphoneAVPFMode{ + LinphoneAVPFDefault=-1, /**quality_reporting_interval = lc ? lp_config_get_default_int(lc->config, "proxy", "quality_reporting_interval", 0) : 0; obj->contact_params = contact_params ? ms_strdup(contact_params) : NULL; obj->contact_uri_params = contact_uri_params ? ms_strdup(contact_uri_params) : NULL; - obj->avpf_enabled = lc ? lp_config_get_default_int(lc->config, "proxy", "avpf", 0) : 0; + obj->avpf_mode = lc ? lp_config_get_default_int(lc->config, "proxy", "avpf", LinphoneAVPFDefault) : LinphoneAVPFDefault; obj->avpf_rr_interval = lc ? lp_config_get_default_int(lc->config, "proxy", "avpf_rr_interval", 5) : 5; obj->publish_expires=-1; } @@ -1286,7 +1286,7 @@ void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyC lp_config_set_int(config,key,"reg_expires",obj->expires); lp_config_set_int(config,key,"reg_sendregister",obj->reg_sendregister); lp_config_set_int(config,key,"publish",obj->publish); - lp_config_set_int(config, key, "avpf", obj->avpf_enabled); + lp_config_set_int(config, key, "avpf", obj->avpf_mode); lp_config_set_int(config, key, "avpf_rr_interval", obj->avpf_rr_interval); lp_config_set_int(config,key,"dial_escape_plus",obj->dial_escape_plus); lp_config_set_string(config,key,"dial_prefix",obj->dial_prefix); @@ -1338,7 +1338,7 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore* lc CONFIGURE_INT_VALUE(cfg,config,key,expires,"reg_expires") CONFIGURE_BOOL_VALUE(cfg,config,key,register,"reg_sendregister") CONFIGURE_BOOL_VALUE(cfg,config,key,publish,"publish") - CONFIGURE_BOOL_VALUE(cfg,config,key,avpf,"avpf") + CONFIGURE_INT_VALUE(cfg,config,key,avpf_mode,"avpf") CONFIGURE_INT_VALUE(cfg,config,key,avpf_rr_interval,"avpf_rr_interval") CONFIGURE_INT_VALUE(cfg,config,key,dial_escape_plus,"dial_escape_plus") CONFIGURE_STRING_VALUE(cfg,config,key,dial_prefix,"dial_prefix") @@ -1651,11 +1651,22 @@ int linphone_proxy_config_get_publish_expires(const LinphoneProxyConfig *obj) { } void linphone_proxy_config_enable_avpf(LinphoneProxyConfig *cfg, bool_t enable) { - cfg->avpf_enabled = enable; + cfg->avpf_mode=enable ? LinphoneAVPFEnabled : LinphoneAVPFDisabled; } bool_t linphone_proxy_config_avpf_enabled(LinphoneProxyConfig *cfg) { - return cfg->avpf_enabled; + if (cfg->avpf_mode==LinphoneAVPFDefault && cfg->lc){ + return linphone_core_get_avpf_mode(cfg->lc)==LinphoneAVPFEnabled; + } + return cfg->avpf_mode == LinphoneAVPFEnabled; +} + +LinphoneAVPFMode linphone_proxy_config_get_avpf_mode(const LinphoneProxyConfig *cfg){ + return cfg->avpf_mode; +} + +void linphone_proxy_config_set_avpf_mode(LinphoneProxyConfig *cfg, LinphoneAVPFMode mode){ + cfg->avpf_mode=mode; } void linphone_proxy_config_set_avpf_rr_interval(LinphoneProxyConfig *cfg, uint8_t interval) { diff --git a/mediastreamer2 b/mediastreamer2 index ab0e9b39c..7d9de58ac 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit ab0e9b39c5dc82fb04146fcc20843cc7fa361b6e +Subproject commit 7d9de58ac0848bcf91c58a127ad30e338314f296