[asterisk-commits] SDP: Set the remote c= line in RTP instance. (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 16 11:51:42 CDT 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/5816 )

Change subject: SDP: Set the remote c= line in RTP instance.
......................................................................

SDP: Set the remote c= line in RTP instance.

Change-Id: I23b646392082deab65bedeb19b12dcbcb9216d0c
---
M include/asterisk/sdp_state.h
M main/sdp_state.c
2 files changed, 36 insertions(+), 6 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/include/asterisk/sdp_state.h b/include/asterisk/sdp_state.h
index c2122fb..b8209e1 100644
--- a/include/asterisk/sdp_state.h
+++ b/include/asterisk/sdp_state.h
@@ -146,6 +146,10 @@
  * \param sdp_state
  * \param sdp
  *
+ * \note It is assumed that the passed in SDP has been checked for sanity
+ * already.  e.g., There are no syntax errors, a c= line is reachable for
+ * each m= line, etc...
+ *
  * \retval 0 Success
  * \retval non-0 Failure
  *
diff --git a/main/sdp_state.c b/main/sdp_state.c
index a5f1167..f27da21 100644
--- a/main/sdp_state.c
+++ b/main/sdp_state.c
@@ -997,9 +997,30 @@
 	const struct ast_sdp *remote_sdp,
 	const struct ast_sdp_m_line *remote_m_line)
 {
+	struct ast_sdp_c_line *c_line;
+	struct ast_sockaddr *addrs;
+
 	if (!rtp) {
 		/* This is a dummy stream */
 		return;
+	}
+
+	c_line = remote_m_line->c_line;
+	if (!c_line) {
+		c_line = remote_sdp->c_line;
+	}
+	/*
+	 * There must be a c= line somewhere but that would be an error by
+	 * the far end that should have been caught by a validation check
+	 * before we processed the SDP.
+	 */
+	ast_assert(c_line != NULL);
+
+	if (ast_sockaddr_resolve(&addrs, c_line->address, PARSE_PORT_FORBID, AST_AF_UNSPEC) > 0) {
+		/* Apply connection information to the RTP instance */
+		ast_sockaddr_set_port(addrs, remote_m_line->port);
+		ast_rtp_instance_set_remote_address(rtp->instance, addrs);
+		ast_free(addrs);
 	}
 
 	if (ast_sdp_options_get_rtcp_mux(options)
@@ -1011,9 +1032,7 @@
 			AST_RTP_INSTANCE_RTCP_STANDARD);
 	}
 
-	if (ast_sdp_options_get_ice(options) == AST_SDP_ICE_ENABLED_STANDARD) {
-		update_ice(state, rtp->instance, options, remote_sdp, remote_m_line);
-	}
+	update_ice(state, rtp->instance, options, remote_sdp, remote_m_line);
 }
 
 /*!
@@ -1066,12 +1085,19 @@
 		}
 	}
 
-	c_line = remote_sdp->c_line;
-	if (remote_m_line->c_line) {
-		c_line = remote_m_line->c_line;
+	c_line = remote_m_line->c_line;
+	if (!c_line) {
+		c_line = remote_sdp->c_line;
 	}
+	/*
+	 * There must be a c= line somewhere but that would be an error by
+	 * the far end that should have been caught by a validation check
+	 * before we processed the SDP.
+	 */
+	ast_assert(c_line != NULL);
 
 	if (ast_sockaddr_resolve(&addrs, c_line->address, PARSE_PORT_FORBID, AST_AF_UNSPEC) > 0) {
+		/* Apply connection information to the UDPTL instance */
 		ast_sockaddr_set_port(addrs, remote_m_line->port);
 		ast_udptl_set_peer(udptl->instance, addrs);
 		ast_free(addrs);

-- 
To view, visit https://gerrit.asterisk.org/5816
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I23b646392082deab65bedeb19b12dcbcb9216d0c
Gerrit-Change-Number: 5816
Gerrit-PatchSet: 2
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20170616/6cf68ca3/attachment-0001.html>


More information about the asterisk-commits mailing list