From 483bdcf8c64b8d77e267706df59bfaae4d701380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Mon, 20 Apr 2015 16:08:42 -0400 Subject: agent: Warn on invalid media types for SDP Only 6 strings are valid. https://bugs.freedesktop.org/show_bug.cgi?id=90019 --- agent/agent.c | 12 ++++++++++++ agent/agent.h | 8 ++++++-- 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. * * See also: nice_agent_generate_local_sdp() * See also: nice_agent_parse_remote_sdp() -- cgit v1.2.1