From: Jakub Adam Date: Fri, 21 Jun 2013 11:25:43 +0000 (+0200) Subject: media: fix failing call when our host has multiple IP addresses X-Git-Tag: 1.16.1~9 X-Git-Url: https://repo.or.cz/w/siplcs.git/commitdiff_plain/bd6c38b599ecbd6dadfac713901c618c5238c703 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. --- 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; }