diff options
author | Torrey Searle <torrey@voxbone.com> | 2017-07-28 14:53:44 +0200 |
---|---|---|
committer | Torrey Searle <tsearle@gmail.com> | 2017-08-09 08:34:19 -0500 |
commit | fa9e0fa9320cda79634620ac6c543d99965fadbf (patch) | |
tree | c9e7babe6c8a9b945aeceea28d2b0c553351352b /channels | |
parent | 2c23f8719e5a0b5d0fd5a7fd22e9b613a5bcb98a (diff) |
res_rtp_asterisk: Make P2P bridge Asymmetric codec aware
Introduce a new property to rtp-engine to make it aware of
the desire for assymetric codecs or not. If asymmetric codecs
is not allowed, the bridge will compare read/write formats
and shut down the p2p bridge if needed
ASTERISK-26745 #close
Change-Id: I0d9c83e5356df81661e58d40a8db565833501a6f
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_pjsip.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c index 94aca702e..8e19dd87d 100644 --- a/channels/chan_pjsip.c +++ b/channels/chan_pjsip.c @@ -727,14 +727,11 @@ static struct ast_frame *chan_pjsip_read(struct ast_channel *ast) session = channel->session; - if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) { - ast_debug(1, "Oooh, got a frame with format of %s on channel '%s' when it has not been negotiated\n", - ast_format_get_name(f->subclass.format), ast_channel_name(ast)); - - ast_frfree(f); - return &ast_null_frame; - } - + /* + * Asymmetric RTP only has one native format set at a time. + * Therefore we need to update the native format to the current + * raw read format BEFORE the native format check + */ if (!session->endpoint->asymmetric_rtp_codec && ast_format_cmp(ast_channel_rawwriteformat(ast), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) { struct ast_format_cap *caps; @@ -761,6 +758,14 @@ static struct ast_frame *chan_pjsip_read(struct ast_channel *ast) } } + if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) { + ast_debug(1, "Oooh, got a frame with format of %s on channel '%s' when it has not been negotiated\n", + ast_format_get_name(f->subclass.format), ast_channel_name(ast)); + + ast_frfree(f); + return &ast_null_frame; + } + if (session->dsp) { int dsp_features; |