mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-11 13:30:07 -05:00
proxy: use 0 as the core resource
Make it possible to insert and object with a fixed id for the proxy. Make it possible to choose an id for a resource.
This commit is contained in:
parent
3e472c2dae
commit
ff659ad1a7
3 changed files with 24 additions and 8 deletions
|
|
@ -597,7 +597,7 @@ pinos_context_connect_fd (PinosContext *context,
|
|||
impl);
|
||||
|
||||
context->core_proxy = pinos_proxy_new (context,
|
||||
SPA_ID_INVALID,
|
||||
0,
|
||||
context->uri.core);
|
||||
if (context->core_proxy == NULL)
|
||||
goto no_proxy;
|
||||
|
|
|
|||
|
|
@ -43,14 +43,25 @@ pinos_proxy_new (PinosContext *context,
|
|||
|
||||
pinos_signal_init (&this->destroy_signal);
|
||||
|
||||
if (id == SPA_ID_INVALID) {
|
||||
id = pinos_map_insert_new (&context->objects, this);
|
||||
} else if (!pinos_map_insert_at (&context->objects, id, this))
|
||||
goto in_use;
|
||||
|
||||
this->id = id;
|
||||
|
||||
pinos_protocol_native_client_setup (this);
|
||||
|
||||
this->id = pinos_map_insert_new (&context->objects, this);
|
||||
spa_list_insert (&this->context->proxy_list, &this->link);
|
||||
|
||||
pinos_log_debug ("proxy %p: new %u", this, this->id);
|
||||
|
||||
return this;
|
||||
|
||||
in_use:
|
||||
pinos_log_debug ("proxy %p: id %u in use for context %p", this, id, context);
|
||||
free (impl);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -46,20 +46,25 @@ pinos_resource_new (PinosClient *client,
|
|||
this->type = type;
|
||||
this->object = object;
|
||||
this->destroy = destroy;
|
||||
this->id = id;
|
||||
|
||||
pinos_signal_init (&this->destroy_signal);
|
||||
|
||||
if (!pinos_map_insert_at (&client->objects, this->id, this)) {
|
||||
pinos_log_debug ("resource %p: id %u in use for client %p", this, id, client);
|
||||
free (impl);
|
||||
return NULL;
|
||||
}
|
||||
if (id == SPA_ID_INVALID) {
|
||||
this->id = pinos_map_insert_new (&client->objects, this);
|
||||
} else if (!pinos_map_insert_at (&client->objects, id, this))
|
||||
goto in_use;
|
||||
|
||||
this->id = id;
|
||||
|
||||
pinos_log_debug ("resource %p: new for client %p id %u", this, client, this->id);
|
||||
pinos_signal_emit (&client->resource_added, client, this);
|
||||
|
||||
return this;
|
||||
|
||||
in_use:
|
||||
pinos_log_debug ("resource %p: id %u in use for client %p", this, id, client);
|
||||
free (impl);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue