mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-09 07:28:41 +02:00
pw-object-mixin: watch for proxy errors during enum_params
This commit is contained in:
parent
0b558eca74
commit
7ff2bbc0eb
1 changed files with 21 additions and 4 deletions
|
|
@ -116,13 +116,13 @@ enum_params_done (WpCore * core, GAsyncResult * res, gpointer data)
|
|||
/* finish the sync task */
|
||||
wp_core_sync_finish (core, res, &error);
|
||||
|
||||
/* return if the task was cancelled */
|
||||
if (g_task_get_completed (task))
|
||||
return;
|
||||
|
||||
/* remove the task from the stored list; ref is held by the g_autoptr */
|
||||
d->enum_params_tasks = g_list_remove (d->enum_params_tasks, task);
|
||||
|
||||
/* return if the task was cancelled or received an error */
|
||||
if (g_task_get_completed (task))
|
||||
return;
|
||||
|
||||
wp_debug_object (instance, "got %u params, %s, task " WP_OBJECT_FORMAT,
|
||||
params->len, error ? "with error" : "ok", WP_OBJECT_ARGS (task));
|
||||
|
||||
|
|
@ -134,6 +134,19 @@ enum_params_done (WpCore * core, GAsyncResult * res, gpointer data)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
enum_params_error (WpProxy * proxy, int seq, int res, const gchar *msg,
|
||||
GTask * task)
|
||||
{
|
||||
gint t_seq = GPOINTER_TO_INT (g_task_get_source_tag (G_TASK (task)));
|
||||
|
||||
if (SPA_RESULT_ASYNC_SEQ (t_seq) == SPA_RESULT_ASYNC_SEQ (seq) &&
|
||||
!g_task_get_completed (task)) {
|
||||
g_task_return_new_error (task, WP_DOMAIN_LIBRARY,
|
||||
WP_LIBRARY_ERROR_OPERATION_FAILED, "%s", msg);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wp_pw_object_mixin_enum_params_unchecked (gpointer obj,
|
||||
guint32 id, WpSpaPod *filter, GCancellable * cancellable,
|
||||
|
|
@ -183,6 +196,10 @@ wp_pw_object_mixin_enum_params_unchecked (gpointer obj,
|
|||
} else {
|
||||
g_autoptr (WpCore) core = wp_object_get_core (WP_OBJECT (obj));
|
||||
|
||||
/* watch for errors */
|
||||
g_signal_connect_object (obj, "error", G_CALLBACK (enum_params_error),
|
||||
task, 0);
|
||||
|
||||
/* store */
|
||||
g_task_set_task_data (task, params, (GDestroyNotify) g_ptr_array_unref);
|
||||
g_task_set_source_tag (task, GINT_TO_POINTER (seq));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue