mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-20 13:40:13 +00:00
tv: fixed wrong abbrev (ms) for microseconds
This commit is contained in:
@@ -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);
|
||||
|
||||
8
src/tv.c
8
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;
|
||||
}
|
||||
|
||||
4
src/tv.h
4
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);
|
||||
|
||||
Reference in New Issue
Block a user