Commit 209f7680 authored by Guillaume Beraudo's avatar Guillaume Beraudo
Browse files

New attribute current_params in linphonecall to differenciate expected params and effective ones.

Fixed JNI binding for LinphoneCallParams to always copy the params and autodestroy in finalize.
parent 8b3112cc
......@@ -286,6 +286,7 @@ static void call_accepted(SalOp *op){
ms_free(tmp);
ms_free(msg);
}
linphone_core_update_streams (lc,call,md);
linphone_call_set_state(call,LinphoneCallPaused,"Call paused");
}else if (sal_media_description_has_dir(md,SalStreamRecvOnly)){
/*we are put on hold when the call is initially accepted */
......@@ -296,6 +297,7 @@ static void call_accepted(SalOp *op){
ms_free(tmp);
ms_free(msg);
}
linphone_core_update_streams (lc,call,md);
linphone_call_set_state(call,LinphoneCallPaused,"Call paused");
}else{
if (lc->vtable.display_status){
......@@ -306,9 +308,9 @@ static void call_accepted(SalOp *op){
a reinvite made by us. We must notify the application this reinvite was accepted*/
linphone_call_set_state(call, LinphoneCallUpdated, "Call updated");
}
linphone_call_set_state(call,LinphoneCallStreamsRunning,"Connected (streams running)");
linphone_core_update_streams (lc,call,md);
linphone_call_set_state(call, LinphoneCallStreamsRunning, "Streams running");
}
linphone_core_update_streams (lc,call,md);
}else{
/*send a bye*/
ms_error("Incompatible SDP offer received in 200Ok, need to abort the call");
......
......@@ -367,7 +367,7 @@ void linphone_call_unref(LinphoneCall *obj){
* Returns current parameters associated to the call.
**/
const LinphoneCallParams * linphone_call_get_current_params(const LinphoneCall *call){
return &call->params;
return &call->current_params;
}
/**
......@@ -785,6 +785,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
ms_fatal("start_media_stream() called without prior init !");
return;
}
call->current_params = call->params;
/* adjust rtp jitter compensation. It must be at least the latency of the sound card */
int jitt_comp=MAX(lc->sound_conf.latency,lc->rtp_conf.audio_jitt_comp);
......@@ -862,6 +863,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
video_preview_stop(lc->previewstream);
lc->previewstream=NULL;
}
call->current_params.has_video=FALSE;
if (stream && stream->dir!=SalStreamInactive) {
const char *addr=stream->addr[0]!='\0' ? stream->addr : call->resultdesc->addr;
call->video_profile=make_profile(lc,call->resultdesc,stream,&used_pt);
......@@ -870,7 +872,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
MSWebCam *cam=lc->video_conf.device;
bool_t is_inactive=FALSE;
call->params.has_video=TRUE;
call->current_params.has_video=TRUE;
video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc));
video_stream_enable_self_view(call->videostream,lc->video_conf.selfview);
......
......@@ -2182,9 +2182,8 @@ bool_t linphone_core_inc_invite_pending(LinphoneCore*lc){
*
* @return 0 if successful, -1 otherwise.
**/
int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, LinphoneCallParams *params){
int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){
int err;
if (call->localdesc)
sal_media_description_unref(call->localdesc);
call->params=*params;
......
......@@ -618,7 +618,7 @@ int linphone_core_pause_all_calls(LinphoneCore *lc);
int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call);
int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, LinphoneCallParams *params);
int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params);
LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *lc);
......
......@@ -1022,15 +1022,15 @@ extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_enableVideo(JNIEnv
extern "C" jboolean Java_org_linphone_core_LinphoneCallParamsImpl_getVideoEnabled(JNIEnv *env, jobject thiz, jlong lcp){
return linphone_call_params_video_enabled((LinphoneCallParams*)lcp);
}
extern "C" jlong Java_org_linphone_core_LinphoneCallParamsImpl_copy(JNIEnv *env, jobject thiz, jlong lcp){
return (jlong) linphone_call_params_copy((LinphoneCallParams*)lcp);
extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_destroy(JNIEnv *env, jobject thiz, jlong lc){
return linphone_call_params_destroy((LinphoneCallParams*)lc);
}
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_createDefaultCallParams(JNIEnv *env, jobject thiz, jlong lc){
return (jlong) linphone_core_create_default_call_parameters((LinphoneCore*)lc);
}
extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCurrentParams(JNIEnv *env, jobject thiz, jlong lc){
return (jlong) linphone_call_get_current_params((LinphoneCall*)lc);
extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCurrentParamsCopy(JNIEnv *env, jobject thiz, jlong lc){
return (jlong) linphone_call_params_copy(linphone_call_get_current_params((LinphoneCall*)lc));
}
extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_enableCamera(JNIEnv *env, jobject thiz, jlong lc, jboolean b){
......@@ -1046,7 +1046,7 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_updateAddressWithParams(
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_updateCall(JNIEnv *env, jobject thiz, jlong lc, jlong call, jlong params){
return (jint) linphone_core_update_call((LinphoneCore *)lc, (LinphoneCall *)call, (LinphoneCallParams *)params);
return (jint) linphone_core_update_call((LinphoneCore *)lc, (LinphoneCall *)call, (const LinphoneCallParams *)params);
}
......
......@@ -88,6 +88,7 @@ struct _LinphoneCall
struct _VideoStream *videostream;
char *refer_to;
LinphoneCallParams params;
LinphoneCallParams current_params;
int up_bw; /*upload bandwidth setting at the time the call is started. Used to detect if it changes during a call */
bool_t refer_pending;
bool_t media_pending;
......
......@@ -150,10 +150,7 @@ public interface LinphoneCall {
**/
public LinphoneCallLog getCallLog();
/**
* @return parameters for this call; read only, call copy() to get a read/write version.
*/
public LinphoneCallParams getCurrentParamsReadOnly();
public LinphoneCallParams getCurrentParamsCopy();
public void enableCamera(boolean enabled);
......
......@@ -28,5 +28,4 @@ package org.linphone.core;
public interface LinphoneCallParams {
void setVideoEnabled(boolean b);
boolean getVideoEnabled();
LinphoneCallParams copy();
}
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