<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>hi my friends:</div><div><br></div><div>i use libnice in communication with webrtc.</div><div>and in my case i use one mainloop context for agent , and another mainloop context for nicesrc to attach receive .  </div><div>i found some times , the nice compnent state not changed to 4 . i guess the following code may be the problem. </div><div><br></div><div><div><span style="font-size: 14px;">void conn_check_schedule_next (NiceAgent *agent)</span></div><div><span style="font-size: 14px;">{</span></div><div><span style="font-size: 14px;">  if (agent->discovery_unsched_items > 0)</span></div><div><span style="font-size: 14px;">    nice_debug ("Agent %p : WARN: starting conn checks before local candidate gathering is finished.", agent);</span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;">  /* step: schedule timer if not running yet */</span></div><div><span style="font-size: 14px;">  if (agent->conncheck_timer_source == NULL) {</span></div><div><span style="font-size: 14px;">    agent_timeout_add_with_context (agent, &agent->conncheck_timer_source,</span></div><div><span style="font-size: 14px;">        "Connectivity check schedule", agent->timer_ta,</span></div><div><span style="font-size: 14px;">        </span><span style="font-size: 14px; color: rgb(221, 64, 50);">priv_conn_check_tick_agent_locked</span><span style="font-size: 14px;">, NULL);</span><span style="font-size: 14px; color: rgb(221, 64, 50);"> // it's called in mainloop's  timer source , but the timer not callled agent_lock , the function "</span><span style="color: rgb(221, 64, 50);">priv_conn_check_tick_agent_locked" modified </span><span style="color: rgb(221, 64, 50);">vars in agent without lock !!! </span></div><div><span style="color: rgb(221, 64, 50);">                                                                                // in another thread of socket receive , it will modified agent's vars at the same time !!!</span></div><div><span style="font-size: 14px;">  }</span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;">  /* step: also start the keepalive timer */</span></div><div><span style="font-size: 14px;">  if (agent->keepalive_timer_source == NULL) {</span></div><div><span style="font-size: 14px;">    agent_timeout_add_with_context (agent, &agent->keepalive_timer_source,</span></div><div><span style="font-size: 14px;">        "Connectivity keepalive timeout", NICE_AGENT_TIMER_TR_DEFAULT,</span></div><div><span style="font-size: 14px;">        priv_conn_keepalive_tick_agent_locked, NULL);</span></div><div><span style="font-size: 14px;">  }</span></div><div><span style="font-size: 14px;">}</span></div></div><div>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 ?</div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><br><span title="neteasefooter"><p> </p></span>