[libnice] may be a bug for nice agent state machine timer

walletiger walletiger at 163.com
Wed Mar 11 16:31:25 UTC 2020


hi my friends:


i use libnice in communication with webrtc.
and in my case i use one mainloop context for agent , and another mainloop context for nicesrc to attach receive .  
i found some times , the nice compnent state not changed to 4 . i guess the following code may be the problem. 


void conn_check_schedule_next (NiceAgent *agent)
{
  if (agent->discovery_unsched_items > 0)
    nice_debug ("Agent %p : WARN: starting conn checks before local candidate gathering is finished.", agent);


  /* step: schedule timer if not running yet */
  if (agent->conncheck_timer_source == NULL) {
    agent_timeout_add_with_context (agent, &agent->conncheck_timer_source,
        "Connectivity check schedule", agent->timer_ta,
        priv_conn_check_tick_agent_locked, NULL); // it's called in mainloop's  timer source , but the timer not callled agent_lock , the function "priv_conn_check_tick_agent_locked" modified vars in agent without lock !!! 
                                                                                // in another thread of socket receive , it will modified agent's vars at the same time !!!
  }


  /* step: also start the keepalive timer */
  if (agent->keepalive_timer_source == NULL) {
    agent_timeout_add_with_context (agent, &agent->keepalive_timer_source,
        "Connectivity keepalive timeout", NICE_AGENT_TIMER_TR_DEFAULT,
        priv_conn_keepalive_tick_agent_locked, NULL);
  }
}
i see some of the libnice's examples  agent's main loop and socket receive loop always the same . but the gstreamer's wrapper  nicesrc use new alloced mainloop in attach receive , and nice-agent use another . is that some problem ?







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/nice/attachments/20200312/d99f0dfb/attachment.htm>


More information about the nice mailing list