From efe00e9911285d76638db0bada98b7d8629609ec Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 5 Oct 2011 12:18:50 +0200 Subject: [PATCH 01/16] fix crashes with call quality indicator --- src/org/linphone/VideoCallActivity.java | 49 ++++++++++++------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/src/org/linphone/VideoCallActivity.java b/src/org/linphone/VideoCallActivity.java index 9474ada03..9c741cb56 100755 --- a/src/org/linphone/VideoCallActivity.java +++ b/src/org/linphone/VideoCallActivity.java @@ -56,9 +56,9 @@ public class VideoCallActivity extends SoftVolumeActivity { private Handler refreshHandler = new Handler(); AndroidVideoWindowImpl androidVideoWindowImpl; + private Runnable mCallQualityUpdater; public void onCreate(Bundle savedInstanceState) { - launched = true; Log.d("onCreate VideoCallActivity"); super.onCreate(savedInstanceState); setContentView(R.layout.videocall); @@ -119,28 +119,6 @@ public class VideoCallActivity extends SoftVolumeActivity { mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,Log.TAG); mWakeLock.acquire(); - Runnable runnable = new Runnable() { - public void run() { - while (launched && LinphoneManager.getLc().isIncall()) - { - refreshHandler.post(new Runnable() { - public void run() { - int oldQuality = 0; - float newQuality = LinphoneManager.getLc().getCurrentCall().getCurrentQuality(); - if ((int) newQuality != oldQuality) - updateQualityOfSignalIcon(newQuality); - } - }); - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - }; - new Thread(runnable).start(); } void updateQualityOfSignalIcon(float quality) @@ -191,6 +169,24 @@ public class VideoCallActivity extends SoftVolumeActivity { super.onResume(); if (mVideoViewReady != null) ((GLSurfaceView)mVideoViewReady).onResume(); + launched=true; + refreshHandler.postDelayed(mCallQualityUpdater=new Runnable(){ + LinphoneCall mCurrentCall=LinphoneManager.getLc().getCurrentCall(); + public void run() { + if (mCurrentCall==null){ + mCallQualityUpdater=null; + return; + } + int oldQuality = 0; + float newQuality = mCurrentCall.getCurrentQuality(); + if ((int) newQuality != oldQuality){ + updateQualityOfSignalIcon(newQuality); + } + if (launched){ + refreshHandler.postDelayed(this, 1000); + }else mCallQualityUpdater=null; + } + },1000); } @@ -275,13 +271,13 @@ public class VideoCallActivity extends SoftVolumeActivity { @Override protected void onDestroy() { androidVideoWindowImpl.release(); - launched = false; super.onDestroy(); } @Override protected void onPause() { Log.d("onPause VideoCallActivity"); + launched=false; LinphoneManager.getLc().setVideoWindow(null); LinphoneManager.getLc().setPreviewWindow(null); @@ -294,7 +290,10 @@ public class VideoCallActivity extends SoftVolumeActivity { LinphoneManager.getLc().updateCall(LinphoneManager.getLc().getCurrentCall(), null); } } - + if (mCallQualityUpdater!=null){ + refreshHandler.removeCallbacks(mCallQualityUpdater); + mCallQualityUpdater=null; + } if (mWakeLock.isHeld()) mWakeLock.release(); super.onPause(); From 772b04aea7c6b762f6718267d1fabea1805f966a Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 7 Oct 2011 08:48:12 +0200 Subject: [PATCH 02/16] Add missing LinphoneCore function impl --- src/org/linphone/core/LinphoneCoreImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/org/linphone/core/LinphoneCoreImpl.java b/src/org/linphone/core/LinphoneCoreImpl.java index 92eb4a43c..4b3f9e99c 100644 --- a/src/org/linphone/core/LinphoneCoreImpl.java +++ b/src/org/linphone/core/LinphoneCoreImpl.java @@ -541,4 +541,8 @@ class LinphoneCoreImpl implements LinphoneCore { // TODO Auto-generated method stub } + public LinphoneCall findCallFromUri(String uri) { + // TODO Auto-generated method stub + return null; + } } From 60898328582eb52879b3d352c95d677920403807 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 7 Oct 2011 08:48:32 +0200 Subject: [PATCH 03/16] Fix crash when changing phone orientation on audio calls --- src/org/linphone/DialerActivity.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/org/linphone/DialerActivity.java b/src/org/linphone/DialerActivity.java index 3aa7d2cd9..0b6bceebd 100644 --- a/src/org/linphone/DialerActivity.java +++ b/src/org/linphone/DialerActivity.java @@ -100,7 +100,6 @@ public class DialerActivity extends LinphoneManagerWaitActivity implements Linph public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); setContentView(R.layout.dialer); useIncallActivity = getResources().getBoolean(R.bool.use_incall_activity); @@ -144,6 +143,10 @@ public class DialerActivity extends LinphoneManagerWaitActivity implements Linph if (numpad != null) numpad.setAddressWidget(mAddress); + // call to super must be done after all fields are initialized + // because it may call this.enterIncallMode + super.onCreate(savedInstanceState); + checkIfOutgoingCallIntentReceived(); instance = this; From 6b4c11994995e879d1f6ec65595d73665dba979a Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 5 Oct 2011 11:33:09 +0200 Subject: [PATCH 04/16] srtp: init srtp branch --- .gitmodules | 2 +- submodules/linphone | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 7334733a7..dd5b18727 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "linphone"] path = submodules/linphone - url = git://git.savannah.nongnu.org/linphone.git + url = gitosis@git.linphone.org:linphone-private [submodule "submodules/externals/osip"] path = submodules/externals/osip url = git://git.savannah.gnu.org/osip.git diff --git a/submodules/linphone b/submodules/linphone index 9ea9dcadb..3cb22b693 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 9ea9dcadbd06bdc90cffc1e0e95d4e5d1c48fd8e +Subproject commit 3cb22b69375f1bd759bc0bd365fecad0b553cced From c0e8108a12dc8b842ea1e4cb6289bc2bd282de0c Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Thu, 6 Oct 2011 14:50:38 +0200 Subject: [PATCH 05/16] Enable srtp --- .gitmodules | 3 + jni/Android.mk | 4 +- res/raw/linphonerc | 2 + src/org/linphone/core/LinphoneCoreImpl.java | 2 +- submodules/externals/build/srtp/Android.mk | 2 +- submodules/externals/build/srtp/config.h | 171 ++++++++++++++++++++ submodules/externals/srtp | 1 + submodules/linphone | 2 +- 8 files changed, 182 insertions(+), 5 deletions(-) create mode 100644 submodules/externals/build/srtp/config.h create mode 160000 submodules/externals/srtp diff --git a/.gitmodules b/.gitmodules index dd5b18727..b8d8bf450 100644 --- a/.gitmodules +++ b/.gitmodules @@ -40,3 +40,6 @@ [submodule "submodules/externals/libvpx"] path = submodules/externals/libvpx url = http://git.chromium.org/webm/libvpx.git +[submodule "submodules/externals/srtp"] + path = submodules/externals/srtp + url = git://git.linphone.org/srtp.git diff --git a/jni/Android.mk b/jni/Android.mk index 26eaa3408..9d1c9a05e 100755 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -10,16 +10,16 @@ LINPHONE_VIDEO=0 BUILD_X264=0 endif - +BUILD_SRTP=1 ##ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) ifeq ($(BUILD_GPLV3_ZRTP), 1) -BUILD_SRTP=1 ZRTP_C_INCLUDE= \ $(linphone-root-dir)/submodules/externals/libzrtpcpp/src endif ifeq ($(BUILD_SRTP), 1) SRTP_C_INCLUDE= \ + $(linphone-root-dir)/submodules/externals/srtp \ $(linphone-root-dir)/submodules/externals/srtp/include \ $(linphone-root-dir)/submodules/externals/srtp/crypto/include endif diff --git a/res/raw/linphonerc b/res/raw/linphonerc index b490f57df..c6d676668 100644 --- a/res/raw/linphonerc +++ b/res/raw/linphonerc @@ -18,6 +18,8 @@ default_proxy=0 auto_net_state_mon=0 keepalive_period=30000 auto_answer_replacing_calls=1 +media_encryption=srtp +media_encryption_mandatory=0 [rtp] audio_rtp_port=7076 diff --git a/src/org/linphone/core/LinphoneCoreImpl.java b/src/org/linphone/core/LinphoneCoreImpl.java index 4b3f9e99c..902ea9f4f 100644 --- a/src/org/linphone/core/LinphoneCoreImpl.java +++ b/src/org/linphone/core/LinphoneCoreImpl.java @@ -515,7 +515,7 @@ class LinphoneCoreImpl implements LinphoneCore { public boolean isInConference() { // TODO Auto-generated method stub return false; - } + } public void leaveConference() { // TODO Auto-generated method stub diff --git a/submodules/externals/build/srtp/Android.mk b/submodules/externals/build/srtp/Android.mk index c047702cd..e9c85e1e0 100644 --- a/submodules/externals/build/srtp/Android.mk +++ b/submodules/externals/build/srtp/Android.mk @@ -26,7 +26,7 @@ LOCAL_SRC_FILES := \ crypto/rng/ctr_prng.c \ crypto/rng/prng.c -LOCAL_CFLAGS := -Wall -O4 -fexpensive-optimizations -funroll-loops -DCPU_CISC +LOCAL_CFLAGS := -Wall -O4 -fexpensive-optimizations -funroll-loops -DCPU_CISC -include config.h ifeq ($(SRTP_USES_LINUX_KERNEL), 1) LOCAL_SRC_FILES += \ diff --git a/submodules/externals/build/srtp/config.h b/submodules/externals/build/srtp/config.h new file mode 100644 index 000000000..52e6cd654 --- /dev/null +++ b/submodules/externals/build/srtp/config.h @@ -0,0 +1,171 @@ +/* crypto/include/config.h. Generated by configure. */ +/* config_in.h. Generated from configure.in by autoheader. */ + +/* Define if building for a CISC machine (e.g. Intel). */ +#define CPU_CISC 1 + +/* Define if building for a RISC machine (assume slow byte access). */ +/* #undef CPU_RISC */ + +/* Path to random device */ +/* #undef DEV_URANDOM */ + +/* Define to compile in dynamic debugging system. */ +#define ENABLE_DEBUGGING 0 + +/* Report errors to this file. */ +/* #undef ERR_REPORTING_FILE */ + +/* Define to use logging to stdout. */ +#define ERR_REPORTING_STDOUT 1 + +/* Define this to use ISMAcryp code. */ +/* #undef GENERIC_AESICM */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BYTESWAP_H */ + +/* Define to 1 if you have the `inet_aton' function. */ +#define HAVE_INET_ATON 1 + +/* Define to 1 if the system has the type `int16_t'. */ +#define HAVE_INT16_T 1 + +/* Define to 1 if the system has the type `int32_t'. */ +#define HAVE_INT32_T 1 + +/* Define to 1 if the system has the type `int8_t'. */ +#define HAVE_INT8_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_MACHINE_TYPES_H 1*/ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYSLOG_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_INT_TYPES_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UIO_H 1 + +/* Define to 1 if the system has the type `uint16_t'. */ +#define HAVE_UINT16_T 1 + +/* Define to 1 if the system has the type `uint32_t'. */ +#define HAVE_UINT32_T 1 + +/* Define to 1 if the system has the type `uint64_t'. */ +#define HAVE_UINT64_T 1 + +/* Define to 1 if the system has the type `uint8_t'. */ +#define HAVE_UINT8_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `usleep' function. */ +#define HAVE_USLEEP 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINDOWS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to use X86 inlined assembly code */ +/* #undef HAVE_X86 */ + +/* Define to the address where bug reports for this package should be sent. */ +/*#define PACKAGE_BUGREPORT ""*/ + +/* Define to the full name of this package. */ +/*#define PACKAGE_NAME ""*/ + +/* Define to the full name and version of this package. */ +/*#define PACKAGE_STRING ""*/ + +/* Define to the one symbol short name of this package. */ +/*#define PACKAGE_TARNAME ""*/ + +/* Define to the version of this package. */ +/*#define PACKAGE_VERSION ""*/ + +/* The size of a `unsigned long', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_LONG 4 + +/* The size of a `unsigned long long', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_LONG_LONG 8 + +/* Define to use GDOI. */ +/* #undef SRTP_GDOI */ + +/* Define to compile for kernel contexts. */ +/* #undef SRTP_KERNEL */ + +/* Define to compile for Linux kernel context. */ +/* #undef SRTP_KERNEL_LINUX */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Write errors to this file */ +/* #undef USE_ERR_REPORTING_FILE */ + +/* Define to use syslog logging. */ +/* #undef USE_SYSLOG */ + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +/* #undef WORDS_BIGENDIAN */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `unsigned' if does not define. */ +/* #undef size_t */ diff --git a/submodules/externals/srtp b/submodules/externals/srtp new file mode 160000 index 000000000..de53398a1 --- /dev/null +++ b/submodules/externals/srtp @@ -0,0 +1 @@ +Subproject commit de53398a1aa8f60a37bded8d6019649959e7b132 diff --git a/submodules/linphone b/submodules/linphone index 3cb22b693..e83560115 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 3cb22b69375f1bd759bc0bd365fecad0b553cced +Subproject commit e835601158351ce465d0c401f83c82e595c63c1a From ca77d598857d2ce657575a02d048eee4d296ca7a Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 7 Oct 2011 12:02:15 +0200 Subject: [PATCH 06/16] video: avoid dead-lock on video call end --- src/org/linphone/VideoCallActivity.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/org/linphone/VideoCallActivity.java b/src/org/linphone/VideoCallActivity.java index 9c741cb56..0a6487e09 100755 --- a/src/org/linphone/VideoCallActivity.java +++ b/src/org/linphone/VideoCallActivity.java @@ -23,12 +23,9 @@ package org.linphone; import org.linphone.core.LinphoneCall; import org.linphone.core.Log; import org.linphone.mediastream.video.AndroidVideoWindowImpl; -import org.linphone.mediastream.video.capture.AndroidVideoApi5JniWrapper; import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration; import android.content.Context; -import android.hardware.Camera; -import android.hardware.Camera.CameraInfo; import android.opengl.GLSurfaceView; import android.os.Bundle; import android.os.Handler; @@ -40,7 +37,6 @@ import android.view.MenuItem; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; -import android.view.View.OnClickListener; import android.widget.ImageView; /** @@ -278,7 +274,13 @@ public class VideoCallActivity extends SoftVolumeActivity { protected void onPause() { Log.d("onPause VideoCallActivity"); launched=false; - LinphoneManager.getLc().setVideoWindow(null); + synchronized (androidVideoWindowImpl) { + /* this call will destroy native opengl renderer + * which is used by androidVideoWindowImpl + */ + LinphoneManager.getLc().setVideoWindow(null); + } + LinphoneManager.getLc().setPreviewWindow(null); if (!isFinishing() && LinphoneManager.getLc().isIncall()) { From 0a149435791172d7430e4a89090b250d3638307e Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 10 Oct 2011 09:26:14 +0200 Subject: [PATCH 07/16] srtp: add Java impl --- .../linphone/core/LinphoneCallParamsImpl.java | 10 ++++++++++ src/org/linphone/core/LinphoneCoreImpl.java | 20 ++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/org/linphone/core/LinphoneCallParamsImpl.java b/src/org/linphone/core/LinphoneCallParamsImpl.java index ef05eb228..c346dcd1f 100644 --- a/src/org/linphone/core/LinphoneCallParamsImpl.java +++ b/src/org/linphone/core/LinphoneCallParamsImpl.java @@ -28,6 +28,8 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { private native void enableVideo(long nativePtr, boolean b); private native boolean getVideoEnabled(long nativePtr); private native void audioBandwidth(long nativePtr, int bw); + private native void setMediaEncryption(long nativePtr, String menc); + private native String getMediaEncryption(long nativePtr); private native void destroy(long nativePtr); @@ -48,4 +50,12 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { public void setAudioBandwidth(int value) { audioBandwidth(nativePtr, value); } + + public String getMediaEncryption() { + return getMediaEncryption(nativePtr); + } + + public void setMediaEnctyption(String menc) { + setMediaEncryption(nativePtr, menc); + } } diff --git a/src/org/linphone/core/LinphoneCoreImpl.java b/src/org/linphone/core/LinphoneCoreImpl.java index 902ea9f4f..355523d59 100644 --- a/src/org/linphone/core/LinphoneCoreImpl.java +++ b/src/org/linphone/core/LinphoneCoreImpl.java @@ -104,7 +104,12 @@ class LinphoneCoreImpl implements LinphoneCore { private native void enableEchoLimiter(long nativePtr2, boolean val); private native int setVideoDevice(long nativePtr2, int id); private native int getVideoDevice(long nativePtr2); - + private native String getMediaEncryption(long nativePtr); + private native void setMediaEncryption(long nativePtr, String menc); + private native boolean isMediaEncryptionMandatory(long nativePtr); + private native void setMediaEncryptionMandatory(long nativePtr, boolean yesno); + + LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); @@ -545,4 +550,17 @@ class LinphoneCoreImpl implements LinphoneCore { // TODO Auto-generated method stub return null; } + + public String getMediaEncryption() { + return getMediaEncryption(nativePtr); + } + public boolean isMediaEncryptionMandatory() { + return isMediaEncryptionMandatory(nativePtr); + } + public void setMediaEncryption(String menc) { + setMediaEncryption(nativePtr, menc); + } + public void setMediaEncryptionMandatory(boolean yesno) { + setMediaEncryptionMandatory(nativePtr, yesno); + } } From 97db6c695c2e08cac1ca7bb5b9b282514cd4d358 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 10 Oct 2011 11:00:53 +0200 Subject: [PATCH 08/16] Update linphone version --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index e83560115..5becaaee2 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit e835601158351ce465d0c401f83c82e595c63c1a +Subproject commit 5becaaee299415ce648e78482dca295ee57e169e From a01a2c982ad889c633c13f106ce7b3f5915c076f Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 12 Oct 2011 14:48:52 +0200 Subject: [PATCH 09/16] Make latest ZRTP a git submodule --- .gitmodules | 3 +++ README | 11 ++++++----- prepare_sources.sh | 3 ++- submodules/externals/build/libzrtpcpp/Android.mk | 2 ++ submodules/externals/libzrtpcpp | 1 + 5 files changed, 14 insertions(+), 6 deletions(-) create mode 160000 submodules/externals/libzrtpcpp diff --git a/.gitmodules b/.gitmodules index 7334733a7..b2adc916d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -40,3 +40,6 @@ [submodule "submodules/externals/libvpx"] path = submodules/externals/libvpx url = http://git.chromium.org/webm/libvpx.git +[submodule "submodules/externals/libzrtpcpp"] + path = submodules/externals/libzrtpcpp + url = git://github.com/wernerd/ZRTPCPP.git diff --git a/README b/README index 2bbc5c6d7..d44a69955 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ To build liblinphone for Android, you must: 1) download the Android ndk (>=r5c) from google. -2) install the autotools: autoconf, automake, aclocal, libtoolize +2) install the autotools: autoconf, automake, aclocal, libtoolize and cmake 3) run the ./prepare_sources.sh script in the top level directory. This will download iLBC source files and convert some assembly files in VP8 project. $ ./prepare_sources.sh @@ -13,10 +13,11 @@ To build liblinphone for Android, you must: Some options can be passed to ndk-build, like "ndk-build SOME_OPTION=SOME_VALUE" -Option Name | Possible values ----------------------------------------- -BUILD_X264 0 (don't build x264) or 1 (build x264) -BUILD_AMR 0 (don't build amr codec), light (try to use amr codec from android), full (build your own amr codec) +Option Name | Possible values +--------------------------------------------------------------------------------- +BUILD_X264 0 (don't build x264) or 1 (build x264) +BUILD_AMR 0 (don't build amr codec), light (try to use amr codec from android), full (build your own amr codec) +BUILD_GPLV3_ZRTP 0 (don't support ZRTP), 1 (support ZRTP and make the whole program GPLv3) diff --git a/prepare_sources.sh b/prepare_sources.sh index c9814a328..86c0cd8fa 100755 --- a/prepare_sources.sh +++ b/prepare_sources.sh @@ -14,4 +14,5 @@ cd submodules/libilbc-rfc3951 && ./autogen.sh && ./configure && make || ( echo " cd $topdir/submodules/externals/build/libvpx && ./asm_conversion.sh && cp *.asm *.h ../../libvpx/ || ( echo "VP8 prepare stage failed." ; exit 1 ) - +echo Preparing ZRTP (need cmake installed) +cmake -Denable-ccrtp=false submodules/externals/libzrtpcpp diff --git a/submodules/externals/build/libzrtpcpp/Android.mk b/submodules/externals/build/libzrtpcpp/Android.mk index b78eb74a8..cac26625e 100644 --- a/submodules/externals/build/libzrtpcpp/Android.mk +++ b/submodules/externals/build/libzrtpcpp/Android.mk @@ -26,6 +26,8 @@ LOCAL_SRC_FILES := \ src/ZrtpPacketHello.cpp \ src/ZrtpPacketPingAck.cpp \ src/ZrtpPacketPing.cpp \ + src/ZrtpPacketRelayAck.cpp \ + src/ZrtpPacketSASrelay.cpp \ src/ZrtpStateClass.cpp \ src/ZrtpTextData.cpp diff --git a/submodules/externals/libzrtpcpp b/submodules/externals/libzrtpcpp new file mode 160000 index 000000000..93dbdb315 --- /dev/null +++ b/submodules/externals/libzrtpcpp @@ -0,0 +1 @@ +Subproject commit 93dbdb3159f55bb35f69c13df1f60ac4901c88fb From a8c0162086d405bcb598d8465de1769f92c85f59 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 12 Oct 2011 15:30:24 +0200 Subject: [PATCH 10/16] Disable camera when pressing 'back' button while in video call --- src/org/linphone/VideoCallActivity.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/org/linphone/VideoCallActivity.java b/src/org/linphone/VideoCallActivity.java index 0a6487e09..672ca7559 100755 --- a/src/org/linphone/VideoCallActivity.java +++ b/src/org/linphone/VideoCallActivity.java @@ -272,7 +272,8 @@ public class VideoCallActivity extends SoftVolumeActivity { @Override protected void onPause() { - Log.d("onPause VideoCallActivity"); + Log.d("onPause VideoCallActivity (isFinishing:", isFinishing(), ", inCall:", LinphoneManager.getLc().isIncall(), ", changingConf:", getChangingConfigurations()); + launched=false; synchronized (androidVideoWindowImpl) { /* this call will destroy native opengl renderer @@ -283,7 +284,7 @@ public class VideoCallActivity extends SoftVolumeActivity { LinphoneManager.getLc().setPreviewWindow(null); - if (!isFinishing() && LinphoneManager.getLc().isIncall()) { + if (LinphoneManager.getLc().isIncall()) { // we're getting paused for real if (getChangingConfigurations() == 0) { LinphoneManager.getInstance().sendStaticImage(true); From d49506881a9add1eecb4642c341e25a656395bc7 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 13 Oct 2011 09:19:49 +0200 Subject: [PATCH 11/16] Add config.h of zrtpcpp (cmake no more required) --- README | 2 +- prepare_sources.sh | 4 +- .../externals/build/libzrtpcpp/Android.mk | 5 +- .../externals/build/libzrtpcpp/config.h | 53 +++++++++++++++++++ 4 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 submodules/externals/build/libzrtpcpp/config.h diff --git a/README b/README index d44a69955..159a833c5 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ To build liblinphone for Android, you must: 1) download the Android ndk (>=r5c) from google. -2) install the autotools: autoconf, automake, aclocal, libtoolize and cmake +2) install the autotools: autoconf, automake, aclocal, libtoolize 3) run the ./prepare_sources.sh script in the top level directory. This will download iLBC source files and convert some assembly files in VP8 project. $ ./prepare_sources.sh diff --git a/prepare_sources.sh b/prepare_sources.sh index 86c0cd8fa..93ecd83c8 100755 --- a/prepare_sources.sh +++ b/prepare_sources.sh @@ -14,5 +14,5 @@ cd submodules/libilbc-rfc3951 && ./autogen.sh && ./configure && make || ( echo " cd $topdir/submodules/externals/build/libvpx && ./asm_conversion.sh && cp *.asm *.h ../../libvpx/ || ( echo "VP8 prepare stage failed." ; exit 1 ) -echo Preparing ZRTP (need cmake installed) -cmake -Denable-ccrtp=false submodules/externals/libzrtpcpp +# As a memo, the config.h for zrtpcpp is generated using the command +# cmake -Denable-ccrtp=false submodules/externals/libzrtpcpp diff --git a/submodules/externals/build/libzrtpcpp/Android.mk b/submodules/externals/build/libzrtpcpp/Android.mk index cac26625e..57c218276 100644 --- a/submodules/externals/build/libzrtpcpp/Android.mk +++ b/submodules/externals/build/libzrtpcpp/Android.mk @@ -1,5 +1,5 @@ - -LOCAL_EXTERNALS:= $(call my-dir)/../.. +MK_DIR:=$(call my-dir) +LOCAL_EXTERNALS:= $(MK_DIR)/../.. LOCAL_PATH:= $(LOCAL_EXTERNALS:=)/libzrtpcpp include $(CLEAR_VARS) @@ -58,6 +58,7 @@ LOCAL_SRC_FILES += \ LOCAL_CFLAGS := -D__EXPORT="" LOCAL_C_INCLUDES += \ + $(MK_DIR)/ \ $(LOCAL_PATH)/src/ \ $(LOCAL_EXTERNALS)/openssl \ $(LOCAL_EXTERNALS)/openssl/include diff --git a/submodules/externals/build/libzrtpcpp/config.h b/submodules/externals/build/libzrtpcpp/config.h new file mode 100644 index 000000000..191321486 --- /dev/null +++ b/submodules/externals/build/libzrtpcpp/config.h @@ -0,0 +1,53 @@ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GCRYPT_H */ + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +/* #undef HAVE_LIBPTHREAD */ + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_AES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_BN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_SHA_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_PTHREAD_H 1 + +/* Name of package */ +#define PACKAGE libzrtpcpp + +/* Version number of package */ +#define VERSION 2.1.0 + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported directly. */ +#undef restrict +/* Work around a bug in Sun C++: it does not support _Restrict, even + though the corresponding Sun C compiler does, which causes + "#define restrict _Restrict" in the previous line. Perhaps some future + version of Sun C++ will work with _Restrict; if so, it'll probably + define __RESTRICT, just as Sun C does. */ +#if defined __SUNPRO_CC && !defined __RESTRICT +# define _Restrict +#endif + +/* Define to empty if the keyword `volatile' does not work. Warning: valid + code using `volatile' can become incorrect without. Disable with care. */ +#undef volatile From 75d7c37331020456d28c9d55607397ca9ba54b27 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Thu, 13 Oct 2011 11:57:49 +0200 Subject: [PATCH 12/16] Hide settings menu during calls --- src/org/linphone/LinphoneActivity.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index c7e63a0ef..0cb9efd7f 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -276,6 +276,18 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener menu.findItem(R.id.menu_about).setVisible(useMenuAbout); return true; } + + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + if (lc == null) + return true; + // hide settings menu when in call + // otherwise, exiting the 'setting' menu will cause exosip deletion/recreation... + menu.findItem(R.id.menu_settings).setVisible(!lc.isIncall()); + + return super.onPrepareOptionsMenu(menu); + } @Override public boolean onOptionsItemSelected(MenuItem item) { From 0ced595b883c9593aec333d18cf601447f63a581 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Thu, 13 Oct 2011 11:58:28 +0200 Subject: [PATCH 13/16] Do not apply new settings during a call --- src/org/linphone/LinphonePreferencesActivity.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/org/linphone/LinphonePreferencesActivity.java b/src/org/linphone/LinphonePreferencesActivity.java index f69baa1b9..1745b3404 100644 --- a/src/org/linphone/LinphonePreferencesActivity.java +++ b/src/org/linphone/LinphonePreferencesActivity.java @@ -32,6 +32,7 @@ import java.util.Arrays; import java.util.List; import org.linphone.LinphoneManager.EcCalibrationListener; +import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCoreException; import org.linphone.core.Log; import org.linphone.core.LinphoneCore.EcCalibratorStatus; @@ -229,6 +230,12 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E if (!isFinishing()) return; + LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + + if (lc != null && (lc.isInComingInvitePending() || lc.isIncall())) { + Log.w("Call in progress => settings not applied"); + return; + } try { LinphoneManager.getInstance().initFromConf(getApplicationContext()); From 0161fa8f548d036a1c2ad4ae2beb0d3cee58d33e Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Thu, 13 Oct 2011 12:10:06 +0200 Subject: [PATCH 14/16] Update linphone and msx264 --- submodules/linphone | 2 +- submodules/msx264 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/submodules/linphone b/submodules/linphone index 9ea9dcadb..89cb3a385 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 9ea9dcadbd06bdc90cffc1e0e95d4e5d1c48fd8e +Subproject commit 89cb3a385b55640604811982f2970187c16883bf diff --git a/submodules/msx264 b/submodules/msx264 index 2e10820e9..b78cec7a5 160000 --- a/submodules/msx264 +++ b/submodules/msx264 @@ -1 +1 @@ -Subproject commit 2e10820e9c32fe75f049308d69e4164b46bc0d1a +Subproject commit b78cec7a59e04aff2a9884feed11addb9000b0ba From 0e0a6eec05f845ab6da90591e994f9820fcf624f Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Thu, 13 Oct 2011 13:44:44 +0200 Subject: [PATCH 15/16] Update linphone --- jni/Android.mk | 2 +- submodules/linphone | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jni/Android.mk b/jni/Android.mk index dcbe70a3e..8f2ed924d 100755 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -10,7 +10,7 @@ LINPHONE_VIDEO=0 BUILD_X264=0 endif -BUILD_SRTP=0 + ##ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) ifeq ($(BUILD_GPLV3_ZRTP), 1) diff --git a/submodules/linphone b/submodules/linphone index 514f67a88..a0f8cbb73 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 514f67a88ad48a4a5a5eef9cfe77fd92b4a11081 +Subproject commit a0f8cbb73c1c028182972147d1ce3f0fdae2921f From efcb45d7c7ce5c929c384d7d67f9de65d258f925 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Thu, 13 Oct 2011 15:08:23 +0200 Subject: [PATCH 16/16] Fix ringing stopping, by binding ringing status to call --- src/org/linphone/LinphoneManager.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 0fa9acef7..0ee22cace 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -665,7 +665,7 @@ public final class LinphoneManager implements LinphoneCoreListener { } private LinphoneServiceListener serviceListener; - private LinphoneCall.State mCurrentCallState; + private LinphoneCall ringingCall; private MediaPlayer mRingerPlayer; private Vibrator mVibrator; @@ -727,11 +727,11 @@ public final class LinphoneManager implements LinphoneCoreListener { wl.acquire(10000); startRinging(); - } - - if (mCurrentCallState == IncomingReceived) { + ringingCall = call; + } else if (call == ringingCall) { //previous state was ringing, so stop ringing stopRinging(); + ringingCall = null; routeAudioToReceiver(); } @@ -745,7 +745,6 @@ public final class LinphoneManager implements LinphoneCoreListener { } } - mCurrentCallState=state; serviceListener.onCallStateChanged(call, state, message); } @@ -853,6 +852,7 @@ public final class LinphoneManager implements LinphoneCoreListener { public void setAudioModeIncallForGalaxyS() { stopRinging(); mAudioManager.setMode(MODE_IN_CALL); + ringingCall = null; } // Called on first launch only