diff options
author | Joshua Colp <jcolp@digium.com> | 2017-08-30 12:28:58 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2017-08-30 09:18:40 -0500 |
commit | 6c2c74492d808ea697702ad549b323b98b47141e (patch) | |
tree | d1caa8592a228dbb1768c0c4294f1a64527b19c3 /res | |
parent | d05ab9e91a05725fb7cde40d217497b224a106d0 (diff) |
res_rtp_asterisk: Allow remote SSRC to change on an RTP instance.
When SDP renegotiation occurs it is possible for an RTP
instance to be reused for a new stream, resulting in the remote
SSRC changing if it is part of a bundle group. This change
allows this and updates its mapping in the current bundle
group.
ASTERISK-27231
Change-Id: I6e3703974f236bc024c5dbe9bd43adae0c6fb490
Diffstat (limited to 'res')
-rw-r--r-- | res/res_rtp_asterisk.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 0f4f6abda..ab8038422 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -6173,10 +6173,35 @@ static void ast_rtp_set_remote_ssrc(struct ast_rtp_instance *instance, unsigned { struct ast_rtp *rtp = ast_rtp_instance_get_data(instance); - if (rtp->themssrc) { + if (rtp->themssrc == ssrc) { return; } + /* If this is bundled we need to update the SSRC mapping */ + if (rtp->bundled) { + struct ast_rtp *bundled_rtp; + int index; + + ao2_unlock(instance); + + /* The child lock can't be held while accessing the parent */ + ao2_lock(rtp->bundled); + bundled_rtp = ast_rtp_instance_get_data(rtp->bundled); + + for (index = 0; index < AST_VECTOR_SIZE(&bundled_rtp->ssrc_mapping); ++index) { + struct rtp_ssrc_mapping *mapping = AST_VECTOR_GET_ADDR(&bundled_rtp->ssrc_mapping, index); + + if (mapping->ssrc == rtp->themssrc) { + mapping->ssrc = ssrc; + break; + } + } + + ao2_unlock(rtp->bundled); + + ao2_lock(instance); + } + rtp->themssrc = ssrc; } |