Diff
Modified: trunk/Tools/ChangeLog (207530 => 207531)
--- trunk/Tools/ChangeLog 2016-10-19 07:59:27 UTC (rev 207530)
+++ trunk/Tools/ChangeLog 2016-10-19 08:18:24 UTC (rev 207531)
@@ -1,3 +1,25 @@
+2016-10-18 Philippe Normand <pnorm...@igalia.com>
+
+ WebRTC: [GTK] Update jhbuild environment for OpenWebRTC
+ https://bugs.webkit.org/show_bug.cgi?id=163330
+
+ Reviewed by Michael Catanzaro.
+
+ Bring back the openwebrtc JHBuild moduleset in the time being. It
+ should be removed after the bump to GStreamer 1.10 is complete and
+ the libnice patches have been upstreamed. The GStreamer git
+ snapshots used in this patch are the ones configured in Ericsson's
+ GStreamer Cerbero fork.
+
+ * gtk/openwebrtc.modules: Added.
+ * gtk/patches/libnice-0001-TURN-allow-REALM-to-be-empty.patch: Added.
+ * gtk/patches/libnice-0001-agent-Remove-unnecessary-NULL-check.patch: Added.
+ * gtk/patches/libnice-0001-nicesrc-spin-the-agent-mainloop-in-a-separate-thread.patch: Added.
+ * gtk/patches/libnice-0002-Do-not-update-a-remote-candidate-s-type.patch: Added.
+ * gtk/patches/libnice-0002-TURN-handle-437-Allocation-Mismatch-responses.patch: Added.
+ * gtk/patches/libnice-0003-Do-not-compare-scope-for-IPv6-address-when-scope-is-.patch: Added.
+ * gtk/patches/libnice-0004-Removing-no-op-assignment.patch: Added.
+
2016-10-18 Sam Weinig <s...@webkit.org>
Replace std::experimental::variant with WTF::Variant (or similar)
Modified: trunk/Tools/gtk/jhbuild.modules (207530 => 207531)
--- trunk/Tools/gtk/jhbuild.modules 2016-10-19 07:59:27 UTC (rev 207530)
+++ trunk/Tools/gtk/jhbuild.modules 2016-10-19 08:18:24 UTC (rev 207531)
@@ -512,6 +512,7 @@
<autotools id="openwebrtc" autogenargs="--enable-bridge=no --enable-owr-gst=yes">
<dependencies>
<dep package="gst-plugins-openwebrtc"/>
+ <dep package="gst-plugins-bad"/>
<dep package="libnice"/>
</dependencies>
<branch repo="github.com" module="EricssonResearch/openwebrtc.git" checkoutdir="openwebrtc" tag="0b28b080d61af3adb1f779e693fc029f9c1ad499"/>
Added: trunk/Tools/gtk/openwebrtc.modules (0 => 207531)
--- trunk/Tools/gtk/openwebrtc.modules (rev 0)
+++ trunk/Tools/gtk/openwebrtc.modules 2016-10-19 08:18:24 UTC (rev 207531)
@@ -0,0 +1,87 @@
+<?xml version="1.0"?>
+<!DOCTYPE moduleset SYSTEM "moduleset.dtd">
+<?xml-stylesheet type="text/xsl" href=""
+<moduleset>
+
+ <repository type="tarball" name="github-tarball"
+ href=""
+ <repository type="git" name="gstreamer"
+ href=""
+ <repository type="tarball" name="nice.freedesktop.org"
+ href=""
+ <repository type="git" name="github.com"
+ href=""
+
+ <autotools id="openh264" supports-non-srcdir-builds="no" autogen-sh="pseudo-configure">
+ <branch module="cisco/openh264/archive/v${version}.tar.gz" version="1.5.0"
+ checkoutdir="openh264-${version}" repo="github-tarball">
+ <patch file="openh264-configure.patch" strip="0"/>
+ </branch>
+ </autotools>
+
+ <autotools id="libvpx"
+ autogen-template="%(srcdir)s/configure --prefix=%(prefix)s --enable-pic --as=yasm --disable-unit-tests --size-limit=16384x16384 --enable-postproc --enable-multi-res-encoding --enable-temporal-denoising --enable-vp9-temporal-denoising --enable-vp9-postproc --enable-shared">
+ <branch repo="github.com" module="webmproject/libvpx.git" version="1.6.0" checkoutdir="libvpx-1.6.0">
+ </branch>
+ </autotools>
+
+ <autotools id="libnice" supports-non-srcdir-builds="no">
+ <dependencies>
+ <dep package="gstreamer"/>
+ </dependencies>
+ <branch repo="nice.freedesktop.org" module="releases/libnice-${version}.tar.gz" version="0.1.13" checkoutdir="libnice-${version}">
+ <patch file="libnice-0001-agent-Remove-unnecessary-NULL-check.patch" strip="1"/>
+ <patch file="libnice-0002-Do-not-update-a-remote-candidate-s-type.patch" strip="1"/>
+ <patch file="libnice-0003-Do-not-compare-scope-for-IPv6-address-when-scope-is-.patch" strip="1"/>
+ <patch file="libnice-0004-Removing-no-op-assignment.patch" strip="1"/>
+ <patch file="libnice-0001-nicesrc-spin-the-agent-mainloop-in-a-separate-thread.patch" strip="1"/>
+ <patch file="libnice-0001-TURN-allow-REALM-to-be-empty.patch" strip="1"/>
+ <patch file="libnice-0002-TURN-handle-437-Allocation-Mismatch-responses.patch" strip="1"/>
+ </branch>
+ </autotools>
+
+ <autotools id="gstreamer" autogenargs="--disable-gtk-doc">
+ <if condition-set="macos">
+ <autogenargs value="--disable-introspection"/>
+ </if>
+ <dependencies>
+ <dep package="orc"/>
+ </dependencies>
+ <branch repo="gstreamer" module="gstreamer" checkoutdir="gstreamer-b6e69ffdfb3bb21dbada8f01b488ae877f8d205c" tag="b6e69ffdfb3bb21dbada8f01b488ae877f8d205c"/>
+ </autotools>
+
+ <autotools id="gst-plugins-base"
+ autogen-sh="autogen.sh"
+ autogenargs="--disable-examples --disable-gtk-doc">
+ <if condition-set="macos">
+ <autogenargs value="--disable-introspection"/>
+ </if>
+ <dependencies>
+ <dep package="gstreamer"/>
+ </dependencies>
+ <branch repo="gstreamer" module="gst-plugins-base" checkoutdir="gst-plugins-base-cf18fae9deb02f0867b67593f678b932f8eb931a" tag="cf18fae9deb02f0867b67593f678b932f8eb931a"/>
+ </autotools>
+
+ <autotools id="gst-plugins-good" autogenargs="--disable-examples --disable-soup --disable-gtk-doc">
+ <if condition-set="macos">
+ <autogenargs value="--disable-introspection"/>
+ </if>
+ <dependencies>
+ <dep package="libvpx"/>
+ <dep package="gst-plugins-base"/>
+ </dependencies>
+ <branch repo="gstreamer" module="gst-plugins-good" checkoutdir="gst-plugins-good-567afdd4d3f2fa07fecf4c02a7eca70f7a7ef7f7" tag="567afdd4d3f2fa07fecf4c02a7eca70f7a7ef7f7"/>
+ </autotools>
+
+ <autotools id="gst-plugins-bad" autogenargs="--disable-examples --disable-gtk-doc --enable-openh264">
+ <if condition-set="macos">
+ <autogenargs value="--disable-introspection"/>
+ </if>
+ <dependencies>
+ <dep package="gst-plugins-base"/>
+ <dep package="openh264"/>
+ </dependencies>
+ <branch repo="gstreamer" module="gst-plugins-bad" checkoutdir="gst-plugins-bad-a036b7ef9ffe9fe5dac4a7e46fbc3bac92921a54" tag="a036b7ef9ffe9fe5dac4a7e46fbc3bac92921a54"/>
+ </autotools>
+
+</moduleset>
Added: trunk/Tools/gtk/patches/libnice-0001-TURN-allow-REALM-to-be-empty.patch (0 => 207531)
--- trunk/Tools/gtk/patches/libnice-0001-TURN-allow-REALM-to-be-empty.patch (rev 0)
+++ trunk/Tools/gtk/patches/libnice-0001-TURN-allow-REALM-to-be-empty.patch 2016-10-19 08:18:24 UTC (rev 207531)
@@ -0,0 +1,50 @@
+From 0c55166a817ec51096460f789234ef49237000cc Mon Sep 17 00:00:00 2001
+From: Alessandro Decina <alessandr...@gmail.com>
+Date: Thu, 24 Mar 2016 10:48:27 +1100
+Subject: [PATCH 1/2] TURN: allow REALM to be empty
+
+---
+ agent/conncheck.c | 6 ++----
+ stun/stunhmac.c | 6 ++++--
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/agent/conncheck.c b/agent/conncheck.c
+index 057fc81..97bf536 100644
+--- a/agent/conncheck.c
++++ b/agent/conncheck.c
+@@ -2768,13 +2768,11 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
+ agent->compatibility == NICE_COMPATIBILITY_OC2007R2) &&
+ stun_message_get_class (resp) == STUN_ERROR &&
+ stun_message_find_error (resp, &code) ==
+- STUN_MESSAGE_RETURN_SUCCESS &&
+- recv_realm != NULL && recv_realm_len > 0) {
+-
++ STUN_MESSAGE_RETURN_SUCCESS) {
+ if (code == 438 ||
+ (code == 401 &&
+ !(recv_realm_len == sent_realm_len &&
+- sent_realm != NULL &&
++ recv_realm != NULL && sent_realm != NULL &&
+ memcmp (sent_realm, recv_realm, sent_realm_len) == 0))) {
+ d->stun_resp_msg = *resp;
+ memcpy (d->stun_resp_buffer, resp->buffer,
+diff --git a/stun/stunhmac.c b/stun/stunhmac.c
+index df5deb6..f73943f 100644
+--- a/stun/stunhmac.c
++++ b/stun/stunhmac.c
+@@ -90,8 +90,10 @@ static const uint8_t *priv_trim_var (const uint8_t *var, size_t *var_len)
+ ptr++;
+ (*var_len)--;
+ }
+- while(ptr[*var_len-1] == '"' ||
+- ptr[*var_len-1] == 0) {
++
++ while(*var_len > 0 &&
++ (ptr[*var_len-1] == '"' ||
++ ptr[*var_len-1] == 0)) {
+ (*var_len)--;
+ }
+
+--
+2.3.4
+
Added: trunk/Tools/gtk/patches/libnice-0001-agent-Remove-unnecessary-NULL-check.patch (0 => 207531)
--- trunk/Tools/gtk/patches/libnice-0001-agent-Remove-unnecessary-NULL-check.patch (rev 0)
+++ trunk/Tools/gtk/patches/libnice-0001-agent-Remove-unnecessary-NULL-check.patch 2016-10-19 08:18:24 UTC (rev 207531)
@@ -0,0 +1,44 @@
+From 7b7d2d986876fc53a23af7b516d78f82f2a546e9 Mon Sep 17 00:00:00 2001
+From: Philip Withnall <phi...@tecnocode.co.uk>
+Date: Sun, 3 May 2015 16:05:30 +0100
+Subject: [PATCH 1/4] agent: Remove unnecessary NULL check
+
+With the changes in commit 483bdcf8, @name is now guaranteed to be
+non-NULL. Spotted by Coverity.
+
+CID: #109878
+---
+ agent/agent.c | 16 +++++++---------
+ 1 file changed, 7 insertions(+), 9 deletions(-)
+
+diff --git a/agent/agent.c b/agent/agent.c
+index 259fdc9..e733c82 100644
+--- a/agent/agent.c
++++ b/agent/agent.c
+@@ -5329,16 +5329,14 @@ nice_agent_set_stream_name (NiceAgent *agent, guint stream_id,
+
+ agent_lock();
+
+- if (name != NULL) {
+- for (i = agent->streams; i; i = i->next) {
+- Stream *stream = i->data;
++ for (i = agent->streams; i; i = i->next) {
++ Stream *stream = i->data;
+
+- if (stream->id != stream_id &&
+- g_strcmp0 (stream->name, name) == 0)
+- goto done;
+- else if (stream->id == stream_id)
+- stream_to_name = stream;
+- }
++ if (stream->id != stream_id &&
++ g_strcmp0 (stream->name, name) == 0)
++ goto done;
++ else if (stream->id == stream_id)
++ stream_to_name = stream;
+ }
+
+ if (stream_to_name == NULL)
+--
+2.3.2 (Apple Git-55)
+
Added: trunk/Tools/gtk/patches/libnice-0001-nicesrc-spin-the-agent-mainloop-in-a-separate-thread.patch (0 => 207531)
--- trunk/Tools/gtk/patches/libnice-0001-nicesrc-spin-the-agent-mainloop-in-a-separate-thread.patch (rev 0)
+++ trunk/Tools/gtk/patches/libnice-0001-nicesrc-spin-the-agent-mainloop-in-a-separate-thread.patch 2016-10-19 08:18:24 UTC (rev 207531)
@@ -0,0 +1,253 @@
+From 3196a96a408a90f707dff3f31fa3d05d64aeb68a Mon Sep 17 00:00:00 2001
+From: Alessandro Decina <alessandr...@gmail.com>
+Date: Tue, 13 Oct 2015 12:49:19 +1100
+Subject: [PATCH] nicesrc: spin the agent mainloop in a separate thread
+
+Don't run the mainloop from the srcpad task, since that can get blocked in the
+pipeline and cause unnecessary STUN retrasmissions (at best) and completely
+block the agent (at worst).
+---
+ gst/gstnicesrc.c | 158 ++++++++++++++++++++++++++++++++-----------------------
+ gst/gstnicesrc.h | 4 +-
+ 2 files changed, 93 insertions(+), 69 deletions(-)
+
+diff --git a/gst/gstnicesrc.c b/gst/gstnicesrc.c
+index d369e09..eb59fe9 100644
+--- a/gst/gstnicesrc.c
++++ b/gst/gstnicesrc.c
+@@ -48,6 +48,14 @@ GST_DEBUG_CATEGORY_STATIC (nicesrc_debug);
+
+ #define BUFFER_SIZE (65536)
+
++static gboolean
++gst_nice_src_start (
++ GstBaseSrc *basesrc);
++
++static gboolean
++gst_nice_src_stop (
++ GstBaseSrc *basesrc);
++
+ static GstFlowReturn
+ gst_nice_src_create (
+ GstPushSrc *basesrc,
+@@ -57,10 +65,6 @@ static gboolean
+ gst_nice_src_unlock (
+ GstBaseSrc *basesrc);
+
+-static gboolean
+-gst_nice_src_unlock_stop (
+- GstBaseSrc *basesrc);
+-
+ static void
+ gst_nice_src_set_property (
+ GObject *object,
+@@ -116,8 +120,9 @@ gst_nice_src_class_init (GstNiceSrcClass *klass)
+ gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_nice_src_create);
+
+ gstbasesrc_class = (GstBaseSrcClass *) klass;
++ gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_nice_src_start);
++ gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_nice_src_stop);
+ gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_nice_src_unlock);
+- gstbasesrc_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_nice_src_unlock_stop);
+
+ gobject_class = (GObjectClass *) klass;
+ gobject_class->set_property = gst_nice_src_set_property;
+@@ -179,9 +184,83 @@ gst_nice_src_init (GstNiceSrc *src)
+ src->component_id = 0;
+ src->mainctx = g_main_context_new ();
+ src->mainloop = g_main_loop_new (src->mainctx, FALSE);
+- src->unlocked = FALSE;
+- src->idle_source = NULL;
+ src->outbufs = g_queue_new ();
++ src->agent_io_thread = NULL;
++ g_cond_init (&src->outcond);
++}
++
++static gpointer
++gst_nice_src_agent_io_thread (gpointer data)
++{
++ GstNiceSrc *nicesrc = GST_NICE_SRC (data);
++
++ GST_INFO_OBJECT (nicesrc, "starting agent io thread");
++ g_main_loop_run (nicesrc->mainloop);
++ GST_INFO_OBJECT (nicesrc, "exiting agent io thread");
++
++ return NULL;
++}
++
++static gboolean
++main_loop_running_cb (gpointer data)
++{
++ GstNiceSrc *nicesrc = GST_NICE_SRC (data);
++
++ GST_OBJECT_LOCK (nicesrc);
++ /* _start() and _stop() could both be waiting for the mainloop to start so we
++ * need to broadcast */
++ g_cond_broadcast (&nicesrc->outcond);
++ GST_OBJECT_UNLOCK (nicesrc);
++
++ return FALSE;
++}
++
++static gboolean
++gst_nice_src_start (GstBaseSrc * basesrc)
++{
++ GstNiceSrc *nicesrc = GST_NICE_SRC (basesrc);
++ GSource *source;
++ gchar *thread_name;
++
++ GST_OBJECT_LOCK (nicesrc);
++ source = g_idle_source_new ();
++ g_source_set_callback (source,
++ (GSourceFunc) main_loop_running_cb, nicesrc, NULL);
++ g_source_attach (source, nicesrc->mainctx);
++ g_source_unref (source);
++
++ thread_name = g_strdup_printf ("%s:agent_io", GST_OBJECT_NAME (nicesrc));
++ nicesrc->agent_io_thread = g_thread_new (thread_name, gst_nice_src_agent_io_thread, nicesrc);
++ g_free (thread_name);
++ /* wait until the agent thread starts spinning the mainloop or _stop() is
++ * called */
++ while (GST_BASE_SRC_IS_STARTING (basesrc) &&
++ !g_main_loop_is_running (nicesrc->mainloop))
++ g_cond_wait (&nicesrc->outcond, GST_OBJECT_GET_LOCK (nicesrc));
++ GST_OBJECT_UNLOCK (nicesrc);
++
++ return TRUE;
++}
++
++static gboolean
++gst_nice_src_stop (GstBaseSrc * basesrc)
++{
++ GstNiceSrc *nicesrc = GST_NICE_SRC (basesrc);
++ GThread *agent_io_thread = NULL;
++
++ GST_OBJECT_LOCK (nicesrc);
++ /* here we wait for the agent thread created in _start() to be scheduled so
++ * that we don't risk calling _quit() first and then _run() on the mainloop */
++ while (!g_main_loop_is_running (nicesrc->mainloop))
++ g_cond_wait (&nicesrc->outcond, GST_OBJECT_GET_LOCK (nicesrc));
++ g_main_loop_quit (nicesrc->mainloop);
++ agent_io_thread = nicesrc->agent_io_thread;
++ nicesrc->agent_io_thread = NULL;
++ GST_OBJECT_UNLOCK (nicesrc);
++
++ g_thread_join (agent_io_thread);
++
++ return TRUE;
+ }
+
+ static void
+@@ -207,62 +286,17 @@ gst_nice_src_read_callback (NiceAgent *agent,
+ #endif
+ GST_OBJECT_LOCK (nicesrc);
+ g_queue_push_tail (nicesrc->outbufs, buffer);
+- g_main_loop_quit (nicesrc->mainloop);
++ g_cond_signal (&nicesrc->outcond);
+ GST_OBJECT_UNLOCK (nicesrc);
+ }
+
+ static gboolean
+-gst_nice_src_unlock_idler (gpointer data)
+-{
+- GstNiceSrc *nicesrc = GST_NICE_SRC (data);
+-
+- GST_OBJECT_LOCK (nicesrc);
+- if (nicesrc->unlocked)
+- g_main_loop_quit (nicesrc->mainloop);
+-
+- if (nicesrc->idle_source) {
+- g_source_destroy (nicesrc->idle_source);
+- g_source_unref (nicesrc->idle_source);
+- nicesrc->idle_source = NULL;
+- }
+- GST_OBJECT_UNLOCK (nicesrc);
+-
+- return FALSE;
+-}
+-
+-static gboolean
+ gst_nice_src_unlock (GstBaseSrc *src)
+ {
+ GstNiceSrc *nicesrc = GST_NICE_SRC (src);
+
+ GST_OBJECT_LOCK (src);
+- nicesrc->unlocked = TRUE;
+-
+- g_main_loop_quit (nicesrc->mainloop);
+-
+- if (!nicesrc->idle_source) {
+- nicesrc->idle_source = g_idle_source_new ();
+- g_source_set_priority (nicesrc->idle_source, G_PRIORITY_HIGH);
+- g_source_set_callback (nicesrc->idle_source, gst_nice_src_unlock_idler, src, NULL);
+- g_source_attach (nicesrc->idle_source, g_main_loop_get_context (nicesrc->mainloop));
+- }
+- GST_OBJECT_UNLOCK (src);
+-
+- return TRUE;
+-}
+-
+-static gboolean
+-gst_nice_src_unlock_stop (GstBaseSrc *src)
+-{
+- GstNiceSrc *nicesrc = GST_NICE_SRC (src);
+-
+- GST_OBJECT_LOCK (src);
+- nicesrc->unlocked = FALSE;
+- if (nicesrc->idle_source) {
+- g_source_destroy (nicesrc->idle_source);
+- g_source_unref(nicesrc->idle_source);
+- }
+- nicesrc->idle_source = NULL;
++ g_cond_signal (&nicesrc->outcond);
+ GST_OBJECT_UNLOCK (src);
+
+ return TRUE;
+@@ -278,19 +312,8 @@ gst_nice_src_create (
+ GST_LOG_OBJECT (nicesrc, "create called");
+
+ GST_OBJECT_LOCK (basesrc);
+- if (nicesrc->unlocked) {
+- GST_OBJECT_UNLOCK (basesrc);
+-#if GST_CHECK_VERSION (1,0,0)
+- return GST_FLOW_FLUSHING;
+-#else
+- return GST_FLOW_WRONG_STATE;
+-#endif
+- }
+- if (g_queue_is_empty (nicesrc->outbufs)) {
+- GST_OBJECT_UNLOCK (basesrc);
+- g_main_loop_run (nicesrc->mainloop);
+- GST_OBJECT_LOCK (basesrc);
+- }
++ if (g_queue_is_empty (nicesrc->outbufs))
++ g_cond_wait (&nicesrc->outcond, GST_OBJECT_GET_LOCK (nicesrc));
+
+ *buffer = g_queue_pop_head (nicesrc->outbufs);
+ GST_OBJECT_UNLOCK (basesrc);
+@@ -331,6 +354,7 @@ gst_nice_src_dispose (GObject *object)
+ g_queue_free (src->outbufs);
+ }
+ src->outbufs = NULL;
++ g_cond_clear (&src->outcond);
+
+ G_OBJECT_CLASS (gst_nice_src_parent_class)->dispose (object);
+ }
+diff --git a/gst/gstnicesrc.h b/gst/gstnicesrc.h
+index 5d3f554..2d9f674 100644
+--- a/gst/gstnicesrc.h
++++ b/gst/gstnicesrc.h
+@@ -68,8 +68,8 @@ struct _GstNiceSrc
+ GMainContext *mainctx;
+ GMainLoop *mainloop;
+ GQueue *outbufs;
+- gboolean unlocked;
+- GSource *idle_source;
++ GCond outcond;
++ GThread *agent_io_thread;
+ };
+
+ typedef struct _GstNiceSrcClass GstNiceSrcClass;
+--
+2.3.4
+
Added: trunk/Tools/gtk/patches/libnice-0002-Do-not-update-a-remote-candidate-s-type.patch (0 => 207531)
--- trunk/Tools/gtk/patches/libnice-0002-Do-not-update-a-remote-candidate-s-type.patch (rev 0)
+++ trunk/Tools/gtk/patches/libnice-0002-Do-not-update-a-remote-candidate-s-type.patch 2016-10-19 08:18:24 UTC (rev 207531)
@@ -0,0 +1,31 @@
+From 93862c1e1940618e06143d4788f54bffd4d1c5da Mon Sep 17 00:00:00 2001
+From: Youness Alaoui <kakar...@kakaroto.homelinux.net>
+Date: Tue, 5 May 2015 14:24:15 -0400
+Subject: [PATCH 2/4] Do not update a remote candidate's type
+
+When adding a remote candidate, if it's the same ip:port, we should
+also check its type, otherwise it's a new candidate. We can't allow
+a candidate type to be updated. This caused issues to ikonst_ on IRC
+where for some reason a host candidate appeared as both host and prflx
+and the update caused a remote host candidate to be updated to prflx
+causing a crash when the sockptr was being accessed.
+---
+ agent/agent.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/agent/agent.c b/agent/agent.c
+index e733c82..38b679f 100644
+--- a/agent/agent.c
++++ b/agent/agent.c
+@@ -3041,7 +3041,7 @@ static gboolean priv_add_remote_candidate (
+
+ /* step: check whether the candidate already exists */
+ candidate = component_find_remote_candidate(component, addr, transport);
+- if (candidate) {
++ if (candidate && candidate->type == type) {
+ if (nice_debug_is_enabled ()) {
+ gchar tmpbuf[INET6_ADDRSTRLEN];
+ nice_address_to_string (addr, tmpbuf);
+--
+2.3.2 (Apple Git-55)
+
Added: trunk/Tools/gtk/patches/libnice-0002-TURN-handle-437-Allocation-Mismatch-responses.patch (0 => 207531)
--- trunk/Tools/gtk/patches/libnice-0002-TURN-handle-437-Allocation-Mismatch-responses.patch (rev 0)
+++ trunk/Tools/gtk/patches/libnice-0002-TURN-handle-437-Allocation-Mismatch-responses.patch 2016-10-19 08:18:24 UTC (rev 207531)
@@ -0,0 +1,131 @@
+From 9e2ced131ac0fc642ef5c861851c5988d8b96d16 Mon Sep 17 00:00:00 2001
+From: Alessandro Decina <alessandr...@gmail.com>
+Date: Thu, 24 Mar 2016 10:54:20 +1100
+Subject: [PATCH 2/2] TURN: handle 437 Allocation Mismatch responses
+
+On Allocation Mismatch responses, the client is supposed to retry with a
+different host:port combination.
+---
+ agent/conncheck.c | 42 +++++++++++++++++++++++++++++++++---------
+ agent/discovery.h | 1 +
+ stun/stunagent.c | 2 +-
+ 3 files changed, 35 insertions(+), 10 deletions(-)
+
+diff --git a/agent/conncheck.c b/agent/conncheck.c
+index 97bf536..d03e57a 100644
+--- a/agent/conncheck.c
++++ b/agent/conncheck.c
+@@ -2630,9 +2630,10 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
+ StunTransactionId discovery_id;
+ StunTransactionId response_id;
+ stun_message_id (resp, response_id);
++ CandidateDiscovery *d = NULL;
+
+ for (i = agent->discovery_list; i && trans_found != TRUE; i = i->next) {
+- CandidateDiscovery *d = i->data;
++ d = i->data;
+
+ if (d->type == NICE_CANDIDATE_TYPE_RELAYED &&
+ d->stun_message.buffer) {
+@@ -2757,6 +2758,7 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
+ uint16_t sent_realm_len = 0;
+ uint16_t recv_realm_len = 0;
+
++ trans_found = TRUE;
+ sent_realm = (uint8_t *) stun_message_find (&d->stun_message,
+ STUN_ATTRIBUTE_REALM, &sent_realm_len);
+ recv_realm = (uint8_t *) stun_message_find (resp,
+@@ -2769,11 +2771,31 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
+ stun_message_get_class (resp) == STUN_ERROR &&
+ stun_message_find_error (resp, &code) ==
+ STUN_MESSAGE_RETURN_SUCCESS) {
+- if (code == 438 ||
++ if (code == 437 ||
++ code == 438 ||
+ (code == 401 &&
+ !(recv_realm_len == sent_realm_len &&
+ recv_realm != NULL && sent_realm != NULL &&
+ memcmp (sent_realm, recv_realm, sent_realm_len) == 0))) {
++ if (code == 437) {
++ if (d->turn_retries++ == 3)
++ goto error;
++
++ /* retry up to three times on Allocation Mismatch errors */
++ NiceAddress addr = d->nicesock->addr;
++ NiceSocket *new_socket;
++
++ /* FIXME: this ignores nice_agent_set_port_range */
++ nice_address_set_port (&addr, 0);
++
++ new_socket = nice_udp_bsd_socket_new (&addr);
++ if (new_socket) {
++ _priv_set_socket_tos (agent, new_socket, d->stream->tos);
++ component_attach_socket (d->component, new_socket);
++ d->nicesock = new_socket;
++ }
++ }
++
+ d->stun_resp_msg = *resp;
+ memcpy (d->stun_resp_buffer, resp->buffer,
+ stun_message_length (resp));
+@@ -2782,23 +2804,25 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
+ d->pending = FALSE;
+ } else {
+ /* case: a real unauthorized error */
+- d->stun_message.buffer = NULL;
+- d->stun_message.buffer_len = 0;
+- d->done = TRUE;
++ goto error;
+ }
+ } else {
+ /* case: STUN error, the check STUN context was freed */
+- d->stun_message.buffer = NULL;
+- d->stun_message.buffer_len = 0;
+- d->done = TRUE;
++ goto error;
+ }
+- trans_found = TRUE;
+ }
+ }
+ }
+ }
+
+ return trans_found;
++
++error:
++ d->stun_message.buffer = NULL;
++ d->stun_message.buffer_len = 0;
++ d->done = TRUE;
++
++ return trans_found;
+ }
+
+
+diff --git a/agent/discovery.h b/agent/discovery.h
+index c22ea6a..148b8c2 100644
+--- a/agent/discovery.h
++++ b/agent/discovery.h
+@@ -56,6 +56,7 @@ typedef struct
+ Stream *stream;
+ Component *component;
+ TurnServer *turn;
++ gint turn_retries;
+ StunAgent stun_agent;
+ StunTimer timer;
+ uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE_IPV6];
+diff --git a/stun/stunagent.c b/stun/stunagent.c
+index 2abcc29..0abae3d 100644
+--- a/stun/stunagent.c
++++ b/stun/stunagent.c
+@@ -301,7 +301,7 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg,
+ } else if (!(stun_message_get_class (msg) == STUN_ERROR &&
+ stun_message_find_error (msg, &error_code) ==
+ STUN_MESSAGE_RETURN_SUCCESS &&
+- (error_code == 400 || error_code == 401))) {
++ (error_code == 400 || error_code == 401 || error_code == 437))) {
+ stun_debug ("STUN auth error: No message integrity attribute!");
+ return STUN_VALIDATION_UNAUTHORIZED;
+ }
+--
+2.3.4
+
Added: trunk/Tools/gtk/patches/libnice-0003-Do-not-compare-scope-for-IPv6-address-when-scope-is-.patch (0 => 207531)
--- trunk/Tools/gtk/patches/libnice-0003-Do-not-compare-scope-for-IPv6-address-when-scope-is-.patch (rev 0)
+++ trunk/Tools/gtk/patches/libnice-0003-Do-not-compare-scope-for-IPv6-address-when-scope-is-.patch 2016-10-19 08:18:24 UTC (rev 207531)
@@ -0,0 +1,43 @@
+From 91a7b9324244844baf35d8fcef019a4ea3872d30 Mon Sep 17 00:00:00 2001
+From: Youness Alaoui <kakar...@kakaroto.homelinux.net>
+Date: Tue, 5 May 2015 15:00:30 -0400
+Subject: [PATCH 3/4] Do not compare scope for IPv6 address when scope is 0
+
+This caused issues with thinking local host candidates were peer-reflexive
+candidates because the nice_address_equal would fail since the scope
+would be 6 (or some other value) but locally created NiceAddress from
+a stun response would have the scope set to 0.
+We ignore the scope when comparing ipv6 candidates when scope is 0
+to avoid these kinds of issues.
+Thanks to ikonst_ for finding these issues
+---
+ agent/address.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/agent/address.c b/agent/address.c
+index a8d9c76..01eebab 100644
+--- a/agent/address.c
++++ b/agent/address.c
+@@ -297,7 +297,8 @@ nice_address_equal (const NiceAddress *a, const NiceAddress *b)
+ case AF_INET6:
+ return IN6_ARE_ADDR_EQUAL (&a->s.ip6.sin6_addr, &b->s.ip6.sin6_addr)
+ && (a->s.ip6.sin6_port == b->s.ip6.sin6_port)
+- && (a->s.ip6.sin6_scope_id == b->s.ip6.sin6_scope_id);
++ && (a->s.ip6.sin6_scope_id == 0 || b->s.ip6.sin6_scope_id == 0 ||
++ (a->s.ip6.sin6_scope_id == b->s.ip6.sin6_scope_id));
+
+ default:
+ g_return_val_if_reached (FALSE);
+@@ -412,7 +413,8 @@ nice_address_equal_no_port (const NiceAddress *a, const NiceAddress *b)
+
+ case AF_INET6:
+ return IN6_ARE_ADDR_EQUAL (&a->s.ip6.sin6_addr, &b->s.ip6.sin6_addr)
+- && (a->s.ip6.sin6_scope_id == b->s.ip6.sin6_scope_id);
++ && (a->s.ip6.sin6_scope_id == 0 || b->s.ip6.sin6_scope_id == 0 ||
++ (a->s.ip6.sin6_scope_id == b->s.ip6.sin6_scope_id));
+
+ default:
+ g_return_val_if_reached (FALSE);
+--
+2.3.2 (Apple Git-55)
+
Added: trunk/Tools/gtk/patches/libnice-0004-Removing-no-op-assignment.patch (0 => 207531)
--- trunk/Tools/gtk/patches/libnice-0004-Removing-no-op-assignment.patch (rev 0)
+++ trunk/Tools/gtk/patches/libnice-0004-Removing-no-op-assignment.patch 2016-10-19 08:18:24 UTC (rev 207531)
@@ -0,0 +1,24 @@
+From 6a8c63219c632c27707267b6510dca096c6fd511 Mon Sep 17 00:00:00 2001
+From: Youness Alaoui <kakar...@kakaroto.homelinux.net>
+Date: Tue, 5 May 2015 15:07:10 -0400
+Subject: [PATCH 4/4] Removing no-op assignment
+
+---
+ agent/agent.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/agent/agent.c b/agent/agent.c
+index 38b679f..84d4093 100644
+--- a/agent/agent.c
++++ b/agent/agent.c
+@@ -3051,7 +3051,6 @@ static gboolean priv_add_remote_candidate (
+ username, password, priority);
+ }
+ /* case 1: an existing candidate, update the attributes */
+- candidate->type = type;
+ if (base_addr)
+ candidate->base_addr = *base_addr;
+ candidate->priority = priority;
+--
+2.3.2 (Apple Git-55)
+