mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 19:18:06 +00:00
add TMMBR callback at java level
This commit is contained in:
parent
84a8e1690d
commit
6dd6ea842d
2 changed files with 35 additions and 5 deletions
|
|
@ -7755,19 +7755,45 @@ static void _next_video_frame_decoded_callback(LinphoneCall *call, void *user_da
|
|||
return;
|
||||
}
|
||||
|
||||
jobject listener = (jobject) user_data;
|
||||
jobject listener = (jobject) env->NewLocalRef((jobject)user_data);
|
||||
if (listener == NULL){
|
||||
ms_error("_next_video_frame_decoded_callback: listener has gone.");
|
||||
return;
|
||||
}
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onNextVideoFrameDecoded","(Lorg/linphone/core/LinphoneCall;)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
||||
jobject jcall = getCall(env, call);
|
||||
env->CallVoidMethod(listener, method, jcall);
|
||||
env->DeleteLocalRef(listener);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCallImpl_setListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
|
||||
jobject listener = env->NewGlobalRef(jlistener);
|
||||
static void _on_tmmbr_received(LinphoneCall *call, int index, int bitrate){
|
||||
LinphoneCallCbs *cbs = linphone_call_get_current_callbacks(call);
|
||||
JNIEnv *env = ms_get_jni_env();
|
||||
jobject listener = (jobject) env->NewLocalRef((jobject)linphone_call_cbs_get_user_data(cbs));
|
||||
if (listener == NULL){
|
||||
ms_error("_on_tmmbr_received: listener has gone.");
|
||||
return;
|
||||
}
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "tmmbrReceived","(Lorg/linphone/core/LinphoneCall;II)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
||||
jobject jcall = getCall(env, call);
|
||||
env->CallVoidMethod(listener, method, jcall,(jint)index, (jint)bitrate);
|
||||
env->DeleteLocalRef(listener);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCallImpl_setListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
|
||||
LinphoneCall *call = (LinphoneCall *)ptr;
|
||||
linphone_call_set_next_video_frame_decoded_callback(call, _next_video_frame_decoded_callback, listener);
|
||||
LinphoneCallCbs *cbs = linphone_factory_create_call_cbs(linphone_factory_get());
|
||||
linphone_call_cbs_set_user_data(cbs, env->NewWeakGlobalRef(jlistener));
|
||||
linphone_call_cbs_set_tmmbr_received(cbs, _on_tmmbr_received);
|
||||
linphone_call_add_callbacks(call, cbs);
|
||||
|
||||
linphone_call_set_next_video_frame_decoded_callback(call, _next_video_frame_decoded_callback, env->NewWeakGlobalRef(jlistener));
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCallImpl_setVideoWindowId(JNIEnv* env
|
||||
|
|
|
|||
|
|
@ -31,8 +31,12 @@ public interface LinphoneCall {
|
|||
/**
|
||||
* LinphoneCall listener
|
||||
*/
|
||||
interface LinphoneCallListener {
|
||||
public interface LinphoneCallListener {
|
||||
void onNextVideoFrameDecoded(LinphoneCall call);
|
||||
/**
|
||||
* Invoked when a TMMBR RTCP packet is received.
|
||||
*/
|
||||
void tmmbrReceived(LinphoneCall call, int streamIndex, int bitrate);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue