git-svn-id: svn+ssh://jackaudio.org/trunk/jack@374 0c269be4-1314-0410-8aa9-9f06e86f4224tags/0.109.0
| @@ -13,8 +13,8 @@ dnl micro version = incremented when implementation-only | |||
| dnl changes are made | |||
| dnl --- | |||
| JACK_MAJOR_VERSION=0 | |||
| JACK_MINOR_VERSION=69 | |||
| JACK_MICRO_VERSION=1 | |||
| JACK_MINOR_VERSION=70 | |||
| JACK_MICRO_VERSION=0 | |||
| dnl --- | |||
| dnl HOWTO: updating the jack protocal version | |||
| @@ -44,6 +44,9 @@ struct _jack_engine { | |||
| pthread_mutex_t request_lock; | |||
| int process_errors; | |||
| int period_msecs; | |||
| int client_timeout_msecs; /* Time to wait for clients in msecs. Used when jackd is | |||
| * run in non-ASIO mode and without realtime priority enabled. | |||
| */ | |||
| unsigned int port_max; | |||
| shm_name_t control_shm_name; | |||
| size_t control_size; | |||
| @@ -92,7 +95,7 @@ struct _jack_engine { | |||
| /* public functions */ | |||
| jack_engine_t *jack_engine_new (int real_time, int real_time_priority, int verbose); | |||
| jack_engine_t *jack_engine_new (int real_time, int real_time_priority, int verbose, int client_timeout); | |||
| int jack_engine_delete (jack_engine_t *); | |||
| int jack_run (jack_engine_t *engine); | |||
| int jack_wait (jack_engine_t *engine); | |||
| @@ -51,18 +51,6 @@ | |||
| #include <sys/capability.h> | |||
| #endif | |||
| /** | |||
| * Time to wait for clients in msecs. Used when jackd is | |||
| * run in non-ASIO mode and without realtime priority enabled. | |||
| */ | |||
| #define DEBUGGING_SLOW_CLIENTS | |||
| #ifdef DEBUGGING_SLOW_CLIENTS | |||
| #define JACKD_SOFT_MODE_TIMEOUT 5000 | |||
| #else | |||
| #define JACKD_SOFT_MODE_TIMEOUT 500 | |||
| #endif | |||
| #define JACK_ERROR_WITH_SOCKETS 10000000 | |||
| typedef struct { | |||
| @@ -493,7 +481,7 @@ jack_process_external(jack_engine_t *engine, JSList *node) | |||
| engine->driver->wait (engine->driver, client->subgraph_wait_fd, &status, &delayed_usecs); | |||
| } else { | |||
| struct pollfd pfd[1]; | |||
| int poll_timeout = (engine->control->real_time == 0 ? JACKD_SOFT_MODE_TIMEOUT : engine->driver->period_usecs/1000); | |||
| int poll_timeout = (engine->control->real_time == 0 ? engine->client_timeout_msecs : engine->driver->period_usecs/1000); | |||
| pfd[0].fd = client->subgraph_wait_fd; | |||
| pfd[0].events = POLLERR|POLLIN|POLLHUP|POLLNVAL; | |||
| @@ -1624,7 +1612,7 @@ jack_server_thread (void *arg) | |||
| handle_client_socket_error (engine, pfd[i].fd); | |||
| } else if (pfd[i].revents & POLLIN) { | |||
| if (handle_external_client_request (engine, pfd[i].fd)) { | |||
| jack_error ("bad hci\n"); | |||
| jack_error ("could not handle external client request"); | |||
| } | |||
| } | |||
| } | |||
| @@ -1634,7 +1622,7 @@ jack_server_thread (void *arg) | |||
| } | |||
| jack_engine_t * | |||
| jack_engine_new (int realtime, int rtpriority, int verbose) | |||
| jack_engine_new (int realtime, int rtpriority, int verbose, int client_timeout) | |||
| { | |||
| jack_engine_t *engine; | |||
| void *addr; | |||
| @@ -1651,6 +1639,7 @@ jack_engine_new (int realtime, int rtpriority, int verbose) | |||
| engine->driver = 0; | |||
| engine->set_sample_rate = jack_set_sample_rate; | |||
| engine->set_buffer_size = jack_set_buffer_size; | |||
| engine->client_timeout_msecs = client_timeout; | |||
| engine->next_client_id = 1; | |||
| engine->timebase_client = 0; | |||
| @@ -2017,6 +2006,7 @@ jack_main_thread (void *arg) | |||
| if ((nframes = driver->wait (driver, -1, &wait_status, &delayed_usecs)) == 0) { | |||
| /* the driver detected an xrun, and restarted */ | |||
| jack_engine_notify_clients_about_delay (engine); | |||
| continue; | |||
| } | |||
| @@ -2241,7 +2231,6 @@ jack_remove_client (jack_engine_t *engine, jack_client_internal_t *client) | |||
| close (client->event_fd); | |||
| close (client->request_fd); | |||
| if (client->control->type == ClientExternal) { | |||
| @@ -54,6 +54,7 @@ static int realtime_priority = 10; | |||
| static int with_fork = 1; | |||
| static int verbose = 0; | |||
| static int asio_mode = 0; | |||
| static int client_timeout = 500; /* msecs */ | |||
| typedef struct { | |||
| pid_t pid; | |||
| @@ -90,7 +91,7 @@ jack_engine_waiter_thread (void *arg) | |||
| pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL); | |||
| if ((engine = jack_engine_new (realtime, realtime_priority, verbose)) == 0) { | |||
| if ((engine = jack_engine_new (realtime, realtime_priority, verbose, client_timeout)) == 0) { | |||
| fprintf (stderr, "cannot create engine\n"); | |||
| kill (warg->pid, SIGTERM); | |||
| return 0; | |||
| @@ -270,12 +271,22 @@ jack_main (int argc, char **argv) | |||
| return; | |||
| } | |||
| static void usage (FILE *file) | |||
| static void copyright (FILE* file) | |||
| { | |||
| fprintf (file, "jackd " VERSION "\n" | |||
| "Copyright 2001-2003 Paul Davis and others.\n" | |||
| "jackd comes with ABSOLUTELY NO WARRANTY\n" | |||
| "This is free software, and you are welcome to redistribute it\n" | |||
| "under certain conditions; see the file COPYING for details\n\n"); | |||
| } | |||
| static void usage (FILE *file) | |||
| { | |||
| copyright (file); | |||
| fprintf (file, "\n" | |||
| "usage: jackd [ --asio OR -a ]\n" | |||
| " [ --realtime OR -R [ --realtime-priority OR -P priority ] ]\n" | |||
| " [ --timeout OR -t client-timeout-in-msecs ]\n" | |||
| " [ --verbose OR -v ]\n" | |||
| " [ --tmpdir OR -D directory-for-temporary-files ]\n" | |||
| " [ --version OR -V ]\n" | |||
| @@ -296,6 +307,7 @@ main (int argc, char *argv[]) | |||
| { "help", 0, 0, 'h' }, | |||
| { "realtime", 0, 0, 'R' }, | |||
| { "realtime-priority", 1, 0, 'P' }, | |||
| { "timeout", 1, 0, 't' }, | |||
| { "spoon", 0, 0, 'F' }, | |||
| { "version", 0, 0, 'V' }, | |||
| { 0, 0, 0, 0 } | |||
| @@ -364,6 +376,10 @@ main (int argc, char *argv[]) | |||
| realtime = 1; | |||
| break; | |||
| case 't': | |||
| client_timeout = atoi (optarg); | |||
| break; | |||
| case 'V': | |||
| show_version = 1; | |||
| break; | |||
| @@ -400,11 +416,7 @@ main (int argc, char *argv[]) | |||
| driver_args[i] = argv[optind++]; | |||
| } | |||
| printf ( "jackd " VERSION "\n" | |||
| "Copyright 2001-2003 Paul Davis and others.\n" | |||
| "jackd comes with ABSOLUTELY NO WARRANTY\n" | |||
| "This is free software, and you are welcome to redistribute it\n" | |||
| "under certain conditions; see the file COPYING for details\n\n"); | |||
| copyright (stdout); | |||
| if (!with_fork) { | |||
| @@ -816,8 +816,11 @@ jack_client_thread (void *arg) | |||
| #ifdef WITH_TIMESTAMPS | |||
| jack_timestamp ("read done"); | |||
| jack_dump_timestamps (stdout); | |||
| #endif | |||
| } | |||
| } | |||
| @@ -1222,6 +1225,18 @@ jack_set_graph_order_callback (jack_client_t *client, JackGraphOrderCallback cal | |||
| return 0; | |||
| } | |||
| int jack_set_xrun_callback (jack_client_t *client, JackXRunCallback callback, void *arg) | |||
| { | |||
| if (client->control->active) { | |||
| jack_error ("You cannot set callbacks on an active client."); | |||
| return -1; | |||
| } | |||
| client->control->xrun = callback; | |||
| client->control->xrun_arg = arg; | |||
| return 0; | |||
| } | |||
| int | |||
| jack_set_process_callback (jack_client_t *client, JackProcessCallback callback, void *arg) | |||
| @@ -504,8 +504,8 @@ jack_ensure_port_monitor_input (jack_port_t *port, int yn) | |||
| port->shared->monitor_requests++; | |||
| } | |||
| } else { | |||
| if (port->shared->monitor_requests == 1) { | |||
| port->shared->monitor_requests--; | |||
| if (port->shared->monitor_requests > 0) { | |||
| port->shared->monitor_requests = 0; | |||
| } | |||
| } | |||