add EC support
This commit is contained in:
parent
ac7944f668
commit
eff3e2ad25
11 changed files with 44 additions and 14 deletions
Binary file not shown.
|
@ -30,5 +30,6 @@ ringer_dev_id=ANDROID SND: Android Sound card
|
|||
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_delay=200
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="pref_echo_cancellation">Echo cancellation</string>
|
||||
<string name="pref_echo_cancellation_key">pref_echo_cancellation_key</string>
|
||||
<string name="pref_handle_outcall_summarry">If set cellular call are redirected to voip when possible</string>
|
||||
<string name="pref_handle_outcall">Redirect cellular calls</string>
|
||||
<string name="pref_handle_outcall_key">pref_handle_outcall_key</string>
|
||||
|
@ -21,6 +23,7 @@
|
|||
<string name="pref_codec_speex8_key">pref_codec_speex8_key</string>
|
||||
<string name="pref_codec_speex16">speex 16 Khz</string>
|
||||
<string name="pref_codec_speex16_key">pref_codec_speex16_key</string>
|
||||
<string name="pref_codec_speex32_key">pref_codec_speex32_key</string>
|
||||
<string name="pref_codecs">Codecs</string>
|
||||
<string name="pref_codecs_key">pref_codecs_key</string>
|
||||
<string name="place_call_chooser">Place a call</string>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<CheckBoxPreference android:key="@string/pref_codec_pcma_key"
|
||||
android:title="@string/pref_codec_pcma" android:defaultValue="true"></CheckBoxPreference>
|
||||
</PreferenceScreen><CheckBoxPreference android:title="@string/pref_autostart" android:defaultValue="true" android:key="@string/pref_autostart_key"></CheckBoxPreference>
|
||||
<CheckBoxPreference android:title="@string/pref_handle_outcall" android:key="@string/pref_handle_outcall_key" android:summary="@string/pref_handle_outcall_summarry"></CheckBoxPreference><EditTextPreference android:title="@string/pref_prefix"
|
||||
<CheckBoxPreference android:title="@string/pref_handle_outcall" android:key="@string/pref_handle_outcall_key" android:summary="@string/pref_handle_outcall_summarry"></CheckBoxPreference><CheckBoxPreference android:key="@string/pref_echo_cancellation_key" android:title="@string/pref_echo_cancellation"></CheckBoxPreference><EditTextPreference android:title="@string/pref_prefix"
|
||||
android:key="@string/pref_prefix_key"></EditTextPreference>
|
||||
|
||||
<CheckBoxPreference android:key="@string/pref_debug_key"
|
||||
|
@ -34,6 +34,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
|
|
@ -399,7 +399,6 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
|||
newOutgoingCall(getIntent().getData().toString().substring("tel://".length()));
|
||||
getIntent().setData(null);
|
||||
}
|
||||
|
||||
} else if (state == GeneralState.GSTATE_REG_OK) {
|
||||
//nop
|
||||
} else if (state == GeneralState.GSTATE_CALL_OUT_INVITE) {
|
||||
|
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
package org.linphone;
|
||||
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.util.Log;
|
||||
|
|
|
@ -43,9 +43,9 @@ import android.app.Service;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.preference.PreferenceManager;
|
||||
|
@ -111,7 +111,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
|
|||
, LINPHONE_FACTORY_RC
|
||||
, null);
|
||||
|
||||
mLinphoneCore.setSoftPlayLevel(3);
|
||||
mLinphoneCore.setPlaybackGain(3);
|
||||
|
||||
try {
|
||||
initFromConf();
|
||||
|
@ -317,7 +317,12 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
|
|||
}
|
||||
|
||||
//codec config
|
||||
PayloadType lPt = mLinphoneCore.findPayloadType("speex", 16000);
|
||||
PayloadType lPt = mLinphoneCore.findPayloadType("speex", 32000);
|
||||
if (lPt !=null) {
|
||||
boolean enable= mPref.getBoolean(getString(R.string.pref_codec_speex32_key),false);
|
||||
mLinphoneCore.enablePayloadType(lPt, enable);
|
||||
}
|
||||
lPt = mLinphoneCore.findPayloadType("speex", 16000);
|
||||
if (lPt !=null) {
|
||||
boolean enable= mPref.getBoolean(getString(R.string.pref_codec_speex16_key),false);
|
||||
mLinphoneCore.enablePayloadType(lPt, enable);
|
||||
|
@ -343,6 +348,12 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
|
|||
mLinphoneCore.enablePayloadType(lPt, enable);
|
||||
}
|
||||
|
||||
if (!mPref.contains(getString(R.string.pref_echo_cancellation_key)) && Integer.parseInt(Build.VERSION.SDK) > 4 /*donuts*/) {
|
||||
mPref.edit().putBoolean(getString(R.string.pref_echo_cancellation_key), true).commit();
|
||||
}
|
||||
|
||||
mLinphoneCore.enableEchoCancellation(mPref.getBoolean(getString(R.string.pref_echo_cancellation_key),false));
|
||||
|
||||
//init network state
|
||||
ConnectivityManager lConnectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo lInfo = lConnectivityManager.getActiveNetworkInfo();
|
||||
|
|
|
@ -48,8 +48,8 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
private native int getNumberOfCallLogs(long nativePtr);
|
||||
private native void delete(long nativePtr);
|
||||
private native void setNetworkStateReachable(long nativePtr,boolean isReachable);
|
||||
private native void setSoftPlayLevel(long nativeptr, float gain);
|
||||
private native float getSoftPlayLevel(long nativeptr);
|
||||
private native void setPlaybackGain(long nativeptr, float gain);
|
||||
private native float getPlaybackGain(long nativeptr);
|
||||
private native void muteMic(long nativePtr,boolean isMuted);
|
||||
private native long interpretUrl(long nativePtr,String destination);
|
||||
private native void inviteAddress(long nativePtr,long to);
|
||||
|
@ -58,6 +58,8 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
private native boolean isMicMuted(long nativePtr);
|
||||
private native long findPayloadType(long nativePtr, String mime, int clockRate);
|
||||
private native int enablePayloadType(long nativePtr, long payloadType, boolean enable);
|
||||
private native void enableEchoCancellation(long nativePtr,boolean enable);
|
||||
private native boolean isEchoCancellationEnabled(long nativePtr);
|
||||
|
||||
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
|
||||
mListener=listener;
|
||||
|
@ -161,12 +163,12 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
public void setNetworkStateReachable(boolean isReachable) {
|
||||
setNetworkStateReachable(nativePtr,isReachable);
|
||||
}
|
||||
public void setSoftPlayLevel(float gain) {
|
||||
setSoftPlayLevel(nativePtr,gain);
|
||||
public void setPlaybackGain(float gain) {
|
||||
setPlaybackGain(nativePtr,gain);
|
||||
|
||||
}
|
||||
public float getSoftPlayLevel() {
|
||||
return getSoftPlayLevel(nativePtr);
|
||||
public float getPlaybackGain() {
|
||||
return getPlaybackGain(nativePtr);
|
||||
}
|
||||
public void muteMic(boolean isMuted) {
|
||||
muteMic(nativePtr,isMuted);
|
||||
|
@ -192,6 +194,7 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
return isMicMuted(nativePtr);
|
||||
}
|
||||
public PayloadType findPayloadType(String mime, int clockRate) {
|
||||
isValid();
|
||||
long playLoadType = findPayloadType(nativePtr, mime, clockRate);
|
||||
if (playLoadType == 0) {
|
||||
return null;
|
||||
|
@ -201,9 +204,19 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
}
|
||||
public void enablePayloadType(PayloadType pt, boolean enable)
|
||||
throws LinphoneCoreException {
|
||||
isValid();
|
||||
if (enablePayloadType(nativePtr,((PayloadTypeImpl)pt).nativePtr,enable) != 0) {
|
||||
throw new LinphoneCoreException("cannot enable payload type ["+pt+"]");
|
||||
}
|
||||
|
||||
}
|
||||
public void enableEchoCancellation(boolean enable) {
|
||||
isValid();
|
||||
enableEchoCancellation(nativePtr, enable);
|
||||
}
|
||||
public boolean isEchoCancellationEnabled() {
|
||||
isValid();
|
||||
return isEchoCancellationEnabled(nativePtr);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
1
submodules/externals/build/speex/Android.mk
vendored
1
submodules/externals/build/speex/Android.mk
vendored
|
@ -68,6 +68,7 @@ LOCAL_SRC_FILES := \
|
|||
$(libspeex_SRC_FILES) \
|
||||
$(libspeexdsp_SRC_FILES)
|
||||
|
||||
# -DARM4_ASM
|
||||
ifeq ($(TARGET_ARCH),arm)
|
||||
LOCAL_CFLAGS +=\
|
||||
-DARM5E_ASM \
|
||||
|
|
|
@ -138,10 +138,10 @@
|
|||
/* #undef USE_INTEL_MKL */
|
||||
|
||||
/* Use KISS Fast Fourier Transform */
|
||||
/* #undef USE_KISS_FFT */
|
||||
#define USE_KISS_FFT
|
||||
|
||||
/* Use FFT from OggVorbis */
|
||||
#define USE_SMALLFT
|
||||
/*#undefine USE_SMALLFT*/
|
||||
|
||||
/* Use C99 variable-size arrays */
|
||||
#define VAR_ARRAYS
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d1f0a3cebe43f779e486825fe200c4e51940bfb2
|
||||
Subproject commit fc856b97ae7e6c8f7346d7a108b20cf73a9fa0f1
|
Loading…
Reference in a new issue