Skip to content

Commit

Permalink
rtp: add rtp_is_rtcp_packet() (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh authored Jun 19, 2022
1 parent 8d4f83d commit 66c4e43
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/re_rtp.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ int rtcp_msg_print(struct re_printf *pf, const struct rtcp_msg *msg);
int rtcp_sdes_encode(struct mbuf *mb, uint32_t src, uint32_t itemc, ...);
const char *rtcp_type_name(enum rtcp_type type);
const char *rtcp_sdes_name(enum rtcp_sdes_type sdes);
bool rtp_is_rtcp_packet(const struct mbuf *mb);


static inline bool rtp_pt_is_rtcp(uint8_t pt)
Expand Down
13 changes: 13 additions & 0 deletions src/rtp/rtcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,16 @@ int rtcp_msg_print(struct re_printf *pf, const struct rtcp_msg *msg)

return err;
}


bool rtp_is_rtcp_packet(const struct mbuf *mb)
{
uint8_t pt;

if (mbuf_get_left(mb) < 2)
return false;

pt = mbuf_buf(mb)[1] & 0x7f;

return rtp_pt_is_rtcp(pt);
}

0 comments on commit 66c4e43

Please sign in to comment.