mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-29 09:09:21 +00:00
Add done no echo state for the echo canceller.
This commit is contained in:
parent
85535d3456
commit
1442b46eea
3 changed files with 32 additions and 18 deletions
|
|
@ -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){
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue