[asterisk-commits] mjordan: branch 12 r408999 - /branches/12/res/res_pjsip_sdp_rtp.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Feb 27 06:28:10 CST 2014
Author: mjordan
Date: Thu Feb 27 06:28:04 2014
New Revision: 408999
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=408999
Log:
res_pjsip_sdp_rtp: Apply packetization rules on inbound SDP handling
The setting 'use_ptime' is supposed to tell Asterisk to honour the ptime
attribute in an offer, preferring it to whatever packetization
preferences have been set internally. Currently, however, something
rather quirky will happen:
(1) The SDP answer will be constructed in create_outgoing_sdp_stream.
This will use the preferences from the endpoint, such that the 200 OK
response will add the packetization preferences from the endpoint, and
not what was offered.
(2) When the 200 response is issued, apply_negotiated_sdp_stream is called.
This will call apply_packetization, which will use the ptime attribute
from the offer internally.
We end up telling the offerer to use the internal ptime attribute, but we end
up using the offered ptime attribute. Hilarity ensues.
This patch modifies the behaviour by calling apply_packetization from
negotiate_incoming_sdp_stream, which is called prior to
create_outgoing_sdp_stream. This causes the format preferences on the
session's media object to be set to the inbound ptime value (if 'use_ptime'
is enabled), such that the construction of the answer gets the right value
immediately.
Review: https://reviewboard.asterisk.org/r/3244/
Modified:
branches/12/res/res_pjsip_sdp_rtp.c
Modified: branches/12/res/res_pjsip_sdp_rtp.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_sdp_rtp.c?view=diff&rev=408999&r1=408998&r2=408999
==============================================================================
--- branches/12/res/res_pjsip_sdp_rtp.c (original)
+++ branches/12/res/res_pjsip_sdp_rtp.c Thu Feb 27 06:28:04 2014
@@ -258,7 +258,7 @@
}
ast_rtp_codecs_payloads_destroy(&codecs);
- return 1;
+ return 0;
}
static pjmedia_sdp_attr* generate_rtpmap_attr(pjmedia_sdp_media *media, pj_pool_t *pool, int rtp_code,
@@ -733,7 +733,15 @@
return -1;
}
- return set_caps(session, session_media, stream);
+ if (set_caps(session, session_media, stream)) {
+ return -1;
+ }
+
+ if (media_type == AST_FORMAT_TYPE_AUDIO) {
+ apply_packetization(session, session_media, stream);
+ }
+
+ return 1;
}
static int add_crypto_to_stream(struct ast_sip_session *session,
@@ -1052,7 +1060,7 @@
ast_sockaddr_set_port(addrs, remote_stream->desc.port);
ast_rtp_instance_set_remote_address(session_media->rtp, addrs);
- if (set_caps(session, session_media, local_stream) < 1) {
+ if (set_caps(session, session_media, local_stream)) {
return -1;
}
More information about the asterisk-commits
mailing list