tv: fixed wrong abbrev (ms) for microseconds

This commit is contained in:
Martin Pulec
2022-03-22 09:23:03 +01:00
parent 7bace13948
commit 273a1082d2
3 changed files with 8 additions and 8 deletions

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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);