]> sjero.net Git - linphone/commitdiff
Fix for ICE state that can be wrong in some failing cases.
authorGhislain MARY <ghislain.mary@belledonne-communications.com>
Thu, 27 Sep 2012 11:32:18 +0000 (13:32 +0200)
committerGhislain MARY <ghislain.mary@belledonne-communications.com>
Mon, 1 Oct 2012 07:50:55 +0000 (09:50 +0200)
coreapi/misc.c

index 5cb2a49f2ac6e8d35c482a41f13b2718e88b49b9..d5e34ce03a2ed34cf3f3a484ec3173bf0e2c9f21 100644 (file)
@@ -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;