From a7adfbdaf513c564e5417fd2312f642c8ea3ca0d Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 13 Oct 2017 15:21:03 +0200 Subject: [PATCH] Improvements on OpenH264 Java helper --- .../classes/tools/OpenH264DownloadHelper.java | 31 ++++++++----------- wrappers/java/migration.sh | 1 - 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/wrappers/java/classes/tools/OpenH264DownloadHelper.java b/wrappers/java/classes/tools/OpenH264DownloadHelper.java index e987436a0..170bda78d 100644 --- a/wrappers/java/classes/tools/OpenH264DownloadHelper.java +++ b/wrappers/java/classes/tools/OpenH264DownloadHelper.java @@ -63,6 +63,19 @@ public class OpenH264DownloadHelper { if (context.getFilesDir() != null) { fileDirection = context.getFilesDir().toString(); } + + File file = new File(context.getApplicationInfo().nativeLibraryDir+"/libmsopenh264.so"); + if (!file.exists()) { + Log.i("LinphoneCoreFactoryImpl"," libmsopenh264 not found, we disable the download of Openh264"); + isDownloadEnabled = false; + } + if (isCodecFound()) { + Log.i("OpenH264DownloadHelper"," Loading OpenH264 downloaded plugin:" + downloadHelper.getFullPathLib()); + System.load(downloadHelper.getFullPathLib()); + } else { + Log.i("OpenH264DownloadHelper"," Cannot load OpenH264 downloaded plugin"); + } + isDownloadEnabled = true; } public static boolean isOpenH264DownloadEnabled() { @@ -73,24 +86,6 @@ public class OpenH264DownloadHelper { isDownloadEnabled = enabled; } - public static boolean checkIfOpenH264DownloadCanBeEnabled(Context context) { - File file = new File(context.getApplicationInfo().nativeLibraryDir+"/libmsopenh264.so"); - - if (!file.exists()) { - Log.i("LinphoneCoreFactoryImpl"," libmsopenh264 not found, we disable the download of Openh264"); - return false; - } - - OpenH264DownloadHelper downloadHelper = new OpenH264DownloadHelper(context); - if (downloadHelper.isCodecFound()) { - Log.i("OpenH264DownloadHelper"," Loading OpenH264 downloaded plugin:" + downloadHelper.getFullPathLib()); - System.load(downloadHelper.getFullPathLib()); - } else { - Log.i("OpenH264DownloadHelper"," Cannot load OpenH264 downloaded plugin"); - } - return true; - } - /** * Set OpenH264DownloadHelperListener * @param h264Listener diff --git a/wrappers/java/migration.sh b/wrappers/java/migration.sh index ba773ad8f..ef80e0005 100644 --- a/wrappers/java/migration.sh +++ b/wrappers/java/migration.sh @@ -234,7 +234,6 @@ eval "$SED_START 's/enableDownloadOpenH264(/OpenH264DownloadHelper.enableDownloa #Factory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath()); #Factory.instance().enableLogCollection(isDebugEnabled); #Factory.instance().setDebugMode(isDebugEnabled, getString(R.string.app_name)); -#Factory.instance().createConfig(String s); #AccountCreator.updatePassword #Android specifics not wrapped automatically