From 011db1f6a2fb47fd97d49372a7c42c6a5d13cee7 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 20 Sep 2012 17:51:02 +0200 Subject: [PATCH 01/36] getCurrentParamsCopy can return null --- coreapi/linphonecore_jni.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index fda8c861f..d7294356c 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1562,6 +1562,9 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getRemoteParams(JNIEnv } extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCurrentParamsCopy(JNIEnv *env, jobject thiz, jlong lc){ + if (linphone_call_get_current_params((LinphoneCall*)lc) == NULL) { + return (jlong) 0; + } return (jlong) linphone_call_params_copy(linphone_call_get_current_params((LinphoneCall*)lc)); } From b94ed904fdfda543a16a6297014f8ff6aff4e876 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 20 Sep 2012 17:57:00 +0200 Subject: [PATCH 02/36] Previous fix cancelled, real fix applied --- coreapi/linphonecore_jni.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index d7294356c..16d44390c 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1558,13 +1558,13 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_createDefaultCallParams } extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getRemoteParams(JNIEnv *env, jobject thiz, jlong lc){ + if (linphone_call_get_remote_params((LinphoneCall*)lc) == NULL) { + return (jlong) 0; + } return (jlong) linphone_call_params_copy(linphone_call_get_remote_params((LinphoneCall*)lc)); } extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCurrentParamsCopy(JNIEnv *env, jobject thiz, jlong lc){ - if (linphone_call_get_current_params((LinphoneCall*)lc) == NULL) { - return (jlong) 0; - } return (jlong) linphone_call_params_copy(linphone_call_get_current_params((LinphoneCall*)lc)); } From b67d2dd4a71626a150e7d57156f548985c1a32cc Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 20 Sep 2012 21:30:42 +0200 Subject: [PATCH 03/36] fix: reuse stun discovered ip/port accross reinvites. --- coreapi/linphonecall.c | 42 +++++++++++++++++++----------------------- coreapi/misc.c | 4 +++- coreapi/private.h | 16 +++++++++------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 7166d1c13..7f11028ab 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -193,6 +193,22 @@ static MSList *make_codec_list(LinphoneCore *lc, const MSList *codecs, int bandw return l; } +static void update_media_description_from_stun(SalMediaDescription *md, const StunCandidate *ac, const StunCandidate *vc){ + if (ac->port!=0){ + strcpy(md->streams[0].rtp_addr,ac->addr); + md->streams[0].rtp_port=ac->port; + if ((ac->addr[0]!='\0' && vc->addr[0]!='\0' && strcmp(ac->addr,vc->addr)==0) || md->nstreams==1){ + strcpy(md->addr,ac->addr); + } + } + if (vc->port!=0){ + strcpy(md->streams[1].rtp_addr,vc->addr); + md->streams[1].rtp_port=vc->port; + } + +} + + static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, LinphoneCall *call, unsigned int session_id, unsigned int session_ver){ MSList *l; PayloadType *pt; @@ -257,7 +273,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li ice_session_add_check_list(call->ice_session, ice_check_list_new()); } } - + update_media_description_from_stun(md,&call->ac,&call->vc); linphone_address_destroy(addr); return md; } @@ -327,20 +343,6 @@ void linphone_call_init_stats(LinphoneCallStats *stats, int type) { stats->ice_state = LinphoneIceStateNotActivated; } -static void update_media_description_from_stun(SalMediaDescription *md, const StunCandidate *ac, const StunCandidate *vc){ - if (ac->port!=0){ - strcpy(md->streams[0].rtp_addr,ac->addr); - md->streams[0].rtp_port=ac->port; - if ((ac->addr[0]!='\0' && vc->addr[0]!='\0' && strcmp(ac->addr,vc->addr)==0) || md->nstreams==1){ - strcpy(md->addr,ac->addr); - } - } - if (vc->port!=0){ - strcpy(md->streams[1].rtp_addr,vc->addr); - md->streams[1].rtp_port=vc->port; - } - -} static void discover_mtu(LinphoneCore *lc, const char *remote){ int mtu; @@ -355,12 +357,9 @@ static void discover_mtu(LinphoneCore *lc, const char *remote){ } } -#define STUN_CANDIDATE_INIT {{0},0} - LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params) { LinphoneCall *call=ms_new0(LinphoneCall,1); - StunCandidate ac=STUN_CANDIDATE_INIT,vc=STUN_CANDIDATE_INIT; int ping_time=-1; call->dir=LinphoneCallOutgoing; call->op=sal_op_new(lc->sal); @@ -374,13 +373,12 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr ice_session_set_role(call->ice_session, IR_Controlling); } if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseStun) { - ping_time=linphone_core_run_stun_tests(call->core,call,&ac, &vc); + ping_time=linphone_core_run_stun_tests(call->core,call); } if (ping_time>=0) { linphone_core_adapt_to_network(lc,ping_time,&call->params); } call->localdesc=create_local_media_description(lc,call); - update_media_description_from_stun(call->localdesc,&ac,&vc); call->camera_active=params->has_video; discover_mtu(lc,linphone_address_get_domain (to)); @@ -395,7 +393,6 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro LinphoneCall *call=ms_new0(LinphoneCall,1); char *from_str; int ping_time=-1; - StunCandidate ac=STUN_CANDIDATE_INIT,vc=STUN_CANDIDATE_INIT; call->dir=LinphoneCallIncoming; sal_op_set_user_pointer(op,call); @@ -434,7 +431,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro } break; case LinphonePolicyUseStun: - ping_time=linphone_core_run_stun_tests(call->core,call,&ac, &vc); + ping_time=linphone_core_run_stun_tests(call->core,call); /* No break to also destroy ice session in this case. */ default: break; @@ -443,7 +440,6 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_core_adapt_to_network(lc,ping_time,&call->params); }; call->localdesc=create_local_media_description(lc,call); - update_media_description_from_stun(call->localdesc,&ac,&vc); call->camera_active=call->params.has_video; discover_mtu(lc,linphone_address_get_domain(from)); diff --git a/coreapi/misc.c b/coreapi/misc.c index 8cdf2bb27..15fc5374c 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -467,8 +467,10 @@ static int recvStunResponse(ortp_socket_t sock, char *ipaddr, int *port, int *id } /* this functions runs a simple stun test and return the number of milliseconds to complete the tests, or -1 if the test were failed.*/ -int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call, StunCandidate *ac, StunCandidate *vc){ +int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ const char *server=linphone_core_get_stun_server(lc); + StunCandidate *ac=&call->ac; + StunCandidate *vc=&call->vc; if (lc->sip_conf.ipv6_enabled){ ms_warning("stun support is not implemented for ipv6"); diff --git a/coreapi/private.h b/coreapi/private.h index f0b3b2c30..1e93c19d7 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -99,7 +99,13 @@ struct _LinphoneChatMessage { char* external_body_url; LinphoneAddress* from; }; - + +typedef struct StunCandidate{ + char addr[64]; + int port; +}StunCandidate; + + struct _LinphoneCall { int magic; /*used to distinguish from proxy config*/ @@ -123,6 +129,7 @@ struct _LinphoneCall void * user_pointer; int audio_port; int video_port; + StunCandidate ac,vc; /*audio video ip/port discovered by STUN*/ struct _AudioStream *audiostream; /**/ struct _VideoStream *videostream; MSAudioEndpoint *endpoint; /*used for conferencing*/ @@ -233,12 +240,7 @@ MSList *linphone_find_friend(MSList *fl, const LinphoneAddress *fri, LinphoneFri void linphone_core_update_allocated_audio_bandwidth(LinphoneCore *lc); void linphone_core_update_allocated_audio_bandwidth_in_call(LinphoneCall *call, const PayloadType *pt); -typedef struct StunCandidate{ - char addr[64]; - int port; -}StunCandidate; - -int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call, StunCandidate *ac, StunCandidate *vc); +int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call); void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params); int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call); void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call); From c476c7ec79263d33d8357e881c636a3b59f8ec1e Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 19 Sep 2012 13:38:02 +0200 Subject: [PATCH 04/36] Add JNI to access call statistics. --- .../core/tutorials/TutorialBuddyStatus.java | 2 + .../core/tutorials/TutorialChatRoom.java | 2 + .../core/tutorials/TutorialHelloWorld.java | 2 + .../core/tutorials/TutorialRegistration.java | 2 + coreapi/linphonecore_jni.cc | 140 ++++++++++++++++++ .../org/linphone/core/LinphoneCall.java | 24 +++ .../org/linphone/core/LinphoneCallStats.java | 102 +++++++++++++ .../linphone/core/LinphoneCoreListener.java | 5 + 8 files changed, 279 insertions(+) create mode 100644 java/common/org/linphone/core/LinphoneCallStats.java diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java index 1d86d482b..bf253b727 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java @@ -20,6 +20,7 @@ package org.linphone.core.tutorials; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCall; +import org.linphone.core.LinphoneCallStats; import org.linphone.core.LinphoneChatMessage; import org.linphone.core.LinphoneChatRoom; import org.linphone.core.LinphoneCore; @@ -97,6 +98,7 @@ public class TutorialBuddyStatus implements LinphoneCoreListener { public void globalState(LinphoneCore lc, GlobalState state, String message) {} public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {} public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg) {} + public void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats) {} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java index 91dc0f247..7514a1ddc 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java @@ -20,6 +20,7 @@ package org.linphone.core.tutorials; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCall; +import org.linphone.core.LinphoneCallStats; import org.linphone.core.LinphoneChatMessage; import org.linphone.core.LinphoneChatRoom; import org.linphone.core.LinphoneCore; @@ -75,6 +76,7 @@ public class TutorialChatRoom implements LinphoneCoreListener { public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,String url) {} public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {} public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg){} + public void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats) {} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java index 354f97501..4b63e8813 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java @@ -20,6 +20,7 @@ package org.linphone.core.tutorials; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCall; +import org.linphone.core.LinphoneCallStats; import org.linphone.core.LinphoneChatMessage; import org.linphone.core.LinphoneChatRoom; import org.linphone.core.LinphoneCore; @@ -69,6 +70,7 @@ public class TutorialHelloWorld implements LinphoneCoreListener { public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,String url) {} public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {} public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {} + public void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats) {} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java index 48e473d61..86b300143 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java @@ -20,6 +20,7 @@ package org.linphone.core.tutorials; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCall; +import org.linphone.core.LinphoneCallStats; import org.linphone.core.LinphoneChatMessage; import org.linphone.core.LinphoneChatRoom; import org.linphone.core.LinphoneCore; @@ -80,6 +81,7 @@ public class TutorialRegistration implements LinphoneCoreListener { public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {} public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {} public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg) {} + public void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats) {} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 16d44390c..38d36ae42 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -112,6 +112,7 @@ public: vTable.message_received = message_received; vTable.new_subscription_request = new_subscription_request; vTable.notify_presence_recv = notify_presence_recv; + vTable.call_stats_updated = callStatsUpdated; listenerClass = (jclass)env->NewGlobalRef(env->GetObjectClass( alistener)); @@ -133,6 +134,9 @@ public: callStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCall$State")); callStateFromIntId = env->GetStaticMethodID(callStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCall$State;"); + /*callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats);*/ + callStatsUpdatedId = env->GetMethodID(listenerClass, "callStatsUpdated", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;Lorg/linphone/core/LinphoneCallStats;)V"); + chatMessageStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneChatMessage$State")); chatMessageStateFromIntId = env->GetStaticMethodID(chatMessageStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneChatMessage$State;"); @@ -172,6 +176,10 @@ public: addressClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneAddressImpl")); addressCtrId =env->GetMethodID(addressClass,"", "(J)V"); + callStatsClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCallStatsImpl")); + callStatsId = env->GetMethodID(callStatsClass, "", "(JJ)V"); + callSetAudioStatsId = env->GetMethodID(callClass, "setAudioStats", "(Lorg/linphone/core/LinphoneCallStats;)V"); + callSetVideoStatsId = env->GetMethodID(callClass, "setVideoStats", "(Lorg/linphone/core/LinphoneCallStats;)V"); } ~LinphoneCoreData() { @@ -184,6 +192,7 @@ public: env->DeleteGlobalRef(globalStateClass); env->DeleteGlobalRef(registrationStateClass); env->DeleteGlobalRef(callStateClass); + env->DeleteGlobalRef(callStatsClass); env->DeleteGlobalRef(chatMessageStateClass); env->DeleteGlobalRef(proxyClass); env->DeleteGlobalRef(callClass); @@ -202,6 +211,7 @@ public: jmethodID notifyPresenceReceivedId; jmethodID textReceivedId; jmethodID messageReceivedId; + jmethodID callStatsUpdatedId; jclass globalStateClass; jmethodID globalStateId; @@ -215,6 +225,11 @@ public: jmethodID callStateId; jmethodID callStateFromIntId; + jclass callStatsClass; + jmethodID callStatsId; + jmethodID callSetAudioStatsId; + jmethodID callSetVideoStatsId; + jclass chatMessageStateClass; jmethodID chatMessageStateFromIntId; @@ -424,6 +439,24 @@ public: } } + static void callStatsUpdated(LinphoneCore *lc, LinphoneCall* call, const LinphoneCallStats *stats) { + JNIEnv *env = 0; + jobject statsobj; + jobject callobj; + jint result = jvm->AttachCurrentThread(&env,NULL); + if (result != 0) { + ms_error("cannot attach VM\n"); + return; + } + LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc); + statsobj = env->NewObject(lcData->callStatsClass, lcData->callStatsId, (jlong)call, (jlong)stats); + callobj = lcData->getCall(env, call); + if (stats->type == LINPHONE_CALL_STATS_AUDIO) + env->CallVoidMethod(callobj, lcData->callSetAudioStatsId, statsobj); + else + env->CallVoidMethod(callobj, lcData->callSetVideoStatsId, statsobj); + env->CallVoidMethod(lcData->listener, lcData->callStatsUpdatedId, lcData->core, callobj, statsobj); + } }; @@ -1211,6 +1244,113 @@ extern "C" jint Java_org_linphone_core_LinphoneCallLogImpl_getCallDuration(JNIEn return ((LinphoneCallLog*)ptr)->duration; } +/* CallStats */ +extern "C" int Java_org_linphone_core_LinphoneCallStatsImpl_getMediaType(JNIEnv *env, jobject thiz, jlong stats_ptr) { + return (int)((LinphoneCallStats *)stats_ptr)->type; +} +extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderLossRate(JNIEnv *env, jobject thiz, jlong stats_ptr) { + const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + const report_block_t *srb = NULL; + + if (!stats->sent_rtcp) + return (jfloat)0.0; + /* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */ + if (stats->sent_rtcp->b_cont != NULL) + msgpullup(stats->sent_rtcp, -1); + if (rtcp_is_SR(stats->sent_rtcp)) + srb = rtcp_SR_get_report_block(stats->sent_rtcp, 0); + else if (rtcp_is_RR(stats->sent_rtcp)) + srb = rtcp_RR_get_report_block(stats->sent_rtcp, 0); + if (!srb) + return (jfloat)0.0; + return (jfloat)(100.0 * report_block_get_fraction_lost(srb) / 256.0); +} +extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverLossRate(JNIEnv *env, jobject thiz, jlong stats_ptr) { + const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + const report_block_t *rrb = NULL; + + if (!stats->received_rtcp) + return (jfloat)0.0; + /* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */ + if (stats->received_rtcp->b_cont != NULL) + msgpullup(stats->received_rtcp, -1); + if (rtcp_is_RR(stats->received_rtcp)) + rrb = rtcp_RR_get_report_block(stats->received_rtcp, 0); + else if (rtcp_is_SR(stats->received_rtcp)) + rrb = rtcp_SR_get_report_block(stats->received_rtcp, 0); + if (!rrb) + return (jfloat)0.0; + return (jfloat)(100.0 * report_block_get_fraction_lost(rrb) / 256.0); +} +extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderInterarrivalJitter(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr) { + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + const LinphoneCall *call = (LinphoneCall *)call_ptr; + const LinphoneCallParams *params = linphone_call_get_current_params(call); + const PayloadType *pt; + const report_block_t *srb = NULL; + + if (!stats->sent_rtcp) + return (jfloat)0.0; + /* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */ + if (stats->sent_rtcp->b_cont != NULL) + msgpullup(stats->sent_rtcp, -1); + if (rtcp_is_SR(stats->sent_rtcp)) + srb = rtcp_SR_get_report_block(stats->sent_rtcp, 0); + else if (rtcp_is_RR(stats->sent_rtcp)) + srb = rtcp_RR_get_report_block(stats->sent_rtcp, 0); + if (!srb) + return (jfloat)0.0; + if (stats->type == LINPHONE_CALL_STATS_AUDIO) + pt = linphone_call_params_get_used_audio_codec(params); + else + pt = linphone_call_params_get_used_video_codec(params); + 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) { + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + const LinphoneCall *call = (LinphoneCall *)call_ptr; + const LinphoneCallParams *params = linphone_call_get_current_params(call); + const PayloadType *pt; + const report_block_t *rrb = NULL; + + if (!stats->received_rtcp) + return (jfloat)0.0; + /* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */ + if (stats->received_rtcp->b_cont != NULL) + msgpullup(stats->received_rtcp, -1); + if (rtcp_is_SR(stats->received_rtcp)) + rrb = rtcp_SR_get_report_block(stats->received_rtcp, 0); + else if (rtcp_is_RR(stats->received_rtcp)) + rrb = rtcp_RR_get_report_block(stats->received_rtcp, 0); + if (!rrb) + return (jfloat)0.0; + if (stats->type == LINPHONE_CALL_STATS_AUDIO) + pt = linphone_call_params_get_used_audio_codec(params); + else + pt = linphone_call_params_get_used_video_codec(params); + 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) { + return (jfloat)((LinphoneCallStats *)stats_ptr)->round_trip_delay; +} +extern "C" jlong Java_org_linphone_core_LinphoneCallStatsImpl_getLatePacketsCumulativeNumber(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr) { + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + LinphoneCall *call = (LinphoneCall *)call_ptr; + rtp_stats_t rtp_stats; + + memset(&rtp_stats, 0, sizeof(rtp_stats)); + if (stats->type == LINPHONE_CALL_STATS_AUDIO) + audio_stream_get_local_rtp_stats(call->audiostream, &rtp_stats); +#ifdef VIDEO_ENABLED + else + video_stream_get_local_rtp_stats(call->videostream, &rtp_stats); +#endif + return (jlong)rtp_stats.outoftime; +} +extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getJitterBufferSize(JNIEnv *env, jobject thiz, jlong stats_ptr) { + return (jfloat)((LinphoneCallStats *)stats_ptr)->jitter_stats.jitter_buffer_size_ms; +} + /*payloadType*/ extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv* env,jobject thiz,jlong ptr) { PayloadType* pt = (PayloadType*)ptr; diff --git a/java/common/org/linphone/core/LinphoneCall.java b/java/common/org/linphone/core/LinphoneCall.java index 6fe6704de..35e173d5a 100644 --- a/java/common/org/linphone/core/LinphoneCall.java +++ b/java/common/org/linphone/core/LinphoneCall.java @@ -159,6 +159,30 @@ public interface LinphoneCall { * @Return LinphoneCallLog **/ LinphoneCallLog getCallLog(); + + /** + * Set the audio statistics associated with this call. + * @return LinphoneCallStats + */ + void setAudioStats(LinphoneCallStats stats); + + /** + * Set the video statistics associated with this call. + * @return LinphoneCallStats + */ + void setVideoStats(LinphoneCallStats stats); + + /** + * Get the audio statistics associated with this call. + * @return LinphoneCallStats + */ + LinphoneCallStats getAudioStats(); + + /** + * Get the video statistics associated with this call. + * @return LinphoneCallStats + */ + LinphoneCallStats getVideoStats(); LinphoneCallParams getRemoteParams(); diff --git a/java/common/org/linphone/core/LinphoneCallStats.java b/java/common/org/linphone/core/LinphoneCallStats.java new file mode 100644 index 000000000..f391b2a91 --- /dev/null +++ b/java/common/org/linphone/core/LinphoneCallStats.java @@ -0,0 +1,102 @@ +/* +LinPhoneCallStats.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +import java.util.Vector; + + +public interface LinphoneCallStats { + static public class MediaType { + static private Vector values = new Vector(); + /** + * Audio + */ + static public MediaType Audio = new MediaType(0, "Audio"); + /** + * Video + */ + static public MediaType Video = new MediaType(1, "Video"); + protected final int mValue; + private final String mStringValue; + + private MediaType(int value, String stringValue) { + mValue = value; + values.addElement(this); + mStringValue = stringValue; + } + public static MediaType fromInt(int value) { + for (int i = 0; i < values.size(); i++) { + MediaType mtype = (MediaType) values.elementAt(i); + if (mtype.mValue == value) return mtype; + } + throw new RuntimeException("MediaType not found [" + value + "]"); + } + public String toString() { + return mStringValue; + } + } + + /** + * Get the stats media type + * @return MediaType + */ + public MediaType getMediaType(); + + /** + * Get the sender loss rate since last report + * @return The sender loss rate + */ + public float getSenderLossRate(); + + /** + * Get the receiver loss rate since last report + * @return The receiver loss rate + */ + public float getReceiverLossRate(); + + /** + * Get the sender interarrival jitter + * @return The interarrival jitter at last emitted sender report + */ + public float getSenderInterarrivalJitter(); + + /** + * Get the receiver interarrival jitter + * @return The interarrival jitter at last received receiver report + */ + public float getReceiverInterarrivalJitter(); + + /** + * Get the round trip delay + * @return The round trip delay in seconds, -1 if the information is not available + */ + public float getRoundTripDelay(); + + /** + * Get the cumulative number of late packets + * @return The cumulative number of late packets + */ + public long getLatePacketsCumulativeNumber(); + + /** + * Get the jitter buffer size + * @return The jitter buffer size in milliseconds + */ + public float getJitterBufferSize(); +} diff --git a/java/common/org/linphone/core/LinphoneCoreListener.java b/java/common/org/linphone/core/LinphoneCoreListener.java index a84f736d2..c81dafec4 100644 --- a/java/common/org/linphone/core/LinphoneCoreListener.java +++ b/java/common/org/linphone/core/LinphoneCoreListener.java @@ -40,6 +40,11 @@ public interface LinphoneCoreListener { * */ void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State cstate,String message); + /** + * Call stats notification + */ + void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats); + /** * Callback to display change in encryption state. * @param encrypted true if all streams of the call are encrypted From 28cacd507485d88bb933d076ab968494f33f9074 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 21 Sep 2012 15:52:16 +0200 Subject: [PATCH 05/36] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index f225ee612..e5a4c5247 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit f225ee612009009075ab6caf7ef91bb3a21fa25f +Subproject commit e5a4c52472dd1ec6d7eddacd69d2c0cf17288359 From 3969da946c4512eae2f10877371049c7ed983180 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 24 Sep 2012 11:24:05 +0200 Subject: [PATCH 06/36] fix pango bug on macos x --- Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 6faebc4fc..8756019f4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -218,7 +218,9 @@ bundle: $(LIBICONV_HACK) MS2_PLUGINS_INSTALL_PREFIX=$(prefix) \ gtk-mac-bundler $(PACKAGE_BUNDLE_FILE) printf "[Pango]\nModuleFiles=./etc/pango/pango.modules\n" \ - > $(BUNDLEDIR)/Contents/Resources/etc/pango/pangorc + > $(BUNDLEDIR)/Contents/Resources/etc/pango/pangorc + cp -f $(BUNDLEDIR)/Contents/Resources/etc/pango/pango.modules $(BUNDLEDIR)/Contents/Resources/etc/pango/pango.modules.orig + sed -e 's:@executable_path/../Resources:../..:g' $(BUNDLEDIR)/Contents/Resources/etc/pango/pango.modules.orig > $(BUNDLEDIR)/Contents/Resources/etc/pango/pango.modules cp -f $(LIBICONV_HACK) $(BUNDLEDIR)/Contents/Resources/lib/. cd $(BUNDLEDIR)/.. && rm -f $(MACAPPZIP) && zip -r $(MACAPPZIP) $(MACAPPNAME) && cd - From e4309a8757f1a85b39d352fcc67e732a2e7e548e Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 24 Sep 2012 12:41:13 +0200 Subject: [PATCH 07/36] fix get local address in case of 3G connectivity on ios --- coreapi/misc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 15fc5374c..df65b53f4 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -971,10 +971,15 @@ static int get_local_ip_with_getifaddrs(int type, char *address, int size) if (getifaddrs(&ifpstart) < 0) { return -1; } - +#ifndef __linux + #define UP_FLAG IFF_UP /* interface is up */ +#else + #define UP_FLAG IFF_RUNNING /* resources allocated */ +#endif + for (ifp = ifpstart; ifp != NULL; ifp = ifp->ifa_next) { if (ifp->ifa_addr && ifp->ifa_addr->sa_family == type - && (ifp->ifa_flags & IFF_RUNNING) && !(ifp->ifa_flags & IFF_LOOPBACK)) + && (ifp->ifa_flags & UP_FLAG) && !(ifp->ifa_flags & IFF_LOOPBACK)) { getnameinfo(ifp->ifa_addr, (type == AF_INET6) ? From e3d56d4124e3df25811d704db9b256242ed12328 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 24 Sep 2012 18:45:55 +0200 Subject: [PATCH 08/36] Select ICE candidates on completion even for the controlled agent. --- coreapi/linphonecall.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 7f11028ab..d3212a9f6 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1767,16 +1767,16 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { switch (ice_session_state(call->ice_session)) { case IS_Completed: + ice_session_select_candidates(call->ice_session); if (ice_session_role(call->ice_session) == IR_Controlling) { - ice_session_select_candidates(call->ice_session); linphone_core_update_call(call->core, call, &call->current_params); } break; case IS_Failed: if (ice_session_has_completed_check_list(call->ice_session) == TRUE) { + ice_session_select_candidates(call->ice_session); if (ice_session_role(call->ice_session) == IR_Controlling) { /* At least one ICE session has succeeded, so perform a call update. */ - ice_session_select_candidates(call->ice_session); linphone_core_update_call(call->core, call, &call->current_params); } } From c55a2c6b50d86e79535e256f6ea8e05985b9ddfd Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 24 Sep 2012 18:46:57 +0200 Subject: [PATCH 09/36] Delay creation of local media description so that edge network detection works with ICE activated. --- coreapi/callbacks.c | 1 - coreapi/linphonecall.c | 14 +++++++++----- coreapi/linphonecore.c | 7 +++---- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 14ca748e1..8954b85da 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -184,7 +184,6 @@ static void call_received(SalOp *h){ } call=linphone_call_new_incoming(lc,from_addr,to_addr,h); - sal_call_set_local_media_description(h,call->localdesc); /* the call is acceptable so we can now add it to our list */ linphone_core_add_call(lc,call); diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index d3212a9f6..3d32371a9 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -269,11 +269,11 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li md->streams[i].crypto[1].algo = 0; md->streams[i].crypto[2].algo = 0; } - if ((linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) && (call->ice_session != NULL) && (ice_session_check_list(call->ice_session, i) == NULL)) { - ice_session_add_check_list(call->ice_session, ice_check_list_new()); - } } update_media_description_from_stun(md,&call->ac,&call->vc); + if (call->ice_session != NULL) { + linphone_core_update_local_media_description_from_ice(md, call->ice_session); + } linphone_address_destroy(addr); return md; } @@ -378,7 +378,6 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr if (ping_time>=0) { linphone_core_adapt_to_network(lc,ping_time,&call->params); } - call->localdesc=create_local_media_description(lc,call); call->camera_active=params->has_video; discover_mtu(lc,linphone_address_get_domain (to)); @@ -439,7 +438,6 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro if (ping_time>=0) { linphone_core_adapt_to_network(lc,ping_time,&call->params); }; - call->localdesc=create_local_media_description(lc,call); call->camera_active=call->params.has_video; discover_mtu(lc,linphone_address_get_domain(from)); @@ -1011,6 +1009,9 @@ void linphone_call_init_audio_stream(LinphoneCall *call){ if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (call->ice_session != NULL)){ rtp_session_set_pktinfo(audiostream->session, TRUE); rtp_session_set_symmetric_rtp(audiostream->session, FALSE); + if (ice_session_check_list(call->ice_session, 0) == NULL) { + ice_session_add_check_list(call->ice_session, ice_check_list_new()); + } audiostream->ice_check_list = ice_session_check_list(call->ice_session, 0); ice_check_list_set_rtp_session(audiostream->ice_check_list, audiostream->session); } @@ -1044,6 +1045,9 @@ void linphone_call_init_video_stream(LinphoneCall *call){ if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (call->ice_session != NULL) && (ice_session_check_list(call->ice_session, 1))){ rtp_session_set_pktinfo(call->videostream->session, TRUE); rtp_session_set_symmetric_rtp(call->videostream->session, FALSE); + if (ice_session_check_list(call->ice_session, 1) == NULL) { + ice_session_add_check_list(call->ice_session, ice_check_list_new()); + } call->videostream->ice_check_list = ice_session_check_list(call->ice_session, 1); ice_check_list_set_rtp_session(call->videostream->ice_check_list, call->videostream->session); } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 99482f620..8e2b9ac98 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2195,10 +2195,9 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphonePro linphone_call_init_media_streams(call); if (lc->ringstream==NULL) audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard); + call->localdesc=create_local_media_description(lc,call); if (!lc->sip_conf.sdp_200_ack){ call->media_pending=TRUE; - if (call->ice_session != NULL) - linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); sal_call_set_local_media_description(call->op,call->localdesc); } real_url=linphone_address_as_string(call->log->to); @@ -2457,8 +2456,8 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){ bool_t propose_early_media=lp_config_get_int(lc->config,"sip","incoming_calls_early_media",FALSE); const char *ringback_tone=linphone_core_get_remote_ringback_tone (lc); - if (call->ice_session != NULL) - linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); + call->localdesc=create_local_media_description(lc,call); + sal_call_set_local_media_description(call->op,call->localdesc); md=sal_call_get_final_media_description(call->op); if (md && sal_media_description_empty(md)){ sal_call_decline(call->op,SalReasonMedia,NULL); From 88298e0d7ef5d0ed2b8ac8b18f23bf6a2901d246 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 24 Sep 2012 18:47:43 +0200 Subject: [PATCH 10/36] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index e5a4c5247..fd8aa5fa1 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit e5a4c52472dd1ec6d7eddacd69d2c0cf17288359 +Subproject commit fd8aa5fa14d1f683aef1a6108fd497dc3e42891a From 0c0f6271ed787c463ec5198c3cf8fcf22bc8c7d8 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 25 Sep 2012 10:52:51 +0200 Subject: [PATCH 11/36] Added lookupCCCFromIso method to JNI --- coreapi/linphonecore_jni.cc | 6 ++++++ java/common/org/linphone/core/LinphoneProxyConfig.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 38d36ae42..a11c158c8 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1074,6 +1074,12 @@ extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_normalizePhone env->ReleaseStringUTFChars(jnumber, number); return normalizedNumber; } +extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_lookupCCCFromIso(JNIEnv* env, jobject thiz, jstring jiso) { + const char* iso = env->GetStringUTFChars(jiso, NULL); + int prefix = linphone_dial_plan_lookup_ccc_from_iso(iso); + env->ReleaseStringUTFChars(jiso, iso); + return (jint) prefix; +} extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getDomain(JNIEnv* env ,jobject thiz ,jlong proxyCfg) { diff --git a/java/common/org/linphone/core/LinphoneProxyConfig.java b/java/common/org/linphone/core/LinphoneProxyConfig.java index bf2907d26..eee58c915 100644 --- a/java/common/org/linphone/core/LinphoneProxyConfig.java +++ b/java/common/org/linphone/core/LinphoneProxyConfig.java @@ -139,4 +139,10 @@ public interface LinphoneProxyConfig { * @param parameters to add */ public void setContactParameters(String params); + + /** + * Return the international prefix for the given country + * @param country iso code + */ + public int lookupCCCFromIso(String iso); } From df3f21cac0046a6c2880aacd9ed434c287ff44d9 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 25 Sep 2012 11:52:27 +0200 Subject: [PATCH 12/36] Fix LookupCCCFromIso --- coreapi/linphonecore_jni.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index a11c158c8..e60090c40 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1074,7 +1074,7 @@ extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_normalizePhone env->ReleaseStringUTFChars(jnumber, number); return normalizedNumber; } -extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_lookupCCCFromIso(JNIEnv* env, jobject thiz, jstring jiso) { +extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_lookupCCCFromIso(JNIEnv* env, jobject thiz, jlong proxyCfg, jstring jiso) { const char* iso = env->GetStringUTFChars(jiso, NULL); int prefix = linphone_dial_plan_lookup_ccc_from_iso(iso); env->ReleaseStringUTFChars(jiso, iso); From 13a3f5fe32d294524048f9e7e69800fe949c4825 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 25 Sep 2012 12:06:27 +0200 Subject: [PATCH 13/36] set gtk required version to 2.18 --- gtk/dscp_settings.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/dscp_settings.ui b/gtk/dscp_settings.ui index 4664768c6..22679a49b 100644 --- a/gtk/dscp_settings.ui +++ b/gtk/dscp_settings.ui @@ -1,6 +1,6 @@ - + False From c01c9b5ee74992ba2ea8841e22b61a5f58a5304c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 25 Sep 2012 14:15:27 +0200 Subject: [PATCH 14/36] fix contact address bug with ice fix edge detection with ice --- coreapi/callbacks.c | 2 +- coreapi/linphonecall.c | 26 +++++++++----------------- coreapi/linphonecore.c | 29 +++++++++++++++-------------- coreapi/private.h | 35 ++++++++++++++++++++--------------- 4 files changed, 45 insertions(+), 47 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 8954b85da..4e5661b35 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -534,7 +534,7 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de call->localdesc->streams[i].proto = SalProtoRtpAvp; memset(call->localdesc->streams[i].crypto, 0, sizeof(call->localdesc->streams[i].crypto)); } - linphone_core_start_invite(lc, call, NULL); + linphone_core_start_invite(lc, call); } return; } diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 3d32371a9..380f07a0c 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -217,6 +217,10 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li LinphoneAddress *addr=linphone_address_new(me); const char *username=linphone_address_get_username (addr); SalMediaDescription *md=sal_media_description_new(); + + if (call->ping_time>0) { + linphone_core_adapt_to_network(lc,call->ping_time,&call->params); + } md->session_id=session_id; md->session_ver=session_ver; @@ -360,7 +364,6 @@ static void discover_mtu(LinphoneCore *lc, const char *remote){ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params) { LinphoneCall *call=ms_new0(LinphoneCall,1); - int ping_time=-1; call->dir=LinphoneCallOutgoing; call->op=sal_op_new(lc->sal); sal_op_set_user_pointer(call->op,call); @@ -373,10 +376,7 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr ice_session_set_role(call->ice_session, IR_Controlling); } if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseStun) { - ping_time=linphone_core_run_stun_tests(call->core,call); - } - if (ping_time>=0) { - linphone_core_adapt_to_network(lc,ping_time,&call->params); + call->ping_time=linphone_core_run_stun_tests(call->core,call); } call->camera_active=params->has_video; @@ -391,7 +391,6 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op){ LinphoneCall *call=ms_new0(LinphoneCall,1); char *from_str; - int ping_time=-1; call->dir=LinphoneCallIncoming; sal_op_set_user_pointer(op,call); @@ -430,14 +429,11 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro } break; case LinphonePolicyUseStun: - ping_time=linphone_core_run_stun_tests(call->core,call); + call->ping_time=linphone_core_run_stun_tests(call->core,call); /* No break to also destroy ice session in this case. */ default: break; } - if (ping_time>=0) { - linphone_core_adapt_to_network(lc,ping_time,&call->params); - }; call->camera_active=call->params.has_video; discover_mtu(lc,linphone_address_get_domain(from)); @@ -1767,6 +1763,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ OrtpEventType evt=ortp_event_get_type(ev); OrtpEventData *evd=ortp_event_get_data(ev); + int ping_time; if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { switch (ice_session_state(call->ice_session)) { @@ -1790,7 +1787,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ } linphone_core_update_ice_state_in_call_stats(call); } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { - int ping_time = -1; + if (evd->info.ice_processing_successful==TRUE) { ice_session_compute_candidates_foundations(call->ice_session); ice_session_eliminate_redundant_candidates(call->ice_session); @@ -1798,6 +1795,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ ping_time = ice_session_gathering_duration(call->ice_session); if (ping_time >=0) { ping_time /= ice_session_nb_check_lists(call->ice_session); + call->ping_time=ping_time; } } else { ms_warning("No STUN answer from [%s], disabling ICE",linphone_core_get_stun_server(call->core)); @@ -1811,16 +1809,10 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ linphone_core_start_accept_call_update(call->core, call); break; case LinphoneCallOutgoingInit: - if (ping_time >= 0) { - linphone_core_adapt_to_network(call->core, ping_time, &call->params); - } linphone_call_stop_media_streams(call); linphone_core_proceed_with_invite_if_ready(call->core, call, NULL); break; default: - if (ping_time >= 0) { - linphone_core_adapt_to_network(call->core, ping_time, &call->params); - } linphone_call_stop_media_streams(call); linphone_core_notify_incoming_call(call->core, call); break; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 8e2b9ac98..e90f595a2 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1910,7 +1910,7 @@ void linphone_core_iterate(LinphoneCore *lc){ linphone_call_delete_ice_session(call); linphone_call_stop_media_streams(call); } - linphone_core_start_invite(lc,call,NULL); + linphone_core_start_invite(lc,call); } if (call->state==LinphoneCallIncomingReceived){ elapsed=curtime-call->start_time; @@ -2174,16 +2174,17 @@ int linphone_core_proceed_with_invite_if_ready(LinphoneCore *lc, LinphoneCall *c } if ((ice_ready == TRUE) && (ping_ready == TRUE)) { - return linphone_core_start_invite(lc, call, dest_proxy); + return linphone_core_start_invite(lc, call); } return 0; } -int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy){ +int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call){ int err; char *contact; char *real_url,*barmsg; char *from; + LinphoneProxyConfig *dest_proxy=call->dest_proxy; /*try to be best-effort in giving real local or routable contact address */ contact=get_fixed_contact(lc,call,dest_proxy); @@ -2315,10 +2316,9 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const { const char *route=NULL; const char *from=NULL; - LinphoneProxyConfig *proxy=NULL; + LinphoneProxyConfig *proxy=NULL,*dest_proxy=NULL; LinphoneAddress *parsed_url2=NULL; char *real_url=NULL; - LinphoneProxyConfig *dest_proxy=NULL; LinphoneCall *call; bool_t use_ice = FALSE; @@ -2351,6 +2351,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const parsed_url2=linphone_address_new(from); call=linphone_call_new_outgoing(lc,parsed_url2,linphone_address_clone(addr),params); + call->dest_proxy=dest_proxy; sal_op_set_route(call->op,route); if(linphone_core_add_call(lc,call)!= 0) @@ -2376,7 +2377,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const } } - if (dest_proxy==NULL && lc->sip_conf.ping_with_options==TRUE){ + if (call->dest_proxy==NULL && lc->sip_conf.ping_with_options==TRUE){ /*defer the start of the call after the OPTIONS ping*/ call->ping_replied=FALSE; call->ping_op=sal_op_new(lc->sal); @@ -2384,7 +2385,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const sal_op_set_user_pointer(call->ping_op,call); call->start_time=time(NULL); }else{ - if (use_ice==FALSE) linphone_core_start_invite(lc,call,dest_proxy); + if (use_ice==FALSE) linphone_core_start_invite(lc,call); } if (real_url!=NULL) ms_free(real_url); @@ -2718,7 +2719,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call){ **/ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params) { - LinphoneProxyConfig *cfg=NULL,*dest_proxy=NULL; + LinphoneProxyConfig *cfg=NULL; const char *contact=NULL; SalOp *replaced; SalMediaDescription *new_md; @@ -2766,15 +2767,15 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, } linphone_core_get_default_proxy(lc,&cfg); - dest_proxy=cfg; - dest_proxy=linphone_core_lookup_known_proxy(lc,call->log->to); + call->dest_proxy=cfg; + call->dest_proxy=linphone_core_lookup_known_proxy(lc,call->log->to); - if (cfg!=dest_proxy && dest_proxy!=NULL) { + if (cfg!=call->dest_proxy && call->dest_proxy!=NULL) { ms_message("Overriding default proxy setting for this call:"); - ms_message("The used identity will be %s",linphone_proxy_config_get_identity(dest_proxy)); + ms_message("The used identity will be %s",linphone_proxy_config_get_identity(call->dest_proxy)); } /*try to be best-effort in giving real local or routable contact address*/ - contact=get_fixed_contact(lc,call,dest_proxy); + contact=get_fixed_contact(lc,call,call->dest_proxy); if (contact) sal_op_set_contact(call->op,contact); @@ -5084,7 +5085,7 @@ void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m) { void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *params) { params->has_video=linphone_core_video_enabled(lc) && lc->video_policy.automatically_initiate; - params->media_encryption=linphone_core_get_media_encryption(lc); + params->media_encryption=linphone_core_get_media_encryption(lc); params->in_conference=FALSE; } diff --git a/coreapi/private.h b/coreapi/private.h index 1e93c19d7..d8e07c1b9 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -125,6 +125,7 @@ struct _LinphoneCall LinphoneCallState state; LinphoneCallState transfer_state; /*idle if no transfer*/ LinphoneReason reason; + LinphoneProxyConfig *dest_proxy; int refcnt; void * user_pointer; int audio_port; @@ -139,27 +140,31 @@ struct _LinphoneCall LinphoneCallParams remote_params; int up_bw; /*upload bandwidth setting at the time the call is started. Used to detect if it changes during a call */ int audio_bw; /*upload bandwidth used by audio */ - bool_t refer_pending; - bool_t media_pending; - bool_t audio_muted; - bool_t camera_active; - bool_t all_muted; /*this flag is set during early medias*/ - bool_t playing_ringbacktone; - bool_t owns_call_log; - bool_t ringing_beep; /* whether this call is ringing through an already existent current call*/ OrtpEvQueue *audiostream_app_evq; char *auth_token; OrtpEvQueue *videostream_app_evq; - bool_t videostream_encrypted; - bool_t audiostream_encrypted; - bool_t auth_token_verified; - bool_t defer_update; - bool_t was_automatically_paused; - bool_t ping_replied; CallCallbackObj nextVideoFrameDecoded; LinphoneCallStats stats[2]; IceSession *ice_session; LinphoneChatMessage* pending_message; + int ping_time; + bool_t refer_pending; + bool_t media_pending; + bool_t audio_muted; + bool_t camera_active; + + bool_t all_muted; /*this flag is set during early medias*/ + bool_t playing_ringbacktone; + bool_t owns_call_log; + bool_t ringing_beep; /* whether this call is ringing through an already existent current call*/ + + bool_t videostream_encrypted; + bool_t audiostream_encrypted; + bool_t auth_token_verified; + bool_t defer_update; + + bool_t was_automatically_paused; + bool_t ping_replied; }; @@ -285,7 +290,7 @@ void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float void linphone_core_stop_waiting(LinphoneCore *lc); int linphone_core_proceed_with_invite_if_ready(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy); -int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy); +int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call); int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call); int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call); void linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *call); From fda9d120e04fa83b7a3d7937a3acba1e51ef5857 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 25 Sep 2012 15:09:15 +0200 Subject: [PATCH 15/36] Fix ICE gathering candidates for the video stream. --- coreapi/linphonecall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 380f07a0c..38ed1de65 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1038,7 +1038,7 @@ void linphone_call_init_video_stream(LinphoneCall *call){ RtpTransport *vrtcp=lc->rtptf->video_rtcp_func(lc->rtptf->video_rtcp_func_data, call->video_port+1); rtp_session_set_transports(call->videostream->session,vrtp,vrtcp); } - if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (call->ice_session != NULL) && (ice_session_check_list(call->ice_session, 1))){ + if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (call->ice_session != NULL)){ rtp_session_set_pktinfo(call->videostream->session, TRUE); rtp_session_set_symmetric_rtp(call->videostream->session, FALSE); if (ice_session_check_list(call->ice_session, 1) == NULL) { From 3e48688f721f430d71ed02b453570f069265a964 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 25 Sep 2012 15:22:00 +0200 Subject: [PATCH 16/36] Add comment about iterate() interval for ICE to work properly. --- coreapi/linphonecore.h | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 583d66356..892864fbb 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -904,6 +904,7 @@ LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable, const char *config_path, const char *factory_config, void* userdata); /* function to be periodically called in a main loop */ +/* For ICE to work properly it should be called every 20ms */ void linphone_core_iterate(LinphoneCore *lc); #if 0 /*not implemented yet*/ /** From d2bf8846e3c40ce5b4dec886f2d0fc6d9698fc87 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 25 Sep 2012 15:25:17 +0200 Subject: [PATCH 17/36] Update ms2 submodule for ICE improvements. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index fd8aa5fa1..6104d4268 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit fd8aa5fa14d1f683aef1a6108fd497dc3e42891a +Subproject commit 6104d42688b022b9d99c7ecc2261c3cff2978caf From 898a4ce91ee94e81b12e424599d641a58a47a2fb Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 25 Sep 2012 17:21:01 +0200 Subject: [PATCH 18/36] Extend call statistics JNI. Add interface for download bandwidth, upload bandwidth and ICE state. --- coreapi/linphonecore_jni.cc | 9 +++ .../org/linphone/core/LinphoneCallStats.java | 62 +++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index e60090c40..cb1c72335 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1254,6 +1254,15 @@ extern "C" jint Java_org_linphone_core_LinphoneCallLogImpl_getCallDuration(JNIEn extern "C" int Java_org_linphone_core_LinphoneCallStatsImpl_getMediaType(JNIEnv *env, jobject thiz, jlong stats_ptr) { return (int)((LinphoneCallStats *)stats_ptr)->type; } +extern "C" int Java_org_linphone_core_LinphoneCallStatsImpl_getIceState(JNIEnv *env, jobject thiz, jlong stats_ptr) { + return (int)((LinphoneCallStats *)stats_ptr)->ice_state; +} +extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getDownloadBandwidth(JNIEnv *env, jobject thiz, jlong stats_ptr) { + return (jfloat)((LinphoneCallStats *)stats_ptr)->download_bandwidth; +} +extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getUploadBandwidth(JNIEnv *env, jobject thiz, jlong stats_ptr) { + return (jfloat)((LinphoneCallStats *)stats_ptr)->upload_bandwidth; +} extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderLossRate(JNIEnv *env, jobject thiz, jlong stats_ptr) { const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; const report_block_t *srb = NULL; diff --git a/java/common/org/linphone/core/LinphoneCallStats.java b/java/common/org/linphone/core/LinphoneCallStats.java index f391b2a91..15b4cfb34 100644 --- a/java/common/org/linphone/core/LinphoneCallStats.java +++ b/java/common/org/linphone/core/LinphoneCallStats.java @@ -51,6 +51,51 @@ public interface LinphoneCallStats { return mStringValue; } } + static public class IceState { + static private Vector values = new Vector(); + /** + * Not activated + */ + static public IceState NotActivated = new IceState(0, "Not activated"); + /** + * Failed + */ + static public IceState Failed = new IceState(1, "Failed"); + /** + * In progress + */ + static public IceState InProgress = new IceState(2, "In progress"); + /** + * Host connection + */ + static public IceState HostConnection = new IceState(3, "Host connection"); + /** + * Reflexive connection + */ + static public IceState ReflexiveConnection = new IceState(4, "Reflexive connection"); + /** + * Relay connection + */ + static public IceState RelayConnection = new IceState(5, "Relay connection"); + protected final int mValue; + private final String mStringValue; + + private IceState(int value, String stringValue) { + mValue = value; + values.addElement(this); + mStringValue = stringValue; + } + public static IceState fromInt(int value) { + for (int i = 0; i < values.size(); i++) { + IceState mstate = (IceState) values.elementAt(i); + if (mstate.mValue == value) return mstate; + } + throw new RuntimeException("IceState not found [" + value + "]"); + } + public String toString() { + return mStringValue; + } + } /** * Get the stats media type @@ -58,6 +103,23 @@ public interface LinphoneCallStats { */ public MediaType getMediaType(); + /** + * Get the ICE state + */ + public IceState getIceState(); + + /** + * Get the download bandwidth in kbit/s + * @return The download bandwidth + */ + public float getDownloadBandwidth(); + + /** + * Get the upload bandwidth in kbit/s + * @return The upload bandwidth + */ + public float getUploadBandwidth(); + /** * Get the sender loss rate since last report * @return The sender loss rate From 2043ec6a90a4f2e7f077391909c968b4f7c98e9e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 26 Sep 2012 12:44:13 +0200 Subject: [PATCH 19/36] remove GPL statements from source code. Use SDES tool same as user agent. Fix call parameters when video is disabled. --- coreapi/linphonecall.c | 11 +++++++---- coreapi/linphonecore.c | 12 ++++++++++++ coreapi/linphonecore.h | 4 ++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 38ed1de65..d43c457b6 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1231,8 +1231,6 @@ static void setup_ring_player(LinphoneCore *lc, LinphoneCall *call){ ms_filter_call_method(call->audiostream->soundread,MS_FILE_PLAYER_LOOP,&pause_time); } -#define LINPHONE_RTCP_SDES_TOOL "Linphone-" LINPHONE_VERSION - static bool_t linphone_call_sound_resources_available(LinphoneCall *call){ LinphoneCore *lc=call->core; LinphoneCall *current=linphone_core_get_current_call(lc); @@ -1251,6 +1249,8 @@ static int find_crypto_index_from_tag(const SalSrtpCryptoAlgo crypto[],unsigned static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cname, bool_t muted, bool_t send_ringbacktone, bool_t use_arc){ LinphoneCore *lc=call->core; int used_pt=-1; + char rtcp_tool[128]={0}; + snprintf(rtcp_tool,sizeof(rtcp_tool)-1,"%s-%s",linphone_core_get_user_agent_name(),linphone_core_get_user_agent_version()); /* look for savp stream first */ const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc, SalProtoRtpSavp,SalAudio); @@ -1336,7 +1336,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna if (send_ringbacktone){ setup_ring_player(lc,call); } - audio_stream_set_rtcp_information(call->audiostream, cname, LINPHONE_RTCP_SDES_TOOL); + audio_stream_set_rtcp_information(call->audiostream, cname, rtcp_tool); /* valid local tags are > 0 */ if (stream->proto == SalProtoRtpSavp) { @@ -1373,6 +1373,9 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna /* look for savp stream first */ const SalStreamDescription *vstream=sal_media_description_find_stream(call->resultdesc, SalProtoRtpSavp,SalVideo); + char rtcp_tool[128]={0}; + snprintf(rtcp_tool,sizeof(rtcp_tool)-1,"%s-%s",linphone_core_get_user_agent_name(),linphone_core_get_user_agent_version()); + /* no savp audio stream, use avp */ if (!vstream) vstream=sal_media_description_find_stream(call->resultdesc, @@ -1436,7 +1439,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna call->video_profile, rtp_addr, vstream->rtp_port, rtcp_addr, linphone_core_rtcp_enabled(lc) ? (vstream->rtcp_port) : 0, used_pt, linphone_core_get_video_jittcomp(lc), cam); - video_stream_set_rtcp_information(call->videostream, cname,LINPHONE_RTCP_SDES_TOOL); + video_stream_set_rtcp_information(call->videostream, cname,rtcp_tool); } if (vstream->proto == SalProtoRtpSavp) { diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e90f595a2..1a7b97de0 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1596,6 +1596,14 @@ void linphone_core_set_user_agent(const char *name, const char *ver){ strncpy(_ua_version,ver,sizeof(_ua_version)); } +const char *linphone_core_get_user_agent_name(void){ + return _ua_name; +} + +const char *linphone_core_get_user_agent_version(void){ + return _ua_version; +} + static void transport_error(LinphoneCore *lc, const char* transport, int port){ char *msg=ortp_strdup_printf("Could not start %s transport on port %i, maybe this port is already used.",transport,port); ms_warning("%s",msg); @@ -2662,6 +2670,10 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const }else call->params=*params; + if (call->params.has_video && !linphone_core_video_enabled(lc)){ + ms_warning("linphone_core_accept_call_update(): requested video but video support is globally disabled. Refusing video."); + call->params.has_video=FALSE; + } if (call->current_params.in_conference) { ms_warning("Video isn't supported in conference"); call->params.has_video = FALSE; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 892864fbb..179ff0ce9 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -899,6 +899,8 @@ void linphone_core_disable_logs(void); /*sets the user-agent string in sip messages, must be set before linphone_core_new() or linphone_core_init() */ void linphone_core_set_user_agent(const char *ua_name, const char *version); const char *linphone_core_get_version(void); +const char *linphone_core_get_user_agent_name(void); +const char *linphone_core_get_user_agent_version(void); LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable, const char *config_path, const char *factory_config, void* userdata); @@ -1421,6 +1423,8 @@ int linphone_core_get_audio_dscp(const LinphoneCore *lc); void linphone_core_set_video_dscp(LinphoneCore *lc, int dscp); int linphone_core_get_video_dscp(const LinphoneCore *lc); + + #ifdef __cplusplus } #endif From e6d835fa745550a043e18a3b850d0cb353ef9ae8 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 26 Sep 2012 12:43:45 +0200 Subject: [PATCH 20/36] Add JNI for used codecs. --- coreapi/linphonecore_jni.cc | 8 ++++++++ .../org/linphone/core/LinphoneCallParams.java | 15 +++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index cb1c72335..a237b1865 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -946,6 +946,14 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMediaEncryption(JNIEn linphone_core_set_media_encryption((LinphoneCore*)lc,(LinphoneMediaEncryption)menc); } +extern "C" long Java_org_linphone_core_LinphoneCallParamsImpl_getUsedAudioCodec(JNIEnv *env, jobject thiz, jlong cp) { + return (long)linphone_call_params_get_used_audio_codec((LinphoneCallParams *)cp); +} + +extern "C" long Java_org_linphone_core_LinphoneCallParamsImpl_getUsedVideoCodec(JNIEnv *env, jobject thiz, jlong cp) { + return (long)linphone_call_params_get_used_video_codec((LinphoneCallParams *)cp); +} + extern "C" int Java_org_linphone_core_LinphoneCallParamsImpl_getMediaEncryption(JNIEnv* env ,jobject thiz ,jlong cp diff --git a/java/common/org/linphone/core/LinphoneCallParams.java b/java/common/org/linphone/core/LinphoneCallParams.java index 5bf067337..2dd497c9c 100644 --- a/java/common/org/linphone/core/LinphoneCallParams.java +++ b/java/common/org/linphone/core/LinphoneCallParams.java @@ -34,7 +34,7 @@ public interface LinphoneCallParams { * @param value 0 to disable limitation */ void setAudioBandwidth(int value); - + /** * return selected media encryption * @return MediaEncryption.None MediaEncryption.SRTP or MediaEncryption.ZRTP @@ -45,5 +45,16 @@ public interface LinphoneCallParams { * @params menc: MediaEncryption.None, MediaEncryption.SRTP or MediaEncryption.ZRTP */ void setMediaEnctyption(MediaEncryption menc); - + + /** + * Get the currently used audio codec + * @return PayloadType or null + */ + PayloadType getUsedAudioCodec(); + + /** + * Get the currently used video codec + * @return PayloadType or null + */ + PayloadType getUsedVideoCodec(); } From b1f7136e1bb05c17c5e8445bf0ac0a7c6f0ec646 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 18 Sep 2012 09:45:38 +0200 Subject: [PATCH 21/36] Detect SSL support in exosip and disable TLS accordingly. --- coreapi/linphonecore.c | 15 +++++++++ coreapi/linphonecore.h | 2 ++ coreapi/sal.h | 1 + coreapi/sal_eXosip2.c | 8 +++++ coreapi/sal_eXosip2.h | 1 + gtk/parameters.ui | 3 +- gtk/propertybox.c | 75 ++++++++++++++++++++++++++++-------------- 7 files changed, 80 insertions(+), 25 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 1a7b97de0..b2f7bb982 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -529,6 +529,10 @@ static void sip_config_read(LinphoneCore *lc) random_port=(0xDFFF&random())+1024; else random_port=0; + if (!sal_is_transport_enabled(lc->sal, SalTransportTLS)) { + tr.tls_port=0; + } + if (tr.udp_port==0 && tr.tcp_port==0 && tr.tls_port==0){ tr.udp_port=5060; } @@ -1689,6 +1693,17 @@ int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *tr){ return 0; } +/** + * Set a non null value to the enabled transports. +**/ +int linphone_core_get_transports_supported(LinphoneCore *lc, LCSipTransports *transports) { + transports->udp_port=sal_is_transport_enabled(lc->sal, SalTransportUDP); + transports->tcp_port=sal_is_transport_enabled(lc->sal, SalTransportTCP); + transports->tls_port=sal_is_transport_enabled(lc->sal, SalTransportTLS); + transports->dtls_port=sal_is_transport_enabled(lc->sal, SalTransportDTLS); + return 0; +} + /** * Sets the UDP port to be used by SIP. * diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 179ff0ce9..60629879f 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1132,6 +1132,8 @@ int linphone_core_get_sip_port(LinphoneCore *lc); int linphone_core_set_sip_transports(LinphoneCore *lc, const LCSipTransports *transports); int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *transports); + +int linphone_core_get_transports_supported(LinphoneCore *lc, LCSipTransports *transports); /** * * Give access to the UDP sip socket. Can be useful to configure this socket as persistent I.E kCFStreamNetworkServiceType set to kCFStreamNetworkServiceTypeVoIP) diff --git a/coreapi/sal.h b/coreapi/sal.h index 751cc6533..e8f0a2c7d 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -53,6 +53,7 @@ typedef enum { SalTransportDTLS /*DTLS*/ }SalTransport; +bool_t sal_is_transport_enabled(Sal *sal, SalTransport transport); const char* sal_transport_to_string(SalTransport transport); SalTransport sal_transport_parse(const char*); /* Address manipulation API*/ diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index b09cae4ff..ee6126ee9 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -284,6 +284,7 @@ Sal * sal_init(){ sal->verify_server_certs=TRUE; sal->expire_old_contact=FALSE; sal->dscp=-1; + sal->exosip_has_ssl=eXosip_tls_verify_certificate(0) != -1; return sal; } @@ -2521,3 +2522,10 @@ int sal_call_update(SalOp *h, const char *subject){ void sal_reuse_authorization(Sal *ctx, bool_t value) { ctx->reuse_authorization=value; } + +bool_t sal_is_transport_enabled(Sal *sal, SalTransport transport) { + if (transport == SalTransportTLS || transport == SalTransportDTLS) { + return sal->exosip_has_ssl; + } + return TRUE; +} diff --git a/coreapi/sal_eXosip2.h b/coreapi/sal_eXosip2.h index 71463854c..09a0020fb 100644 --- a/coreapi/sal_eXosip2.h +++ b/coreapi/sal_eXosip2.h @@ -49,6 +49,7 @@ struct Sal{ bool_t reuse_authorization; bool_t verify_server_certs; bool_t expire_old_contact; + bool_t exosip_has_ssl; }; struct SalOp{ diff --git a/gtk/parameters.ui b/gtk/parameters.ui index 7e76c385f..c575566c4 100644 --- a/gtk/parameters.ui +++ b/gtk/parameters.ui @@ -321,13 +321,14 @@ True False - model8 + diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 31c76f93b..7beb299f8 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -875,6 +875,56 @@ static void linphone_gtk_show_media_encryption(GtkWidget *pb){ g_object_unref(G_OBJECT(model)); } +static void linphone_gtk_show_transports(GtkWidget *pb){ + LinphoneCore *lc=linphone_gtk_get_core(); + GtkWidget *combo=linphone_gtk_get_widget(pb,"proto_combo"); + GtkTreeModel *model; + GtkListStore *store; + GtkTreeIter iter; + GtkCellRenderer *renderer=gtk_cell_renderer_text_new(); + LCSipTransports enabled,tr; + + model=GTK_TREE_MODEL((store=gtk_list_store_new(1,G_TYPE_STRING))); + gtk_combo_box_set_model(GTK_COMBO_BOX(combo),model); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo),renderer,TRUE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo),renderer,"text",0,NULL); + + gtk_list_store_append(store,&iter); + gtk_list_store_set(store,&iter,0,_("UDP"),-1); + + gtk_list_store_append(store,&iter); + gtk_list_store_set(store,&iter,0,_("TCP"),-1); + + linphone_core_get_transports_supported(lc, &enabled); + if (enabled.tls_port != 0){ + gtk_list_store_append(store,&iter); + gtk_list_store_set(store,&iter,0,_("TLS"),-1); + } + + linphone_core_get_sip_transports(lc,&tr); + + if (tr.tcp_port > 0) { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 1); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), + tr.tcp_port); + } + else if (tr.tls_port > 0) { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 2); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), + tr.tls_port); + } + else { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), + tr.udp_port); + } + + g_signal_connect(G_OBJECT(combo),"changed",(GCallback)linphone_gtk_proto_changed,NULL); + g_object_unref(G_OBJECT(model)); +} + + + void linphone_gtk_parameters_destroyed(GtkWidget *pb){ GtkWidget *mw=linphone_gtk_get_main_window(); g_object_set_data(G_OBJECT(mw),"parameters",NULL); @@ -907,7 +957,6 @@ void linphone_gtk_show_parameters(void){ GtkWidget *codec_list; int mtu; int ui_advanced; - LCSipTransports tr; if (pb==NULL) { pb=linphone_gtk_create_window("parameters"); @@ -921,28 +970,8 @@ void linphone_gtk_show_parameters(void){ /* NETWORK CONFIG */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"ipv6_enabled")), linphone_core_ipv6_enabled(lc)); - linphone_core_get_sip_transports(lc,&tr); - if (tr.tcp_port > 0) { - gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 1); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), - tr.tcp_port); - } - else if (tr.tls_port > 0) { - gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 2); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), - tr.tls_port); - } - else { - gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 0); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), - tr.udp_port); - } - - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"audio_rtp_port")), - linphone_core_get_audio_port(lc)); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"video_rtp_port")), - linphone_core_get_video_port(lc)); + linphone_gtk_show_transports(pb); linphone_gtk_show_media_encryption(pb); @@ -1020,8 +1049,6 @@ void linphone_gtk_show_parameters(void){ linphone_gtk_ui_level_adapt(pb); g_signal_connect(G_OBJECT(linphone_gtk_get_widget(pb,"proto_port")),"value-changed",(GCallback)linphone_gtk_update_my_port,NULL); - g_signal_connect(G_OBJECT(linphone_gtk_get_widget(pb,"proto_combo")),"changed",(GCallback)linphone_gtk_proto_changed,NULL); - if (linphone_core_tunnel_available()){ gtk_widget_set_visible(GTK_WIDGET(linphone_gtk_get_widget(pb,"tunnel_edit_button")), TRUE); From 650cb5b160573528b6551da5822930364a495c04 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 26 Sep 2012 14:00:47 +0200 Subject: [PATCH 22/36] Prevent using getifaddrs() to get the local IP during ICE gathering. --- coreapi/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index df65b53f4..be977400f 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -620,7 +620,7 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) lc->vtable.display_status(lc, _("ICE local candidates gathering in progress...")); /* Gather local host candidates. */ - if (linphone_core_get_local_ip_for(AF_INET, NULL, local_addr) < 0) { + if (linphone_core_get_local_ip_for(AF_INET, server, local_addr) < 0) { ms_error("Fail to get local ip"); return -1; } From 53cb74c7e541616963b073d527948da15382877a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 26 Sep 2012 15:08:18 +0200 Subject: [PATCH 23/36] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 6104d4268..3a0c909d4 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 6104d42688b022b9d99c7ecc2261c3cff2978caf +Subproject commit 3a0c909d402338d3848fe12e718f89dc712384bb From 5bb8f5cc8701089704650f5dcd85d336c3a38d6c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 26 Sep 2012 16:00:26 +0200 Subject: [PATCH 24/36] Revert "Detect SSL support in exosip and disable TLS accordingly." This reverts commit b1f7136e1bb05c17c5e8445bf0ac0a7c6f0ec646. --- coreapi/linphonecore.c | 15 --------- coreapi/linphonecore.h | 2 -- coreapi/sal.h | 1 - coreapi/sal_eXosip2.c | 8 ----- coreapi/sal_eXosip2.h | 1 - gtk/parameters.ui | 3 +- gtk/propertybox.c | 75 ++++++++++++++---------------------------- 7 files changed, 25 insertions(+), 80 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b2f7bb982..1a7b97de0 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -529,10 +529,6 @@ static void sip_config_read(LinphoneCore *lc) random_port=(0xDFFF&random())+1024; else random_port=0; - if (!sal_is_transport_enabled(lc->sal, SalTransportTLS)) { - tr.tls_port=0; - } - if (tr.udp_port==0 && tr.tcp_port==0 && tr.tls_port==0){ tr.udp_port=5060; } @@ -1693,17 +1689,6 @@ int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *tr){ return 0; } -/** - * Set a non null value to the enabled transports. -**/ -int linphone_core_get_transports_supported(LinphoneCore *lc, LCSipTransports *transports) { - transports->udp_port=sal_is_transport_enabled(lc->sal, SalTransportUDP); - transports->tcp_port=sal_is_transport_enabled(lc->sal, SalTransportTCP); - transports->tls_port=sal_is_transport_enabled(lc->sal, SalTransportTLS); - transports->dtls_port=sal_is_transport_enabled(lc->sal, SalTransportDTLS); - return 0; -} - /** * Sets the UDP port to be used by SIP. * diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 60629879f..179ff0ce9 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1132,8 +1132,6 @@ int linphone_core_get_sip_port(LinphoneCore *lc); int linphone_core_set_sip_transports(LinphoneCore *lc, const LCSipTransports *transports); int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *transports); - -int linphone_core_get_transports_supported(LinphoneCore *lc, LCSipTransports *transports); /** * * Give access to the UDP sip socket. Can be useful to configure this socket as persistent I.E kCFStreamNetworkServiceType set to kCFStreamNetworkServiceTypeVoIP) diff --git a/coreapi/sal.h b/coreapi/sal.h index e8f0a2c7d..751cc6533 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -53,7 +53,6 @@ typedef enum { SalTransportDTLS /*DTLS*/ }SalTransport; -bool_t sal_is_transport_enabled(Sal *sal, SalTransport transport); const char* sal_transport_to_string(SalTransport transport); SalTransport sal_transport_parse(const char*); /* Address manipulation API*/ diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index ee6126ee9..b09cae4ff 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -284,7 +284,6 @@ Sal * sal_init(){ sal->verify_server_certs=TRUE; sal->expire_old_contact=FALSE; sal->dscp=-1; - sal->exosip_has_ssl=eXosip_tls_verify_certificate(0) != -1; return sal; } @@ -2522,10 +2521,3 @@ int sal_call_update(SalOp *h, const char *subject){ void sal_reuse_authorization(Sal *ctx, bool_t value) { ctx->reuse_authorization=value; } - -bool_t sal_is_transport_enabled(Sal *sal, SalTransport transport) { - if (transport == SalTransportTLS || transport == SalTransportDTLS) { - return sal->exosip_has_ssl; - } - return TRUE; -} diff --git a/coreapi/sal_eXosip2.h b/coreapi/sal_eXosip2.h index 09a0020fb..71463854c 100644 --- a/coreapi/sal_eXosip2.h +++ b/coreapi/sal_eXosip2.h @@ -49,7 +49,6 @@ struct Sal{ bool_t reuse_authorization; bool_t verify_server_certs; bool_t expire_old_contact; - bool_t exosip_has_ssl; }; struct SalOp{ diff --git a/gtk/parameters.ui b/gtk/parameters.ui index c575566c4..7e76c385f 100644 --- a/gtk/parameters.ui +++ b/gtk/parameters.ui @@ -321,14 +321,13 @@ True False - diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 7beb299f8..31c76f93b 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -875,56 +875,6 @@ static void linphone_gtk_show_media_encryption(GtkWidget *pb){ g_object_unref(G_OBJECT(model)); } -static void linphone_gtk_show_transports(GtkWidget *pb){ - LinphoneCore *lc=linphone_gtk_get_core(); - GtkWidget *combo=linphone_gtk_get_widget(pb,"proto_combo"); - GtkTreeModel *model; - GtkListStore *store; - GtkTreeIter iter; - GtkCellRenderer *renderer=gtk_cell_renderer_text_new(); - LCSipTransports enabled,tr; - - model=GTK_TREE_MODEL((store=gtk_list_store_new(1,G_TYPE_STRING))); - gtk_combo_box_set_model(GTK_COMBO_BOX(combo),model); - gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo),renderer,TRUE); - gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo),renderer,"text",0,NULL); - - gtk_list_store_append(store,&iter); - gtk_list_store_set(store,&iter,0,_("UDP"),-1); - - gtk_list_store_append(store,&iter); - gtk_list_store_set(store,&iter,0,_("TCP"),-1); - - linphone_core_get_transports_supported(lc, &enabled); - if (enabled.tls_port != 0){ - gtk_list_store_append(store,&iter); - gtk_list_store_set(store,&iter,0,_("TLS"),-1); - } - - linphone_core_get_sip_transports(lc,&tr); - - if (tr.tcp_port > 0) { - gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 1); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), - tr.tcp_port); - } - else if (tr.tls_port > 0) { - gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 2); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), - tr.tls_port); - } - else { - gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 0); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), - tr.udp_port); - } - - g_signal_connect(G_OBJECT(combo),"changed",(GCallback)linphone_gtk_proto_changed,NULL); - g_object_unref(G_OBJECT(model)); -} - - - void linphone_gtk_parameters_destroyed(GtkWidget *pb){ GtkWidget *mw=linphone_gtk_get_main_window(); g_object_set_data(G_OBJECT(mw),"parameters",NULL); @@ -957,6 +907,7 @@ void linphone_gtk_show_parameters(void){ GtkWidget *codec_list; int mtu; int ui_advanced; + LCSipTransports tr; if (pb==NULL) { pb=linphone_gtk_create_window("parameters"); @@ -970,8 +921,28 @@ void linphone_gtk_show_parameters(void){ /* NETWORK CONFIG */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"ipv6_enabled")), linphone_core_ipv6_enabled(lc)); + linphone_core_get_sip_transports(lc,&tr); - linphone_gtk_show_transports(pb); + if (tr.tcp_port > 0) { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 1); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), + tr.tcp_port); + } + else if (tr.tls_port > 0) { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 2); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), + tr.tls_port); + } + else { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), + tr.udp_port); + } + + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"audio_rtp_port")), + linphone_core_get_audio_port(lc)); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"video_rtp_port")), + linphone_core_get_video_port(lc)); linphone_gtk_show_media_encryption(pb); @@ -1049,6 +1020,8 @@ void linphone_gtk_show_parameters(void){ linphone_gtk_ui_level_adapt(pb); g_signal_connect(G_OBJECT(linphone_gtk_get_widget(pb,"proto_port")),"value-changed",(GCallback)linphone_gtk_update_my_port,NULL); + g_signal_connect(G_OBJECT(linphone_gtk_get_widget(pb,"proto_combo")),"changed",(GCallback)linphone_gtk_proto_changed,NULL); + if (linphone_core_tunnel_available()){ gtk_widget_set_visible(GTK_WIDGET(linphone_gtk_get_widget(pb,"tunnel_edit_button")), TRUE); From e0f197256c925230efcd7455ce802e7f8493aa4c Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 27 Sep 2012 10:19:53 +0200 Subject: [PATCH 25/36] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 3a0c909d4..54e1d72f8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 3a0c909d402338d3848fe12e718f89dc712384bb +Subproject commit 54e1d72f83cdd3ad34ad459ac782373d8e0e1596 From 85ad456a10df3a23d9004e316ff928c3965ae4e7 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 26 Sep 2012 15:29:47 +0200 Subject: [PATCH 26/36] Prevent deleting streams (and therefore RTP sessions) when switching form ICE gathering to the call. This prevents losing the first ICE connectivity checks if the restart of the streams is slow. --- coreapi/linphonecall.c | 35 +++++++++++++++++++++++++++++------ coreapi/linphonecore.c | 20 +++++++++++--------- coreapi/misc.c | 11 +++++++++++ coreapi/private.h | 4 ++++ 4 files changed, 55 insertions(+), 15 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index d43c457b6..8c109c3d9 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -413,6 +413,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_call_init_common(call, from, to); linphone_core_init_default_params(lc, &call->params); call->params.has_video &= !!lc->video_policy.automatically_accept; + call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(op)); switch (linphone_core_get_firewall_policy(call->core)) { case LinphonePolicyUseIce: call->ice_session = ice_session_new(); @@ -424,7 +425,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro if (linphone_core_gather_ice_candidates(call->core,call)<0) { /* Ice candidates gathering failed, proceed with the call anyway. */ linphone_call_delete_ice_session(call); - linphone_call_stop_media_streams(call); + linphone_call_stop_media_streams_for_ice_gathering(call); } } break; @@ -965,9 +966,11 @@ void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, Lin void linphone_call_init_audio_stream(LinphoneCall *call){ LinphoneCore *lc=call->core; AudioStream *audiostream; - int dscp=linphone_core_get_audio_dscp(lc); + int dscp; + if (call->audiostream != NULL) return; call->audiostream=audiostream=audio_stream_new(call->audio_port,call->audio_port+1,linphone_core_ipv6_enabled(lc)); + dscp=linphone_core_get_audio_dscp(lc); if (dscp!=-1) audio_stream_set_dscp(audiostream,dscp); if (linphone_core_echo_limiter_enabled(lc)){ @@ -1020,6 +1023,11 @@ void linphone_call_init_video_stream(LinphoneCall *call){ #ifdef VIDEO_ENABLED LinphoneCore *lc=call->core; + if (!call->params.has_video) { + linphone_call_stop_video_stream(call); + return; + } + if (call->videostream != NULL) return; if ((lc->video_conf.display || lc->video_conf.capture) && call->params.has_video){ int video_recv_buf_size=lp_config_get_int(lc->config,"video","recv_buf_size",0); int dscp=linphone_core_get_video_dscp(lc); @@ -1535,6 +1543,15 @@ void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call){ #endif } +void linphone_call_stop_media_streams_for_ice_gathering(LinphoneCall *call){ + audio_stream_unprepare_sound(call->audiostream); +#ifdef VIDEO_ENABLED + if (call->videostream) { + video_stream_unprepare_video(call->videostream); + } +#endif +} + void linphone_call_delete_ice_session(LinphoneCall *call){ if (call->ice_session != NULL) { ice_session_destroy(call->ice_session); @@ -1551,7 +1568,7 @@ static void linphone_call_log_fill_stats(LinphoneCallLog *log, AudioStream *st){ log->quality=audio_stream_get_average_quality_rating(st); } -void linphone_call_stop_media_streams(LinphoneCall *call){ +void linphone_call_stop_audio_stream(LinphoneCall *call) { if (call->audiostream!=NULL) { call->audiostream->ice_check_list = NULL; rtp_session_unregister_event_queue(call->audiostream->session,call->audiostream_app_evq); @@ -1574,8 +1591,9 @@ void linphone_call_stop_media_streams(LinphoneCall *call){ audio_stream_stop(call->audiostream); call->audiostream=NULL; } +} - +void linphone_call_stop_video_stream(LinphoneCall *call) { #ifdef VIDEO_ENABLED if (call->videostream!=NULL){ call->videostream->ice_check_list = NULL; @@ -1587,6 +1605,11 @@ void linphone_call_stop_media_streams(LinphoneCall *call){ call->videostream=NULL; } #endif +} + +void linphone_call_stop_media_streams(LinphoneCall *call){ + linphone_call_stop_audio_stream(call); + linphone_call_stop_video_stream(call); ms_event_queue_skip(call->core->msevq); if (call->audio_profile){ @@ -1812,11 +1835,11 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ linphone_core_start_accept_call_update(call->core, call); break; case LinphoneCallOutgoingInit: - linphone_call_stop_media_streams(call); + linphone_call_stop_media_streams_for_ice_gathering(call); linphone_core_proceed_with_invite_if_ready(call->core, call, NULL); break; default: - linphone_call_stop_media_streams(call); + linphone_call_stop_media_streams_for_ice_gathering(call); linphone_core_notify_incoming_call(call->core, call); break; } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 1a7b97de0..b55c08ece 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1916,7 +1916,7 @@ void linphone_core_iterate(LinphoneCore *lc){ ms_warning("ICE candidates gathering from [%s] has not finished yet, proceed with the call without ICE anyway." ,linphone_core_get_stun_server(lc)); linphone_call_delete_ice_session(call); - linphone_call_stop_media_streams(call); + linphone_call_stop_media_streams_for_ice_gathering(call); } linphone_core_start_invite(lc,call); } @@ -2379,7 +2379,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const if (linphone_core_gather_ice_candidates(lc,call)<0) { /* Ice candidates gathering failed, proceed with the call anyway. */ linphone_call_delete_ice_session(call); - linphone_call_stop_media_streams(call); + linphone_call_stop_media_streams_for_ice_gathering(call); } else { use_ice = TRUE; } @@ -2678,6 +2678,7 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const ms_warning("Video isn't supported in conference"); call->params.has_video = FALSE; } + call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(call->op)); call->camera_active=call->params.has_video; update_local_media_description(lc,call); if (call->ice_session != NULL) { @@ -2791,19 +2792,20 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, if (contact) sal_op_set_contact(call->op,contact); + if (params){ + call->params=*params; + call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(call->op)); + call->camera_active=call->params.has_video; + update_local_media_description(lc,call); + sal_call_set_local_media_description(call->op,call->localdesc); + } + if (call->audiostream==NULL) linphone_call_init_media_streams(call); if (!was_ringing && call->audiostream->ticker==NULL){ audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard); } - if (params){ - call->params=*params; - call->camera_active=call->params.has_video; - update_local_media_description(lc,call); - sal_call_set_local_media_description(call->op,call->localdesc); - } - sal_call_accept(call->op); if (lc->vtable.display_status!=NULL) lc->vtable.display_status(lc,_("Connected.")); diff --git a/coreapi/misc.c b/coreapi/misc.c index be977400f..5cb2a49f2 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -904,6 +904,17 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, } } +bool_t linphone_core_media_description_contains_video_stream(const SalMediaDescription *md) +{ + int i; + + for (i = 0; i < md->nstreams; i++) { + if ((md->streams[i].type == SalVideo) && (md->streams[i].rtp_port != 0)) + return TRUE; + } + return FALSE; +} + void linphone_core_deactivate_ice_for_deactivated_media_streams(LinphoneCall *call, const SalMediaDescription *md) { int i; diff --git a/coreapi/private.h b/coreapi/private.h index d8e07c1b9..ea21a967a 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -251,6 +251,7 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call); void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call); void linphone_core_update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session); void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md); +bool_t linphone_core_media_description_contains_video_stream(const SalMediaDescription *md); void linphone_core_deactivate_ice_for_deactivated_media_streams(LinphoneCall *call, const SalMediaDescription *md); void linphone_core_send_initial_subscribes(LinphoneCore *lc); @@ -280,8 +281,11 @@ void linphone_call_init_video_stream(LinphoneCall *call); void linphone_call_init_media_streams(LinphoneCall *call); void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone); void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call); +void linphone_call_stop_audio_stream(LinphoneCall *call); +void linphone_call_stop_video_stream(LinphoneCall *call); void linphone_call_stop_media_streams(LinphoneCall *call); void linphone_call_delete_ice_session(LinphoneCall *call); +void linphone_call_stop_media_streams_for_ice_gathering(LinphoneCall *call); const char * linphone_core_get_identity(LinphoneCore *lc); const char * linphone_core_get_route(LinphoneCore *lc); From 79c2debc99f7f08616d0c1cf0a003df1242c008d Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 27 Sep 2012 13:32:18 +0200 Subject: [PATCH 27/36] Fix for ICE state that can be wrong in some failing cases. --- coreapi/misc.c | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 5cb2a49f2..d5e34ce03 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -652,31 +652,39 @@ void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call) session_state = ice_session_state(call->ice_session); if ((session_state == IS_Completed) || ((session_state == IS_Failed) && (ice_session_has_completed_check_list(call->ice_session) == TRUE))) { - switch (ice_check_list_selected_valid_candidate_type(audio_check_list)) { - case ICT_HostCandidate: - call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateHostConnection; - break; - case ICT_ServerReflexiveCandidate: - case ICT_PeerReflexiveCandidate: - call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateReflexiveConnection; - break; - case ICT_RelayedCandidate: - call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateRelayConnection; - break; - } - if (call->params.has_video && (video_check_list != NULL)) { - switch (ice_check_list_selected_valid_candidate_type(video_check_list)) { + if (ice_check_list_state(audio_check_list) == ICL_Completed) { + switch (ice_check_list_selected_valid_candidate_type(audio_check_list)) { case ICT_HostCandidate: - call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateHostConnection; + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateHostConnection; break; case ICT_ServerReflexiveCandidate: case ICT_PeerReflexiveCandidate: - call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateReflexiveConnection; + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateReflexiveConnection; break; case ICT_RelayedCandidate: - call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateRelayConnection; + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateRelayConnection; break; } + } else { + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateFailed; + } + if (call->params.has_video && (video_check_list != NULL)) { + if (ice_check_list_state(video_check_list) == ICL_Completed) { + switch (ice_check_list_selected_valid_candidate_type(video_check_list)) { + case ICT_HostCandidate: + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateHostConnection; + break; + case ICT_ServerReflexiveCandidate: + case ICT_PeerReflexiveCandidate: + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateReflexiveConnection; + break; + case ICT_RelayedCandidate: + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateRelayConnection; + break; + } + } else { + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateFailed; + } } } else { call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateFailed; From d9ec3f37bf5b2a4ac78d30ff3603882d5a1a42c2 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 1 Oct 2012 15:06:22 +0200 Subject: [PATCH 28/36] fix indent --- coreapi/linphonecall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index d43c457b6..70ccac5ee 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1431,7 +1431,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna cam=get_nowebcam_device(); } if (!is_inactive){ - call->log->video_enabled = TRUE; + call->log->video_enabled = TRUE; video_stream_set_direction (call->videostream, dir); ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation); video_stream_set_device_rotation(call->videostream, lc->device_rotation); From 4cd61b605d7e848ca735b6fb649b18a4cbfe3e7a Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 1 Oct 2012 15:41:10 +0200 Subject: [PATCH 29/36] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 54e1d72f8..373c92572 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 54e1d72f83cdd3ad34ad459ac782373d8e0e1596 +Subproject commit 373c9257215ca8cf436ee122e496ad778d685368 From 1469857acdf17f030b08089d397575e73ccebfa1 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 1 Oct 2012 15:47:35 +0200 Subject: [PATCH 30/36] Update ms2 submodule for ICE. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 373c92572..1a7f7e73c 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 373c9257215ca8cf436ee122e496ad778d685368 +Subproject commit 1a7f7e73cdb2df7683ddb808458b53111057f921 From 37e69be09139dc82910fa176c648cd61c89c7561 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 1 Oct 2012 15:48:43 +0200 Subject: [PATCH 31/36] Check that ICE gathering has already been completed before launching it again. --- coreapi/misc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index d5e34ce03..1c026948e 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -624,10 +624,13 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) ms_error("Fail to get local ip"); return -1; } - ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port, 1, NULL); - ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port + 1, 2, NULL); - call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateInProgress; - if (call->params.has_video && (video_check_list != NULL)) { + if ((ice_check_list_state(audio_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(audio_check_list) == FALSE)) { + ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port, 1, NULL); + ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port + 1, 2, NULL); + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateInProgress; + } + if (call->params.has_video && (video_check_list != NULL) + && (ice_check_list_state(video_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(video_check_list) == FALSE)) { ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port, 1, NULL); ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port + 1, 2, NULL); call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateInProgress; From 3b6eae74415cb14cb4fb96dd54725bde2f0d0abd Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 1 Oct 2012 15:49:15 +0200 Subject: [PATCH 32/36] Add check to prevent crash if something wrong happens when sending Re-INVITE for ICE. --- coreapi/misc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 1c026948e..6f7aff698 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -783,10 +783,14 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription * int rtp_port, rtcp_port; memset(stream->ice_remote_candidates, 0, sizeof(stream->ice_remote_candidates)); ice_check_list_selected_valid_remote_candidate(cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); - strncpy(stream->ice_remote_candidates[0].addr, rtp_addr, sizeof(stream->ice_remote_candidates[0].addr)); - stream->ice_remote_candidates[0].port = rtp_port; - strncpy(stream->ice_remote_candidates[1].addr, rtcp_addr, sizeof(stream->ice_remote_candidates[1].addr)); - stream->ice_remote_candidates[1].port = rtcp_port; + if ((rtp_addr != NULL) && (rtcp_addr != NULL)) { + strncpy(stream->ice_remote_candidates[0].addr, rtp_addr, sizeof(stream->ice_remote_candidates[0].addr)); + stream->ice_remote_candidates[0].port = rtp_port; + strncpy(stream->ice_remote_candidates[1].addr, rtcp_addr, sizeof(stream->ice_remote_candidates[1].addr)); + stream->ice_remote_candidates[1].port = rtcp_port; + } else { + ms_error("ice: Selected valid remote candidates should be present if the check list is in the Completed state"); + } } } } From c6235d70a0b49c015ca1551d2946370b69b4882d Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 1 Oct 2012 15:53:09 +0200 Subject: [PATCH 33/36] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 1a7f7e73c..28f57ace8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 1a7f7e73cdb2df7683ddb808458b53111057f921 +Subproject commit 28f57ace8c7c1d20f93de338951bc471eb523ab1 From 9ac0fdee297a68c8137f664034429e1ada81c92e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 1 Oct 2012 21:08:23 +0200 Subject: [PATCH 34/36] set high prio to calibrator thread --- coreapi/ec-calibrator.c | 5 ++++- mediastreamer2 | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/coreapi/ec-calibrator.c b/coreapi/ec-calibrator.c index 2f4fa6500..5fbf7a1fb 100644 --- a/coreapi/ec-calibrator.c +++ b/coreapi/ec-calibrator.c @@ -29,7 +29,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static void ecc_init_filters(EcCalibrator *ecc){ unsigned int rate; - ecc->ticker=ms_ticker_new(); + MSTickerParams params={0}; + params.name="Echo calibrator"; + params.prio=MS_TICKER_PRIO_HIGH; + ecc->ticker=ms_ticker_new_with_params(¶ms); ecc->sndread=ms_snd_card_create_reader(ecc->play_card); ms_filter_call_method(ecc->sndread,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); diff --git a/mediastreamer2 b/mediastreamer2 index 28f57ace8..c3d6a0953 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 28f57ace8c7c1d20f93de338951bc471eb523ab1 +Subproject commit c3d6a095338c7d98647517b949e06e0b85f6443e From 438a8f4f73e54aa53cd9ac349f354601704a5862 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 1 Oct 2012 21:15:22 +0200 Subject: [PATCH 35/36] update oRTP --- oRTP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oRTP b/oRTP index b7c5f78d8..8a8843b1f 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit b7c5f78d83f8a310ba3700e93174c7eb1234d2d3 +Subproject commit 8a8843b1f3a56888492b298d5262a61369e15bb7 From fd97457fe72f30a1bf60c75aff6e714ac9d0efc1 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 2 Oct 2012 10:29:55 +0200 Subject: [PATCH 36/36] fix disable-video build --- coreapi/linphonecore.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b55c08ece..93c1a8cf3 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2659,7 +2659,9 @@ int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call) * @return 0 if sucessful, -1 otherwise (actually when this function call is performed outside ot #LinphoneCallUpdatedByRemote state). **/ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){ +#ifdef VIDEO_ENABLED bool_t old_has_video = call->params.has_video; +#endif if (call->state!=LinphoneCallUpdatedByRemote){ ms_error("linphone_core_accept_update(): invalid state %s to call this function.", linphone_call_state_to_string(call->state));