mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -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
|
|
@ -58,8 +58,6 @@ struct object {
|
|||
};
|
||||
|
||||
struct impl {
|
||||
struct timespec now;
|
||||
|
||||
struct pw_main_loop *loop;
|
||||
struct pw_context *context;
|
||||
|
||||
|
|
@ -353,8 +351,6 @@ int main(int argc, char *argv[])
|
|||
impl.loop = pw_main_loop_new(NULL);
|
||||
impl.context = pw_context_new(pw_main_loop_get_loop(impl.loop), NULL, 0);
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &impl.now);
|
||||
|
||||
spa_list_init(&impl.device_list);
|
||||
|
||||
impl.core = pw_context_connect(impl.context, NULL, 0);
|
||||
|
|
|
|||
|
|
@ -102,9 +102,7 @@ static void on_process(void *userdata)
|
|||
|
||||
if ((h = spa_buffer_find_meta_data(buf, SPA_META_Header, sizeof(*h)))) {
|
||||
#if 0
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
h->pts = SPA_TIMESPEC_TO_NSEC(&now);
|
||||
h->pts = pw_stream_get_nsec(data->stream);
|
||||
#else
|
||||
h->pts = -1;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -90,9 +90,7 @@ static void on_process(void *userdata)
|
|||
|
||||
if ((h = spa_buffer_find_meta_data(buf, SPA_META_Header, sizeof(*h)))) {
|
||||
#if 0
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
h->pts = SPA_TIMESPEC_TO_NSEC(&now);
|
||||
h->pts = pw_stream_get_nsec(data->stream));
|
||||
#else
|
||||
h->pts = -1;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -164,9 +164,7 @@ static void on_process(void *userdata)
|
|||
|
||||
if ((h = spa_buffer_find_meta_data(buf, SPA_META_Header, sizeof(*h)))) {
|
||||
#if 0
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
h->pts = SPA_TIMESPEC_TO_NSEC(&now);
|
||||
h->pts = pw_stream_get_nsec(data->stream);
|
||||
#else
|
||||
h->pts = -1;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -94,9 +94,7 @@ static void on_process(void *userdata)
|
|||
|
||||
if ((h = spa_buffer_find_meta_data(buf, SPA_META_Header, sizeof(*h)))) {
|
||||
#if 0
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
h->pts = SPA_TIMESPEC_TO_NSEC(&now);
|
||||
h->pts = pw_stream_get_nsec(data->stream);
|
||||
#else
|
||||
h->pts = -1;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -90,9 +90,7 @@ static void on_process(void *userdata)
|
|||
|
||||
if ((h = spa_buffer_find_meta_data(buf, SPA_META_Header, sizeof(*h)))) {
|
||||
#if 0
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
h->pts = SPA_TIMESPEC_TO_NSEC(&now);
|
||||
h->pts = pw_stream_get_nsec(data->stream);
|
||||
#else
|
||||
h->pts = -1;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue