Navigation Menu

Skip to content

Commit

Permalink
Modified RTCP code to recognize XR packets
Browse files Browse the repository at this point in the history
  • Loading branch information
lminiero committed Dec 12, 2016
1 parent b21832d commit ac37a9e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
20 changes: 19 additions & 1 deletion rtcp.c
Expand Up @@ -55,6 +55,11 @@ guint32 janus_rtcp_get_sender_ssrc(char *packet, int len) {
rtcp_fb *rtcpfb = (rtcp_fb *)rtcp;
return ntohl(rtcpfb->ssrc);
}
case RTCP_XR: {
/* XR, extended reports (rfc3611) */
rtcp_xr *xr = (rtcp_xr *)rtcp;
return ntohl(xr->ssrc);
}
default:
break;
}
Expand Down Expand Up @@ -343,13 +348,22 @@ int janus_rtcp_fix_ssrc(rtcp_context *ctx, char *packet, int len, int fixssrc, u
}
break;
}
case RTCP_XR: {
/* XR, extended reports (rfc3611) */
rtcp_xr *xr = (rtcp_xr *)rtcp;
if(fixssrc && newssrcl) {
xr->ssrc = htonl(newssrcl);
}
/* TODO Fix report blocks too, once we support them */
break;
}
default:
JANUS_LOG(LOG_ERR, " Unknown RTCP PT %d\n", rtcp->type);
break;
}
/* Is this a compound packet? */
int length = ntohs(rtcp->length);
JANUS_LOG(LOG_HUGE, " RTCP PT length: %d bytes\n", length*4+4);
JANUS_LOG(LOG_HUGE, " RTCP PT %d, length: %d bytes\n", rtcp->type, length*4+4);
if(length == 0) {
//~ JANUS_LOG(LOG_HUGE, " 0-length, end of compound packet\n");
break;
Expand Down Expand Up @@ -401,6 +415,10 @@ char *janus_rtcp_filter(char *packet, int len, int *newlen) {
break;
}
break;
case RTCP_XR:
/* FIXME We generate RR/SR ourselves, so remove XR */
keep = FALSE;
break;
default:
JANUS_LOG(LOG_ERR, "Unknown RTCP PT %d\n", rtcp->type);
/* FIXME Should we allow this to go through instead? */
Expand Down
23 changes: 23 additions & 0 deletions rtcp.h
Expand Up @@ -35,6 +35,7 @@ typedef enum {
RTCP_APP = 204,
RTCP_RTPFB = 205,
RTCP_PSFB = 206,
RTCP_XR = 207,
} rtcp_type;


Expand Down Expand Up @@ -181,6 +182,28 @@ typedef struct rtcp_fb
char fci[1];
} rtcp_fb;

/*! \brief RTCP Extended Report Block (https://tools.ietf.org/html/rfc3611#section-3) */
typedef struct extended_report_block
{
/*! \brief Block type (BT) */
uint8_t blocktype;
/*! \brief Type-specific */
uint8_t typesp;
/*! \brief Block length */
uint16_t length;
/*! \brief Content (variable length) */
char content[1];

} extended_report_block;

/*! \brief RTCP Extended Report (https://tools.ietf.org/html/rfc3611#section-2) */
typedef struct rtcp_xr
{
rtcp_header header;
uint32_t ssrc;
extended_report_block erb[1];
} rtcp_xr;


/*! \brief Internal RTCP state context (for RR/SR) */
typedef struct rtcp_context
Expand Down

0 comments on commit ac37a9e

Please sign in to comment.