echo cancellation improvemnents:

- use echo limiter always on !armv7
- enable echo cancellation by default
- toggle speaker mode on during video calls
This commit is contained in:
Simon Morlat 2011-09-05 16:40:47 +02:00
parent dde4bffacc
commit 83cb74e6b7
7 changed files with 39 additions and 21 deletions

View file

@ -33,10 +33,12 @@ capture_dev_id=ANDROID SND: Android Sound card
remote_ring=/data/data/org.linphone/files/ringback.wav
local_ring=/data/data/org.linphone/files/oldphone_mono.wav
ec_tail_len=120
ec_framesize=128
el_type=mic
el_thres=0.05
el_force=100000
el_sustain=200
el_sustain=600
el_transmit_thres=1.7
ng_floorgain=0.01

View file

@ -41,7 +41,7 @@
<PreferenceCategory android:title="@string/pref_audio">
<CheckBoxPreference android:key="@string/pref_echo_cancellation_key"
<CheckBoxPreference android:key="@string/pref_echo_cancellation_key" android:defaultValue="true"
android:title="@string/pref_echo_cancellation" android:summary="@string/pref_echo_cancellation_summary"></CheckBoxPreference>
<CheckBoxPreference android:key="@string/pref_echo_canceller_calibration_key"

View file

@ -450,9 +450,7 @@ public class DialerActivity extends SoftVolumeActivity implements LinphoneGuiLis
if (LinphoneService.isReady()) {
mStatus.setText(LinphoneManager.getInstance().getLastLcStatusMessage());
}
super.onResume();
}
}

View file

@ -139,7 +139,7 @@ public class LinphoneActivity extends TabActivity {
if (pref.getBoolean(PREF_FIRST_LAUNCH, true)) {
onFirstLaunch();
} else if (!pref.getBoolean(PREF_CHECK_CONFIG, false)
&& !checkDefined(pref, R.string.pref_username_key, R.string.pref_passwd_key, R.string.pref_domain_key)) {
&& !checkDefined(pref, R.string.pref_username_key, R.string.pref_domain_key)) {
onBadSettings(pref);
} else {
checkAccount = false;
@ -502,6 +502,7 @@ public class LinphoneActivity extends TabActivity {
}
public void startVideoActivity() {
mHandler.post(new Runnable() {
public void run() {
startActivityForResult(new Intent().setClass(
@ -510,7 +511,7 @@ public class LinphoneActivity extends TabActivity {
video_activity);
}
});
LinphoneManager.getInstance().routeAudioToSpeaker();
}
public void finishVideoActivity() {

View file

@ -181,8 +181,9 @@ public final class LinphoneManager implements LinphoneCoreListener {
public void routeAudioToSpeaker() {
routeAudioToSpeakerHelper(true);
if (mLc.isIncall()) {
/*disable EC*/
/*disable EC, it is not efficient enough on speaker mode due to bad quality of speakers and saturation*/
mLc.getCurrentCall().enableEchoCancellation(false);
/* instead we prefer the echo limiter */
mLc.getCurrentCall().enableEchoLimiter(true);
}
@ -192,8 +193,13 @@ public final class LinphoneManager implements LinphoneCoreListener {
routeAudioToSpeakerHelper(false);
if (mLc.isIncall()) {
//Restore default value
if (Version.isArmv7()){
mLc.getCurrentCall().enableEchoCancellation(mLc.isEchoCancellationEnabled());
mLc.getCurrentCall().enableEchoLimiter(false);
}else{
mLc.getCurrentCall().enableEchoCancellation(false);
mLc.getCurrentCall().enableEchoLimiter(mLc.isEchoCancellationEnabled());
}
}
}
@ -436,9 +442,14 @@ public final class LinphoneManager implements LinphoneCoreListener {
for (PayloadType videoCodec : mLc.getVideoCodecs()) {
enableDisableVideoCodecs(videoCodec);
}
mLc.enableEchoCancellation(mPref.getBoolean(getString(R.string.pref_echo_cancellation_key),false));
boolean use_ec=mPref.getBoolean(getString(R.string.pref_echo_cancellation_key),false);
if (Version.isArmv7()){
mLc.enableEchoCancellation(use_ec);
mLc.enableEchoLimiter(false);
}else{
mLc.enableEchoCancellation(false);
mLc.enableEchoLimiter(false);
}
} catch (LinphoneCoreException e) {
throw new LinphoneConfigException(getString(R.string.wrong_settings),e);
}
@ -451,9 +462,10 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
String lPasswd = mPref.getString(getString(R.string.pref_passwd_key), null);
if (lPasswd == null || lPasswd.length()==0) {
throw new LinphoneConfigException(getString(R.string.wrong_passwd));
}
// we have the right of having no password
//if (lPasswd == null || lPasswd.length()==0) {
// throw new LinphoneConfigException(getString(R.string.wrong_passwd));
//}
String lDomain = mPref.getString(getString(R.string.pref_domain_key), null);
if (lDomain == null || lDomain.length()==0) {
@ -468,8 +480,10 @@ public final class LinphoneManager implements LinphoneCoreListener {
//auth
mLc.clearAuthInfos();
if (lPasswd!=null && lPasswd.length()>0){
LinphoneAuthInfo lAuthInfo = LinphoneCoreFactory.instance().createAuthInfo(lUserName, lPasswd,null);
mLc.addAuthInfo(lAuthInfo);
}
//proxy
@ -841,8 +855,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
Editor e = mPref.edit();
boolean fastCpu = Version.isArmv7();
e.putBoolean(getString(pref_echo_cancellation_key), fastCpu);
e.putBoolean(getString(R.string.pref_codec_gsm_key), true);
e.putBoolean(getString(R.string.pref_codec_pcma_key), true);
e.putBoolean(getString(R.string.pref_codec_pcmu_key), true);

View file

@ -103,6 +103,7 @@ class LinphoneCoreImpl implements LinphoneCore {
private native void setUploadPtime(long nativePtr, int ptime);
private native void setDownloadPtime(long nativePtr, int ptime);
private native void setZrtpSecretsCache(long nativePtr, String file);
private native void enableEchoLimiter(long nativePtr2, boolean val);
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
mListener=listener;
@ -503,4 +504,8 @@ class LinphoneCoreImpl implements LinphoneCore {
public synchronized void setZrtpSecretsCache(String file) {
setZrtpSecretsCache(nativePtr,file);
}
public void enableEchoLimiter(boolean val) {
enableEchoLimiter(nativePtr,val);
}
}

@ -1 +1 @@
Subproject commit 20709fc5f1b06c04f2311e1f6ec4ff45f76f4de8
Subproject commit fba8726ff8acfb71ee1588e664476d6590015f50