diff options
author | Alexei Gradinari <alex2grad@gmail.com> | 2016-11-15 16:01:27 -0500 |
---|---|---|
committer | George Joseph <gjoseph@digium.com> | 2016-11-30 07:55:24 -0500 |
commit | e5e887be53ceb0b3ae4c0aa5a5cd055bd524fbde (patch) | |
tree | 94586b4e80b7ed5f105027ef0ea4290d6ce62df1 /channels | |
parent | fdf4355bd054ce3a264f3d7a83725259b8acb32f (diff) |
chan_pjsip: fix switching sending codec when asymmetric_rtp_codec=no
The sending codec is switched to the receiving codec and then
is switched back to the best native codec on EVERY receiving RTP packets.
This is because after call of ast_channel_set_rawwriteformat there is call
of ast_set_write_format which calls set_format which sets rawwriteformat
to the best native format.
This patch adds a new function ast_set_write_format_path which set
specific write path on channel and uses this function to switch
the sending codec.
ASTERISK-26603 #close
Change-Id: I5b7d098f8b254ce8f45546e6c36e5d324737f71d
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_pjsip.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c index d4a7d618d..4aae15ce9 100644 --- a/channels/chan_pjsip.c +++ b/channels/chan_pjsip.c @@ -677,7 +677,11 @@ static struct ast_frame *chan_pjsip_cng_tone_detected(struct ast_sip_session *se return f; } -/*! \brief Function called by core to read any waiting frames */ +/*! + * \brief Function called by core to read any waiting frames + * + * \note The channel is already locked. + */ static struct ast_frame *chan_pjsip_read(struct ast_channel *ast) { struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast); @@ -735,8 +739,7 @@ static struct ast_frame *chan_pjsip_read(struct ast_channel *ast) 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(ast_channel_rawwriteformat(ast))); - ast_channel_set_rawwriteformat(ast, f->subclass.format); - ast_set_write_format(ast, ast_channel_writeformat(ast)); + ast_set_write_format_path(ast, ast_channel_writeformat(ast), f->subclass.format); if (ast_channel_is_bridged(ast)) { ast_channel_set_unbridged_nolock(ast, 1); |