]> sjero.net Git - linphone/commitdiff
Merge branch 'master' of git.linphone.org:linphone
authorJehan Monnier <jehan.monnier@linphone.org>
Tue, 2 Oct 2012 13:30:50 +0000 (15:30 +0200)
committerJehan Monnier <jehan.monnier@linphone.org>
Tue, 2 Oct 2012 13:30:50 +0000 (15:30 +0200)
coreapi/TunnelManager.cc
coreapi/callbacks.c
coreapi/linphonecall.c
coreapi/linphonecore.c
coreapi/linphonecore.h
coreapi/linphonecore_jni.cc

index 9b5dffd29c306bed85a946715eedd7e4f87dab90..71ecc51843c288dc45d414a63435a954595b14af 100644 (file)
@@ -59,12 +59,12 @@ int TunnelManager::eXosipRecvfrom(int fd, void *buf, size_t len, int flags, stru
 int TunnelManager::eXosipSelect(int max_fds, fd_set *s1, fd_set *s2, fd_set *s3, struct timeval *tv,void* userdata){
        struct timeval begin,cur;
        TunnelManager* lTunnelMgr=(TunnelManager*)userdata;
-       if (tv!=0 && tv->tv_sec){
+       if (s1 && tv!=0 && tv->tv_sec){
                /*this is the select from udp.c, the one that is interesting to us*/
                NativeSocket udp_fd=(NativeSocket)eXosip_get_udp_socket();
                NativeSocket controlfd=(NativeSocket)eXosip_get_control_fd();
 
-               FD_ZERO(s1);            
+               FD_ZERO(s1);
                gettimeofday(&begin,NULL);
                do{
                        struct timeval abit;
@@ -258,7 +258,7 @@ void TunnelManager::processTunnelEvent(const Event &ev){
                lTransport.tls_port=0;
                lTransport.dtls_port=0;
                
-               linphone_core_set_sip_transports(mCore, &lTransport);           
+               linphone_core_set_sip_transports(mCore, &lTransport);
                //register
                if (lProxy) {
                        linphone_proxy_config_done(lProxy);
index 4e5661b35a01d6be20a0c82f08545224cc45e47d..7f901195f0ce9f3f84d22e24615b52a51638843b 100644 (file)
@@ -302,11 +302,7 @@ static void call_accepted(SalOp *op){
                        linphone_core_update_streams (lc,call,md);
                        linphone_call_set_state(call,LinphoneCallPausedByRemote,"Call paused by remote");
                }else{
-                       if (call->state==LinphoneCallStreamsRunning){
-                               /*media was running before, the remote as acceted a call modification (that is
-                                       a reinvite made by us. We must notify the application this reinvite was accepted*/
-                               linphone_call_set_state(call, LinphoneCallUpdated, "Call updated");
-                       }else{
+                       if (call->state!=LinphoneCallUpdating){
                                if (call->state==LinphoneCallResuming){
                                        if (lc->vtable.display_status){
                                                lc->vtable.display_status(lc,_("Call resumed."));
@@ -343,11 +339,6 @@ static void call_ack(SalOp *op){
        if (call->media_pending){
                SalMediaDescription *md=sal_call_get_final_media_description(op);
                if (md && !sal_media_description_empty(md)){
-                       if (call->state==LinphoneCallStreamsRunning){
-                               /*media was running before, the remote as acceted a call modification (that is
-                                       a reinvite made by us. We must notify the application this reinvite was accepted*/
-                               linphone_call_set_state(call, LinphoneCallUpdated, "Call updated");
-                       }
                        linphone_core_update_streams (lc,call,md);
                        linphone_call_set_state (call,LinphoneCallStreamsRunning,"Connected (streams running)");
                }else{
index 1351f0eb90dd039a299c5d468e7e0bb6a1163403..a3709669756b9843a59c285711920132c6ae19fc 100644 (file)
@@ -521,8 +521,8 @@ const char *linphone_call_state_to_string(LinphoneCallState cs){
                        return "LinphoneCallUpdatedByRemote";
                case LinphoneCallIncomingEarlyMedia:
                        return "LinphoneCallIncomingEarlyMedia";
-               case LinphoneCallUpdated:
-                       return "LinphoneCallUpdated";
+               case LinphoneCallUpdating:
+                       return "LinphoneCallUpdating";
                case LinphoneCallReleased:
                        return "LinphoneCallReleased";
        }
@@ -1829,7 +1829,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
                        linphone_call_delete_ice_session(call);
                }
                switch (call->state) {
-                       case LinphoneCallStreamsRunning:
+                       case LinphoneCallUpdating:
                                linphone_core_start_update_call(call->core, call);
                                break;
                        case LinphoneCallUpdatedByRemote:
@@ -1839,10 +1839,12 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
                                linphone_call_stop_media_streams_for_ice_gathering(call);
                                linphone_core_proceed_with_invite_if_ready(call->core, call, NULL);
                                break;
-                       default:
+                       case LinphoneCallIdle:
                                linphone_call_stop_media_streams_for_ice_gathering(call);
                                linphone_core_notify_incoming_call(call->core, call);
                                break;
+                       default:
+                               break;
                }
        } else if (evt == ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED) {
                linphone_core_start_accept_call_update(call->core, call);
index 66cb26eff35b5793bf349337cd3c97a87890c24e..b0cc2bb54894a7f0748dbc3b498306c9f69fdc04 100644 (file)
@@ -2569,6 +2569,7 @@ int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call){
 int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){
        int err=0;
        if (params!=NULL){
+               linphone_call_set_state(call,LinphoneCallUpdating,"Updating call");
 #ifdef VIDEO_ENABLED
                bool_t has_video = call->params.has_video;
                if ((call->ice_session != NULL) && (call->videostream != NULL) && !params->has_video) {
@@ -2576,7 +2577,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho
                        call->videostream->ice_check_list = NULL;
                }
                call->params = *params;
-               if ((call->ice_session != NULL) && (ice_session_state(call->ice_session) != IS_Completed) && !has_video && params->has_video) {
+               if ((call->ice_session != NULL) && !has_video && params->has_video) {
                        /* Defer call update until the ICE candidates gathering process has finished. */
                        ms_message("Defer call update to gather ICE candidates");
                        update_local_media_description(lc, call);
@@ -5035,7 +5036,7 @@ bool_t linphone_core_sound_resources_locked(LinphoneCore *lc){
                        case LinphoneCallConnected:
                        case LinphoneCallRefered:
                        case LinphoneCallIncomingEarlyMedia:
-                       case LinphoneCallUpdated:
+                       case LinphoneCallUpdating:
                                return TRUE;
                        default:
                                break;
index 735f1a04857a9832745e1a747bc8b118ff1f03e7..5196d93dc17fa31631468c6ed10326e729fa5ae0 100644 (file)
@@ -344,7 +344,7 @@ typedef enum _LinphoneCallState{
        LinphoneCallPausedByRemote, /**<The call is paused by remote end*/
        LinphoneCallUpdatedByRemote, /**<The call's parameters change is requested by remote end, used for example when video is added by remote */
        LinphoneCallIncomingEarlyMedia, /**<We are proposing early media to an incoming call */
-       LinphoneCallUpdated, /**<The remote accepted the call update initiated by us */
+       LinphoneCallUpdating, /**<A call update has been initiated by us */
        LinphoneCallReleased /**< The call object is no more retained by the core */
 } LinphoneCallState;
 
index a237b1865144e216c6a5cc07470c7df489856b50..3cd7b76cca75e5621bd3e76f09f3720a74051600 100644 (file)
@@ -1131,11 +1131,17 @@ extern "C" jlong Java_org_linphone_core_LinphoneAuthInfoImpl_newLinphoneAuthInfo
                , jstring jrealm) {
 
        const char* username = env->GetStringUTFChars(jusername, NULL);
+       const char* userid = env->GetStringUTFChars(juserid, NULL);
        const char* password = env->GetStringUTFChars(jpassword, NULL);
-       jlong auth = (jlong)linphone_auth_info_new(username,NULL,password,NULL,NULL);
+       const char* ha1 = env->GetStringUTFChars(jha1, NULL);
+       const char* realm = env->GetStringUTFChars(jrealm, NULL);
+       jlong auth = (jlong)linphone_auth_info_new(username,userid,password,ha1,realm);
 
        env->ReleaseStringUTFChars(jusername, username);
+       env->ReleaseStringUTFChars(juserid, userid);
        env->ReleaseStringUTFChars(jpassword, password);
+       env->ReleaseStringUTFChars(jha1, ha1);
+       env->ReleaseStringUTFChars(jrealm, realm);
        return auth;
 
 }
@@ -1275,7 +1281,7 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderLossRate
        const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr;
        const report_block_t *srb = NULL;
 
-       if (!stats->sent_rtcp)
+       if (!stats || !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)
@@ -1292,7 +1298,7 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverLossRa
        const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr;
        const report_block_t *rrb = NULL;
 
-       if (!stats->received_rtcp)
+       if (!stats || !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)
@@ -1308,11 +1314,14 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverLossRa
 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 LinphoneCallParams *params;
        const PayloadType *pt;
        const report_block_t *srb = NULL;
 
-       if (!stats->sent_rtcp)
+       if (!stats || !call || !stats->sent_rtcp)
+               return (jfloat)0.0;
+       params = linphone_call_get_current_params(call);
+       if (!params)
                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)
@@ -1332,11 +1341,14 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderInterarr
 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 LinphoneCallParams *params;
        const PayloadType *pt;
        const report_block_t *rrb = NULL;
 
-       if (!stats->received_rtcp)
+       if (!stats || !call || !stats->received_rtcp)
+               return (jfloat)0.0;
+       params = linphone_call_get_current_params(call);
+       if (!params)
                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)
@@ -1361,6 +1373,8 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallStatsImpl_getLatePacketsCumu
        LinphoneCall *call = (LinphoneCall *)call_ptr;
        rtp_stats_t rtp_stats;
 
+       if (!stats || !call)
+               return (jlong)0;
        memset(&rtp_stats, 0, sizeof(rtp_stats));
        if (stats->type == LINPHONE_CALL_STATS_AUDIO)
                audio_stream_get_local_rtp_stats(call->audiostream, &rtp_stats);