mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
node: move position calculation to the node
This commit is contained in:
parent
757e2ccc79
commit
c01112d6c2
3 changed files with 13 additions and 11 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@ struct pw_client_node {
|
|||
struct pw_node *node;
|
||||
|
||||
struct pw_resource *resource;
|
||||
|
||||
int status;
|
||||
};
|
||||
|
||||
struct pw_client_node *
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <spa/clock/clock.h>
|
||||
#include <spa/lib/debug.h>
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue