[Asterisk-code-review] res/res_rtp_asterisk: generate new SSRC on native bridge end (asterisk[18])

George Joseph asteriskteam at digium.com
Mon Mar 8 08:13:55 CST 2021


George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/15569 )

Change subject: res/res_rtp_asterisk: generate new SSRC on native bridge end
......................................................................

res/res_rtp_asterisk: generate new SSRC on native bridge end

For RTCP to work, we update the ssrc to be the one corresponding to
the native bridge while active.  However when the bridge ends we
should generate a new SSRC as the sequence numbers will not continue
from the native bridge left off.

ASTERISK-29300 #close

Change-Id: I23334b6934d2bf6490bda4bbf6414d96b8d17d10
---
M res/res_rtp_asterisk.c
1 file changed, 14 insertions(+), 0 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index a962d70..21eff54 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -362,6 +362,8 @@
 	struct ast_frame f;
 	unsigned char rawdata[8192 + AST_FRIENDLY_OFFSET];
 	unsigned int ssrc;		/*!< Synchronization source, RFC 3550, page 10. */
+	unsigned int ssrc_orig;		/*!< SSRC used before native bridge activated */
+	unsigned char ssrc_saved;	/*!< indicates if ssrc_orig has a value */
 	char cname[AST_UUID_STR_LEN]; /*!< Our local CNAME */
 	unsigned int themssrc;		/*!< Their SSRC */
 	unsigned int themssrc_valid;	/*!< True if their SSRC is available. */
@@ -8530,6 +8532,18 @@
 		ast_smoother_free(rtp->smoother);
 		rtp->smoother = NULL;
 	}
+
+	/* We must use a new SSRC when local bridge ends */
+	if (!instance1) {
+		rtp->ssrc = rtp->ssrc_orig;
+		rtp->ssrc_orig = 0;
+		rtp->ssrc_saved = 0;
+	} else if (!rtp->ssrc_saved) {
+		/* In case ast_rtp_local_bridge is called multiple times, only save the ssrc from before local bridge began */
+		rtp->ssrc_orig = rtp->ssrc;
+		rtp->ssrc_saved = 1;
+	}
+
 	ao2_unlock(instance0);
 
 	return 0;

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15569
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I23334b6934d2bf6490bda4bbf6414d96b8d17d10
Gerrit-Change-Number: 15569
Gerrit-PatchSet: 2
Gerrit-Owner: Torrey Searle <tsearle at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210308/37fc39e9/attachment-0001.html>


More information about the asterisk-code-review mailing list