mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
client-node: set parent id and owner
Make sure we set the right parent id and owner for the client node and client-stream Move the remote id in the proxy object and use it in the stream to get the node id.
This commit is contained in:
parent
fe03ec8bde
commit
79a3b594f9
11 changed files with 39 additions and 19 deletions
|
|
@ -44,7 +44,9 @@ struct factory_data {
|
|||
struct pw_factory *this;
|
||||
struct pw_properties *properties;
|
||||
|
||||
struct pw_module *module;
|
||||
struct spa_hook module_listener;
|
||||
|
||||
uint32_t type_client_node;
|
||||
};
|
||||
|
||||
|
|
@ -55,8 +57,10 @@ static void *create_object(void *_data,
|
|||
struct pw_properties *properties,
|
||||
uint32_t new_id)
|
||||
{
|
||||
struct factory_data *d = _data;
|
||||
void *result;
|
||||
struct pw_resource *node_resource;
|
||||
struct pw_global *parent;
|
||||
|
||||
if (resource == NULL)
|
||||
goto no_resource;
|
||||
|
|
@ -66,11 +70,13 @@ static void *create_object(void *_data,
|
|||
if (node_resource == NULL)
|
||||
goto no_mem;
|
||||
|
||||
parent = pw_module_get_global(d->module);
|
||||
|
||||
if (properties && pw_properties_get(properties, "node.stream") != NULL) {
|
||||
result = pw_client_stream_new(node_resource, properties);
|
||||
result = pw_client_stream_new(node_resource, parent, properties);
|
||||
}
|
||||
else {
|
||||
result = pw_client_node_new(node_resource, properties, true);
|
||||
result = pw_client_node_new(node_resource, parent, properties, true);
|
||||
}
|
||||
if (result == NULL)
|
||||
goto no_mem;
|
||||
|
|
@ -134,6 +140,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie
|
|||
|
||||
data = pw_factory_get_user_data(factory);
|
||||
data->this = factory;
|
||||
data->module = module;
|
||||
data->properties = properties;
|
||||
data->type_client_node = type_client_node;
|
||||
|
||||
|
|
|
|||
|
|
@ -1156,6 +1156,7 @@ void pw_client_node_registered(struct pw_client_node *this, uint32_t node_id)
|
|||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
|
||||
|
||||
pw_log_debug("client-node %p: %d", this, node_id);
|
||||
pw_client_node_resource_transport(this->resource,
|
||||
node_id,
|
||||
impl->other_fds[0],
|
||||
|
|
@ -1326,6 +1327,7 @@ static const struct pw_resource_events resource_events = {
|
|||
* \memberof pw_client_node
|
||||
*/
|
||||
struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
||||
struct pw_global *parent,
|
||||
struct pw_properties *properties,
|
||||
bool do_register)
|
||||
{
|
||||
|
|
@ -1360,9 +1362,10 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
|||
name = "client-node";
|
||||
|
||||
this->resource = resource;
|
||||
this->parent = parent;
|
||||
this->node = pw_spa_node_new(core,
|
||||
pw_resource_get_client(this->resource),
|
||||
NULL,
|
||||
parent,
|
||||
name,
|
||||
PW_SPA_NODE_FLAG_ASYNC |
|
||||
(do_register ? 0 : PW_SPA_NODE_FLAG_NO_REGISTER),
|
||||
|
|
|
|||
|
|
@ -35,10 +35,12 @@ struct pw_client_node {
|
|||
struct pw_node *node;
|
||||
|
||||
struct pw_resource *resource;
|
||||
struct pw_global *parent;
|
||||
};
|
||||
|
||||
struct pw_client_node *
|
||||
pw_client_node_new(struct pw_resource *resource,
|
||||
struct pw_global *parent,
|
||||
struct pw_properties *properties,
|
||||
bool do_register);
|
||||
|
||||
|
|
|
|||
|
|
@ -633,6 +633,7 @@ impl_node_port_set_io(struct spa_node *node,
|
|||
impl = this->impl;
|
||||
t = impl->t;
|
||||
|
||||
spa_log_debug(this->log, "set io %d %d %d", id, direction, impl->direction);
|
||||
if (direction != impl->direction)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
@ -1028,6 +1029,7 @@ static const struct pw_node_events node_events = {
|
|||
* \memberof pw_client_stream
|
||||
*/
|
||||
struct pw_client_stream *pw_client_stream_new(struct pw_resource *resource,
|
||||
struct pw_global *parent,
|
||||
struct pw_properties *properties)
|
||||
{
|
||||
struct impl *impl;
|
||||
|
|
@ -1053,6 +1055,7 @@ struct pw_client_stream *pw_client_stream_new(struct pw_resource *resource,
|
|||
|
||||
impl->client_node = pw_client_node_new(
|
||||
resource,
|
||||
parent,
|
||||
pw_properties_copy(properties),
|
||||
false);
|
||||
if (impl->client_node == NULL)
|
||||
|
|
@ -1068,7 +1071,7 @@ struct pw_client_stream *pw_client_stream_new(struct pw_resource *resource,
|
|||
|
||||
this->node = pw_spa_node_new(core,
|
||||
client,
|
||||
NULL,
|
||||
parent,
|
||||
name,
|
||||
PW_SPA_NODE_FLAG_ASYNC,
|
||||
&impl->node.node,
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ struct pw_client_stream {
|
|||
|
||||
struct pw_client_stream *
|
||||
pw_client_stream_new(struct pw_resource *resource,
|
||||
struct pw_properties *properties);
|
||||
struct pw_global *parent,
|
||||
struct pw_properties *properties);
|
||||
|
||||
void
|
||||
pw_client_stream_destroy(struct pw_client_stream *stream);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue