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

Change-Id: I23b646392082deab65bedeb19b12dcbcb9216d0c
This commit is contained in:
Richard Mudgett
2017-05-11 18:46:52 -05:00
parent 0fdb99c268
commit a95584d079
2 changed files with 36 additions and 6 deletions

View File

@@ -146,6 +146,10 @@ const void *ast_sdp_state_get_local_sdp_impl(struct ast_sdp_state *sdp_state);
* \param sdp_state * \param sdp_state
* \param sdp * \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 0 Success
* \retval non-0 Failure * \retval non-0 Failure
* *

View File

@@ -997,11 +997,32 @@ static void update_rtp_after_merge(const struct ast_sdp_state *state,
const struct ast_sdp *remote_sdp, const struct ast_sdp *remote_sdp,
const struct ast_sdp_m_line *remote_m_line) const struct ast_sdp_m_line *remote_m_line)
{ {
struct ast_sdp_c_line *c_line;
struct ast_sockaddr *addrs;
if (!rtp) { if (!rtp) {
/* This is a dummy stream */ /* This is a dummy stream */
return; 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) if (ast_sdp_options_get_rtcp_mux(options)
&& ast_sdp_m_find_attribute(remote_m_line, "rtcp-mux", -1)) { && ast_sdp_m_find_attribute(remote_m_line, "rtcp-mux", -1)) {
ast_rtp_instance_set_prop(rtp->instance, AST_RTP_PROPERTY_RTCP, ast_rtp_instance_set_prop(rtp->instance, AST_RTP_PROPERTY_RTCP,
@@ -1011,9 +1032,7 @@ static void update_rtp_after_merge(const struct ast_sdp_state *state,
AST_RTP_INSTANCE_RTCP_STANDARD); 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 @@ static void update_udptl_after_merge(const struct ast_sdp_state *state, struct s
} }
} }
c_line = remote_sdp->c_line; c_line = remote_m_line->c_line;
if (remote_m_line->c_line) { if (!c_line) {
c_line = remote_m_line->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) { 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_sockaddr_set_port(addrs, remote_m_line->port);
ast_udptl_set_peer(udptl->instance, addrs); ast_udptl_set_peer(udptl->instance, addrs);
ast_free(addrs); ast_free(addrs);