Commit 2e0cfb13 authored by Erwan Croze's avatar Erwan Croze 👋🏻
Browse files

Little factorisation in LinphoneCoreFactoryImpl

parent d0c6e976
......@@ -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) {
......
mediastreamer2 @ 8ffb9d13
Subproject commit bddafa836a00c848442670af6fd50c934a1e669f
Subproject commit 8ffb9d13a73d035e173c9a0ef42c3b701be07827
oRTP @ 9857d829
Subproject commit e7ae3587d3b7638a59c0929b332a50b78d84aa1c
Subproject commit 9857d82970226055b279a13fc566933f3014da1b
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment