Use echo limiter by default except for SGS II.
SGS II has a built in echo canceller.
This commit is contained in:
parent
81a6fa2a93
commit
13dbb00a77
5 changed files with 44 additions and 44 deletions
|
@ -99,7 +99,7 @@
|
||||||
<string name="no_phone_numbers">No phone numbers found for %s</string>
|
<string name="no_phone_numbers">No phone numbers found for %s</string>
|
||||||
<string name="filter_contacts">Filter contacts</string>
|
<string name="filter_contacts">Filter contacts</string>
|
||||||
<string name="title_numbers_dialog">%s\'s phone numbers</string>
|
<string name="title_numbers_dialog">%s\'s phone numbers</string>
|
||||||
<string name="pref_echo_canceller_calibration">Echo canceler calibration</string>
|
<string name="pref_echo_canceller_calibration">Echo canceller calibration</string>
|
||||||
<string name="pref_echo_limiter">Echo limiter</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_use_front_camera_title">Use front camera</string>
|
||||||
<string name="pref_video">Video</string>
|
<string name="pref_video">Video</string>
|
||||||
|
@ -187,7 +187,7 @@
|
||||||
<string name="error_cannot_invite_address">Cannot invite destination address [%s]</string>
|
<string name="error_cannot_invite_address">Cannot invite destination address [%s]</string>
|
||||||
|
|
||||||
<string name="notification_started">started</string>
|
<string name="notification_started">started</string>
|
||||||
<string name="pref_echo_cancellation_summary">Removes the echo heard by other end</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_limiter_summary">Removes the echo heard by other end (brute force method)</string>
|
||||||
<string name="pref_stun_server">Stun server</string>
|
<string name="pref_stun_server">Stun server</string>
|
||||||
<string name="ec_calibrating">Calibrating...</string>
|
<string name="ec_calibrating">Calibrating...</string>
|
||||||
|
|
|
@ -41,14 +41,15 @@
|
||||||
|
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/pref_audio">
|
<PreferenceCategory android:title="@string/pref_audio">
|
||||||
<CheckBoxPreference android:key="@string/pref_echo_cancellation_key" android:defaultValue="true"
|
<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>
|
android:title="@string/pref_echo_cancellation" android:summary="@string/pref_echo_cancellation_summary"></CheckBoxPreference>
|
||||||
|
|
||||||
<CheckBoxPreference android:key="@string/pref_echo_canceller_calibration_key"
|
<CheckBoxPreference android:key="@string/pref_echo_canceller_calibration_key"
|
||||||
android:title="@string/pref_echo_canceller_calibration" />
|
android:title="@string/pref_echo_canceller_calibration" />
|
||||||
<CheckBoxPreference android:key="@string/pref_echo_limiter_key"
|
|
||||||
android:title="@string/pref_echo_limiter" android:summary="@string/pref_echo_limiter_summary"/>
|
|
||||||
|
|
||||||
<PreferenceScreen android:title="@string/pref_codecs" android:key="@string/pref_codecs_key">
|
<PreferenceScreen android:title="@string/pref_codecs" android:key="@string/pref_codecs_key">
|
||||||
<CheckBoxPreference android:key="@string/pref_codec_speex16_key"
|
<CheckBoxPreference android:key="@string/pref_codec_speex16_key"
|
||||||
android:title="@string/pref_codec_speex16"/>
|
android:title="@string/pref_codec_speex16"/>
|
||||||
|
|
|
@ -21,15 +21,12 @@ package org.linphone;
|
||||||
|
|
||||||
import static android.content.Intent.ACTION_MAIN;
|
import static android.content.Intent.ACTION_MAIN;
|
||||||
|
|
||||||
import org.linphone.LinphoneManager.EcCalibrationListener;
|
|
||||||
import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener;
|
import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener;
|
||||||
import org.linphone.core.CallDirection;
|
import org.linphone.core.CallDirection;
|
||||||
import org.linphone.core.LinphoneCall;
|
import org.linphone.core.LinphoneCall;
|
||||||
import org.linphone.core.LinphoneCore;
|
import org.linphone.core.LinphoneCore;
|
||||||
import org.linphone.core.LinphoneCoreException;
|
|
||||||
import org.linphone.core.Log;
|
import org.linphone.core.Log;
|
||||||
import org.linphone.core.LinphoneCall.State;
|
import org.linphone.core.LinphoneCall.State;
|
||||||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
|
||||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||||
import org.linphone.mediastream.Version;
|
import org.linphone.mediastream.Version;
|
||||||
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
||||||
|
@ -138,20 +135,19 @@ public class LinphoneActivity extends TabActivity implements
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case FIRST_LOGIN_ACTIVITY:
|
case FIRST_LOGIN_ACTIVITY:
|
||||||
if (resultCode == RESULT_OK) {
|
if (resultCode == RESULT_OK) {
|
||||||
Toast.makeText(this, getString(R.string.ec_calibration_launch_message), Toast.LENGTH_LONG).show();
|
// Toast.makeText(this, getString(R.string.ec_calibration_launch_message), Toast.LENGTH_LONG).show();
|
||||||
try {
|
// try {
|
||||||
LinphoneManager.getInstance().startEcCalibration(new EcCalibrationListener() {
|
// LinphoneManager.getInstance().startEcCalibration(new EcCalibrationListener() {
|
||||||
public void onEcCalibrationStatus(EcCalibratorStatus status, int delayMs) {
|
// public void onEcCalibrationStatus(EcCalibratorStatus status, int delayMs) {
|
||||||
PreferenceManager.getDefaultSharedPreferences(LinphoneActivity.this)
|
// PreferenceManager.getDefaultSharedPreferences(LinphoneActivity.this)
|
||||||
.edit().putBoolean(
|
// .edit().putBoolean(
|
||||||
getString(R.string.pref_echo_canceller_calibration_key),
|
// getString(R.string.pref_echo_canceller_calibration_key),
|
||||||
status == EcCalibratorStatus.Done).commit();
|
// status == EcCalibratorStatus.Done).commit();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
} catch (LinphoneCoreException e) {
|
// } catch (LinphoneCoreException e) {
|
||||||
Log.e(e, "Unable to calibrate EC");
|
// Log.e(e, "Unable to calibrate EC");
|
||||||
}
|
// }
|
||||||
|
|
||||||
fillTabHost();
|
fillTabHost();
|
||||||
} else {
|
} else {
|
||||||
finish();
|
finish();
|
||||||
|
|
|
@ -230,7 +230,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
public void routeAudioToSpeaker() {
|
public void routeAudioToSpeaker() {
|
||||||
routeAudioToSpeakerHelper(true);
|
routeAudioToSpeakerHelper(true);
|
||||||
LinphoneCall currentCall = mLc.getCurrentCall();
|
LinphoneCall currentCall = mLc.getCurrentCall();
|
||||||
if (currentCall != null) {
|
if (currentCall != null && !Hacks.hasBuiltInEchoCanceller()) {
|
||||||
/*disable EC, it is not efficient enough on speaker mode due to bad quality of speakers and saturation*/
|
/*disable EC, it is not efficient enough on speaker mode due to bad quality of speakers and saturation*/
|
||||||
currentCall.enableEchoCancellation(false);
|
currentCall.enableEchoCancellation(false);
|
||||||
/* instead we prefer the echo limiter */
|
/* instead we prefer the echo limiter */
|
||||||
|
@ -243,13 +243,11 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
*/
|
*/
|
||||||
public void routeAudioToReceiver() {
|
public void routeAudioToReceiver() {
|
||||||
routeAudioToSpeakerHelper(false);
|
routeAudioToSpeakerHelper(false);
|
||||||
if (mLc.isIncall()) {
|
LinphoneCall call=mLc.getCurrentCall();
|
||||||
|
if (call!=null && !Hacks.hasBuiltInEchoCanceller()) {
|
||||||
//Restore default value
|
//Restore default value
|
||||||
LinphoneCall call=mLc.getCurrentCall();
|
call.enableEchoCancellation(mLc.isEchoCancellationEnabled());
|
||||||
if (call!=null){
|
call.enableEchoLimiter(mLc.isEchoLimiterEnabled());
|
||||||
call.enableEchoCancellation(mLc.isEchoCancellationEnabled());
|
|
||||||
call.enableEchoLimiter(mLc.isEchoLimiterEnabled());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,16 +512,16 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
enableDisableAudioCodec("SILK", 12000, R.string.pref_codec_silk12_key);
|
enableDisableAudioCodec("SILK", 12000, R.string.pref_codec_silk12_key);
|
||||||
enableDisableAudioCodec("SILK", 8000, R.string.pref_codec_silk8_key);
|
enableDisableAudioCodec("SILK", 8000, R.string.pref_codec_silk8_key);
|
||||||
|
|
||||||
|
|
||||||
// Configure video codecs
|
// Configure video codecs
|
||||||
for (PayloadType videoCodec : mLc.getVideoCodecs()) {
|
for (PayloadType videoCodec : mLc.getVideoCodecs()) {
|
||||||
enableDisableVideoCodecs(videoCodec);
|
enableDisableVideoCodecs(videoCodec);
|
||||||
}
|
}
|
||||||
boolean use_ec=mPref.getBoolean(getString(R.string.pref_echo_cancellation_key),false);
|
|
||||||
boolean use_el=mPref.getBoolean(getString(R.string.pref_echo_limiter_key),false);
|
boolean useEC = getPrefBoolean(R.string.pref_echo_cancellation_key, false);
|
||||||
mLc.enableEchoCancellation(use_ec);
|
boolean useEL = getPrefBoolean(R.string.pref_echo_limiter_key, false);
|
||||||
mLc.enableEchoLimiter(use_el);
|
mLc.enableEchoCancellation(useEC);
|
||||||
|
mLc.enableEchoLimiter(useEL);
|
||||||
} catch (LinphoneCoreException e) {
|
} catch (LinphoneCoreException e) {
|
||||||
throw new LinphoneConfigException(getString(R.string.wrong_settings),e);
|
throw new LinphoneConfigException(getString(R.string.wrong_settings),e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ package org.linphone;
|
||||||
|
|
||||||
|
|
||||||
import static org.linphone.R.string.ec_calibrating;
|
import static org.linphone.R.string.ec_calibrating;
|
||||||
import static org.linphone.R.string.ec_calibration_launch_message;
|
|
||||||
import static org.linphone.R.string.pref_codec_amr_key;
|
import static org.linphone.R.string.pref_codec_amr_key;
|
||||||
import static org.linphone.R.string.pref_codec_ilbc_key;
|
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_codec_speex16_key;
|
||||||
|
@ -55,7 +54,6 @@ import android.preference.Preference;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
import android.preference.Preference.OnPreferenceChangeListener;
|
import android.preference.Preference.OnPreferenceChangeListener;
|
||||||
import android.preference.Preference.OnPreferenceClickListener;
|
import android.preference.Preference.OnPreferenceClickListener;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
public class LinphonePreferencesActivity extends PreferenceActivity implements EcCalibrationListener {
|
public class LinphonePreferencesActivity extends PreferenceActivity implements EcCalibrationListener {
|
||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
|
@ -129,22 +127,29 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E
|
||||||
} else if (!AndroidCameraConfiguration.hasFrontCamera()) {
|
} else if (!AndroidCameraConfiguration.hasFrontCamera()) {
|
||||||
uncheckDisableAndHideCheckbox(R.string.pref_video_use_front_camera_key);
|
uncheckDisableAndHideCheckbox(R.string.pref_video_use_front_camera_key);
|
||||||
}
|
}
|
||||||
if (prefs().getBoolean(LinphoneActivity.PREF_FIRST_LAUNCH,true)) {
|
|
||||||
if (fastCpu) {
|
|
||||||
Toast.makeText(this, getString(ec_calibration_launch_message), Toast.LENGTH_LONG).show();
|
|
||||||
startEcCalibration();
|
|
||||||
}
|
|
||||||
|
|
||||||
prefs().edit().putBoolean(LinphoneActivity.PREF_FIRST_LAUNCH, false).commit();
|
if (prefs().getBoolean(LinphoneActivity.PREF_FIRST_LAUNCH,true)) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
detectVideoCodec(R.string.pref_video_codec_h264_key, "H264");
|
detectVideoCodec(R.string.pref_video_codec_h264_key, "H264");
|
||||||
|
|
||||||
addEchoPrefsListener();
|
addEchoPrefsListener();
|
||||||
|
|
||||||
if (Hacks.needSoftvolume()) checkAndDisableCheckbox(R.string.pref_audio_soft_volume_key);
|
if (Hacks.needSoftvolume()) checkAndDisableCheckbox(R.string.pref_audio_soft_volume_key);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doOnFirstLaunch() {
|
||||||
|
manageCheckbox(R.string.pref_echo_limiter_key, !Hacks.hasBuiltInEchoCanceller(), true, false);
|
||||||
|
prefs().edit().putBoolean(LinphoneActivity.PREF_FIRST_LAUNCH, false).commit();
|
||||||
|
}
|
||||||
|
|
||||||
private void initializeMediaEncryptionPreferences() {
|
private void initializeMediaEncryptionPreferences() {
|
||||||
LinphoneCore lc=LinphoneManager.getLc();
|
LinphoneCore lc=LinphoneManager.getLc();
|
||||||
|
|
Loading…
Reference in a new issue