From f8911deccf05ce3087b1d4939d3c91ab424fc8de Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Sat, 25 May 2019 00:02:05 +1000 Subject: [PATCH] webrtc: only set sctp ports if they are different SCTPassociation will complain if we do that while running and resetting is not something we support at the moment --- ext/webrtc/gstwebrtcbin.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/ext/webrtc/gstwebrtcbin.c b/ext/webrtc/gstwebrtcbin.c index 141440a534..585854ac67 100644 --- a/ext/webrtc/gstwebrtcbin.c +++ b/ext/webrtc/gstwebrtcbin.c @@ -3702,10 +3702,23 @@ _update_data_channel_from_sdp_media (GstWebRTCBin * webrtc, webrtc->priv->sctp_transport->max_message_size = max_size; - g_object_set (webrtc->priv->sctp_transport->sctpdec, "local-sctp-port", - local_port, NULL); - g_object_set (webrtc->priv->sctp_transport->sctpenc, "remote-sctp-port", - remote_port, NULL); + { + guint orig_local_port, orig_remote_port; + + /* XXX: sctpassociation warns if we are in the wrong state */ + g_object_get (webrtc->priv->sctp_transport->sctpdec, "local-sctp-port", + &orig_local_port, NULL); + + if (orig_local_port != local_port) + g_object_set (webrtc->priv->sctp_transport->sctpdec, "local-sctp-port", + local_port, NULL); + + g_object_get (webrtc->priv->sctp_transport->sctpenc, "remote-sctp-port", + &orig_remote_port, NULL); + if (orig_remote_port != remote_port) + g_object_set (webrtc->priv->sctp_transport->sctpenc, "remote-sctp-port", + remote_port, NULL); + } for (i = 0; i < webrtc->priv->data_channels->len; i++) { GstWebRTCDataChannel *channel;