diff options
author | Richard Mudgett <rmudgett@digium.com> | 2015-07-24 18:46:09 -0500 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2015-08-20 11:56:14 -0500 |
commit | d643b206c6563223fed813808e5a680df1aaf684 (patch) | |
tree | a3090330baa9d81d47497dd3a35987bc454a6e9d /res/res_pjsip_sdp_rtp.c | |
parent | f7df3e1a0119c26595adb1cb48bf2beee8b9cf89 (diff) |
res_pjsip_sdp_rtp.c: Set preferred rx payload type mapping on incoming offers.
ASTERISK-25166
Reported by: Kevin Harwell
ASTERISK-17410
Reported by: Boris Fox
Change-Id: I97ecebc1ab9b5654fb918bf1f4c98c956b852369
Diffstat (limited to 'res/res_pjsip_sdp_rtp.c')
-rw-r--r-- | res/res_pjsip_sdp_rtp.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c index 2ca1f98de..f1314f528 100644 --- a/res/res_pjsip_sdp_rtp.c +++ b/res/res_pjsip_sdp_rtp.c @@ -286,8 +286,10 @@ static void get_codecs(struct ast_sip_session *session, const struct pjmedia_sdp } } -static int set_caps(struct ast_sip_session *session, struct ast_sip_session_media *session_media, - const struct pjmedia_sdp_media *stream) +static int set_caps(struct ast_sip_session *session, + struct ast_sip_session_media *session_media, + const struct pjmedia_sdp_media *stream, + int is_offer) { RAII_VAR(struct ast_format_cap *, caps, NULL, ao2_cleanup); RAII_VAR(struct ast_format_cap *, peer, NULL, ao2_cleanup); @@ -332,6 +334,13 @@ static int set_caps(struct ast_sip_session *session, struct ast_sip_session_medi return -1; } + if (is_offer) { + /* + * Setup rx payload type mapping to prefer the mapping + * from the peer that the RFC says we SHOULD use. + */ + ast_rtp_codecs_payloads_xover(&codecs, &codecs, NULL); + } ast_rtp_codecs_payloads_copy(&codecs, ast_rtp_instance_get_codecs(session_media->rtp), session_media->rtp); @@ -901,7 +910,7 @@ static int negotiate_incoming_sdp_stream(struct ast_sip_session *session, struct pj_strdup(session->inv_session->pool, &session_media->transport, &stream->desc.transport); } - if (set_caps(session, session_media, stream)) { + if (set_caps(session, session_media, stream, 1)) { return 0; } return 1; @@ -1249,7 +1258,7 @@ static int apply_negotiated_sdp_stream(struct ast_sip_session *session, struct a /* Apply connection information to the RTP instance */ 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, remote_stream)) { + if (set_caps(session, session_media, remote_stream, 0)) { return 1; } |