From bd6c38b599ecbd6dadfac713901c618c5238c703 Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Fri, 21 Jun 2013 13:25:43 +0200 Subject: [PATCH] media: fix failing call when our host has multiple IP addresses In get_stream_ip_and_ports() we have to ensure returned RTP and RTCP ports are from a pair of candidates having the same IP. --- src/core/sipe-media.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/sipe-media.c b/src/core/sipe-media.c index ae13df86..2962f8eb 100644 --- a/src/core/sipe-media.c +++ b/src/core/sipe-media.c @@ -133,6 +133,7 @@ get_stream_ip_and_ports(GSList *candidates, gchar **ip, guint *rtp_port, guint *rtcp_port, SipeCandidateType type) { + *ip = 0; *rtp_port = 0; *rtcp_port = 0; @@ -140,9 +141,14 @@ get_stream_ip_and_ports(GSList *candidates, struct sdpcandidate *candidate = candidates->data; if (type == SIPE_CANDIDATE_TYPE_ANY || candidate->type == type) { + if (!*ip) { + *ip = g_strdup(candidate->ip); + } else if (!sipe_strequal(*ip, candidate->ip)) { + continue; + } + if (candidate->component == SIPE_COMPONENT_RTP) { *rtp_port = candidate->port; - *ip = g_strdup(candidate->ip); } else if (candidate->component == SIPE_COMPONENT_RTCP) *rtcp_port = candidate->port; } -- 2.11.4.GIT