[libnice] why state quickly changes from "ready" to not "ready"

tom chen chentom60 at hotmail.com
Fri Oct 23 21:36:48 PDT 2015


I am wondering why during the negotiation, component status can change from "ready" to not "ready"? See the log below, RTP becomes "ready" first but becomes "connecting" during the RTCP negotiation. 


108191.041128691|INFOR|1095730272|cb_component_state_changed|347|agent_state 2 4  (RTP state is 2 - "connecting", RTCP is 4  -- "ready")


Any idea why?




108191.025514051|INFOR|1074003968|wait_for_negotiation_done|408|waiting for state READY or FAILED signal...

108191.025772171|INFOR|1104594016|StartSub|270|remote candidate-gathering-done signal received...

108191.033667811|INFOR|1095730272|cb_component_state_changed|326|SIGNAL: state changed stream 1 RTP connected[3]

108191.033801851|INFOR|1095730272|cb_component_state_changed|326|SIGNAL: state changed stream 1 RTP ready[4]



RTP negotiation complete: local: []:54070, remote: []:14287

108191.033936531|INFOR|1095730272|cb_component_state_changed|347|agent_state 4 1

108191.035725771|INFOR|1104594016|cb_component_state_changed|326|SIGNAL: state changed stream 1 RTP connecting[2]

108191.037519371|INFOR|1104594016|cb_component_state_changed|326|SIGNAL: state changed stream 1 RTCP connecting[2]



remote candidate parsed successfully...

108191.037671491|INFOR|1104594016|wait_for_negotiation_done|408|waiting for state READY or FAILED signal...

108191.040931491|INFOR|1095730272|cb_component_state_changed|326|SIGNAL: state changed stream 1 RTCP connected[3]

108191.041038411|INFOR|1095730272|cb_component_state_changed|326|SIGNAL: state changed stream 1 RTCP ready[4]



RTCP negotiation complete: local: []:50792, remote: []:14287

108191.041128691|INFOR|1095730272|cb_component_state_changed|347|agent_state 2 4


void cb_component_state_changed(NiceAgent *agent, guint _stream_id,

        guint component_id, guint state,

        gpointer data)



    LOG(TRACE_LEVEL_INFO, "SIGNAL: state changed stream %d %s %s[%d]\n",

            _stream_id, (component_id == NICE_COMPONENT_TYPE_RTP)?"RTP":"RTCP",

            state_name[state], state);


    agent_state[component_id - 1] = state;

    if (state == NICE_COMPONENT_STATE_READY) {

        NiceCandidate *local, *remote;


        // Get current selected candidate pair and print IP address used

        if (nice_agent_get_selected_pair (agent, _stream_id, component_id,

                &local, &remote)) {

            gchar local_ipaddr[INET6_ADDRSTRLEN];

            gchar remote_ipaddr[INET6_ADDRSTRLEN];


            nice_address_to_string(&local->addr, local_ipaddr);

            nice_address_to_string(&remote->addr, remote_ipaddr);


            LOG(TRACE_LEVEL_INFO, "\n\n%s negotiation complete: local: [%s]:%d, remote: [%s]:%d\n",

                    (component_id == NICE_COMPONENT_TYPE_RTP)?"RTP":"RTCP",

                    local_ipaddr, nice_address_get_port(&local->addr),

                    remote_ipaddr, nice_address_get_port(&remote->addr));



        LOG(TRACE_LEVEL_INFO, "agent_state %d %d\n",agent_state[0], agent_state[1]);


        //If both RTP & RTCP components are ready

        if ((agent_state[0] == NICE_COMPONENT_STATE_READY) &&

                (agent_state[1]==NICE_COMPONENT_STATE_READY)) {

. . . . . 

            LOG(TRACE_LEVEL_INFO, "\n\n negotiation done \n");


    } else if (state == NICE_COMPONENT_STATE_FAILED) {

        LOG(TRACE_LEVEL_WARNING, "%s connection failed, stop sub thread\n", __func__);




Statement Of Confidentiality:

This electronic message transmission, and all attachments, contains information from Extron Electronics which is confidential and privileged. The information is for the exclusive viewing or use of the intended recipient. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this electronic transmission in error, please notify the sender immediately by a "reply to sender only" message and destroy all electronic and hard copies of the communication, including attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/nice/attachments/20151023/9c33137b/attachment.html>

More information about the nice mailing list