Skip to content

Commit

Permalink
add rtp_ prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh committed Jan 18, 2024
1 parent 177e22d commit dd21159
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions include/re_rtp.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ static inline int16_t rtp_seq_diff(uint16_t x, uint16_t y)


/** NTP Time */
struct ntp_time {
struct rtp_ntp_time {
uint32_t hi; /**< Seconds since 0h UTC on 1 January 1900 */
uint32_t lo; /**< Fraction of seconds */
};
Expand All @@ -334,7 +334,7 @@ struct rtp_source {
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 */
struct rtp_ntp_time last_sr;/**< NTP Timestamp from last SR recvd */
uint32_t rtp_ts; /**< RTP timestamp */
uint32_t last_rtp_ts; /**< Last RTP timestamp */
uint32_t psent; /**< RTP packets sent */
Expand Down
8 changes: 4 additions & 4 deletions src/rtp/ntp.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @param ntp NTP time to convert to (output)
* @param tv Unix time to convert from (input)
*/
void unix2ntp(struct ntp_time *ntp, const struct timeval *tv)
void unix2ntp(struct rtp_ntp_time *ntp, const struct timeval *tv)
{
ntp->hi = (uint32_t)(tv->tv_sec + UNIX_NTP_OFFSET);
ntp->lo = (uint32_t)((double)tv->tv_usec*(double)(1LL<<32)*1.0e-6);
Expand All @@ -45,7 +45,7 @@ void unix2ntp(struct ntp_time *ntp, const struct timeval *tv)
* @param tv Unix time to convert to (output)
* @param ntp NTP time to convert from (input)
*/
void ntp2unix(struct timeval *tv, const struct ntp_time *ntp)
void ntp2unix(struct timeval *tv, const struct rtp_ntp_time *ntp)
{
tv->tv_sec = ntp->hi - UNIX_NTP_OFFSET;
tv->tv_usec = (uint32_t)(1.0e6 * (double) ntp->lo / (1LL<<32));
Expand All @@ -58,7 +58,7 @@ void ntp2unix(struct timeval *tv, const struct ntp_time *ntp)
* @param ntp NTP time
* @param jfs_rt Microseconds since UNIX epoch. Optional, may be NULL.
*/
void ntp_time_get(struct ntp_time *ntp, uint64_t *jfs_rt)
void ntp_time_get(struct rtp_ntp_time *ntp, uint64_t *jfs_rt)
{
#if defined(WIN32)
/* timeval::tv_sec on Windows is 32-bit, and it doesn't
Expand Down Expand Up @@ -88,7 +88,7 @@ void ntp_time_get(struct ntp_time *ntp, uint64_t *jfs_rt)
*
* @return NTP time in compact representation
*/
uint32_t ntp_compact(const struct ntp_time *ntp)
uint32_t ntp_compact(const struct rtp_ntp_time *ntp)
{
return ntp ? ((ntp->hi & 0xffff) << 16 | (ntp->lo >> 16)) : 0;
}
Expand Down
8 changes: 4 additions & 4 deletions src/rtp/rtcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ int rtcp_psfb_decode(struct mbuf *mb, struct rtcp_msg *msg);

/** NTP Time */
struct timeval;
void unix2ntp(struct ntp_time *ntp, const struct timeval *tv);
void ntp2unix(struct timeval *tv, const struct ntp_time *ntp);
void ntp_time_get(struct ntp_time *ntp, uint64_t* jfs_rt);
uint32_t ntp_compact(const struct ntp_time *ntp);
void unix2ntp(struct rtp_ntp_time *ntp, const struct timeval *tv);
void ntp2unix(struct timeval *tv, const struct rtp_ntp_time *ntp);
void ntp_time_get(struct rtp_ntp_time *ntp, uint64_t* jfs_rt);
uint32_t ntp_compact(const struct rtp_ntp_time *ntp);
uint64_t ntp_compact2us(uint32_t ntpc);

/* RTP Socket */
Expand Down
6 changes: 3 additions & 3 deletions src/rtp/sess.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static struct rtp_member *get_member(struct rtcp_sess *sess, uint32_t src)
*/
void rtcp_calc_rtt(uint32_t *rtt, uint32_t lsr, uint32_t dlsr)
{
struct ntp_time ntp_time;
struct rtp_ntp_time ntp_time;
uint64_t a_us, lsr_us, dlsr_us;

ntp_time_get(&ntp_time, NULL);
Expand Down Expand Up @@ -371,7 +371,7 @@ int rtcp_enable(struct rtcp_sess *sess, bool enabled, const char *cname)


/** Calculate LSR (middle 32 bits out of 64 in the NTP timestamp) */
static uint32_t calc_lsr(const struct ntp_time *last_sr)
static uint32_t calc_lsr(const struct rtp_ntp_time *last_sr)
{
return last_sr->hi ? ntp_compact(last_sr) : 0;
}
Expand Down Expand Up @@ -436,7 +436,7 @@ static int mk_sr(struct rtcp_sess *sess, struct mbuf *mb)
mtx_unlock(sess->lock);

if (txstat.jfs_rt_ref) {
struct ntp_time ntp;
struct rtp_ntp_time ntp;
uint64_t jfs_rt, dur;
uint32_t rtp_ts;

Expand Down

0 comments on commit dd21159

Please sign in to comment.