[Asterisk-code-review] res rtp asterisk: Allow remote SSRC to change on an RTP inst... (asterisk[master])

Joshua Colp asteriskteam at digium.com
Thu Aug 31 16:50:50 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/6330 )

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
  Joshua Colp: 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/6330
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I6e3703974f236bc024c5dbe9bd43adae0c6fb490
Gerrit-Change-Number: 6330
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
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-code-review/attachments/20170831/d7e85740/attachment-0001.html>


More information about the asterisk-code-review mailing list