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
This commit is contained in:
Kevin Harwell 2021-02-24 16:05:32 -06:00 committed by George Joseph
parent 7acb6e2194
commit 11fa7f6e0c
1 changed files with 28 additions and 2 deletions

View 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);
}