From b24e3aba5f625e20f64dc43d21e0d2a4ac852882 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 17 Apr 2012 16:57:37 +0200 Subject: [PATCH 1/3] Fix last issue with pause + fix shared libs without neon problem --- LinphoneCoreFactoryImpl.java | 48 ++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index a5ae7805f..3dedd06d0 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -20,9 +20,12 @@ package org.linphone.core; import java.io.File; import java.io.IOException; +import java.io.InputStream; import org.linphone.mediastream.Version; +import android.util.Log; + public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { private static void loadOptionalLibrary(String s) { @@ -35,10 +38,17 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { static { // FFMPEG (audio/video) - loadOptionalLibrary("avutil"); - loadOptionalLibrary("swscale"); - loadOptionalLibrary("avcore"); - loadOptionalLibrary("avcodec"); + if (!hasNeonInCpuFeatures()) { + loadOptionalLibrary("avutilnoneon"); + loadOptionalLibrary("swscalenoneon"); + loadOptionalLibrary("avcorenoneon"); + loadOptionalLibrary("avcodecnoneon"); + } else { + loadOptionalLibrary("avutil"); + loadOptionalLibrary("swscale"); + loadOptionalLibrary("avcore"); + loadOptionalLibrary("avcodec"); + } // OPENSSL (cryptography) // lin prefix avoids collision with libs in /system/lib @@ -56,7 +66,11 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { loadOptionalLibrary("bcg729"); //Main library - System.loadLibrary("linphone"); + if (!hasNeonInCpuFeatures()) { + System.loadLibrary("linphonenoneon"); + } else { + System.loadLibrary("linphone"); + } Version.dumpCapabilities(); } @@ -121,4 +135,28 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { public LinphoneFriend createLinphoneFriend() { return createLinphoneFriend(null); } + + public static boolean hasNeonInCpuFeatures() + { + ProcessBuilder cmd; + boolean result = false; + + try { + String[] args = {"/system/bin/cat", "/proc/cpuinfo"}; + cmd = new ProcessBuilder(args); + + Process process = cmd.start(); + InputStream in = process.getInputStream(); + byte[] re = new byte[1024]; + while(in.read(re) != -1){ + String line = new String(re); + if (line.startsWith("Features")) + result = line.contains("neon"); + } + in.close(); + } catch(IOException ex){ + ex.printStackTrace(); + } + return result; + } } From d0501c8328f9008b65091ee106e91d95b4ffb1f6 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 19 Apr 2012 16:35:29 +0200 Subject: [PATCH 2/3] Fix video preferences issue --- LinphoneCoreFactoryImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/LinphoneCoreFactoryImpl.java b/LinphoneCoreFactoryImpl.java index 3dedd06d0..29f1c58ca 100644 --- a/LinphoneCoreFactoryImpl.java +++ b/LinphoneCoreFactoryImpl.java @@ -150,8 +150,10 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { byte[] re = new byte[1024]; while(in.read(re) != -1){ String line = new String(re); - if (line.startsWith("Features")) + if (line.startsWith("Features")) { result = line.contains("neon"); + break; + } } in.close(); } catch(IOException ex){ From 058e011ce1f33e2b2d5c60ac2668730753a95fd4 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 27 Apr 2012 15:42:35 +0200 Subject: [PATCH 3/3] Fix issues/behaviour on smartphones + update linphone/ms2/ortp --- LinphoneCoreImpl.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 92faacc55..0dd655fcd 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -20,8 +20,6 @@ package org.linphone.core; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; import java.util.Vector; @@ -542,9 +540,9 @@ class LinphoneCoreImpl implements LinphoneCore { terminateAllCalls(nativePtr); } private native Object getCall(long nativePtr, int position); - @SuppressWarnings("unchecked") public synchronized List getCalls() { + @SuppressWarnings("unchecked") public synchronized Vector getCalls() { int size = getCallsNb(nativePtr); - List calls = new ArrayList(size); + Vector calls = new Vector(size); for (int i=0; i < size; i++) { calls.add((LinphoneCall)getCall(nativePtr, i)); }