mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-06 21:33:08 +00:00
Some fixes for Java wrapper
This commit is contained in:
parent
12e1ccfe58
commit
9fa66fc345
2 changed files with 11 additions and 4 deletions
|
|
@ -171,10 +171,10 @@ class {{classImplName}} {{#isLinphoneFactory}}extends{{/isLinphoneFactory}}{{#is
|
|||
@Override
|
||||
public native void setDebugMode(boolean enable, String tag);
|
||||
|
||||
private native Core createCore(long nativePtr, CoreListener listener, String configPath, String factoryConfigPath);
|
||||
private native Core createCore(Factory factory, CoreListener listener, String configPath, String factoryConfigPath);
|
||||
@Override
|
||||
public Core createCore(CoreListener listener, String configPath, String factoryConfigPath) {
|
||||
return createCore(nativePtr, listener, configPath, factoryConfigPath);
|
||||
return createCore(this, listener, configPath, factoryConfigPath);
|
||||
}
|
||||
{{/isLinphoneFactory}}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,12 @@ static jlong GetObjectNativePtr(JNIEnv *env, jobject object) {
|
|||
return nativePtr;
|
||||
}
|
||||
|
||||
static void SetObjectNativePtr(JNIEnv *env, jobject object, jlong ptr) {
|
||||
jclass objClass = env->GetObjectClass(object);
|
||||
jfieldID nativePtrId = env->GetFieldID(objClass, "nativePtr", "J");
|
||||
env->SetLongField(object, nativePtrId, ptr);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void linphone_android_log_handler(int prio, char *str) {
|
||||
|
|
@ -357,8 +363,9 @@ jobject Java_{{jni_package}}CoreImpl_getMediastreamerFactory(JNIEnv *env, jobjec
|
|||
return env->NewObject(ljb->ms_factory_class, ljb->ms_factory_class_constructor, (jlong)factory);
|
||||
}
|
||||
|
||||
jobject Java_{{jni_package}}FactoryImpl_createCore(JNIEnv *env, jobject thiz, jlong ptr, jobject jlistener, jstring jconfig_path, jstring jfactory_config_path) {
|
||||
LinphoneFactory *cptr = (LinphoneFactory*)ptr;
|
||||
jobject Java_{{jni_package}}FactoryImpl_createCore(JNIEnv *env, jobject thiz, jobject jfactory, jobject jlistener, jstring jconfig_path, jstring jfactory_config_path) {
|
||||
LinphoneFactory *cptr = linphone_factory_get();
|
||||
SetObjectNativePtr(env, jfactory, (jlong)cptr); // Set the C factory ptr as Factory.nativePtr for next factory calls
|
||||
|
||||
LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(cptr);
|
||||
jobject listener = env->NewGlobalRef(jlistener);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue