From 740fd2e92a4ed14a0f7fac190671a08a154cadf0 Mon Sep 17 00:00:00 2001 From: alexcohn Date: Sun, 17 May 2020 22:31:58 +0300 Subject: [PATCH] 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). --- .../java/com/arthenica/mobileffmpeg/AbiDetect.java | 12 +++++++++++- .../main/java/com/arthenica/mobileffmpeg/Config.java | 9 +++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/android/app/src/main/java/com/arthenica/mobileffmpeg/AbiDetect.java b/android/app/src/main/java/com/arthenica/mobileffmpeg/AbiDetect.java index af59120be..816e0ee17 100644 --- a/android/app/src/main/java/com/arthenica/mobileffmpeg/AbiDetect.java +++ b/android/app/src/main/java/com/arthenica/mobileffmpeg/AbiDetect.java @@ -20,6 +20,7 @@ package com.arthenica.mobileffmpeg; import android.os.Build; +import android.util.Log; /** *

This class is used to detect running ABI name using Android's cpufeatures @@ -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"); diff --git a/android/app/src/main/java/com/arthenica/mobileffmpeg/Config.java b/android/app/src/main/java/com/arthenica/mobileffmpeg/Config.java index 15bb631d3..88a69454b 100644 --- a/android/app/src/main/java/com/arthenica/mobileffmpeg/Config.java +++ b/android/app/src/main/java/com/arthenica/mobileffmpeg/Config.java @@ -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 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");