Commit 06d8cec7 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Add checks to prevent crashes.

The getReceiverInterarrivalJitter() function may be called before the
used audio codec is known in case of early media, so test that the
payload type is valid before using it.
parent 362d7790
......@@ -1372,6 +1372,8 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderInterarr
pt = linphone_call_params_get_used_audio_codec(params);
else
pt = linphone_call_params_get_used_video_codec(params);
if (!pt || (pt->clock_rate == 0))
return (jfloat)0.0;
return (jfloat)((float)report_block_get_interarrival_jitter(srb) / (float)pt->clock_rate);
}
extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverInterarrivalJitter(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr) {
......@@ -1399,6 +1401,8 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverIntera
pt = linphone_call_params_get_used_audio_codec(params);
else
pt = linphone_call_params_get_used_video_codec(params);
if (!pt || (pt->clock_rate == 0))
return (jfloat)0.0;
return (jfloat)((float)report_block_get_interarrival_jitter(rrb) / (float)pt->clock_rate);
}
extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getRoundTripDelay(JNIEnv *env, jobject thiz, jlong stats_ptr) {
......
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