]> sjero.net Git - linphone/commitdiff
Add done no echo state for the echo canceller.
authorGhislain MARY <ghislain.mary@belledonne-communications.com>
Fri, 12 Oct 2012 10:12:56 +0000 (12:12 +0200)
committerGhislain MARY <ghislain.mary@belledonne-communications.com>
Tue, 16 Oct 2012 13:03:03 +0000 (15:03 +0200)
coreapi/ec-calibrator.c
coreapi/linphonecore_utils.h
java/common/org/linphone/core/LinphoneCore.java

index ab3bc80ac87cbfc0bbfad8c3c7c3074d9c40dcec..7fb001d3de75554467c4ddc83de2c04bcbe46e87 100644 (file)
@@ -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){
index 9643856832fae7d3c4fce6ff24e0db0e527a748c..fadfc1a3608bb25cf559c39927ecba02b488ac61 100644 (file)
@@ -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;
 
 
index f2ad09b90cf024074db445ba5e9f037aa4aafd61..de1b4743cfa62364759969c8131cf26c2b9b677a 100644 (file)
@@ -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;