summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2014-04-16 00:19:18 (GMT)
committerOlivier CrĂȘte <olivier.crete@collabora.com>2014-04-25 00:55:56 (GMT)
commit5bbed7e436df89c04d05657b510a60867c222e06 (patch)
tree90b7f7d2689e672ca6126de07e9a4cc9306949c9
parent28ab0b5078c89d7abc4aa4115f3530f95fe406f6 (diff)
downloadlibnice-5bbed7e436df89c04d05657b510a60867c222e06.tar.gz
libnice-5bbed7e436df89c04d05657b510a60867c222e06.tar.xz
agent: Add nice_agent_restart_stream() to restart a single stream
-rw-r--r--agent/agent.c27
-rw-r--r--agent/agent.h22
-rw-r--r--docs/reference/libnice/libnice-sections.txt1
-rw-r--r--nice/libnice.sym1
4 files changed, 50 insertions, 1 deletions
diff --git a/agent/agent.c b/agent/agent.c
index 09e9d9d..c60ca47 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -3689,7 +3689,6 @@ nice_agent_get_remote_candidates (
return ret;
}
-
gboolean
nice_agent_restart (
NiceAgent *agent)
@@ -3713,6 +3712,32 @@ nice_agent_restart (
return TRUE;
}
+gboolean
+nice_agent_restart_stream (
+ NiceAgent *agent,
+ guint stream_id)
+{
+ gboolean res = FALSE;
+ Stream *stream;
+
+ agent_lock();
+
+ stream = agent_find_stream (agent, stream_id);
+ if (!stream) {
+ g_warning ("Could not find stream %u", stream_id);
+ goto done;
+ }
+
+ /* step: reset local credentials for the stream and
+ * clean up the list of remote candidates */
+ stream_restart (agent, stream, agent->rng);
+
+ res = TRUE;
+ done:
+ agent_unlock_and_emit (agent);
+ return res;
+}
+
static void
nice_agent_dispose (GObject *object)
diff --git a/agent/agent.h b/agent/agent.h
index eee835c..8ffa3a0 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -787,6 +787,28 @@ gboolean
nice_agent_restart (
NiceAgent *agent);
+/**
+ * nice_agent_restart_stream:
+ * @agent: The #NiceAgent Object
+ * @stream_id: The ID of the stream
+ *
+ * Restarts a single stream as defined in RFC 5245. This function
+ * needs to be called both when initiating (ICE spec section 9.1.1.1.
+ * "ICE Restarts"), as well as when reacting (spec section 9.2.1.1.
+ * "Detecting ICE Restart") to a restart.
+ *
+ * Unlike nice_agent_restart(), this applies to a single stream. It also
+ * does not generate a new tie breaker.
+ *
+ * Returns: %TRUE on success %FALSE on error
+ *
+ * Since: 0.1.6
+ **/
+gboolean
+nice_agent_restart_stream (
+ NiceAgent *agent,
+ guint stream_id);
+
/**
* nice_agent_attach_recv:
diff --git a/docs/reference/libnice/libnice-sections.txt b/docs/reference/libnice/libnice-sections.txt
index 5288625..edbdeef 100644
--- a/docs/reference/libnice/libnice-sections.txt
+++ b/docs/reference/libnice/libnice-sections.txt
@@ -36,6 +36,7 @@ nice_agent_set_selected_remote_candidate
nice_agent_set_stream_tos
nice_agent_set_software
nice_agent_restart
+nice_agent_restart_stream
nice_agent_set_stream_name
nice_agent_get_stream_name
nice_agent_get_default_local_candidate
diff --git a/nice/libnice.sym b/nice/libnice.sym
index d45c29b..b2c92ca 100644
--- a/nice/libnice.sym
+++ b/nice/libnice.sym
@@ -41,6 +41,7 @@ nice_agent_parse_remote_sdp
nice_agent_parse_remote_stream_sdp
nice_agent_remove_stream
nice_agent_restart
+nice_agent_restart_stream
nice_agent_send
nice_agent_send_messages_nonblocking
nice_agent_set_port_range