summaryrefslogtreecommitdiff
path: root/main/bridge.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2014-08-20 22:52:44 +0000
committerRichard Mudgett <rmudgett@digium.com>2014-08-20 22:52:44 +0000
commitb7f98c3da45411c7394ebf5ebef2f800fb11e3d1 (patch)
tree27dc9b09faf866e8c6305351995a72af30e9fc65 /main/bridge.c
parent4672c139ddcaa7bae6600ed2ec330192a87f2883 (diff)
chan_pjsip: Update media translation paths when new SDP negotiated.
On a SIP reinvite that changes media strams, the PJSIP channel driver was flooding the log with "Asked to transmit frame type %s, while native formats is %s" warnings. * Fixes PJSIP not setting up translation paths when the formats change on a reinvite. AFS-63 was effectively reintroduced because of the media formats work. res_pjsip_sdp_rtp.c:set_caps() * Improved the unexpected frame format WARNING message to include more information. * Added protective locking while altering formats on a channel. Reworked set_format() to simplify and protect the formats under manipulation. * Restored some code that got lost in the media_formats work. (channel.c:set_format() and res_pjsip_sdp_rtp.c:set_caps()) AFS-137 #close Reported by: Mark Michelson Review: https://reviewboard.asterisk.org/r/3906/ ........ Merged revisions 421645 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421646 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/bridge.c')
-rw-r--r--main/bridge.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/main/bridge.c b/main/bridge.c
index a3ca8a976..0478e4686 100644
--- a/main/bridge.c
+++ b/main/bridge.c
@@ -939,12 +939,14 @@ int ast_bridge_destroy(struct ast_bridge *bridge, int cause)
static int bridge_make_compatible(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
{
struct ast_str *codec_buf = ast_str_alloca(64);
- struct ast_format *read_format;
- struct ast_format *write_format;
struct ast_format *best_format;
+ RAII_VAR(struct ast_format *, read_format, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_format *, write_format, NULL, ao2_cleanup);
- read_format = ast_channel_readformat(bridge_channel->chan);
- write_format = ast_channel_writeformat(bridge_channel->chan);
+ ast_channel_lock(bridge_channel->chan);
+ read_format = ao2_bump(ast_channel_readformat(bridge_channel->chan));
+ write_format = ao2_bump(ast_channel_writeformat(bridge_channel->chan));
+ ast_channel_unlock(bridge_channel->chan);
/* Are the formats currently in use something this bridge can handle? */
if (ast_format_cap_iscompatible_format(bridge->technology->format_capabilities, read_format) == AST_FORMAT_CMP_NOT_EQUAL) {