ladishd: workaround for bug in jack2/jackdbus

http://trac.jackaudio.org/ticket/209
This commit is contained in:
Nedko Arnaudov 2011-01-02 05:04:29 +02:00
parent 891805634d
commit 91b87783d7
3 changed files with 104 additions and 2 deletions

View File

@ -2,7 +2,7 @@
/*
* LADI Session Handler (ladish)
*
* Copyright (C) 2008, 2009, 2010 Nedko Arnaudov <nedko@arnaudov.name>
* Copyright (C) 2008, 2009, 2010, 2011 Nedko Arnaudov <nedko@arnaudov.name>
* Copyright (C) 2008 Juuso Alasuutari
*
**************************************************************************
@ -2540,6 +2540,57 @@ ladish_graph_iterate_connections(
return true;
}
bool
ladish_graph_interate_client_ports(
ladish_graph_handle graph_handle,
ladish_client_handle client,
void * callback_context,
bool
(* port_callback)(
void * context,
ladish_graph_handle graph_handle,
bool hidden,
ladish_client_handle client_handle,
const char * client_name,
ladish_port_handle port_handle,
const char * port_name,
uint32_t port_type,
uint32_t port_flags))
{
struct ladish_graph_client * client_ptr;
struct list_head * port_node_ptr;
struct list_head * port_temp_node_ptr;
struct ladish_graph_port * port_ptr;
client_ptr = ladish_graph_find_client(graph_ptr, client);
if (client_ptr == NULL)
{
ASSERT_NO_PASS;
return false;
}
list_for_each_safe(port_node_ptr, port_temp_node_ptr, &client_ptr->ports)
{
port_ptr = list_entry(port_node_ptr, struct ladish_graph_port, siblings_client);
if (!port_callback(
callback_context,
graph_handle,
port_ptr->hidden,
client_ptr->client,
client_ptr->name,
port_ptr->port,
port_ptr->name,
port_ptr->type,
port_ptr->flags))
{
return false;
}
}
return true;
}
static
bool
dump_dict_entry(

View File

@ -2,7 +2,7 @@
/*
* LADI Session Handler (ladish)
*
* Copyright (C) 2009, 2010 Nedko Arnaudov <nedko@arnaudov.name>
* Copyright (C) 2009, 2010, 2011 Nedko Arnaudov <nedko@arnaudov.name>
*
**************************************************************************
* This file contains interface to the D-Bus patchbay interface helpers
@ -228,6 +228,23 @@ ladish_graph_iterate_connections(
bool port2_hidden,
ladish_dict_handle dict));
bool
ladish_graph_interate_client_ports(
ladish_graph_handle graph_handle,
ladish_client_handle client_handle,
void * callback_context,
bool
(* port_callback)(
void * context,
ladish_graph_handle graph_handle,
bool hidden,
ladish_client_handle client_handle,
const char * client_name,
ladish_port_handle port_handle,
const char * port_name,
uint32_t port_type,
uint32_t port_flags));
void ladish_graph_clear_persist(ladish_graph_handle graph_handle);
void ladish_graph_set_persist(ladish_graph_handle graph_handle);
bool ladish_graph_is_persist(ladish_graph_handle graph_handle);

View File

@ -379,6 +379,37 @@ exit:
return;
}
static void port_disappeared(void * context, uint64_t client_id, uint64_t port_id);
bool
force_port_disappear(
void * context,
ladish_graph_handle graph_handle,
bool hidden,
ladish_client_handle client_handle,
const char * client_name,
ladish_port_handle port_handle,
const char * port_name,
uint32_t port_type,
uint32_t port_flags)
{
uint64_t client_id;
uint64_t port_id;
if (hidden)
{
return true;
}
log_error("forcing disappear of port '%s':'%s'", client_name, port_name);
client_id = ladish_client_get_jack_id(client_handle);
port_id = ladish_port_get_jack_id(port_handle);
port_disappeared(context, client_id, port_id);
return true;
}
static void client_disappeared(void * context, uint64_t id)
{
ladish_client_handle client;
@ -398,6 +429,9 @@ static void client_disappeared(void * context, uint64_t id)
log_info("client disappeared: '%s'", ladish_graph_get_client_name(virtualizer_ptr->jack_graph, client));
/* This is a workaround for jack2/jackdbus bug. */
ladish_graph_interate_client_ports(virtualizer_ptr->jack_graph, client, context, force_port_disappear);
vgraph = ladish_client_get_vgraph(client);
pid = ladish_client_get_pid(client);