diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2015-04-20 16:09:28 -0400 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.com> | 2015-04-20 16:09:28 -0400 |
commit | 5972db04c554f73187185b333d1d71c81be96f72 (patch) | |
tree | 473424f344bf01262cae721630632ac332f32251 | |
parent | 483bdcf8c64b8d77e267706df59bfaae4d701380 (diff) | |
download | libnice-5972db04c554f73187185b333d1d71c81be96f72.tar.gz |
agent: Count m= files to match streams
The only valid way to match streams is to count m= lines, see RFC 3264.
https://bugs.freedesktop.org/show_bug.cgi?id=90019
-rw-r--r-- | agent/agent.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/agent/agent.c b/agent/agent.c index d732e46..126316a 100644 --- a/agent/agent.c +++ b/agent/agent.c @@ -5654,7 +5654,7 @@ nice_agent_parse_remote_sdp (NiceAgent *agent, const gchar *sdp) { Stream *current_stream = NULL; gchar **sdp_lines = NULL; - GSList *l; + GSList *l, *stream_item; gint i; gint ret = 0; @@ -5673,25 +5673,18 @@ nice_agent_parse_remote_sdp (NiceAgent *agent, const gchar *sdp) } sdp_lines = g_strsplit (sdp, "\n", 0); + stream_item = agent->streams; + current_stream = stream_item->data; for (i = 0; sdp_lines && sdp_lines[i]; i++) { if (g_str_has_prefix (sdp_lines[i], "m=")) { - gchar *name = g_strdup (sdp_lines[i] + 2); - gchar *ptr = name; - - while (*ptr != ' ' && *ptr != '\0') ptr++; - *ptr = 0; - - current_stream = NULL; - for (l = agent->streams; l; l = l->next) { - Stream *stream = l->data; - - if (g_strcmp0 (stream->name, name) == 0) { - current_stream = stream; - break; - } + stream_item = stream_item->next; + if (!stream_item) { + g_critical("More streams in SDP than in agent"); + ret = -1; + goto done; } - g_free (name); - } else if (g_str_has_prefix (sdp_lines[i], "a=ice-ufrag:")) { + current_stream = stream_item->data; + } else if (g_str_has_prefix (sdp_lines[i], "a=ice-ufrag:")) { if (current_stream == NULL) { ret = -1; goto done; |