diff --git a/src/rtp/rtcp.h b/src/rtp/rtcp.h index d85404866..a935c659a 100644 --- a/src/rtp/rtcp.h +++ b/src/rtp/rtcp.h @@ -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); diff --git a/src/rtp/sess.c b/src/rtp/sess.c index 78a0bb54a..d634da08f 100644 --- a/src/rtp/sess.c +++ b/src/rtp/sess.c @@ -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); @@ -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"); } @@ -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); } @@ -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; diff --git a/src/rtp/source.c b/src/rtp/source.c index c6a324229..21c2268be 100644 --- a/src/rtp/source.c +++ b/src/rtp/source.c @@ -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; @@ -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; @@ -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; } @@ -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); @@ -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; @@ -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; @@ -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;