From 47e2ef29c779dd9b1dd1e767902365c12c04a4c7 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 19 Apr 2011 10:53:46 +0200 Subject: [PATCH] add code to detect missing NEON instructions --- build/android/Android.mk | 4 ++++ coreapi/linphonecore_jni.cc | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/build/android/Android.mk b/build/android/Android.mk index db4d5368d..468afbfa3 100755 --- a/build/android/Android.mk +++ b/build/android/Android.mk @@ -86,6 +86,7 @@ LOCAL_LDLIBS += -llog -ldl LOCAL_STATIC_LIBRARIES := \ + cpufeatures \ libmediastreamer2 \ libortp \ libeXosip2 \ @@ -130,3 +131,6 @@ endif LOCAL_MODULE := liblinphone include $(BUILD_SHARED_LIBRARY) +$(call import-module,android/cpufeatures) + + diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index b2dd76f16..315c0dbcc 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "mediastreamer2/msjava.h" +#include + #ifdef ANDROID #include extern "C" void libmsilbc_init(); @@ -1238,15 +1240,22 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_adjustSoftwareVolume(JNI LinphoneCore *lc = (LinphoneCore *) ptr; if (db == 0) { - linphone_core_set_playback_gain_db(lc, 0); - return; + linphone_core_set_playback_gain_db(lc, 0); + return; } - float gain = linphone_core_get_playback_gain_db(lc) + db; - if (gain > 0) gain = 0; + float gain = linphone_core_get_playback_gain_db(lc) + db; + if (gain > 0) gain = 0; linphone_core_set_playback_gain_db(lc, gain); } +extern "C" jboolean Java_org_linphone_core_Version_nativeHasNeon(JNIEnv *env){ + if (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM && (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0) + { + return 1; + } + return 0; +}