Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtp: add rtp_is_rtcp_packet() #405

Merged
merged 1 commit into from
Jun 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}