[Asterisk-code-review] res_rtp_asterisk: Add packet subtype during RTCP debug when relevant (asterisk[master])

Kevin Harwell asteriskteam at digium.com
Wed Feb 24 16:10:12 CST 2021


Kevin Harwell has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/15518 )


Change subject: res_rtp_asterisk: Add packet subtype during RTCP debug when relevant
......................................................................

res_rtp_asterisk: Add packet subtype during RTCP debug when relevant

For some RTCP packet types the report count is actually the packet's subtype.
This was not being reflected in the packet debug output.

This patch makes it so for some RTCP packet types a "Packet Subtype" is
now output in the debug replacing the "Reception reports" (i.e count).

Change-Id: Id4f4b77bb37077a4c4f039abd6a069287bfefcb8
---
M res/res_rtp_asterisk.c
1 file changed, 28 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/18/15518/1

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index ad9cb7d..403c397 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -5926,6 +5926,26 @@
 	return str;
 }
 
+static const char *rtcp_payload_subtype2str(unsigned int pt, unsigned int subtype)
+{
+	switch (pt) {
+	case AST_RTP_RTCP_RTPFB:
+		if (subtype == AST_RTP_RTCP_FMT_NACK) {
+			return "NACK";
+		}
+		break;
+	case RTCP_PT_PSFB:
+		if (subtype == AST_RTP_RTCP_FMT_REMB) {
+			return "REMB";
+		}
+		break;
+	default:
+		break;
+	}
+
+	return NULL;
+}
+
 /*! \pre instance is locked */
 static int ast_rtp_rtcp_handle_nack(struct ast_rtp_instance *instance, unsigned int *nackdata, unsigned int position,
 	unsigned int length)
@@ -6255,10 +6275,16 @@
 		}
 
 		if (rtcp_debug_test_addr(addr)) {
+			const char *subtype = rtcp_payload_subtype2str(pt, rc);
+
 			ast_verbose("\n");
 			ast_verbose("RTCP from %s\n", ast_sockaddr_stringify(addr));
-			ast_verbose("PT: %u(%s)\n", pt, rtcp_payload_type2str(pt));
-			ast_verbose("Reception reports: %u\n", rc);
+			ast_verbose("PT: %u (%s)\n", pt, rtcp_payload_type2str(pt));
+			if (subtype) {
+				ast_verbose("Packet Subtype: %u (%s)\n", rc, subtype);
+			} else {
+				ast_verbose("Reception reports: %u\n", rc);
+			}
 			ast_verbose("SSRC of sender: %u\n", ssrc);
 		}
 

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Id4f4b77bb37077a4c4f039abd6a069287bfefcb8
Gerrit-Change-Number: 15518
Gerrit-PatchSet: 1
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210224/af06d6e6/attachment.html>


More information about the asterisk-code-review mailing list