mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-02-11 04:27:56 -05:00
stream: add pw_stream_get_nsec() to get current time
Make a method to get the current time to compare agains the pw_time-now field. This is currently CLOCK_MONOTONIC but make this into a method so that we can more easily change it later.
This commit is contained in:
parent
81d8ecf0dc
commit
f4e391dd41
16 changed files with 53 additions and 58 deletions
|
|
@ -608,13 +608,6 @@ static int create_filters(struct impl *impl)
|
|||
}
|
||||
|
||||
|
||||
static inline uint64_t get_time_ns(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return SPA_TIMESPEC_TO_NSEC(&ts);
|
||||
}
|
||||
|
||||
static void
|
||||
on_data_io(void *data, int fd, uint32_t mask)
|
||||
{
|
||||
|
|
@ -634,7 +627,7 @@ on_data_io(void *data, int fd, uint32_t mask)
|
|||
if (nframes == 0)
|
||||
return;
|
||||
|
||||
nsec = get_time_ns();
|
||||
nsec = pw_filter_get_nsec(impl->source.filter);
|
||||
|
||||
if (!impl->done) {
|
||||
impl->pw_xrun++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue