Merge branch 'master' of git.linphone.org:linphone-android into conferencing

Conflicts:
	src/org/linphone/LinphoneManager.java
	src/org/linphone/core/LinphoneCallParamsImpl.java
	src/org/linphone/core/LinphoneCoreImpl.java
	submodules/linphone
This commit is contained in:
Guillaume Beraudo 2011-10-13 15:25:17 +02:00
commit e436b2b620
20 changed files with 343 additions and 50 deletions

6
.gitmodules vendored
View file

@ -40,3 +40,9 @@
[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
[submodule "submodules/externals/srtp"]
path = submodules/externals/srtp
url = git://git.linphone.org/srtp.git

9
README
View file

@ -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)

View file

@ -11,6 +11,7 @@ BUILD_X264=0
endif
##ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
ifeq ($(BUILD_GPLV3_ZRTP), 1)
BUILD_SRTP=1
@ -20,6 +21,7 @@ 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

View file

@ -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 )
# As a memo, the config.h for zrtpcpp is generated using the command
# cmake -Denable-ccrtp=false submodules/externals/libzrtpcpp

View file

@ -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

View file

@ -155,6 +155,10 @@ public class DialerActivity extends Activity implements LinphoneGuiListener, Lin
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();
waitHelper = new LinphoneManagerWaitHelper(this, this);

View file

@ -273,6 +273,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) {
@ -488,4 +500,4 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener
interface ContactPicked {
void setAddressAndGoToDialer(String number, String name, Uri photo);
}
}

View file

@ -678,7 +678,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
private ListenerDispatcher listenerDispatcher = new ListenerDispatcher(simpleListeners);
private LinphoneCall.State mCurrentCallState;
private LinphoneCall ringingCall;
private MediaPlayer mRingerPlayer;
private Vibrator mVibrator;
@ -739,17 +739,14 @@ public final class LinphoneManager implements LinphoneCoreListener {
wl.acquire(10000);
if (mLc.getCallsNb() == 1) {
ringingCall = call;
startRinging();
// otherwise there is the beep
}
}
if (mCurrentCallState == IncomingReceived) {
} else if (call == ringingCall && isRinging) {
//previous state was ringing, so stop ringing
if (isRinging) {
stopRinging();
routeAudioToReceiver();
}
stopRinging();
routeAudioToReceiver();
}
if (state == CallEnd || state == Error) {
@ -783,7 +780,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
Log.i("New call active while incall (CPU only) wake lock already active");
}
}
mCurrentCallState=state;
listenerDispatcher.onCallStateChanged(call, state, message);
}
@ -890,7 +886,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
public void setAudioModeIncallForGalaxyS() {
// if (isRinging) stopRinging(); // FIXME was this line useful?
mAudioManager.setMode(MODE_IN_CALL);
}

View file

@ -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());

View file

@ -54,9 +54,9 @@ public class VideoCallActivity extends Activity {
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);
@ -117,28 +117,6 @@ public class VideoCallActivity extends Activity {
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)
@ -189,6 +167,24 @@ public class VideoCallActivity extends Activity {
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);
}
@ -278,17 +274,24 @@ public class VideoCallActivity extends Activity {
@Override
protected void onDestroy() {
androidVideoWindowImpl.release();
launched = false;
super.onDestroy();
}
@Override
protected void onPause() {
Log.d("onPause VideoCallActivity");
LinphoneManager.getLc().setVideoWindow(null);
Log.d("onPause VideoCallActivity (isFinishing:", isFinishing(), ", inCall:", LinphoneManager.getLc().isIncall(), ", changingConf:", getChangingConfigurations());
launched=false;
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()) {
if (LinphoneManager.getLc().isIncall()) {
// we're getting paused for real
if (getChangingConfigurations() == 0) {
LinphoneManager.getInstance().sendStaticImage(true);
@ -297,7 +300,10 @@ public class VideoCallActivity extends Activity {
LinphoneManager.getLc().updateCall(LinphoneManager.getLc().getCurrentCall(), null);
}
}
if (mCallQualityUpdater!=null){
refreshHandler.removeCallbacks(mCallQualityUpdater);
mCallQualityUpdater=null;
}
if (mWakeLock.isHeld()) mWakeLock.release();
super.onPause();

View file

@ -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,6 +50,14 @@ 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);
}
private native boolean localConferenceMode(long nativePtr);
public boolean localConferenceMode() {

View file

@ -105,7 +105,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);
@ -565,4 +570,17 @@ class LinphoneCoreImpl implements LinphoneCore {
public synchronized LinphoneCall findCallFromUri(String uri) {
return (LinphoneCall) findCallFromUri(nativePtr, uri);
}
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);
}
}

View file

@ -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)
@ -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
@ -56,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

View file

@ -0,0 +1,53 @@
/* Define to 1 if you have the <gcrypt.h> 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 <openssl/aes.h> header file. */
#define HAVE_OPENSSL_AES_H 1
/* Define to 1 if you have the <openssl/bn.h> header file. */
#define HAVE_OPENSSL_BN_H 1
/* Define to 1 if you have the <openssl/sha.h> header file. */
#define HAVE_OPENSSL_SHA_H 1
/* Define to 1 if you have the <pthread.h> 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

View file

@ -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 += \

171
submodules/externals/build/srtp/config.h vendored Normal file
View file

@ -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 <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define to 1 if you have the <byteswap.h> 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 <inttypes.h> 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 <machine/types.h> header file. */
/*#define HAVE_MACHINE_TYPES_H 1*/
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <netinet/in.h> 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 <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <syslog.h> header file. */
#define HAVE_SYSLOG_H 1
/* Define to 1 if you have the <sys/int_types.h> header file. */
/* #undef HAVE_SYS_INT_TYPES_H */
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> 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 <unistd.h> 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 <windows.h> header file. */
/* #undef HAVE_WINDOWS_H */
/* Define to 1 if you have the <winsock2.h> 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 <sys/types.h> does not define. */
/* #undef size_t */

1
submodules/externals/libzrtpcpp vendored Submodule

@ -0,0 +1 @@
Subproject commit 93dbdb3159f55bb35f69c13df1f60ac4901c88fb

1
submodules/externals/srtp vendored Submodule

@ -0,0 +1 @@
Subproject commit de53398a1aa8f60a37bded8d6019649959e7b132

@ -1 +1 @@
Subproject commit 12bf9694a4b506c3145adfd2aaf90c49d72e3369
Subproject commit a0f8cbb73c1c028182972147d1ce3f0fdae2921f

@ -1 +1 @@
Subproject commit 2e10820e9c32fe75f049308d69e4164b46bc0d1a
Subproject commit b78cec7a59e04aff2a9884feed11addb9000b0ba