]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_rtp_asterisk: Add packet subtype during RTCP debug when relevant
authorKevin Harwell <kharwell@sangoma.com>
Wed, 24 Feb 2021 22:05:32 +0000 (16:05 -0600)
committerGeorge Joseph <gjoseph@digium.com>
Fri, 26 Feb 2021 14:06:11 +0000 (08:06 -0600)
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

res/res_rtp_asterisk.c

index ad9cb7d6cc0b3fd860952ce99f29b9358992decd..403c397f6c48fc07f0a510c256a33f0d010bf374 100644 (file)
@@ -5926,6 +5926,26 @@ static const char *rtcp_payload_type2str(unsigned int pt)
        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 @@ static struct ast_frame *ast_rtcp_interpret(struct ast_rtp_instance *instance, s
                }
 
                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);
                }