Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions agent/agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -2036,6 +2036,35 @@ nice_agent_add_stream_local_address_from_string (NiceAgent * agent,
return nice_agent_add_stream_local_address (agent, stream_id, &nice_addr);
}

NICEAPI_EXPORT gboolean
nice_agent_clear_stream_local_addresses (NiceAgent * agent, guint stream_id)
{
gboolean result = FALSE;
Stream *stream;
GSList *item;

agent_lock (agent);

stream = agent_find_stream (agent, stream_id);

if (!stream) {
goto done;
}

for (item = stream->local_addresses; item; item = g_slist_next (item)) {
NiceAddress *address = item->data;
nice_address_free (address);
}
g_slist_free (stream->local_addresses);
stream->local_addresses = NULL;

result = TRUE;

done:
agent_unlock (agent);
return result;
}

/* Recompute foundations of all candidate pairs from a given stream
* having a specific remote candidate, and eventually update the
* priority of the selected pair as well.
Expand Down
16 changes: 16 additions & 0 deletions agent/agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,22 @@ nice_agent_add_local_address_from_string (NiceAgent *agent, const gchar *addr);
NICE_EXPORT gboolean
nice_agent_add_stream_local_address (NiceAgent *agent, guint stream_id, NiceAddress *addr);

/**
* nice_agent_clear_stream_local_addresses:
* @agent: The #NiceAgent Object
* @stream_id: The stream whose local addresses should be cleared
*
* Remove all local addresses that were previously configured on the
* stream @stream_id with nice_agent_add_stream_local_address() or
* nice_agent_add_stream_local_address_from_string(). After this call,
* new local addresses may be added to replace the cleared ones.
*
* See also: nice_agent_add_stream_local_address()
* Returns: %TRUE on success, %FALSE if the stream id is invalid
*/
NICE_EXPORT gboolean
nice_agent_clear_stream_local_addresses (NiceAgent *agent, guint stream_id);

/**
* nice_agent_add_stream_local_address_from_string:
* @agent: The #NiceAgent Object
Expand Down
1 change: 1 addition & 0 deletions nice/libnice.sym
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ nice_agent_add_local_address
nice_agent_add_local_address_from_string
nice_agent_add_stream_local_address
nice_agent_add_stream_local_address_from_string
nice_agent_clear_stream_local_addresses
nice_agent_add_stream
nice_agent_set_stream
nice_agent_attach_recv
Expand Down