diff options
author | Richard Mudgett <rmudgett@digium.com> | 2014-08-20 22:49:32 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2014-08-20 22:49:32 +0000 |
commit | e8b72c6f4b572e3e26d9ed60de5a0bda51aebd22 (patch) | |
tree | 781ef1c04fad9324d27c9d2e5effccb7d28ec37b /main/bridge_channel.c | |
parent | ab526502e6fbca26fc049d6a983620239f8ddb9c (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/
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@421645 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/bridge_channel.c')
-rw-r--r-- | main/bridge_channel.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/main/bridge_channel.c b/main/bridge_channel.c index f6b466545..5bf85126a 100644 --- a/main/bridge_channel.c +++ b/main/bridge_channel.c @@ -323,6 +323,8 @@ void ast_bridge_channel_restore_formats(struct ast_bridge_channel *bridge_channe ast_assert(bridge_channel->read_format != NULL); ast_assert(bridge_channel->write_format != NULL); + ast_channel_lock(bridge_channel->chan); + /* Restore original formats of the channel as they came in */ if (ast_format_cmp(ast_channel_readformat(bridge_channel->chan), bridge_channel->read_format) == AST_FORMAT_CMP_NOT_EQUAL) { ast_debug(1, "Bridge is returning %p(%s) to read format %s\n", @@ -344,6 +346,8 @@ void ast_bridge_channel_restore_formats(struct ast_bridge_channel *bridge_channe ast_format_get_name(bridge_channel->write_format)); } } + + ast_channel_unlock(bridge_channel->chan); } struct ast_bridge *ast_bridge_channel_merge_inhibit(struct ast_bridge_channel *bridge_channel, int request) @@ -2354,9 +2358,6 @@ int bridge_channel_internal_join(struct ast_bridge_channel *bridge_channel) int res = 0; struct ast_bridge_features *channel_features; - bridge_channel->read_format = ao2_bump(ast_channel_readformat(bridge_channel->chan)); - bridge_channel->write_format = ao2_bump(ast_channel_writeformat(bridge_channel->chan)); - ast_debug(1, "Bridge %s: %p(%s) is joining\n", bridge_channel->bridge->uniqueid, bridge_channel, ast_channel_name(bridge_channel->chan)); @@ -2368,6 +2369,10 @@ int bridge_channel_internal_join(struct ast_bridge_channel *bridge_channel) ast_bridge_lock(bridge_channel->bridge); ast_channel_lock(bridge_channel->chan); + + bridge_channel->read_format = ao2_bump(ast_channel_readformat(bridge_channel->chan)); + bridge_channel->write_format = ao2_bump(ast_channel_writeformat(bridge_channel->chan)); + /* Make sure we're still good to be put into a bridge */ if (ast_channel_internal_bridge(bridge_channel->chan) || ast_test_flag(ast_channel_flags(bridge_channel->chan), AST_FLAG_ZOMBIE)) { |