context: ensure the registry exists

Make sure we are watching the registry before we try to enumerate
objects.
When we wait for new object info, resync the pending operations
because they might depend on the info.
This commit is contained in:
Wim Taymans 2020-06-24 14:23:41 +02:00
parent d560499054
commit 5feedbfd42
4 changed files with 44 additions and 13 deletions

View file

@ -255,6 +255,8 @@ pa_operation* pa_context_get_sink_info_list(pa_context *c, pa_sink_info_cb_t cb,
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
pa_context_ensure_registry(c);
o = pa_operation_new(c, NULL, sink_info_list, sizeof(struct sink_data));
d = o->userdata;
d->context = c;
@ -724,6 +726,8 @@ pa_operation* pa_context_get_source_info_list(pa_context *c, pa_source_info_cb_t
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
pa_context_ensure_registry(c);
o = pa_operation_new(c, NULL, source_info_list, sizeof(struct source_data));
d = o->userdata;
d->context = c;
@ -1070,6 +1074,8 @@ pa_operation* pa_context_get_module_info_list(pa_context *c, pa_module_info_cb_t
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
pa_context_ensure_registry(c);
o = pa_operation_new(c, NULL, module_info_list, sizeof(struct module_data));
d = o->userdata;
d->context = c;
@ -1189,6 +1195,8 @@ pa_operation* pa_context_get_client_info_list(pa_context *c, pa_client_info_cb_t
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
pa_context_ensure_registry(c);
o = pa_operation_new(c, NULL, client_info_list, sizeof(struct client_data));
d = o->userdata;
d->context = c;
@ -1393,6 +1401,7 @@ pa_operation* pa_context_get_card_info_list(pa_context *c, pa_card_info_cb_t cb,
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
pw_log_debug("context %p", c);
pa_context_ensure_registry(c);
o = pa_operation_new(c, NULL, card_info_list, sizeof(struct card_data));
d = o->userdata;
@ -1707,6 +1716,7 @@ pa_operation* pa_context_get_sink_input_info_list(pa_context *c, pa_sink_input_i
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
pw_log_debug("context %p", c);
pa_context_ensure_registry(c);
o = pa_operation_new(c, NULL, sink_input_info_list, sizeof(struct sink_input_data));
d = o->userdata;
@ -2015,6 +2025,8 @@ pa_operation* pa_context_get_source_output_info_list(pa_context *c, pa_source_ou
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
pa_context_ensure_registry(c);
o = pa_operation_new(c, NULL, source_output_info_list, sizeof(struct source_output_data));
d = o->userdata;
d->context = c;