From 2e0cfb1313e84388336a8ccb085bae9120714669 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Tue, 26 Jul 2016 10:37:12 +0200 Subject: [PATCH] Little factorisation in LinphoneCoreFactoryImpl --- .../core/LinphoneCoreFactoryImpl.java | 33 +++++++++++-------- mediastreamer2 | 2 +- oRTP | 2 +- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java index 14ed89c58..ef822b999 100644 --- a/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java @@ -35,7 +35,8 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { System.loadLibrary(s); return true; } catch (Throwable e) { - android.util.Log.w("LinphoneCoreFactoryImpl", "Unable to load optional library " + s +"\n" +e.getMessage()); + android.util.Log.w("LinphoneCoreFactoryImpl", "Unable to load optional library " + s + + ": " +e.getMessage()); } return false; } @@ -62,10 +63,10 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { if (firstException == null) firstException=e; } } - + if (!libLoaded){ throw new RuntimeException(firstException); - + }else{ Version.dumpCapabilities(); } @@ -86,24 +87,30 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { public LinphoneAddress createLinphoneAddress(String identity) throws LinphoneCoreException { return new LinphoneAddressImpl(identity); } - + @Override public LpConfig createLpConfig(String file) { return LpConfigImpl.fromFile(file); } - + public LpConfig createLpConfigFromString(String buffer) { return LpConfigImpl.fromBuffer(buffer); } + private void loadOpenH264(Context context) { + fcontext = context; + OpenH264DownloadHelper downloadHelper = new OpenH264DownloadHelper(fcontext); + if(downloadHelper != null && downloadHelper.isCodecFound()) { + System.load(downloadHelper.getFullPathLib()); + } + } + @Override public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, String userConfig, String factoryConfig, Object userdata, Object context) throws LinphoneCoreException { try { - fcontext = (Context)context; - OpenH264DownloadHelper downloadHelper = new OpenH264DownloadHelper((Context)context); - if(context!=null && downloadHelper.isCodecFound()) System.load(downloadHelper.getFullPathLib()); + loadOpenH264((Context) context); MediastreamerAndroidContext.setContext(context); File user = userConfig == null ? null : new File(userConfig); File factory = factoryConfig == null ? null : new File(factoryConfig); @@ -118,9 +125,7 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { @Override public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, Object context) throws LinphoneCoreException { try { - fcontext = (Context)context; - OpenH264DownloadHelper downloadHelper = new OpenH264DownloadHelper((Context)context); - if(context!=null && downloadHelper.isCodecFound()) System.load(downloadHelper.getFullPathLib()); + loadOpenH264((Context) context); MediastreamerAndroidContext.setContext(context); LinphoneCore lc = new LinphoneCoreImpl(listener); if(context!=null) lc.setContext(context); @@ -133,7 +138,7 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { @Override public native void setDebugMode(boolean enable, String tag); - + private native void _setLogHandler(Object handler); @Override public void setLogHandler(LinphoneLogHandler handler) { @@ -158,7 +163,7 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { public LinphoneFriend createLinphoneFriend() { return createLinphoneFriend(null); } - + @Override public native void enableLogCollection(boolean enable); @@ -181,7 +186,7 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { byte [] data, String encoding) { return new LinphoneContentImpl(type,subType,data,encoding); } - + @Override public LinphoneContent createLinphoneContent(String type, String subType, String data) { diff --git a/mediastreamer2 b/mediastreamer2 index bddafa836..8ffb9d13a 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit bddafa836a00c848442670af6fd50c934a1e669f +Subproject commit 8ffb9d13a73d035e173c9a0ef42c3b701be07827 diff --git a/oRTP b/oRTP index e7ae3587d..9857d8297 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit e7ae3587d3b7638a59c0929b332a50b78d84aa1c +Subproject commit 9857d82970226055b279a13fc566933f3014da1b