From 68049ee6cb9d9109c9fb235345d54e500c384036 Mon Sep 17 00:00:00 2001 From: Nedko Arnaudov Date: Thu, 2 Dec 2010 05:40:21 +0200 Subject: [PATCH] ladishd: don't create two vclients with same name If the app first creates alsa (a2j) port, the created vclient is not intrelinked because there is no jack client to interlink. When the first jack port appears, because the jack client has no interlinked client, a new vclient with same name was created. This changeset implements a search by app uuid before new vclient is created. --- daemon/virtualizer.c | 64 +++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/daemon/virtualizer.c b/daemon/virtualizer.c index 67da3971..376c883a 100644 --- a/daemon/virtualizer.c +++ b/daemon/virtualizer.c @@ -676,23 +676,23 @@ port_appeared( vclient = ladish_graph_find_client_by_name(vgraph, vclient_name, false); if (vclient == NULL) { - if (!ladish_client_create(NULL, &vclient)) - { - log_error("ladish_client_create() failed."); - goto free_alsa_names; - } + if (!ladish_client_create(NULL, &vclient)) + { + log_error("ladish_client_create() failed."); + goto free_alsa_names; + } - if (has_app) - { - ladish_client_set_app(vclient, app_uuid); - } + if (has_app) + { + ladish_client_set_app(vclient, app_uuid); + } - if (!ladish_graph_add_client(vgraph, vclient, vclient_name, false)) - { - log_error("ladish_graph_add_client() failed."); - ladish_client_destroy(vclient); - goto free_alsa_names; - } + if (!ladish_graph_add_client(vgraph, vclient, vclient_name, false)) + { + log_error("ladish_graph_add_client() failed."); + ladish_client_destroy(vclient); + goto free_alsa_names; + } } } else if (client_id == virtualizer_ptr->system_client_id) @@ -749,25 +749,29 @@ port_appeared( } else { - log_info("creating new vclient"); - if (!ladish_client_create(NULL, &vclient)) + vclient = ladish_graph_find_client_by_app(vgraph, app_uuid); + if (vclient == NULL) { - log_error("ladish_client_create() failed."); - goto free_alsa_names; - } + log_info("creating new vclient"); + if (!ladish_client_create(NULL, &vclient)) + { + log_error("ladish_client_create() failed."); + goto free_alsa_names; + } - ladish_client_interlink(vclient, jack_client); + ladish_client_interlink(vclient, jack_client); - if (has_app) - { - ladish_client_set_app(vclient, app_uuid); - } + if (has_app) + { + ladish_client_set_app(vclient, app_uuid); + } - if (!ladish_graph_add_client(vgraph, vclient, vclient_name, false)) - { - log_error("ladish_graph_add_client() failed to add client '%s' to virtual graph", jack_client_name); - ladish_client_destroy(vclient); - goto free_alsa_names; + if (!ladish_graph_add_client(vgraph, vclient, vclient_name, false)) + { + log_error("ladish_graph_add_client() failed to add client '%s' to virtual graph", jack_client_name); + ladish_client_destroy(vclient); + goto free_alsa_names; + } } } }