From: Sylvain Berfini Date: Fri, 18 Jan 2013 10:48:14 +0000 (+0100) Subject: Updated FactoryImpl to change Neon detection in CPUs X-Git-Url: http://sjero.net/git/?p=linphone;a=commitdiff_plain;h=ebfa43d5b22d986b5d0076cd04a8d0e8fbfd7fd8 Updated FactoryImpl to change Neon detection in CPUs --- diff --git a/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java index b719f0f7..04b6af1c 100644 --- a/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java @@ -20,8 +20,8 @@ package org.linphone.core; import java.io.File; import java.io.IOException; -import java.io.InputStream; +import org.linphone.CpuUtils; import org.linphone.mediastream.Version; import android.util.Log; @@ -43,6 +43,8 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { loadOptionalLibrary("avutil"); loadOptionalLibrary("swscale"); loadOptionalLibrary("avcore"); + + System.loadLibrary("neon"); if (!hasNeonInCpuFeatures()) { boolean noNeonLibrariesLoaded = loadOptionalLibrary("avcodecnoneon"); @@ -151,28 +153,8 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { 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.contains("Features")) { - result = line.contains("neon"); - break; - } - } - in.close(); - } catch(IOException ex){ - ex.printStackTrace(); - } - return result; + CpuUtils cpu = new CpuUtils(); + return cpu.isCpuNeon(); } public static boolean isArmv7()