diff options
author | Joshua Colp <jcolp@digium.com> | 2017-08-31 16:50:50 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-08-31 16:50:50 -0500 |
commit | be8639f81b7c5b25f7c01b97303176aa7eb8646e (patch) | |
tree | 70285aeebf140f55d3b1a1631042f9828d2ee19f | |
parent | 8cfff60cee4a2984079453ae1b1ec10bf75be796 (diff) | |
parent | 5ba82cedc6675e1f5f0c3e1f2e9bdda3b486730a (diff) |
Merge "res_rtp_asterisk: Allow remote SSRC to change on an RTP instance."
-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 d976ed250..091533e19 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -6186,10 +6186,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; } |