diff options
author | Joshua Colp <jcolp@digium.com> | 2017-06-13 09:26:02 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-06-13 09:26:02 -0500 |
commit | 7994914c882874593eb17fdd8c910ee418f44a1b (patch) | |
tree | fc494f06178fd4e922f6afc27966533391e709a4 /res | |
parent | 9bf726d30e4ae5a48a5b315a405de5ce5b8b6ce1 (diff) | |
parent | a34dd63eb0a961a901c7540fb02a8c8cbbf53024 (diff) |
Merge "pjsip: Extend 'asymmetric_rtp_codec' option to include us changing." into 14
Diffstat (limited to 'res')
-rw-r--r-- | res/res_pjsip_sdp_rtp.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c index 6f94b0f4a..5ae108f76 100644 --- a/res/res_pjsip_sdp_rtp.c +++ b/res/res_pjsip_sdp_rtp.c @@ -411,7 +411,24 @@ static int set_caps(struct ast_sip_session *session, ast_format_cap_append_from_cap(caps, ast_channel_nativeformats(session->channel), AST_MEDIA_TYPE_UNKNOWN); ast_format_cap_remove_by_type(caps, media_type); - ast_format_cap_append_from_cap(caps, joint, media_type); + + /* + * If we don't allow the sending codec to be changed on our side + * then get the best codec from the joint capabilities of the media + * type and use only that. This ensures the core won't start sending + * out a format that we aren't currently sending. + */ + if (!session->endpoint->asymmetric_rtp_codec) { + struct ast_format *best; + + best = ast_format_cap_get_best_by_type(joint, media_type); + if (best) { + ast_format_cap_append(caps, best, ast_format_cap_get_framing(joint)); + ao2_ref(best, -1); + } + } else { + ast_format_cap_append_from_cap(caps, joint, media_type); + } /* * Apply the new formats to the channel, potentially changing |