mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-22 12:52:33 +00:00
pjsip: Extend 'asymmetric_rtp_codec' option to include us changing.
PJSIP support in Asterisk differs from chan_sip in that it allows media to be sent as-is without transcoding provided the codecs were negotiated in the SDP. This is allowed according to the RFC. Support for this differs quite a lot though and some endpoints do not handle it well. This change extends the 'asymmetric_rtp_codec' option to also cover this case. When set to no (the default) the code behaves as chan_sip does - the best codec is selected and we will only ever send that, unless we change what we are sending if the remote side changes. When set to yes we will send media as-is without transcoding if the codec has been negotiated in the SDP. ASTERISK-26996 Change-Id: Ib1647f6902a0843e8c435946f831c2159e8d1d51
This commit is contained in:
@@ -401,7 +401,24 @@ static int set_caps(struct ast_sip_session *session, struct ast_sip_session_medi
|
||||
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
|
||||
|
Reference in New Issue
Block a user