mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Merge "pjsip: Extend 'asymmetric_rtp_codec' option to include us changing."
This commit is contained in:
6
CHANGES
6
CHANGES
@@ -43,6 +43,12 @@ chan_pjsip
|
|||||||
function any contact which is considered unreachable due to qualify being
|
function any contact which is considered unreachable due to qualify being
|
||||||
enabled will no longer be called.
|
enabled will no longer be called.
|
||||||
|
|
||||||
|
* The asymmetric_rtp_codec option now also controls whether chan_pjsip will
|
||||||
|
send media as-is without transcoding if the codec has been negotiated in the
|
||||||
|
SDP. If set to "no" then Asterisk will only ever send the preferred codec
|
||||||
|
from the SDP, unless the remote side sends a different codec and we will
|
||||||
|
switch to match.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
--- Functionality changes from Asterisk 14.4.0 to Asterisk 14.5.0 ------------
|
--- Functionality changes from Asterisk 14.4.0 to Asterisk 14.5.0 ------------
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
@@ -735,11 +735,24 @@ static struct ast_frame *chan_pjsip_read(struct ast_channel *ast)
|
|||||||
|
|
||||||
if (!session->endpoint->asymmetric_rtp_codec &&
|
if (!session->endpoint->asymmetric_rtp_codec &&
|
||||||
ast_format_cmp(ast_channel_rawwriteformat(ast), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
|
ast_format_cmp(ast_channel_rawwriteformat(ast), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
|
||||||
/* For maximum compatibility we ensure that the write format matches that of the received media */
|
struct ast_format_cap *caps;
|
||||||
|
|
||||||
|
/* For maximum compatibility we ensure that the formats match that of the received media */
|
||||||
ast_debug(1, "Oooh, got a frame with format of %s on channel '%s' when we're sending '%s', switching to match\n",
|
ast_debug(1, "Oooh, got a frame with format of %s on channel '%s' when we're sending '%s', switching to match\n",
|
||||||
ast_format_get_name(f->subclass.format), ast_channel_name(ast),
|
ast_format_get_name(f->subclass.format), ast_channel_name(ast),
|
||||||
ast_format_get_name(ast_channel_rawwriteformat(ast)));
|
ast_format_get_name(ast_channel_rawwriteformat(ast)));
|
||||||
|
|
||||||
|
caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
|
||||||
|
if (caps) {
|
||||||
|
ast_format_cap_append_from_cap(caps, ast_channel_nativeformats(ast), AST_MEDIA_TYPE_UNKNOWN);
|
||||||
|
ast_format_cap_remove_by_type(caps, AST_MEDIA_TYPE_AUDIO);
|
||||||
|
ast_format_cap_append(caps, f->subclass.format, 0);
|
||||||
|
ast_channel_nativeformats_set(ast, caps);
|
||||||
|
ao2_ref(caps, -1);
|
||||||
|
}
|
||||||
|
|
||||||
ast_set_write_format_path(ast, ast_channel_writeformat(ast), f->subclass.format);
|
ast_set_write_format_path(ast, ast_channel_writeformat(ast), f->subclass.format);
|
||||||
|
ast_set_read_format_path(ast, ast_channel_readformat(ast), f->subclass.format);
|
||||||
|
|
||||||
if (ast_channel_is_bridged(ast)) {
|
if (ast_channel_is_bridged(ast)) {
|
||||||
ast_channel_set_unbridged_nolock(ast, 1);
|
ast_channel_set_unbridged_nolock(ast, 1);
|
||||||
|
@@ -410,13 +410,29 @@ static int set_caps(struct ast_sip_session *session,
|
|||||||
ast_format_cap_append_from_cap(caps, ast_channel_nativeformats(session->channel),
|
ast_format_cap_append_from_cap(caps, ast_channel_nativeformats(session->channel),
|
||||||
AST_MEDIA_TYPE_UNKNOWN);
|
AST_MEDIA_TYPE_UNKNOWN);
|
||||||
ast_format_cap_remove_by_type(caps, media_type);
|
ast_format_cap_remove_by_type(caps, media_type);
|
||||||
|
|
||||||
if (session->endpoint->preferred_codec_only){
|
if (session->endpoint->preferred_codec_only){
|
||||||
struct ast_format *preferred_fmt = ast_format_cap_get_format(joint, 0);
|
struct ast_format *preferred_fmt = ast_format_cap_get_format(joint, 0);
|
||||||
ast_format_cap_append(caps, preferred_fmt, 0);
|
ast_format_cap_append(caps, preferred_fmt, 0);
|
||||||
ao2_ref(preferred_fmt, -1);
|
ao2_ref(preferred_fmt, -1);
|
||||||
|
} else if (!session->endpoint->asymmetric_rtp_codec) {
|
||||||
|
struct ast_format *best;
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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 {
|
} else {
|
||||||
ast_format_cap_append_from_cap(caps, joint, media_type);
|
ast_format_cap_append_from_cap(caps, joint, media_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Apply the new formats to the channel, potentially changing
|
* Apply the new formats to the channel, potentially changing
|
||||||
* raw read/write formats and translation path while doing so.
|
* raw read/write formats and translation path while doing so.
|
||||||
|
Reference in New Issue
Block a user