linphonecall.c \
sipsetup.c sipsetup.h \
siplogin.c \
- lsd.c linphonecore_utils.h
+ lsd.c linphonecore_utils.h \
+ ec-calibrator.c
liblinphone_la_LDFLAGS= -version-info $(LIBLINPHONE_SO_VERSION) -no-undefined
liblinphone_la_LIBADD+=$(top_builddir)/oRTP/src/libortp.la
endif
-noinst_PROGRAMS=test_lsd
+noinst_PROGRAMS=test_lsd test_ecc
test_lsd_SOURCES=test_lsd.c
$(MEDIASTREAMER_LIBS) \
$(ORTP_LIBS)
+test_ecc_SOURCES=test_ecc.c
+
+test_ecc_LDADD=liblinphone.la \
+ $(MEDIASTREAMER_LIBS) \
+ $(ORTP_LIBS)
+
+
+
AM_CFLAGS=$(STRICT_OPTIONS) -DIN_LINPHONE \
$(ORTP_CFLAGS) \
$(OSIP_CFLAGS) \
one_second_elapsed=TRUE;
}
+ if (lc->ecc!=NULL){
+ LinphoneEcCalibratorStatus ecs=ec_calibrator_get_status(lc->ecc);
+ if (ecs!=LinphoneEcCalibratorInProgress){
+ if (lc->ecc->cb)
+ lc->ecc->cb(lc,ecs,lc->ecc->delay,lc->ecc->cb_data);
+ if (ecs==LinphoneEcCalibratorDone){
+ lp_config_set_int(lc->config, "sound", "ec_delay",lc->ecc->delay);
+ }
+ ec_calibrator_destroy(lc->ecc);
+ lc->ecc=NULL;
+ }
+ }
+
if (lc->preview_finished){
lc->preview_finished=0;
ring_stop(lc->ringstream);
void linphone_core_use_sound_daemon(LinphoneCore *lc, LinphoneSoundDaemon *lsd);
void linphone_sound_daemon_destroy(LinphoneSoundDaemon *obj);
+/**
+ * Enum describing the result of the echo canceller calibration process.
+**/
+typedef enum {
+ LinphoneEcCalibratorInProgress,
+ LinphoneEcCalibratorDone,
+ LinphoneEcCalibratorFailed
+}LinphoneEcCalibratorStatus;
+
+
+typedef void (*LinphoneEcCalibrationCallback)(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms, void *data);
+
+/**
+ * Start an echo calibration of the sound devices, in order to find adequate settings for the echo canceller automatically.
+**/
+int linphone_core_start_echo_calibration(LinphoneCore *lc, LinphoneEcCalibrationCallback cb, void *cb_data);
+
#endif
#define _PRIVATE_H
#include "linphonecore.h"
+#include "linphonecore_utils.h"
#include "sal.h"
#ifdef HAVE_CONFIG_H
unsigned long video_window_id;
unsigned long preview_window_id;
time_t netup_time; /*time when network went reachable */
+ struct _EcCalibrator *ecc;
bool_t use_files;
bool_t apply_nat_settings;
bool_t initial_subscribes_sent;
#define linphone_core_ready(lc) ((lc)->state!=LinphoneGlobalStartup)
void _linphone_core_configure_resolver();
+struct _EcCalibrator{
+ ms_thread_t thread;
+ MSSndCard *play_card,*capt_card;
+ MSFilter *sndread,*det,*rec;
+ MSFilter *play, *gen, *sndwrite;
+ MSTicker *ticker;
+ LinphoneEcCalibrationCallback cb;
+ void *cb_data;
+ int recv_count;
+ int sent_count;
+ int64_t acc;
+ int delay;
+ LinphoneEcCalibratorStatus status;
+};
+
+typedef struct _EcCalibrator EcCalibrator;
+
+LinphoneEcCalibratorStatus ec_calibrator_get_status(EcCalibrator *ecc);
+
+void ec_calibrator_destroy(EcCalibrator *ecc);
+
#define HOLD_OFF (0)
#define HOLD_ON (1)
-Subproject commit dce5ac7d4dc8e298cdedd5dcef55c60d7485206e
+Subproject commit c5959fa4520005013cd14d2f773116f24f2eb7b7
-Subproject commit c8b487f32fe225f8b1961754db9140eb282a0d28
+Subproject commit 37c60a638fd108404ca437e2bbef78f227178450