Skip to content

Commit

Permalink
rtp: add RE_RTP_PCAP debug helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Feb 8, 2024
1 parent 15cd2b1 commit 27c5703
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/rtp/rtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <re_atomic.h>
#include "rtcp.h"


#define DEBUG_MODULE "rtp"
#define DEBUG_LEVEL 5
#include <re_dbg.h>
Expand Down Expand Up @@ -167,6 +166,10 @@ static void rtcp_recv_handler(const struct sa *src, struct mbuf *mb, void *arg)
struct rtp_sock *rs = arg;
struct rtcp_msg *msg;

#ifdef RE_RTP_PCAP
re_text2pcap_trace("rtcp_recv", "RTCP", true, mb);
#endif

while (0 == rtcp_decode(&msg, mb)) {

/* handle internally first */
Expand Down Expand Up @@ -202,10 +205,15 @@ static void udp_recv_handler(const struct sa *src, struct mbuf *mb, void *arg)
}
}

#ifdef RE_RTP_PCAP
re_text2pcap_trace("rtp_udp_recv", "RTP", true, mb);
#endif

err = rtp_decode(rs, mb, &hdr);
if (err)
return;


if (rs->rtcp)
rtcp_sess_rx_rtp(rs->rtcp, &hdr, mbuf_get_left(mb), src);

Expand Down Expand Up @@ -525,6 +533,10 @@ int rtp_send(struct rtp_sock *rs, const struct sa *dst, bool ext,

mb->pos = pos;

#ifdef RE_RTP_PCAP
re_text2pcap_trace("rtp_send", "RTP", false, mb);
#endif

return udp_send(rs->sock_rtp, dst, mb);
}

Expand Down Expand Up @@ -569,6 +581,10 @@ int rtp_resend(struct rtp_sock *rs, uint16_t seq, const struct sa *dst,

mb->pos = pos;

#ifdef RE_RTP_PCAP
re_text2pcap_trace("rtp_resend", "RTP", false, mb);
#endif

return udp_send(rs->sock_rtp, dst, mb);
}

Expand Down Expand Up @@ -704,6 +720,9 @@ int rtcp_send(struct rtp_sock *rs, struct mbuf *mb)
if (!sock || !sa_isset(&rs->rtcp_peer, SA_ALL))
return EINVAL;

#ifdef RE_RTP_PCAP
re_text2pcap_trace("rtcp_send", "RTCP", false, mb);
#endif
return udp_send(sock, &rs->rtcp_peer, mb);
}

Expand Down

0 comments on commit 27c5703

Please sign in to comment.