[asterisk-commits] res rtp asterisk: Allow remote SSRC to change on an RTP inst... (asterisk[15])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 31 16:52:24 CDT 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/6328 )

Change subject: res_rtp_asterisk: Allow remote SSRC to change on an RTP instance.
......................................................................

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
---
M res/res_rtp_asterisk.c
1 file changed, 26 insertions(+), 1 deletion(-)

Approvals:
  Matthew Fredrickson: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 0f4f6ab..ab80384 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -6173,10 +6173,35 @@
 {
 	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;
 }
 

-- 
To view, visit https://gerrit.asterisk.org/6328
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: I6e3703974f236bc024c5dbe9bd43adae0c6fb490
Gerrit-Change-Number: 6328
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20170831/47b48aca/attachment-0001.html>


More information about the asterisk-commits mailing list