[Asterisk-code-review] res rtp asterisk: enable rtcp & QOS stats on native bridge (asterisk[13])

Torrey Searle asteriskteam at digium.com
Wed Jul 26 09:20:41 CDT 2017


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


Change subject: res_rtp_asterisk: enable rtcp & QOS stats on native bridge
......................................................................

res_rtp_asterisk: enable rtcp & QOS stats on native bridge

Asterisk wasn't generating or forwarding RTCP packets when native
bridge was activated.  Also the stats weren't available via
CHANNEL(qos). Now the RTCP stats are always calculated.

ASTERISK-27158 #close

Change-Id: I46fb8f61c95e836b9d2dda6054b0cf205c16037b
---
M res/res_rtp_asterisk.c
1 file changed, 17 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/00/6100/1

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index e521756..de6c29b 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -4822,9 +4822,6 @@
 		return -1;
 	}
 
-	rtp->rxcount++;
-	rtp->rxoctetcount += (len - hdrlen);
-
 	/* If the payload coming in is not one of the negotiated ones then send it to the core, this will cause formats to change and the bridge to break */
 	if (ast_rtp_codecs_find_payload_code(ast_rtp_instance_get_codecs(instance1), bridged_payload) == -1) {
 		ast_debug(1, "Unsupported payload type received \n");
@@ -5060,13 +5057,6 @@
 		}
 	}
 
-	/* If we are directly bridged to another instance send the audio directly out */
-	instance1 = ast_rtp_instance_get_bridged(instance);
-	if (instance1
-		&& !bridge_p2p_rtp_write(instance, instance1, rtpheader, res, hdrlen)) {
-		return &ast_null_frame;
-	}
-
 	/* If the version is not what we expected by this point then just drop the packet */
 	if (version != 2) {
 		return &ast_null_frame;
@@ -5171,6 +5161,23 @@
 		rtp->themssrc = ntohl(rtpheader[2]); /* Record their SSRC to put in future RR */
 	}
 
+
+	/* This needs to be after RTCP calculations to get more RTCP data */
+	/* If we are directly bridged to another instance send the audio directly out */
+	instance1 = ast_rtp_instance_get_bridged(instance);
+	if (instance1 &&
+		&& !bridge_p2p_rtp_write(instance, instance1, rtpheader, res, hdrlen)) {
+		struct timeval rxtime;
+		struct ast_frame *f;
+		/* update jitter statistics */
+		calc_rxstamp(&rxtime, rtp, timestamp, mark);
+		/* if we do p2p bridge, free the frames SSRC CHANGE frames we won't return */
+		while ((f = AST_LIST_REMOVE_HEAD(&frames, frame_list)) != NULL) {
+			ast_frfree(f);
+		}
+		return &ast_null_frame;
+	}
+
 	if (rtp_debug_test_addr(&addr)) {
 		ast_verbose("Got  RTP packet from    %s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6d)\n",
 			    ast_sockaddr_stringify(&addr),

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: I46fb8f61c95e836b9d2dda6054b0cf205c16037b
Gerrit-Change-Number: 6100
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/20170726/ab73feac/attachment.html>


More information about the asterisk-code-review mailing list