Skip to content

Commit

Permalink
rtp: add rtp_source_ prefix to RTP source api
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh committed Jan 16, 2024
1 parent e066d85 commit 84880ff
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions src/rtp/rtcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ struct rtp_member *member_add(struct hash *ht, uint32_t src);
struct rtp_member *member_find(struct hash *ht, uint32_t src);

/* Source */
void source_init_seq(struct rtp_source *s, uint16_t seq);
int source_update_seq(struct rtp_source *s, uint16_t seq);
void source_calc_jitter(struct rtp_source *s, uint32_t rtp_ts,
void rtp_source_init_seq(struct rtp_source *s, uint16_t seq);
int rtp_source_update_seq(struct rtp_source *s, uint16_t seq);
void rtp_source_calc_jitter(struct rtp_source *s, uint32_t rtp_ts,
uint32_t arrival);
int source_calc_lost(const struct rtp_source *s);
uint8_t source_calc_fraction_lost(struct rtp_source *s);
int rtp_source_calc_lost(const struct rtp_source *s);
uint8_t rtp_source_calc_fraction_lost(struct rtp_source *s);

/* RR (Reception report) */
int rtcp_rr_alloc(struct rtcp_rr **rrp, size_t count);
Expand Down
12 changes: 6 additions & 6 deletions src/rtp/sess.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,8 @@ static bool sender_apply_handler(struct le *le, void *arg)

/* Initialise the members */
rr.ssrc = mbr->src;
rr.fraction = source_calc_fraction_lost(s);
rr.lost = source_calc_lost(s);
rr.fraction = rtp_source_calc_fraction_lost(s);
rr.lost = rtp_source_calc_lost(s);
rr.last_seq = s->cycles | s->max_seq;
rr.jitter = s->jitter >> 4;
rr.lsr = calc_lsr(&s->last_sr);
Expand Down Expand Up @@ -596,13 +596,13 @@ void rtcp_sess_rx_rtp(struct rtcp_sess *sess, struct rtp_header *hdr,
}

/* first packet - init sequence number */
source_init_seq(mbr->s, hdr->seq);
rtp_source_init_seq(mbr->s, hdr->seq);
/* probation not used */
sa_cpy(&mbr->s->rtp_peer, peer);
++sess->senderc;
}

if (!source_update_seq(mbr->s, hdr->seq)) {
if (!rtp_source_update_seq(mbr->s, hdr->seq)) {
DEBUG_WARNING("rtp_update_seq() returned 0\n");
}

Expand All @@ -616,7 +616,7 @@ void rtcp_sess_rx_rtp(struct rtcp_sess *sess, struct rtp_header *hdr,
* https://www.cs.columbia.edu/~hgs/rtp/faq.html#jitter).
*/
if (hdr->ts != mbr->s->last_rtp_ts)
source_calc_jitter(mbr->s, hdr->ts,
rtp_source_calc_jitter(mbr->s, hdr->ts,
(uint32_t)hdr->ts_arrive);
}

Expand Down Expand Up @@ -665,7 +665,7 @@ int rtcp_stats(struct rtp_sock *rs, uint32_t ssrc, struct rtcp_stats *stats)
}

stats->rx.sent = mbr->s->received;
stats->rx.lost = source_calc_lost(mbr->s);
stats->rx.lost = rtp_source_calc_lost(mbr->s);
stats->rx.jit = sess->srate_rx ?
1000000 * (mbr->s->jitter>>4) / sess->srate_rx : 0;

Expand Down
14 changes: 7 additions & 7 deletions src/rtp/source.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ enum {
};


void source_init_seq(struct rtp_source *s, uint16_t seq)
void rtp_source_init_seq(struct rtp_source *s, uint16_t seq)
{
if (!s)
return;
Expand All @@ -39,7 +39,7 @@ void source_init_seq(struct rtp_source *s, uint16_t seq)
/*
* See RFC 3550 - A.1 RTP Data Header Validity Checks
*/
int source_update_seq(struct rtp_source *s, uint16_t seq)
int rtp_source_update_seq(struct rtp_source *s, uint16_t seq)
{
uint16_t udelta = seq - s->max_seq;
const int MAX_DROPOUT = 3000;
Expand All @@ -57,7 +57,7 @@ int source_update_seq(struct rtp_source *s, uint16_t seq)
s->probation--;
s->max_seq = seq;
if (s->probation == 0) {
source_init_seq(s, seq);
rtp_source_init_seq(s, seq);
s->received++;
return 1;
}
Expand Down Expand Up @@ -88,7 +88,7 @@ int source_update_seq(struct rtp_source *s, uint16_t seq)
* restarted without telling us so just re-sync
* (i.e., pretend this was the first packet).
*/
source_init_seq(s, seq);
rtp_source_init_seq(s, seq);
}
else {
s->bad_seq = (seq + 1) & (RTP_SEQ_MOD-1);
Expand All @@ -111,7 +111,7 @@ int source_update_seq(struct rtp_source *s, uint16_t seq)
* rtp_ts: the timestamp from the incoming RTP packet
* arrival: the current time in the same units.
*/
void source_calc_jitter(struct rtp_source *s, uint32_t rtp_ts,
void rtp_source_calc_jitter(struct rtp_source *s, uint32_t rtp_ts,
uint32_t arrival)
{
const int transit = arrival - rtp_ts;
Expand All @@ -132,7 +132,7 @@ void source_calc_jitter(struct rtp_source *s, uint32_t rtp_ts,


/* A.3 */
int source_calc_lost(const struct rtp_source *s)
int rtp_source_calc_lost(const struct rtp_source *s)
{
int extended_max = s->cycles + s->max_seq;
int expected = extended_max - s->base_seq + 1;
Expand All @@ -151,7 +151,7 @@ int source_calc_lost(const struct rtp_source *s)


/* A.3 */
uint8_t source_calc_fraction_lost(struct rtp_source *s)
uint8_t rtp_source_calc_fraction_lost(struct rtp_source *s)
{
int extended_max = s->cycles + s->max_seq;
int expected = extended_max - s->base_seq + 1;
Expand Down

0 comments on commit 84880ff

Please sign in to comment.