echo calibrator ready

This commit is contained in:
Simon Morlat 2011-01-24 15:58:24 +01:00
parent 703e455e34
commit 3302d8c1ea
6 changed files with 66 additions and 4 deletions

View file

@ -35,7 +35,8 @@ liblinphone_la_SOURCES=\
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
@ -49,7 +50,7 @@ if BUILD_WIN32
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
@ -57,6 +58,14 @@ test_lsd_LDADD=liblinphone.la \
$(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) \

View file

@ -1635,6 +1635,19 @@ void linphone_core_iterate(LinphoneCore *lc){
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);

View file

@ -49,4 +49,21 @@ void linphone_sound_daemon_release_all_players(LinphoneSoundDaemon *obj);
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

View file

@ -26,6 +26,7 @@
#define _PRIVATE_H
#include "linphonecore.h"
#include "linphonecore_utils.h"
#include "sal.h"
#ifdef HAVE_CONFIG_H
@ -424,6 +425,7 @@ struct _LinphoneCore
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;
@ -451,6 +453,27 @@ bool_t linphone_core_is_payload_type_usable_for_bandwidth(LinphoneCore *lc, Payl
#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)

@ -1 +1 @@
Subproject commit dce5ac7d4dc8e298cdedd5dcef55c60d7485206e
Subproject commit c5959fa4520005013cd14d2f773116f24f2eb7b7

2
oRTP

@ -1 +1 @@
Subproject commit c8b487f32fe225f8b1961754db9140eb282a0d28
Subproject commit 37c60a638fd108404ca437e2bbef78f227178450