summaryrefslogtreecommitdiff
path: root/channels/chan_mgcp.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2015-07-23 19:24:04 -0500
committerRichard Mudgett <rmudgett@digium.com>2015-08-19 17:09:58 -0500
commit1a549ed134b45c757d8d1cd5d0c66df4285a9150 (patch)
tree7bbf5ab302f79b574d7807f5f99311357e42a5ae /channels/chan_mgcp.c
parentaacb46b56ae684d8f5d8affab31d9c45b149e733 (diff)
rtp_engine.c: Initial split of payload types into rx and tx mappings.
There are numerous problems with the current implementation of the RTP payload type mapping in Asterisk. It uses only one mapping structure to associate payload types to codecs. The single mapping is overkill if all of the payload type values are well known values. Dynamic payload type mappings do not work as well with the single mapping because RFC3264 allows each side of the link to negotiate different dynamic mappings for what they want to receive. Not only could you have the same codec mapped for sending and receiving on different payload types you could wind up with the same payload type mapped to different codecs for each direction. 1) An independent payload type mapping is needed for sending and receiving. 2) The receive mapping needs to keep track of previous mappings because of the slack to when negotiation happens and current packets in flight using the old mapping arrive. 3) The transmit mapping only needs to keep track of the current negotiated values since we are sending the packets and know when the switchover takes place. * Needed to create ast_rtp_codecs_payload_code_tx() and make some callers use the new function because ast_rtp_codecs_payload_code() was used for mappings in both directions. * Needed to create ast_rtp_codecs_payloads_xover() for cases where we need to pass preferred codec mappings to the peer channel for early media bridging or when we need to prefer the offered mapping that RFC3264 says we SHOULD use. * ast_rtp_codecs_payloads_xover() and ast_rtp_codecs_payload_code_tx() are the only new public functions created. All the others were only used for the tx or rx mapping direction so the function doxygen now reflects which direction the function operates. * chan_mgcp.c: Removed call to ast_rtp_codecs_payloads_clear() as doing that makes no sense when processing an incoming SDP. We would be wiping out any mappings that we set for the possible outgoing SDP we sent earlier. ASTERISK-25166 Reported by: Kevin Harwell ASTERISK-17410 Reported by: Boris Fox Change-Id: Iaf6c227bca68cb7c414cf2fd4108a8ac98bd45ac
Diffstat (limited to 'channels/chan_mgcp.c')
-rw-r--r--channels/chan_mgcp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index d9e182cc7..0210e8ab2 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -2018,7 +2018,6 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
ast_rtp_instance_set_remote_address(sub->rtp, &sin_tmp);
ast_debug(3, "Peer RTP is at port %s:%d\n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
/* Scan through the RTP payload types specified in a "m=" line: */
- ast_rtp_codecs_payloads_clear(ast_rtp_instance_get_codecs(sub->rtp), sub->rtp);
codecs = ast_strdupa(m + len);
while (!ast_strlen_zero(codecs)) {
if (sscanf(codecs, "%30d%n", &codec, &len) != 1) {
@@ -4487,7 +4486,8 @@ static enum ast_rtp_glue_result mgcp_get_rtp_peer(struct ast_channel *chan, stru
if (!(sub = ast_channel_tech_pvt(chan)) || !(sub->rtp))
return AST_RTP_GLUE_RESULT_FORBID;
- *instance = sub->rtp ? ao2_ref(sub->rtp, +1), sub->rtp : NULL;
+ ao2_ref(sub->rtp, +1);
+ *instance = sub->rtp;
if (sub->parent->directmedia)
return AST_RTP_GLUE_RESULT_REMOTE;