Commit 5972db04 authored by Olivier Crête's avatar Olivier Crête

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
parent 483bdcf8
...@@ -5654,7 +5654,7 @@ nice_agent_parse_remote_sdp (NiceAgent *agent, const gchar *sdp) ...@@ -5654,7 +5654,7 @@ nice_agent_parse_remote_sdp (NiceAgent *agent, const gchar *sdp)
{ {
Stream *current_stream = NULL; Stream *current_stream = NULL;
gchar **sdp_lines = NULL; gchar **sdp_lines = NULL;
GSList *l; GSList *l, *stream_item;
gint i; gint i;
gint ret = 0; gint ret = 0;
...@@ -5673,25 +5673,18 @@ nice_agent_parse_remote_sdp (NiceAgent *agent, const gchar *sdp) ...@@ -5673,25 +5673,18 @@ nice_agent_parse_remote_sdp (NiceAgent *agent, const gchar *sdp)
} }
sdp_lines = g_strsplit (sdp, "\n", 0); 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++) { for (i = 0; sdp_lines && sdp_lines[i]; i++) {
if (g_str_has_prefix (sdp_lines[i], "m=")) { if (g_str_has_prefix (sdp_lines[i], "m=")) {
gchar *name = g_strdup (sdp_lines[i] + 2); stream_item = stream_item->next;
gchar *ptr = name; if (!stream_item) {
g_critical("More streams in SDP than in agent");
while (*ptr != ' ' && *ptr != '\0') ptr++; ret = -1;
*ptr = 0; goto done;
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;
}
} }
g_free (name); current_stream = stream_item->data;
} else if (g_str_has_prefix (sdp_lines[i], "a=ice-ufrag:")) { } else if (g_str_has_prefix (sdp_lines[i], "a=ice-ufrag:")) {
if (current_stream == NULL) { if (current_stream == NULL) {
ret = -1; ret = -1;
goto done; goto done;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment