summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2015-04-20 16:08:42 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2015-04-20 16:08:42 -0400
commit483bdcf8c64b8d77e267706df59bfaae4d701380 (patch)
treec6e03806ed81e0edc993691ba3bff832333101ee
parent52534c43be1fdc74cd15f64ba28b8e753c212b62 (diff)
downloadlibnice-483bdcf8c64b8d77e267706df59bfaae4d701380.tar.gz
agent: Warn on invalid media types for SDP
Only 6 strings are valid. https://bugs.freedesktop.org/show_bug.cgi?id=90019
-rw-r--r--agent/agent.c12
-rw-r--r--agent/agent.h8
2 files changed, 18 insertions, 2 deletions
diff --git a/agent/agent.c b/agent/agent.c
index cde2386..d732e46 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -5314,6 +5314,18 @@ nice_agent_set_stream_name (NiceAgent *agent, guint stream_id,
g_return_val_if_fail (NICE_IS_AGENT (agent), FALSE);
g_return_val_if_fail (stream_id >= 1, FALSE);
+ g_return_val_if_fail (name, FALSE);
+
+ if (strcmp (name, "audio") &&
+ strcmp (name, "video") &&
+ strcmp (name, "text") &&
+ strcmp (name, "application") &&
+ strcmp (name, "message") &&
+ strcmp (name, "image")) {
+ g_critical ("Stream name %s will produce invalid SDP, only \"audio\","
+ " \"video\", \"text\", \"application\", \"image\" and \"message\""
+ " are valid", name);
+ }
agent_lock();
diff --git a/agent/agent.h b/agent/agent.h
index 5d38839..47c4d5a 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -1253,8 +1253,12 @@ void nice_agent_set_software (
* @stream_id: The ID of the stream to change
* @name: The new name of the stream or %NULL
*
- * This function will assign a unique name to a stream.
- * This is only useful when parsing and generating an SDP of the candidates.
+ * This function will assign a media type to a stream. The only values
+ * that can be used to produce a valid SDP are: "audio", "video",
+ * "text", "application", "image" and "message".
+ *
+ * This is only useful when parsing and generating an SDP of the
+ * candidates.
*
* <para>See also: nice_agent_generate_local_sdp()</para>
* <para>See also: nice_agent_parse_remote_sdp()</para>