context: fix context_id, use the client bound id

This commit is contained in:
Wim Taymans 2020-06-30 20:23:23 +02:00
parent 813e2d22a6
commit f30a8f6895
2 changed files with 13 additions and 1 deletions

View file

@ -1674,7 +1674,17 @@ pa_operation *pa_context_proplist_remove(pa_context *c, const char *const keys[]
SPA_EXPORT
uint32_t pa_context_get_index(PA_CONST pa_context *c)
{
return c->client_index;
struct pw_client *client;
pa_assert(c);
spa_assert(c->refcount >= 1);
PA_CHECK_VALIDITY_RETURN_ANY(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE, PA_INVALID_INDEX);
client = pw_core_get_client(c->core);
if (client == NULL)
return PA_INVALID_INDEX;
return pw_proxy_get_bound_id((struct pw_proxy*)client);
}
SPA_EXPORT

View file

@ -1282,6 +1282,8 @@ pa_operation* pa_context_get_server_info(pa_context *c, pa_server_info_cb_t cb,
pa_assert(c->refcount >= 1);
pa_assert(cb);
pa_context_ensure_registry(c);
o = pa_operation_new(c, NULL, server_info, sizeof(struct server_data));
d = o->userdata;
d->context = c;