summaryrefslogtreecommitdiff
path: root/res/res_pjsip_sdp_rtp.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 /res/res_pjsip_sdp_rtp.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 'res/res_pjsip_sdp_rtp.c')
-rw-r--r--res/res_pjsip_sdp_rtp.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index ca018c86b..938d5ea92 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -265,15 +265,20 @@ static int set_caps(struct ast_sip_session *session, struct ast_sip_session_medi
if (session->channel) {
struct ast_format *fmt;
+ ast_channel_lock(session->channel);
ast_format_cap_append_from_cap(caps, ast_channel_nativeformats(session->channel), AST_MEDIA_TYPE_UNKNOWN);
ast_format_cap_remove_by_type(caps, media_type);
fmt = ast_format_cap_get_format(joint, 0);
ast_format_cap_append(caps, fmt, 0);
- /* Apply the new formats to the channel, potentially changing read/write formats while doing so */
+ /*
+ * Apply the new formats to the channel, potentially changing
+ * raw read/write formats and translation path while doing so.
+ */
ast_channel_nativeformats_set(session->channel, caps);
- ast_channel_set_rawwriteformat(session->channel, fmt);
- ast_channel_set_rawreadformat(session->channel, fmt);
+ ast_set_read_format(session->channel, ast_channel_readformat(session->channel));
+ ast_set_write_format(session->channel, ast_channel_writeformat(session->channel));
+ ast_channel_unlock(session->channel);
ao2_ref(fmt, -1);
}