Skip to content

Commit

Permalink
test/rtcp: add rtcp_send_gnack test
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Sep 4, 2024
1 parent 5a9a142 commit 415bbf6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/rtcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ struct agent {
struct sa laddr_rtcp;
unsigned rtp_count;
unsigned psfb_count;
unsigned rtpfb_count;
unsigned gnack_count;
};


Expand All @@ -222,6 +224,12 @@ static void rtcp_recv_handler(const struct sa *src, struct rtcp_msg *msg,

switch (msg->hdr.pt) {

case RTCP_RTPFB:
if (msg->r.fb.fci.gnackv->pid == 42)
++ag->gnack_count;
++ag->rtpfb_count;
break;

case RTCP_PSFB:
++ag->psfb_count;
re_cancel();
Expand Down Expand Up @@ -266,6 +274,9 @@ static int test_rtcp_loop_base(bool mux)
rtcp_start(a.rtp_sock, "cname", &b.laddr_rtcp);
rtcp_start(b.rtp_sock, "cname", &a.laddr_rtcp);

err = rtcp_send_gnack(a.rtp_sock, rtp_sess_ssrc(b.rtp_sock), 42, 0);
TEST_ERR(err);

err = rtcp_send_pli(a.rtp_sock, rtp_sess_ssrc(b.rtp_sock));
TEST_ERR(err);

Expand All @@ -276,6 +287,8 @@ static int test_rtcp_loop_base(bool mux)
ASSERT_EQ(0, a.psfb_count);
ASSERT_EQ(0, b.rtp_count);
ASSERT_EQ(1, b.psfb_count);
ASSERT_EQ(1, b.rtpfb_count);
ASSERT_EQ(1, b.gnack_count);

out:
mem_deref(b.rtp_sock);
Expand Down

0 comments on commit 415bbf6

Please sign in to comment.