Skip to content

Commit

Permalink
rtp: make struct rtp_source public
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh committed Jan 18, 2024
1 parent 8539c01 commit 177e22d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 33 deletions.
37 changes: 37 additions & 0 deletions include/re_rtp.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,40 @@ static inline int16_t rtp_seq_diff(uint16_t x, uint16_t y)
{
return (int16_t)(y - x);
}


/** NTP Time */
struct ntp_time {
uint32_t hi; /**< Seconds since 0h UTC on 1 January 1900 */
uint32_t lo; /**< Fraction of seconds */
};

/** Per-source state information */
struct rtp_source {
struct sa rtp_peer; /**< IP-address of the RTP source */
uint16_t max_seq; /**< Highest seq. number seen */
uint32_t cycles; /**< Shifted count of seq. number cycles */
uint32_t base_seq; /**< Base seq number */
uint32_t bad_seq; /**< Last 'bad' seq number + 1 */
uint32_t probation; /**< Sequ. packets till source is valid */
uint32_t received; /**< Packets received */
uint32_t expected_prior; /**< Packet expected at last interval */
uint32_t received_prior; /**< Packet received at last interval */
int transit; /**< Relative trans time for prev pkt */
uint32_t jitter; /**< Estimated jitter */
size_t rtp_rx_bytes; /**< Number of RTP bytes received */
uint64_t sr_recv; /**< When the last SR was received */
struct ntp_time last_sr; /**< NTP Timestamp from last SR received */
uint32_t rtp_ts; /**< RTP timestamp */
uint32_t last_rtp_ts; /**< Last RTP timestamp */
uint32_t psent; /**< RTP packets sent */
uint32_t osent; /**< RTP octets sent */
};

/* Source */
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 rtp_source_calc_lost(const struct rtp_source *s);
uint8_t rtp_source_calc_fraction_lost(struct rtp_source *s);
33 changes: 0 additions & 33 deletions src/rtp/rtcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,9 @@ enum {
RTCP_HEADROOM = 4, /**< Headroom in RTCP packets */
};

/** NTP Time */
struct ntp_time {
uint32_t hi; /**< Seconds since 0h UTC on 1 January 1900 */
uint32_t lo; /**< Fraction of seconds */
};

struct hash;

/** Per-source state information */
struct rtp_source {
struct sa rtp_peer; /**< IP-address of the RTP source */
uint16_t max_seq; /**< Highest seq. number seen */
uint32_t cycles; /**< Shifted count of seq. number cycles */
uint32_t base_seq; /**< Base seq number */
uint32_t bad_seq; /**< Last 'bad' seq number + 1 */
uint32_t probation; /**< Sequ. packets till source is valid */
uint32_t received; /**< Packets received */
uint32_t expected_prior; /**< Packet expected at last interval */
uint32_t received_prior; /**< Packet received at last interval */
int transit; /**< Relative trans time for prev pkt */
uint32_t jitter; /**< Estimated jitter */
size_t rtp_rx_bytes; /**< Number of RTP bytes received */
uint64_t sr_recv; /**< When the last SR was received */
struct ntp_time last_sr; /**< NTP Timestamp from last SR received */
uint32_t rtp_ts; /**< RTP timestamp */
uint32_t last_rtp_ts; /**< Last RTP timestamp */
uint32_t psent; /**< RTP packets sent */
uint32_t osent; /**< RTP octets sent */
};

/** RTP Member */
struct rtp_member {
Expand All @@ -64,13 +38,6 @@ struct rtp_member {
struct rtp_member *member_add(struct hash *ht, uint32_t src);
struct rtp_member *member_find(struct hash *ht, uint32_t src);

/* Source */
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 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

0 comments on commit 177e22d

Please sign in to comment.