[Asterisk-code-review] res/res rtp asterisk: ensure marker bit is correctly set on ... (asterisk[13])

Torrey Searle asteriskteam at digium.com
Wed May 9 08:34:50 CDT 2018


Torrey Searle has uploaded this change for review. ( https://gerrit.asterisk.org/8948


Change subject: res/res_rtp_asterisk: ensure marker bit is correctly set on ssrc change
......................................................................

res/res_rtp_asterisk: ensure marker bit is correctly set on ssrc change

ASTERISK-27845 #close

Certain race conditions between changing bridge types and DTMF can
cause the current FLAG_NEED_MARKER_BIT to send the marker bit before
the actual first packet of native bridging.

This logic keeps track of the ssrc the bridge is currently sending
and will correctly ensure the marker bit is set if SSRC as changed
from the previous sent packet

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



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/48/8948/1

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 04e9fa5..350b293 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -38,6 +38,7 @@
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
+
 #include <sys/time.h>
 #include <signal.h>
 #include <fcntl.h>
@@ -5128,6 +5129,7 @@
 	int res = 0, payload = 0, bridged_payload = 0, mark;
 	RAII_VAR(struct ast_rtp_payload_type *, payload_type, NULL, ao2_cleanup);
 	int reconstruct = ntohl(rtpheader[0]);
+	unsigned int ssrc = ntohl(rtpheader[2]);
 	struct ast_sockaddr remote_address = { {0,} };
 	int ice;
 	unsigned int timestamp = ntohl(rtpheader[1]);
@@ -5234,6 +5236,17 @@
 		ast_clear_flag(bridged, FLAG_NEED_MARKER_BIT);
 	}
 
+	/*
+	 * Check for this condition as increasing the lock duration we find marker bit may need setting
+	 * for a changed SSRC
+	 */
+	if(!mark && ssrc != bridged->ssrc) {
+		bridged->ssrc = ssrc;
+		mark = 1;
+		ast_debug(1, "Setting Marker bit for ssrc change\n");
+		ast_clear_flag(bridged, FLAG_NEED_MARKER_BIT);
+	}
+
 	/* Reconstruct part of the packet */
 	reconstruct &= 0xFF80FFFF;
 	reconstruct |= (bridged_payload << 16);

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: I01858bd0235f1e5e629e20de71b422b16f55759b
Gerrit-Change-Number: 8948
Gerrit-PatchSet: 1
Gerrit-Owner: Torrey Searle <tsearle at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180509/0664e258/attachment.html>


More information about the asterisk-code-review mailing list