Browse Source

Make switchmaster a bit more robust.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4394 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.9.8
sletz 14 years ago
parent
commit
00fc09b3b8
2 changed files with 20 additions and 11 deletions
  1. +5
    -3
      dbus/controller.c
  2. +15
    -8
      dbus/controller_iface_control.c

+ 5
- 3
dbus/controller.c View File

@@ -330,15 +330,17 @@ jack_controller_switch_master(
struct jack_controller * controller_ptr,
void *dbus_call_context_ptr)
{
assert(controller_ptr->started); /* should be ensured by caller */

if (!jackctl_server_switch_master(
controller_ptr->server,
jack_params_get_driver(controller_ptr->params)))
{
jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "Failed to switch master");
controller_ptr->started = false;
return FALSE;
}


return TRUE;
}

@@ -390,10 +392,10 @@ on_device_release(const char * device_name)

// Look for corresponding reserved device
for (i = 0; i < DEVICE_MAX; i++) {
if (strcmp(g_reserved_device[i].device_name, device_name) == 0)
if (strcmp(g_reserved_device[i].device_name, device_name) == 0)
break;
}
if (i < DEVICE_MAX) {
jack_info("Released audio card %s", device_name);
rd_release(g_reserved_device[i].reserved_device);


+ 15
- 8
dbus/controller_iface_control.c View File

@@ -122,11 +122,18 @@ jack_control_run_method(
}
else if (strcmp (call->method_name, "SwitchMaster") == 0)
{
if (!jack_controller_switch_master(controller_ptr, call))
if (!controller_ptr->started)
{
/* the reply is set by the failed function */
assert(call->reply != NULL);
return true;
goto not_started;
}
else
{
if (!jack_controller_switch_master(controller_ptr, call))
{
/* the reply is set by the failed function */
assert(call->reply != NULL);
return true;
}
}
}
else if (strcmp (call->method_name, "GetLoad") == 0)
@@ -220,7 +227,7 @@ jack_control_run_method(
*/
goto exit;
}
if (!jack_controller_load_internal(controller_ptr, internal_name)) {
jack_dbus_error(
call,
@@ -244,7 +251,7 @@ jack_control_run_method(
*/
goto exit;
}
if (!jack_controller_add_slave_driver(controller_ptr, driver_name))
{
jack_dbus_error(
@@ -273,7 +280,7 @@ jack_control_run_method(
*/
goto exit;
}
if (!jack_controller_remove_slave_driver(controller_ptr, driver_name))
{
jack_dbus_error(
@@ -297,7 +304,7 @@ jack_control_run_method(
*/
goto exit;
}
if (!jack_controller_unload_internal(controller_ptr, internal_name)) {
jack_dbus_error(
call,


Loading…
Cancel
Save