From 273a1082d2fb7e9504b04708bab618caebdbbb04 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 22 Mar 2022 09:23:03 +0100 Subject: [PATCH] tv: fixed wrong abbrev (ms) for microseconds --- src/rtp/rtp.c | 4 ++-- src/tv.c | 8 ++++---- src/tv.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/rtp/rtp.c b/src/rtp/rtp.c index 824619a65..66896ec3b 100644 --- a/src/rtp/rtp.c +++ b/src/rtp/rtp.c @@ -3667,8 +3667,8 @@ void rtp_send_bye(struct rtp *session) /* Schedule us to block in udp_select() until the time we are due to send our */ /* BYE packet. If we receive an RTCP packet from another participant before */ /* then, we are woken up to handle it... */ - long long ms = (session->next_rtcp_send_time - curr_time) / NS_IN_MS; - lldiv_t d = lldiv(ms, MS_IN_SEC); + long long us = (session->next_rtcp_send_time - curr_time) / NS_IN_US; + lldiv_t d = lldiv(us, US_IN_SEC); struct timeval timeout = { .tv_sec = d.quot, .tv_usec = d.rem }; udp_fd_zero(); udp_fd_set(session->rtcp_socket); diff --git a/src/tv.c b/src/tv.c index 082b852e9..b5ab1fed4 100644 --- a/src/tv.c +++ b/src/tv.c @@ -111,16 +111,16 @@ void tv_add_usec(struct timeval *ts, long long offset) { long long new_usec = ts->tv_usec + offset; - if (new_usec < MS_IN_SEC) { + if (new_usec < US_IN_SEC) { ts->tv_usec = new_usec; return; } - if (new_usec < 2 * MS_IN_SEC) { + if (new_usec < 2 * US_IN_SEC) { ts->tv_sec++; - ts->tv_usec = new_usec - MS_IN_SEC; + ts->tv_usec = new_usec - US_IN_SEC; return; } - lldiv_t d = lldiv(new_usec, MS_IN_SEC); + lldiv_t d = lldiv(new_usec, US_IN_SEC); ts->tv_sec += d.quot; ts->tv_usec = d.rem; } diff --git a/src/tv.h b/src/tv.h index 03596baa6..cc1f50053 100644 --- a/src/tv.h +++ b/src/tv.h @@ -68,9 +68,9 @@ uint32_t get_std_audio_local_mediatime(double samples, int rate); uint32_t get_std_video_local_mediatime(void); typedef long long time_ns_t; -#define MS_IN_SEC 1000000LL +#define US_IN_SEC 1000000LL #define NS_IN_SEC 1000000000LL -#define NS_IN_MS (NS_IN_SEC/MS_IN_SEC) +#define NS_IN_US (NS_IN_SEC/US_IN_SEC) static inline time_ns_t get_time_in_ns() { struct timespec ts = { 0, 0 }; timespec_get(&ts, TIME_UTC);