diff --git a/coreapi/ec-calibrator.c b/coreapi/ec-calibrator.c index ab3bc80ac..7fb001d3d 100644 --- a/coreapi/ec-calibrator.c +++ b/coreapi/ec-calibrator.c @@ -114,7 +114,6 @@ static void ecc_play_tones(EcCalibrator *ecc){ MSDtmfGenCustomTone tone; MSToneDetectorDef expected_tone; - ms_filter_set_notify_callback(ecc->det,on_tone_received,ecc); expected_tone.frequency=2000; @@ -142,20 +141,29 @@ static void ecc_play_tones(EcCalibrator *ecc){ ms_filter_call_method(ecc->gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone); ms_sleep(1); - if (ecc->sent_count==3 && ecc->recv_count==3){ - int delay=ecc->acc/3; - if (delay<0){ - ms_error("Quite surprising calibration result, delay=%i",delay); - ecc->status=LinphoneEcCalibratorFailed; - }else{ms_message("Echo calibration estimated delay to be %i ms",delay); - ecc->delay=delay; - ecc->status=LinphoneEcCalibratorDone; + if (ecc->sent_count==3) { + if (ecc->recv_count==3){ + int delay=ecc->acc/3; + if (delay<0){ + ms_error("Quite surprising calibration result, delay=%i",delay); + ecc->status=LinphoneEcCalibratorFailed; + }else{ + ms_message("Echo calibration estimated delay to be %i ms",delay); + ecc->delay=delay; + ecc->status=LinphoneEcCalibratorDone; + } + } else if (ecc->recv_count == 0) { + ms_message("Echo calibration succeeded, no echo has been detected"); + ecc->status = LinphoneEcCalibratorDoneNoEcho; + } else { + ecc->status = LinphoneEcCalibratorFailed; } }else{ - ms_error("Echo calibration failed, tones received = %i",ecc->recv_count); ecc->status=LinphoneEcCalibratorFailed; } - + if (ecc->status == LinphoneEcCalibratorFailed) { + ms_error("Echo calibration failed, tones received = %i",ecc->recv_count); + } } static void * ecc_thread(void *p){ diff --git a/coreapi/linphonecore_utils.h b/coreapi/linphonecore_utils.h index 964385683..fadfc1a36 100644 --- a/coreapi/linphonecore_utils.h +++ b/coreapi/linphonecore_utils.h @@ -56,9 +56,10 @@ void linphone_sound_daemon_destroy(LinphoneSoundDaemon *obj); * Enum describing the result of the echo canceller calibration process. **/ typedef enum { - LinphoneEcCalibratorInProgress, - LinphoneEcCalibratorDone, - LinphoneEcCalibratorFailed + LinphoneEcCalibratorInProgress, /**< The echo canceller calibration process is on going. */ + LinphoneEcCalibratorDone, /**< The echo canceller calibration has been performed and produced an echo delay measure. */ + LinphoneEcCalibratorFailed, /**< The echo canceller calibration process has failed. */ + LinphoneEcCalibratorDoneNoEcho /**< The echo canceller calibration has been performed and no echo has been detected. */ }LinphoneEcCalibratorStatus; diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index f2ad09b90..de1b4743c 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -234,18 +234,23 @@ public interface LinphoneCore { public static final int IN_PROGRESS_STATUS=0; public static final int DONE_STATUS=1; public static final int FAILED_STATUS=2; + public static final int DONE_NO_ECHO_STATUS=3; /** * Calibration in progress */ - static public EcCalibratorStatus InProgress = new EcCalibratorStatus(IN_PROGRESS_STATUS,"InProgress"); + static public EcCalibratorStatus InProgress = new EcCalibratorStatus(IN_PROGRESS_STATUS,"InProgress"); /** - * Calibration done + * Calibration done that produced an echo delay measure */ - static public EcCalibratorStatus Done = new EcCalibratorStatus(DONE_STATUS,"Done"); + static public EcCalibratorStatus Done = new EcCalibratorStatus(DONE_STATUS,"Done"); /** - * Calibration in progress + * Calibration failed */ static public EcCalibratorStatus Failed = new EcCalibratorStatus(FAILED_STATUS,"Failed"); + /** + * Calibration done with no echo detected + */ + static public EcCalibratorStatus DoneNoEcho = new EcCalibratorStatus(DONE_NO_ECHO_STATUS, "DoneNoEcho"); private final int mValue; private final String mStringValue;