mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
impl-node: run the remote driver node logic remotely
Don't signal the pipewire daemon to run the driver. We can transfer the complete driver state to the client and run everything there.
This commit is contained in:
parent
a46076b207
commit
b8fe832188
4 changed files with 39 additions and 85 deletions
|
|
@ -1080,8 +1080,6 @@ static void node_on_data_fd_events(struct spa_source *source)
|
|||
if (SPA_LIKELY(source->rmask & SPA_IO_IN)) {
|
||||
uint64_t cmd;
|
||||
struct pw_impl_node *node = impl->this.node;
|
||||
struct pw_node_activation *a = node->rt.activation;
|
||||
int status;
|
||||
|
||||
if (SPA_UNLIKELY(spa_system_eventfd_read(impl->data_system,
|
||||
impl->data_source.fd, &cmd) < 0))
|
||||
|
|
@ -1090,9 +1088,15 @@ static void node_on_data_fd_events(struct spa_source *source)
|
|||
pw_log_info("(%s-%u) client missed %"PRIu64" wakeups",
|
||||
node->name, node->info.id, cmd - 1);
|
||||
|
||||
status = a->state[0].status;
|
||||
spa_log_trace_fp(impl->log, "%p: got ready %d", impl, status);
|
||||
spa_node_call_ready(&impl->callbacks, status);
|
||||
if (impl->resource && impl->resource->version < 5) {
|
||||
struct pw_node_activation *a = node->rt.activation;
|
||||
int status = a->state[0].status;
|
||||
spa_log_trace_fp(impl->log, "%p: got ready %d", impl, status);
|
||||
spa_node_call_ready(&impl->callbacks, status);
|
||||
} else {
|
||||
spa_log_trace_fp(impl->log, "%p: got complete", impl);
|
||||
pw_context_driver_emit_complete(node->context, node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1202,16 +1206,14 @@ static void node_peer_added(void *data, struct pw_impl_node *peer)
|
|||
struct impl *impl = data;
|
||||
struct pw_memblock *m;
|
||||
|
||||
if (peer == impl->this.node)
|
||||
return;
|
||||
|
||||
m = pw_mempool_import_block(impl->client->pool, peer->activation);
|
||||
if (m == NULL) {
|
||||
pw_log_debug("%p: can't ensure mem: %m", impl);
|
||||
pw_log_warn("%p: can't ensure mem: %m", impl);
|
||||
return;
|
||||
}
|
||||
pw_log_debug("%p: peer %p id:%u added mem_id:%u", &impl->this, peer,
|
||||
peer->info.id, m->id);
|
||||
|
||||
pw_log_debug("%p: peer %p/%p id:%u added mem_id:%u", impl, peer,
|
||||
impl->this.node, peer->info.id, m->id);
|
||||
|
||||
if (impl->resource == NULL)
|
||||
return;
|
||||
|
|
@ -1229,17 +1231,15 @@ static void node_peer_removed(void *data, struct pw_impl_node *peer)
|
|||
struct impl *impl = data;
|
||||
struct pw_memblock *m;
|
||||
|
||||
if (peer == impl->this.node)
|
||||
return;
|
||||
|
||||
m = pw_mempool_find_fd(impl->client->pool, peer->activation->fd);
|
||||
if (m == NULL) {
|
||||
pw_log_warn("%p: unknown peer %p fd:%d", impl, peer,
|
||||
peer->source.fd);
|
||||
return;
|
||||
}
|
||||
pw_log_debug("%p: peer %p %u removed", impl, peer,
|
||||
peer->info.id);
|
||||
|
||||
pw_log_debug("%p: peer %p/%p id:%u removed mem_id:%u", impl, peer,
|
||||
impl->this.node, peer->info.id, m->id);
|
||||
|
||||
if (impl->resource != NULL) {
|
||||
pw_client_node_resource_set_activation(impl->resource,
|
||||
|
|
@ -1249,7 +1249,6 @@ static void node_peer_removed(void *data, struct pw_impl_node *peer)
|
|||
0,
|
||||
0);
|
||||
}
|
||||
|
||||
pw_memblock_unref(m);
|
||||
}
|
||||
|
||||
|
|
@ -1356,7 +1355,7 @@ static void node_free(void *data)
|
|||
pw_resource_destroy(impl->resource);
|
||||
|
||||
if (impl->activation)
|
||||
pw_memblock_unref(impl->activation);
|
||||
pw_memblock_free(impl->activation);
|
||||
|
||||
pw_array_for_each(area, &impl->io_areas) {
|
||||
if (*area)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue