Load neon liblinphone if fails to load no-neon liblinphone
This commit is contained in:
parent
dbc10f25e4
commit
4cda366e89
1 changed files with 21 additions and 7 deletions
|
@ -28,21 +28,30 @@ import android.util.Log;
|
||||||
|
|
||||||
public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
|
public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
|
||||||
|
|
||||||
private static void loadOptionalLibrary(String s) {
|
private static boolean loadOptionalLibrary(String s) {
|
||||||
try {
|
try {
|
||||||
System.loadLibrary(s);
|
System.loadLibrary(s);
|
||||||
|
return true;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.w("Unable to load optional library lib", s);
|
Log.w("Unable to load optional library lib", s);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// FFMPEG (audio/video)
|
// FFMPEG (audio/video)
|
||||||
if (!hasNeonInCpuFeatures()) {
|
if (!hasNeonInCpuFeatures()) {
|
||||||
loadOptionalLibrary("avutilnoneon");
|
boolean noNeonLibrariesLoaded = true;
|
||||||
loadOptionalLibrary("swscalenoneon");
|
noNeonLibrariesLoaded = noNeonLibrariesLoaded && loadOptionalLibrary("avutilnoneon");
|
||||||
loadOptionalLibrary("avcorenoneon");
|
noNeonLibrariesLoaded = noNeonLibrariesLoaded && loadOptionalLibrary("swscalenoneon");
|
||||||
loadOptionalLibrary("avcodecnoneon");
|
noNeonLibrariesLoaded = noNeonLibrariesLoaded && loadOptionalLibrary("avcorenoneon");
|
||||||
|
noNeonLibrariesLoaded = noNeonLibrariesLoaded && loadOptionalLibrary("avcodecnoneon");
|
||||||
|
if (!noNeonLibrariesLoaded) {
|
||||||
|
loadOptionalLibrary("avutil");
|
||||||
|
loadOptionalLibrary("swscale");
|
||||||
|
loadOptionalLibrary("avcore");
|
||||||
|
loadOptionalLibrary("avcodec");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
loadOptionalLibrary("avutil");
|
loadOptionalLibrary("avutil");
|
||||||
loadOptionalLibrary("swscale");
|
loadOptionalLibrary("swscale");
|
||||||
|
@ -67,8 +76,13 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
|
||||||
|
|
||||||
//Main library
|
//Main library
|
||||||
if (!hasNeonInCpuFeatures()) {
|
if (!hasNeonInCpuFeatures()) {
|
||||||
System.loadLibrary("linphonenoneon");
|
try {
|
||||||
Log.w("linphone", "No-neon liblinphone loaded");
|
System.loadLibrary("linphonenoneon");
|
||||||
|
Log.w("linphone", "No-neon liblinphone loaded");
|
||||||
|
} catch (UnsatisfiedLinkError ule) {
|
||||||
|
Log.w("linphone", "Failed to load no-neon liblinphone, loading neon liblinphone");
|
||||||
|
System.loadLibrary("linphone");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
System.loadLibrary("linphone");
|
System.loadLibrary("linphone");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue