Fix timespec
This commit is contained in:
parent
568a44a372
commit
e8aa94e4f4
@ -57,7 +57,7 @@ buffer_t *buffer_lock_get(buffer_lock_t *buf_lock, int timeout_ms, int *counter)
|
||||
if(!timeout_ms)
|
||||
timeout_ms = DEFAULT_BUFFER_LOCK_GET_TIMEOUT;
|
||||
|
||||
get_time_us(CLOCK_REALTIME, &timeout, NULL, timeout_ms * 1000LL * 1000LL);
|
||||
get_time_us(CLOCK_REALTIME, &timeout, NULL, timeout_ms * 1000LL);
|
||||
|
||||
pthread_mutex_lock(&buf_lock->lock);
|
||||
if (*counter == buf_lock->counter || !buf_lock->buf) {
|
||||
|
@ -151,7 +151,7 @@ int links_step(link_t *all_links, int timeout)
|
||||
buffer_list_t *buf_list = buf_lists[i];
|
||||
link_t *link = links[i];
|
||||
|
||||
E_LOG_DEBUG(buf_list, "pool event=%s%s%s%s%s%08x streaming=%d enqueued=%d/%d",
|
||||
E_LOG_DEBUG(buf_list, "pool event=%s%s%s%s%s%08x streaming=%d enqueued=%d/%d paused=%d",
|
||||
!fds[i].revents ? "NONE/" : "",
|
||||
fds[i].revents & POLLIN ? "IN/" : "",
|
||||
fds[i].revents & POLLOUT ? "OUT/" : "",
|
||||
@ -160,7 +160,8 @@ int links_step(link_t *all_links, int timeout)
|
||||
fds[i].revents,
|
||||
buf_list->streaming,
|
||||
buffer_list_count_enqueued(buf_list),
|
||||
buf_list->nbufs);
|
||||
buf_list->nbufs,
|
||||
buf_list->device->paused);
|
||||
|
||||
if (fds[i].revents & POLLIN) {
|
||||
if (links_enqueue_from_source(buf_list, link) < 0) {
|
||||
|
@ -86,9 +86,10 @@ uint64_t get_time_us(clockid_t clock, struct timespec *ts, struct timeval *tv, i
|
||||
clock_gettime(clock, &now);
|
||||
|
||||
if (delays_us > 0) {
|
||||
now.tv_nsec += delays_us * 1000LL;
|
||||
now.tv_sec += now.tv_nsec / (1000LL * 1000LL * 1000LL);
|
||||
now.tv_nsec %= 1000LL * 1000LL * 1000LL;
|
||||
#define NS_IN_S (1000LL * 1000LL * 1000LL)
|
||||
int64_t nsec = now.tv_nsec + delays_us * 1000LL;
|
||||
now.tv_nsec = nsec % NS_IN_S;
|
||||
now.tv_sec += nsec / NS_IN_S;
|
||||
}
|
||||
|
||||
if (ts) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user