summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-11-28 13:24:09 +0100
committerWim Taymans <wtaymans@redhat.com>2019-11-28 13:31:23 +0100
commiteef1be79c2c7c23c6c80bb9b23b4ce885406d34b (patch)
tree0418cbb27247faeb25dcbd088ad3b4c9959cd1d0
parentcf7454d4e8b838984fb07be6fee627f03a389115 (diff)
client-node: use bound id from the proxybound_id
Remove the obsolete node_id from the transport. We get this info now from the proxy.
-rw-r--r--pipewire-jack/src/pipewire-jack.c10
-rw-r--r--src/extensions/client-node.h2
-rw-r--r--src/modules/module-client-node/client-node.c1
-rw-r--r--src/modules/module-client-node/protocol-native.c8
-rw-r--r--src/modules/module-client-node/remote-node.c16
5 files changed, 21 insertions, 16 deletions
diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c
index 1ebd9799..23e00f18 100644
--- a/pipewire-jack/src/pipewire-jack.c
+++ b/pipewire-jack/src/pipewire-jack.c
@@ -606,9 +606,16 @@ static void on_node_proxy_destroy(void *data)
}
+static void on_node_proxy_bound(void *data, uint32_t global_id)
+{
+ struct client *client = data;
+ client->node_id = global_id;
+}
+
static const struct pw_proxy_events proxy_events = {
PW_VERSION_PROXY_EVENTS,
.destroy = on_node_proxy_destroy,
+ .bound = on_node_proxy_bound,
};
static struct link *find_activation(struct pw_array *links, uint32_t node_id)
@@ -1094,7 +1101,6 @@ static void clean_transport(struct client *c)
}
static int client_node_transport(void *object,
- uint32_t node_id,
int readfd, int writefd,
uint32_t mem_id, uint32_t offset, uint32_t size)
{
@@ -1102,8 +1108,6 @@ static int client_node_transport(void *object,
clean_transport(c);
- c->node_id = node_id;
-
c->mem = pw_mempool_map_id(c->remote->pool, mem_id,
PW_MEMMAP_FLAG_READWRITE, offset, size, NULL);
if (c->mem == NULL) {
diff --git a/src/extensions/client-node.h b/src/extensions/client-node.h
index a8c60e34..73cb2e5a 100644
--- a/src/extensions/client-node.h
+++ b/src/extensions/client-node.h
@@ -68,7 +68,6 @@ struct pw_client_node_proxy_events {
*
* The transport area is used to signal the client and the server.
*
- * \param node_id the node id created for this client node
* \param readfd fd for signal data can be read
* \param writefd fd for signal data can be written
* \param mem_id id for activation memory
@@ -76,7 +75,6 @@ struct pw_client_node_proxy_events {
* \param size size of activation memory
*/
int (*transport) (void *object,
- uint32_t node_id,
int readfd,
int writefd,
uint32_t mem_id,
diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c
index 04ec2907..2a5f75d2 100644
--- a/src/modules/module-client-node/client-node.c
+++ b/src/modules/module-client-node/client-node.c
@@ -1231,7 +1231,6 @@ void pw_client_node_registered(struct pw_client_node *this, struct pw_global *gl
pw_resource_bound_id(this->resource, node_id);
pw_client_node_resource_transport(this->resource,
- node_id,
impl->other_fds[0],
impl->other_fds[1],
m->id,
diff --git a/src/modules/module-client-node/protocol-native.c b/src/modules/module-client-node/protocol-native.c
index 5da9b411..bbc5f639 100644
--- a/src/modules/module-client-node/protocol-native.c
+++ b/src/modules/module-client-node/protocol-native.c
@@ -311,13 +311,12 @@ static int client_node_demarshal_transport(void *object, const struct pw_protoco
{
struct pw_proxy *proxy = object;
struct spa_pod_parser prs;
- uint32_t node_id, mem_id, offset, sz;
+ uint32_t mem_id, offset, sz;
int64_t ridx, widx;
int readfd, writefd;
spa_pod_parser_init(&prs, msg->data, msg->size);
if (spa_pod_parser_get_struct(&prs,
- SPA_POD_Int(&node_id),
SPA_POD_Fd(&ridx),
SPA_POD_Fd(&widx),
SPA_POD_Int(&mem_id),
@@ -331,7 +330,7 @@ static int client_node_demarshal_transport(void *object, const struct pw_protoco
if (readfd < 0 || writefd < 0)
return -EINVAL;
- pw_proxy_notify(proxy, struct pw_client_node_proxy_events, transport, 0, node_id,
+ pw_proxy_notify(proxy, struct pw_client_node_proxy_events, transport, 0,
readfd, writefd, mem_id,
offset, sz);
return 0;
@@ -591,7 +590,7 @@ static int client_node_demarshal_set_io(void *object, const struct pw_protocol_n
return 0;
}
-static int client_node_marshal_transport(void *object, uint32_t node_id, int readfd, int writefd,
+static int client_node_marshal_transport(void *object, int readfd, int writefd,
uint32_t mem_id, uint32_t offset, uint32_t size)
{
struct pw_protocol_native_message *msg;
@@ -601,7 +600,6 @@ static int client_node_marshal_transport(void *object, uint32_t node_id, int rea
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_TRANSPORT, &msg);
spa_pod_builder_add_struct(b,
- SPA_POD_Int(node_id),
SPA_POD_Fd(pw_protocol_native_add_resource_fd(resource, readfd)),
SPA_POD_Fd(pw_protocol_native_add_resource_fd(resource, writefd)),
SPA_POD_Int(mem_id),
diff --git a/src/modules/module-client-node/remote-node.c b/src/modules/module-client-node/remote-node.c
index 2d82df63..a5ffcba4 100644
--- a/src/modules/module-client-node/remote-node.c
+++ b/src/modules/module-client-node/remote-node.c
@@ -138,7 +138,6 @@ static void clean_transport(struct node_data *data)
pw_memmap_free(data->activation);
close(data->rtwritefd);
- data->remote_id = SPA_ID_INVALID;
data->have_transport = false;
}
@@ -234,7 +233,7 @@ static struct mix *ensure_mix(struct node_data *data,
}
-static int client_node_transport(void *object, uint32_t node_id,
+static int client_node_transport(void *object,
int readfd, int writefd, uint32_t mem_id, uint32_t offset, uint32_t size)
{
struct pw_proxy *proxy = object;
@@ -249,11 +248,10 @@ static int client_node_transport(void *object, uint32_t node_id,
return -errno;
}
- data->remote_id = node_id;
data->node->rt.activation = data->activation->ptr;
pw_log_debug("remote-node %p: fds:%d %d node:%u activation:%p",
- proxy, readfd, writefd, node_id, data->activation->ptr);
+ proxy, readfd, writefd, data->remote_id, data->activation->ptr);
data->rtwritefd = writefd;
close(data->node->source.fd);
@@ -922,7 +920,7 @@ static void clean_node(struct node_data *d)
{
struct mix *mix, *tmp;
- if (d->remote_id != SPA_ID_INVALID) {
+ if (d->have_transport) {
spa_list_for_each_safe(mix, tmp, &d->mix[SPA_DIRECTION_INPUT], link)
clear_mix(d, mix);
spa_list_for_each_safe(mix, tmp, &d->mix[SPA_DIRECTION_OUTPUT], link)
@@ -1019,9 +1017,17 @@ static void client_node_proxy_destroy(void *_data)
pw_node_destroy(data->node);
}
+static void client_node_proxy_bound(void *_data, uint32_t global_id)
+{
+ struct node_data *data = _data;
+ pw_log_debug("%p: bound %u", data, global_id);
+ data->remote_id = global_id;
+}
+
static const struct pw_proxy_events client_node_proxy_events = {
PW_VERSION_PROXY_EVENTS,
.destroy = client_node_proxy_destroy,
+ .bound = client_node_proxy_bound,
};
static void proxy_destroy(void *_data)