Commit 7deb6e30 authored by Youness Alaoui's avatar Youness Alaoui
Browse files

Do not modify agent->local_addresses in the nice_agent_gather_candidates.

The agent->local_addresses should not change when we gather_candidates, let
the user set it with nice_agent_add_local_address, if he does not, then we
should auto-discover interface *during* the gathering process, and not save it.
Currently, when we call gather_candidates, we discover interfaces and save it to
agent->local_addresses as if someone called the _add_local_address API... problem
is that if we have 2/3 interfaces, we do an audio call.. an interface disappears
(vmware closed/whatever) then we upgrade to a video call, then libnice will reuse
the old interface list instead of the current ones..
parent 1ee6200a
......@@ -1666,6 +1666,7 @@ nice_agent_gather_candidates (
guint n;
GSList *i;
Stream *stream;
GSList *local_addresses = NULL;
agent_lock();
......@@ -1711,13 +1712,21 @@ nice_agent_gather_candidates (
NiceAddress *addr = nice_address_new ();
if (nice_address_set_from_string (addr, item->data)) {
nice_agent_add_local_address (agent, addr);
local_addresses = g_slist_append (local_addresses, addr);
} else {
nice_address_free (addr);
}
nice_address_free (addr);
}
g_list_foreach (addresses, (GFunc) g_free, NULL);
g_list_free (addresses);
} else {
for (i = agent->local_addresses; i; i = i->next) {
NiceAddress *addr = i->data;
NiceAddress *dup = nice_address_dup (addr);
local_addresses = g_slist_append (local_addresses, dup);
}
}
/* generate a local host candidate for each local address */
......@@ -1806,7 +1815,9 @@ nice_agent_gather_candidates (
discovery_schedule (agent);
}
done:
for (i = local_addresses; i; i = i->next)
nice_address_free (i->data);
g_slist_free (local_addresses);
agent_unlock();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment