Skip to content
This repository has been archived by the owner on Feb 18, 2023. It is now read-only.

Commit

Permalink
rtcp: use udp_send() (#132)
Browse files Browse the repository at this point in the history
* rtcp: use udp_send()

* rtcp: add workaround for OOM test
  • Loading branch information
alfredh authored Sep 29, 2022
1 parent ad8ea9b commit 5bf765a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/rtcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ struct fixture {
};


static int send_rtp_packet(const struct sa *dst, uint16_t seq, uint32_t ssrc)
static int send_rtp_packet(struct udp_sock *us, const struct sa *dst,
uint16_t seq, uint32_t ssrc)
{
struct rtp_header hdr;
struct mbuf *mb = mbuf_alloc(256);
Expand All @@ -53,7 +54,7 @@ static int send_rtp_packet(const struct sa *dst, uint16_t seq, uint32_t ssrc)
mbuf_fill(mb, 160, 0x00);
mb->pos = 0;

err = udp_send_anon(dst, mb);
err = udp_send(us, dst, mb);
if (err)
goto out;

Expand Down Expand Up @@ -132,7 +133,8 @@ static int test_loss(const uint16_t *seqv, size_t seqc,
for (i=0; i<seqc; i++) {
uint16_t seq = seqv[i];

err = send_rtp_packet(&f->rtp_addr, seq, ssrc);
err = send_rtp_packet(rtp_sock(f->rtp), &f->rtp_addr,
seq, ssrc);
if (err)
goto out;
}
Expand All @@ -141,7 +143,11 @@ static int test_loss(const uint16_t *seqv, size_t seqc,
TEST_ERR(err);

err = rtcp_stats(f->rtp, ssrc, &stats);
TEST_ERR(err);
if (err) {
if (err == ENOENT)
err = ENOMEM;
goto out;
}

/* in OOM-test, detect if member/sender was not allocated */
if (stats.rx.sent == 0 &&
Expand Down

0 comments on commit 5bf765a

Please sign in to comment.