diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 76bde15aa..7d85d2717 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1186,6 +1186,7 @@ static void sound_config_read(LinphoneCore *lc) #endif tmp=lp_config_get_int(lc->config,"sound","echocancellation",tmp); linphone_core_enable_echo_cancellation(lc,tmp); + linphone_core_set_echo_canceller_filter_name(lc, linphone_core_get_echo_canceller_filter_name(lc)); linphone_core_enable_echo_limiter(lc, lp_config_get_int(lc->config,"sound","echolimiter",0)); linphone_core_enable_agc(lc, diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c index c16b827ac..296b0fb73 100644 --- a/coreapi/lpconfig.c +++ b/coreapi/lpconfig.c @@ -481,9 +481,11 @@ int linphone_config_read_file(LpConfig *lpconfig, const char *filename){ } void lp_item_set_value(LpItem *item, const char *value){ - char *prev_value=item->value; - item->value=ortp_strdup(value); - ortp_free(prev_value); + if (item->value != value) { + char *prev_value=item->value; + item->value=ortp_strdup(value); + ortp_free(prev_value); + } } diff --git a/coreapi/misc.c b/coreapi/misc.c index 3d58237c9..c57dfe764 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -1270,6 +1270,17 @@ const char *linphone_core_get_video_display_filter(LinphoneCore *lc){ return lp_config_get_string(lc->config,"video","displaytype",NULL); } +void linphone_core_set_echo_canceller_filter_name(LinphoneCore *lc, const char *filtername) { + lp_config_set_string(lc->config, "sound", "ec_filter", filtername); + if (filtername != NULL) { + ms_factory_set_echo_canceller_filter_name(lc->factory, filtername); + } +} + +const char * linphone_core_get_echo_canceller_filter_name(const LinphoneCore *lc) { + return lp_config_get_string(lc->config, "sound", "ec_filter", NULL); +} + /** * Queue a task into the main loop. The data pointer must remain valid until the task is completed. * task_fun must return BELLE_SIP_STOP when job is finished. diff --git a/include/linphone/core.h b/include/linphone/core.h index 568a17672..c27a6ce2b 100644 --- a/include/linphone/core.h +++ b/include/linphone/core.h @@ -4145,6 +4145,23 @@ LINPHONE_PUBLIC const char *linphone_core_get_video_display_filter(LinphoneCore **/ LINPHONE_PUBLIC void linphone_core_set_video_display_filter(LinphoneCore *lc, const char *filtername); +/** + * Get the name of the mediastreamer2 filter used for echo cancelling. + * @param[in] lc LinphoneCore object + * @return The name of the mediastreamer2 filter used for echo cancelling + * @ingroup media_parameters + */ +LINPHONE_PUBLIC const char * linphone_core_get_echo_canceller_filter_name(const LinphoneCore *lc); + +/** + * Set the name of the mediastreamer2 filter to be used for echo cancelling. + * This is for advanced users of the library. + * @param[in] lc LinphoneCore object + * @param[in] filtername The name of the mediastreamer2 filter to be used for echo cancelling + * @ingroup media_parameters + */ +LINPHONE_PUBLIC void linphone_core_set_echo_canceller_filter_name(LinphoneCore *lc, const char *filtername); + /** Contact Providers */