diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c index f5490c12e..7b421e495 100644 --- a/src/modules/module-client-node/client-node.c +++ b/src/modules/module-client-node/client-node.c @@ -152,7 +152,6 @@ struct impl { int other_fds[2]; struct pw_client_node_position *position; - uint32_t next_position; }; /** \endcond */ @@ -899,11 +898,6 @@ static int impl_node_process(struct spa_node *node) struct pw_driver_quantum *q, *rq; uint64_t cmd = 1; - if (this->impl->this.status != SPA_ID_INVALID) { - spa_log_trace(this->log, "%p: return %d", this, this->impl->this.status); - return impl->this.status; - } - spa_log_trace(this->log, "%p: send process %p", this, impl->this.node->driver_node); q = impl->this.node->driver_node->rt.quantum; @@ -911,8 +905,6 @@ static int impl_node_process(struct spa_node *node) struct pw_driver_quantum); *rq = *q; - rq->position = impl->next_position; - impl->next_position += rq->size; if (write(this->writefd, &cmd, 8) != 8) spa_log_warn(this->log, "node %p: error %s", this, strerror(errno)); @@ -1350,7 +1342,6 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource, return NULL; this = &impl->this; - this->status = SPA_ID_INVALID; impl->core = core; impl->t = pw_core_get_type(core); diff --git a/src/modules/module-client-node/client-node.h b/src/modules/module-client-node/client-node.h index 7a1053bbb..b802de4a0 100644 --- a/src/modules/module-client-node/client-node.h +++ b/src/modules/module-client-node/client-node.h @@ -35,8 +35,6 @@ struct pw_client_node { struct pw_node *node; struct pw_resource *resource; - - int status; }; struct pw_client_node * diff --git a/src/pipewire/node.c b/src/pipewire/node.c index 9b8ce5c9b..465123d50 100644 --- a/src/pipewire/node.c +++ b/src/pipewire/node.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -58,6 +59,7 @@ struct impl { struct pw_node_activation node_activation; struct pw_driver_quantum quantum; + uint32_t next_position; }; struct resource_data { @@ -647,6 +649,7 @@ static void node_event(void *data, struct spa_event *event) static void node_process(void *data, int status) { struct pw_node *node = data; + struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this); pw_log_trace("node %p: process driver:%d exported:%d", node, node->driver, node->exported); @@ -655,6 +658,16 @@ static void node_process(void *data, int status) if (node->driver) { if (!node->exported) { if (node->rt.driver->state->pending == 0 || !node->remote) { + struct timespec ts; + struct pw_driver_quantum *q; + q = node->rt.quantum; + + q->position = impl->next_position; + impl->next_position += q->size; + + clock_gettime(CLOCK_MONOTONIC, &ts); + q->nsec = ts.tv_sec * SPA_NSEC_PER_SEC + ts.tv_nsec; + spa_graph_run(node->rt.driver); } else