diff --git a/hw/buffer_lock.c b/hw/buffer_lock.c index b5e9479..7533fec 100644 --- a/hw/buffer_lock.c +++ b/hw/buffer_lock.c @@ -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) { diff --git a/hw/links.c b/hw/links.c index 231fe8c..0f76d53 100644 --- a/hw/links.c +++ b/hw/links.c @@ -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) { diff --git a/hw/v4l2.c b/hw/v4l2.c index b50dabe..a1ec14c 100644 --- a/hw/v4l2.c +++ b/hw/v4l2.c @@ -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) {