LTS: fix the static constructor blocks to handle the changed name of the cpu features library
Also, add ffmpeg dependencies for lower APIs (how did it work before?) Also, just try to load c++_shared if it is present, not trying to guess whether the external libraries require it (android.sh will still make the decision to add c++_shared to dependencies list based on the list of external libraries).
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
package com.arthenica.mobileffmpeg;
|
||||
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* <p>This class is used to detect running ABI name using Android's <code>cpufeatures</code>
|
||||
@@ -35,7 +36,16 @@ public class AbiDetect {
|
||||
|
||||
/* LOAD NOT-LOADED LIBRARIES ON API < 21 */
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
System.loadLibrary("cpufeatures");
|
||||
try {
|
||||
System.loadLibrary("c++_shared");
|
||||
}
|
||||
catch (UnsatisfiedLinkError ex) {
|
||||
Log.i(Config.TAG, "libc++_shared.so fialed to load, try to proceed without it");
|
||||
}
|
||||
System.loadLibrary("ndk_compat");
|
||||
System.loadLibrary("avutil");
|
||||
System.loadLibrary("swresample");
|
||||
System.loadLibrary("avcodec");
|
||||
}
|
||||
System.loadLibrary("mobileffmpeg_abidetect");
|
||||
|
||||
|
||||
@@ -84,12 +84,13 @@ public class Config {
|
||||
|
||||
/* LOAD NOT-LOADED LIBRARIES ON API < 21 */
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
final List<String> externalLibrariesEnabled = getExternalLibraries();
|
||||
if (externalLibrariesEnabled.contains("tesseract") || externalLibrariesEnabled.contains("x265") || externalLibrariesEnabled.contains("snappy") || externalLibrariesEnabled.contains("openh264") || externalLibrariesEnabled.contains("rubberband")) {
|
||||
// libc++_shared.so included only when tesseract or x265 is enabled
|
||||
try {
|
||||
System.loadLibrary("c++_shared");
|
||||
}
|
||||
System.loadLibrary("cpufeatures");
|
||||
catch (UnsatisfiedLinkError ex) {
|
||||
Log.i(Config.TAG, "libc++_shared.so fialed to load, try to proceed without it");
|
||||
}
|
||||
System.loadLibrary("ndk_compat");
|
||||
System.loadLibrary("avutil");
|
||||
System.loadLibrary("swscale");
|
||||
System.loadLibrary("swresample");
|
||||
|
||||
Reference in New Issue
Block a user