[libnice] "candidate-gathering-done" is never fired with STUN

ND spam_me_please at gmx.net
Wed Oct 29 07:15:44 PDT 2014

Hello list :)

I encountered a problem in my Android SIP App using libnice: when I set 
a (valid) stun-server the "candidate-gathering-done"-signal is never 
fired (without the server it is). I tried various servers (e.g. 
stun.ekiga.net, stun.antisip.com...) with port 3478. To resolve the 
hostnames to addresses I used 
InetAddress.getByName(stunserver).getHostAddress. I confirmed that these 
work using another stun library.

I try to use libnice as a callable object, so my agent has no GMainLoop 
and uses a mutex to wait for the candidate-gathering-done signal. As it 
never comes my application is stuck :/ See the relevant code below:

         int stream_id = nice_agent_add_stream(jnictx->ice.agent, 2);
         nice_agent_set_stream_name(agent, stream_id, name);

         if (!nice_agent_gather_candidates(jnictx->ice.agent, stream_id))
             <error handling>

         while (!candidate_gathering_done)
             g_cond_wait(&gather_cond, &gather_mutex);

         candidate_gathering_done = false;

         // update my SDP

At this point no remote candidates have been set yet. The callbacks are 
correctly connected to the signal and log activity if used without STUN. 
When using STUN 2 (one for each component) host candidates are found, 
then component state changes to GATHERING for both components. 
Afterwards nothing more happens.

Can anybody help me...?
Thank you in advance,

Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz ist aktiv.

More information about the nice mailing list