client-node: use bound id from the proxy

Remove the obsolete node_id from the transport. We get this info
now from the proxy.
This commit is contained in:
Wim Taymans 2019-11-28 13:24:09 +01:00
parent fcd4ae3334
commit c9a54112e4
5 changed files with 21 additions and 16 deletions

View file

@ -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) {

View file

@ -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,

View file

@ -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,

View file

@ -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),

View file

@ -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)