mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
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:
parent
fcd4ae3334
commit
c9a54112e4
5 changed files with 21 additions and 16 deletions
|
|
@ -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 = {
|
static const struct pw_proxy_events proxy_events = {
|
||||||
PW_VERSION_PROXY_EVENTS,
|
PW_VERSION_PROXY_EVENTS,
|
||||||
.destroy = on_node_proxy_destroy,
|
.destroy = on_node_proxy_destroy,
|
||||||
|
.bound = on_node_proxy_bound,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct link *find_activation(struct pw_array *links, uint32_t node_id)
|
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,
|
static int client_node_transport(void *object,
|
||||||
uint32_t node_id,
|
|
||||||
int readfd, int writefd,
|
int readfd, int writefd,
|
||||||
uint32_t mem_id, uint32_t offset, uint32_t size)
|
uint32_t mem_id, uint32_t offset, uint32_t size)
|
||||||
{
|
{
|
||||||
|
|
@ -1102,8 +1108,6 @@ static int client_node_transport(void *object,
|
||||||
|
|
||||||
clean_transport(c);
|
clean_transport(c);
|
||||||
|
|
||||||
c->node_id = node_id;
|
|
||||||
|
|
||||||
c->mem = pw_mempool_map_id(c->remote->pool, mem_id,
|
c->mem = pw_mempool_map_id(c->remote->pool, mem_id,
|
||||||
PW_MEMMAP_FLAG_READWRITE, offset, size, NULL);
|
PW_MEMMAP_FLAG_READWRITE, offset, size, NULL);
|
||||||
if (c->mem == NULL) {
|
if (c->mem == NULL) {
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,6 @@ struct pw_client_node_proxy_events {
|
||||||
*
|
*
|
||||||
* The transport area is used to signal the client and the server.
|
* 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 readfd fd for signal data can be read
|
||||||
* \param writefd fd for signal data can be written
|
* \param writefd fd for signal data can be written
|
||||||
* \param mem_id id for activation memory
|
* \param mem_id id for activation memory
|
||||||
|
|
@ -76,7 +75,6 @@ struct pw_client_node_proxy_events {
|
||||||
* \param size size of activation memory
|
* \param size size of activation memory
|
||||||
*/
|
*/
|
||||||
int (*transport) (void *object,
|
int (*transport) (void *object,
|
||||||
uint32_t node_id,
|
|
||||||
int readfd,
|
int readfd,
|
||||||
int writefd,
|
int writefd,
|
||||||
uint32_t mem_id,
|
uint32_t mem_id,
|
||||||
|
|
|
||||||
|
|
@ -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_resource_bound_id(this->resource, node_id);
|
||||||
|
|
||||||
pw_client_node_resource_transport(this->resource,
|
pw_client_node_resource_transport(this->resource,
|
||||||
node_id,
|
|
||||||
impl->other_fds[0],
|
impl->other_fds[0],
|
||||||
impl->other_fds[1],
|
impl->other_fds[1],
|
||||||
m->id,
|
m->id,
|
||||||
|
|
|
||||||
|
|
@ -311,13 +311,12 @@ static int client_node_demarshal_transport(void *object, const struct pw_protoco
|
||||||
{
|
{
|
||||||
struct pw_proxy *proxy = object;
|
struct pw_proxy *proxy = object;
|
||||||
struct spa_pod_parser prs;
|
struct spa_pod_parser prs;
|
||||||
uint32_t node_id, mem_id, offset, sz;
|
uint32_t mem_id, offset, sz;
|
||||||
int64_t ridx, widx;
|
int64_t ridx, widx;
|
||||||
int readfd, writefd;
|
int readfd, writefd;
|
||||||
|
|
||||||
spa_pod_parser_init(&prs, msg->data, msg->size);
|
spa_pod_parser_init(&prs, msg->data, msg->size);
|
||||||
if (spa_pod_parser_get_struct(&prs,
|
if (spa_pod_parser_get_struct(&prs,
|
||||||
SPA_POD_Int(&node_id),
|
|
||||||
SPA_POD_Fd(&ridx),
|
SPA_POD_Fd(&ridx),
|
||||||
SPA_POD_Fd(&widx),
|
SPA_POD_Fd(&widx),
|
||||||
SPA_POD_Int(&mem_id),
|
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)
|
if (readfd < 0 || writefd < 0)
|
||||||
return -EINVAL;
|
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,
|
readfd, writefd, mem_id,
|
||||||
offset, sz);
|
offset, sz);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -591,7 +590,7 @@ static int client_node_demarshal_set_io(void *object, const struct pw_protocol_n
|
||||||
return 0;
|
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)
|
uint32_t mem_id, uint32_t offset, uint32_t size)
|
||||||
{
|
{
|
||||||
struct pw_protocol_native_message *msg;
|
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);
|
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_TRANSPORT, &msg);
|
||||||
|
|
||||||
spa_pod_builder_add_struct(b,
|
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, readfd)),
|
||||||
SPA_POD_Fd(pw_protocol_native_add_resource_fd(resource, writefd)),
|
SPA_POD_Fd(pw_protocol_native_add_resource_fd(resource, writefd)),
|
||||||
SPA_POD_Int(mem_id),
|
SPA_POD_Int(mem_id),
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,6 @@ static void clean_transport(struct node_data *data)
|
||||||
|
|
||||||
pw_memmap_free(data->activation);
|
pw_memmap_free(data->activation);
|
||||||
close(data->rtwritefd);
|
close(data->rtwritefd);
|
||||||
data->remote_id = SPA_ID_INVALID;
|
|
||||||
data->have_transport = false;
|
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)
|
int readfd, int writefd, uint32_t mem_id, uint32_t offset, uint32_t size)
|
||||||
{
|
{
|
||||||
struct pw_proxy *proxy = object;
|
struct pw_proxy *proxy = object;
|
||||||
|
|
@ -249,11 +248,10 @@ static int client_node_transport(void *object, uint32_t node_id,
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
data->remote_id = node_id;
|
|
||||||
data->node->rt.activation = data->activation->ptr;
|
data->node->rt.activation = data->activation->ptr;
|
||||||
|
|
||||||
pw_log_debug("remote-node %p: fds:%d %d node:%u activation:%p",
|
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;
|
data->rtwritefd = writefd;
|
||||||
close(data->node->source.fd);
|
close(data->node->source.fd);
|
||||||
|
|
@ -922,7 +920,7 @@ static void clean_node(struct node_data *d)
|
||||||
{
|
{
|
||||||
struct mix *mix, *tmp;
|
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)
|
spa_list_for_each_safe(mix, tmp, &d->mix[SPA_DIRECTION_INPUT], link)
|
||||||
clear_mix(d, mix);
|
clear_mix(d, mix);
|
||||||
spa_list_for_each_safe(mix, tmp, &d->mix[SPA_DIRECTION_OUTPUT], link)
|
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);
|
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 = {
|
static const struct pw_proxy_events client_node_proxy_events = {
|
||||||
PW_VERSION_PROXY_EVENTS,
|
PW_VERSION_PROXY_EVENTS,
|
||||||
.destroy = client_node_proxy_destroy,
|
.destroy = client_node_proxy_destroy,
|
||||||
|
.bound = client_node_proxy_bound,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void proxy_destroy(void *_data)
|
static void proxy_destroy(void *_data)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue