Improve TIMESPEC_TO_TIME

Add explicit TO_NSEC and TO_USEC versions to make it clearer and to
allow for some optimizations.
This commit is contained in:
Wim Taymans 2018-11-07 09:56:24 +01:00
parent bf6843743a
commit 088ee9f09e
8 changed files with 20 additions and 18 deletions

View file

@ -538,7 +538,7 @@ handle_node(struct impl *impl, uint32_t id, uint32_t parent_id,
if ((str = spa_dict_lookup(props, "node.plugged")) != NULL)
sess->plugged = pw_properties_parse_uint64(str);
else
sess->plugged = SPA_TIMESPEC_TO_TIME(&impl->now);
sess->plugged = SPA_TIMESPEC_TO_NSEC(&impl->now);
spa_list_init(&sess->node_list);
spa_list_append(&impl->session_list, &sess->l);

View file

@ -62,7 +62,7 @@ gst_pipewire_clock_get_internal_time (GstClock * clock)
result = gst_util_uint64_scale_int (t.ticks, GST_SECOND * t.rate.num, t.rate.denom);
clock_gettime(CLOCK_MONOTONIC, &ts);
result += SPA_TIMESPEC_TO_TIME(&ts) - t.now;
result += SPA_TIMESPEC_TO_NSEC(&ts) - t.now;
GST_DEBUG ("%"PRId64", %d/%d %"PRId64" %"PRId64,
t.ticks, t.rate.num, t.rate.denom, t.now, result);

View file

@ -810,7 +810,7 @@ static void node_process(void *data, int status)
if (!node->rt.clock) {
clock_gettime(CLOCK_MONOTONIC, &ts);
q->clock.nsec = SPA_TIMESPEC_TO_TIME(&ts);
q->clock.nsec = SPA_TIMESPEC_TO_NSEC(&ts);
q->clock.position = impl->next_position;
q->clock.delay = 0;
}