Use echo canceller.
This commit is contained in:
parent
b4576a0036
commit
ce4ec82a7d
7 changed files with 38 additions and 68 deletions
|
@ -29,9 +29,9 @@ video_jitt_comp=60
|
|||
nortp_timeout=30
|
||||
|
||||
[sound]
|
||||
playback_dev_id=ANDROID SND: Android Sound card
|
||||
ringer_dev_id=ANDROID SND: Android Sound card
|
||||
capture_dev_id=ANDROID SND: Android Sound card
|
||||
playback_dev_id=
|
||||
ringer_dev_id=
|
||||
capture_dev_id=
|
||||
remote_ring=/data/data/org.linphone/files/ringback.wav
|
||||
local_ring=/data/data/org.linphone/files/oldphone_mono.wav
|
||||
ec_tail_len=120
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
<string name="pref_transport_use_standard_ports_key">pref_transport_use_standard_ports_key</string>
|
||||
|
||||
<string name="pref_echo_canceller_calibration_key">pref_echo_canceller_calibration_key</string>
|
||||
<string name="pref_echo_limiter_key">pref_echo_limiter_key</string>
|
||||
<string name="pref_prefix_key">pref_prefix_key</string>
|
||||
<string name="pref_proxy_key">pref_proxy_key</string>
|
||||
<string name="pref_domain_key">pref_domain_key</string>
|
||||
|
|
|
@ -120,7 +120,6 @@
|
|||
<string name="pref_delete_account">Delete this account</string>
|
||||
<string name="pref_default_account_title">Use as default</string>
|
||||
<string name="pref_echo_canceller_calibration">Echo canceller calibration</string>
|
||||
<string name="pref_echo_limiter">Echo limiter</string>
|
||||
<string name="pref_video_use_front_camera_title">Use front camera</string>
|
||||
<string name="pref_video">Video</string>
|
||||
<string name="pref_preferences">Preferences</string>
|
||||
|
@ -211,11 +210,11 @@
|
|||
<string name="error_cannot_invite_address">Cannot invite destination address [%s]</string>
|
||||
|
||||
<string name="notification_started">started</string>
|
||||
<string name="pref_echo_cancellation_summary">Removes the echo heard by other end (not recommended)</string>
|
||||
<string name="pref_echo_limiter_summary">Removes the echo heard by other end (brute force method)</string>
|
||||
<string name="pref_echo_cancellation_summary">Removes the echo heard by other end</string>
|
||||
<string name="pref_stun_server">Stun server</string>
|
||||
<string name="ec_calibrating">Calibrating...</string>
|
||||
<string name="ec_calibrated">Calibrated [%s ms]</string>
|
||||
<string name="no_echo">No echo</string>
|
||||
<string name="failed">failed</string>
|
||||
<string name="first_login_explanation">Enter your username and password to connect to the service.</string>
|
||||
<string name="first_login_username">Username</string>
|
||||
|
|
|
@ -56,13 +56,10 @@
|
|||
|
||||
|
||||
<PreferenceCategory android:title="@string/pref_audio">
|
||||
<CheckBoxPreference android:key="@string/pref_echo_limiter_key"
|
||||
android:title="@string/pref_echo_limiter" android:summary="@string/pref_echo_limiter_summary"/>
|
||||
|
||||
<CheckBoxPreference android:key="@string/pref_echo_cancellation_key" android:defaultValue="false"
|
||||
android:title="@string/pref_echo_cancellation" android:summary="@string/pref_echo_cancellation_summary"></CheckBoxPreference>
|
||||
|
||||
<CheckBoxPreference android:key="@string/pref_echo_canceller_calibration_key"
|
||||
<Preference android:key="@string/pref_echo_canceller_calibration_key"
|
||||
android:title="@string/pref_echo_canceller_calibration" />
|
||||
|
||||
<PreferenceScreen android:title="@string/pref_codecs" android:key="@string/pref_codecs_key">
|
||||
|
|
|
@ -21,14 +21,18 @@ package org.linphone;
|
|||
|
||||
import static android.content.Intent.ACTION_MAIN;
|
||||
|
||||
import org.linphone.LinphoneManager.EcCalibrationListener;
|
||||
import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener;
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.Log;
|
||||
import org.linphone.mediastream.Version;
|
||||
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.TabActivity;
|
||||
|
@ -148,19 +152,25 @@ public class LinphoneActivity extends TabActivity implements ContactPicked
|
|||
switch (requestCode) {
|
||||
case FIRST_LOGIN_ACTIVITY:
|
||||
if (resultCode == RESULT_OK) {
|
||||
// Toast.makeText(this, getString(R.string.ec_calibration_launch_message), Toast.LENGTH_LONG).show();
|
||||
// try {
|
||||
// LinphoneManager.getInstance().startEcCalibration(new EcCalibrationListener() {
|
||||
// public void onEcCalibrationStatus(EcCalibratorStatus status, int delayMs) {
|
||||
// PreferenceManager.getDefaultSharedPreferences(LinphoneActivity.this)
|
||||
// .edit().putBoolean(
|
||||
// getString(R.string.pref_echo_canceller_calibration_key),
|
||||
// status == EcCalibratorStatus.Done).commit();
|
||||
// }
|
||||
// });
|
||||
// } catch (LinphoneCoreException e) {
|
||||
// Log.e(e, "Unable to calibrate EC");
|
||||
// }
|
||||
if (!Hacks.hasBuiltInEchoCanceller()) {
|
||||
Toast.makeText(this, getString(R.string.ec_calibration_launch_message), Toast.LENGTH_LONG).show();
|
||||
try {
|
||||
LinphoneManager.getInstance().startEcCalibration(new EcCalibrationListener() {
|
||||
public void onEcCalibrationStatus(EcCalibratorStatus status, int delayMs) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(LinphoneActivity.this);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
if (status == EcCalibratorStatus.DoneNoEcho) {
|
||||
editor.putBoolean(getString(R.string.pref_echo_cancellation_key), false);
|
||||
} else if ((status == EcCalibratorStatus.Done) || (status == EcCalibratorStatus.Failed)) {
|
||||
editor.putBoolean(getString(R.string.pref_echo_cancellation_key), true);
|
||||
}
|
||||
editor.commit();
|
||||
}
|
||||
});
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e(e, "Unable to calibrate EC");
|
||||
}
|
||||
}
|
||||
fillTabHost();
|
||||
} else {
|
||||
finish();
|
||||
|
|
|
@ -605,9 +605,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
}
|
||||
|
||||
boolean useEC = getPrefBoolean(R.string.pref_echo_cancellation_key, false);
|
||||
boolean useEL = getPrefBoolean(R.string.pref_echo_limiter_key, false);
|
||||
mLc.enableEchoCancellation(useEC);
|
||||
mLc.enableEchoLimiter(useEL);
|
||||
} catch (LinphoneCoreException e) {
|
||||
throw new LinphoneConfigException(getString(R.string.wrong_settings),e);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import static org.linphone.R.string.pref_codec_ilbc_key;
|
|||
import static org.linphone.R.string.pref_codec_speex16_key;
|
||||
import static org.linphone.R.string.pref_echo_cancellation_key;
|
||||
import static org.linphone.R.string.pref_echo_canceller_calibration_key;
|
||||
import static org.linphone.R.string.pref_echo_limiter_key;
|
||||
import static org.linphone.R.string.pref_media_encryption_key;
|
||||
import static org.linphone.R.string.pref_video_enable_key;
|
||||
|
||||
|
@ -76,8 +75,7 @@ import de.timroes.axmlrpc.XMLRPCServerException;
|
|||
|
||||
public class LinphonePreferencesActivity extends PreferenceActivity implements EcCalibrationListener {
|
||||
private Handler mHandler = new Handler();
|
||||
private CheckBoxPreference ecCalibratePref;
|
||||
private CheckBoxPreference elPref;
|
||||
private Preference ecCalibratePref;
|
||||
private CheckBoxPreference ecPref;
|
||||
private ListPreference mencPref;
|
||||
private int nbAccounts = 1;
|
||||
|
@ -597,7 +595,7 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E
|
|||
|
||||
addTransportChecboxesListener();
|
||||
|
||||
ecCalibratePref = (CheckBoxPreference) findPreference(pref_echo_canceller_calibration_key);
|
||||
ecCalibratePref = findPreference(pref_echo_canceller_calibration_key);
|
||||
ecCalibratePref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
startEcCalibration();
|
||||
|
@ -605,7 +603,6 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E
|
|||
}
|
||||
});
|
||||
ecPref = (CheckBoxPreference) findPreference(pref_echo_cancellation_key);
|
||||
elPref = (CheckBoxPreference) findPreference(pref_echo_limiter_key);
|
||||
mencPref = (ListPreference) findPreference(pref_media_encryption_key);
|
||||
|
||||
boolean fastCpu = Version.isArmv7();
|
||||
|
@ -614,7 +611,6 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E
|
|||
findPreference(pref_codec_speex16_key).setEnabled(true);
|
||||
//findPreference(pref_codec_speex32_key)).setEnabled(enableIlbc);
|
||||
}
|
||||
findPreference(pref_echo_limiter_key).setEnabled(true);
|
||||
|
||||
initializeMediaEncryptionPreferences();
|
||||
|
||||
|
@ -637,9 +633,8 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E
|
|||
doOnFirstLaunch();
|
||||
}
|
||||
if (Hacks.hasBuiltInEchoCanceller()) {
|
||||
uncheckDisableAndHideCheckbox(R.string.pref_echo_limiter_key);
|
||||
uncheckDisableAndHideCheckbox(R.string.pref_echo_cancellation_key);
|
||||
uncheckDisableAndHideCheckbox(R.string.pref_echo_canceller_calibration_key);
|
||||
findPreference(R.string.pref_echo_canceller_calibration_key).setLayoutResource(R.layout.hidden);
|
||||
}
|
||||
|
||||
|
||||
|
@ -651,10 +646,6 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E
|
|||
findPreference(R.string.pref_video_codec_h264_key).setDefaultValue(false);
|
||||
}
|
||||
|
||||
addEchoPrefsListener();
|
||||
|
||||
if (Hacks.needSoftvolume()) checkAndDisableCheckbox(R.string.pref_audio_soft_volume_key);
|
||||
|
||||
if (!LinphoneManager.getLc().isTunnelAvailable()){
|
||||
hidePreferenceCategory(R.string.pref_tunnel_key);
|
||||
}
|
||||
|
@ -677,7 +668,6 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E
|
|||
}
|
||||
|
||||
private void doOnFirstLaunch() {
|
||||
manageCheckbox(R.string.pref_echo_limiter_key, !Hacks.hasBuiltInEchoCanceller(), true, false);
|
||||
prefs().edit().putBoolean(LinphoneActivity.PREF_FIRST_LAUNCH, false).commit();
|
||||
}
|
||||
|
||||
|
@ -711,29 +701,6 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E
|
|||
}
|
||||
}
|
||||
|
||||
private void addEchoPrefsListener(){
|
||||
OnPreferenceChangeListener ec_listener=new OnPreferenceChangeListener(){
|
||||
public boolean onPreferenceChange(Preference arg0, Object newValue) {
|
||||
Boolean val=(Boolean)newValue;
|
||||
if (val){
|
||||
elPref.setChecked(!val);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
OnPreferenceChangeListener el_listener=new OnPreferenceChangeListener(){
|
||||
public boolean onPreferenceChange(Preference arg0, Object newValue) {
|
||||
Boolean val=(Boolean)newValue;
|
||||
if (val){
|
||||
ecPref.setChecked(!val);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
ecPref.setOnPreferenceChangeListener(ec_listener);
|
||||
elPref.setOnPreferenceChangeListener(el_listener);
|
||||
}
|
||||
|
||||
private void addTransportChecboxesListener() {
|
||||
|
||||
final List<CheckBoxPreference> checkboxes = Arrays.asList(
|
||||
|
@ -801,15 +768,15 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E
|
|||
|
||||
mHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
if (status == EcCalibratorStatus.Done) {
|
||||
if (status == EcCalibratorStatus.DoneNoEcho) {
|
||||
ecCalibratePref.setSummary(R.string.no_echo);
|
||||
ecPref.setChecked(false);
|
||||
} else if (status == EcCalibratorStatus.Done) {
|
||||
ecCalibratePref.setSummary(String.format(getString(R.string.ec_calibrated), delayMs));
|
||||
ecCalibratePref.setChecked(true);
|
||||
|
||||
ecPref.setChecked(true);
|
||||
} else if (status == EcCalibratorStatus.Failed) {
|
||||
ecCalibratePref.setSummary(R.string.failed);
|
||||
ecCalibratePref.setChecked(false);
|
||||
elPref.setChecked(true);
|
||||
ecPref.setChecked(false);
|
||||
ecPref.setChecked(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue