From fe0759163eaa01704d6ed70c2dd29f4e0bce633d Mon Sep 17 00:00:00 2001 From: torben Date: Sun, 29 May 2011 00:47:20 +0000 Subject: [PATCH] [engine] rename continuous_stream to timeout_count and make threshold configurable git-svn-id: svn+ssh://jackaudio.org/trunk/jack@4432 0c269be4-1314-0410-8aa9-9f06e86f4224 --- jack/engine.h | 4 +++- jackd/clientengine.c | 2 +- jackd/engine.c | 11 ++++++----- jackd/jackd.c | 9 ++++++++- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/jack/engine.h b/jack/engine.h index a3d4ccc..3fc617f 100644 --- a/jack/engine.h +++ b/jack/engine.h @@ -137,8 +137,9 @@ struct _jack_engine { int removing_clients; pid_t wait_pid; int nozombies; + int timeout_count_threshold; volatile int problems; - volatile int continuous_stream; + volatile int timeout_count; volatile int new_clients_allowed; /* these lists are protected by `client_lock' */ @@ -184,6 +185,7 @@ jack_engine_t *jack_engine_new (int real_time, int real_time_priority, int verbose, int client_timeout, unsigned int port_max, pid_t waitpid, jack_nframes_t frame_time_offset, int nozombies, + int timeout_count_threshold, JSList *drivers); void jack_engine_delete (jack_engine_t *); int jack_run (jack_engine_t *engine); diff --git a/jackd/clientengine.c b/jackd/clientengine.c index 31b5c17..873808f 100644 --- a/jackd/clientengine.c +++ b/jackd/clientengine.c @@ -294,7 +294,7 @@ jack_check_clients (jack_engine_t* engine, int with_timeout_check) * however, we increase the continuous_stream flag. */ - engine->continuous_stream += 1; + engine->timeout_count += 1; } } } diff --git a/jackd/engine.c b/jackd/engine.c index 36e896f..11ff095 100644 --- a/jackd/engine.c +++ b/jackd/engine.c @@ -805,7 +805,7 @@ jack_process_external(jack_engine_t *engine, JSList *node) return NULL; /* will stop the loop */ } } else { - engine->continuous_stream = 0; + engine->timeout_count = 0; } @@ -1787,7 +1787,7 @@ jack_engine_t * jack_engine_new (int realtime, int rtpriority, int do_mlock, int do_unlock, const char *server_name, int temporary, int verbose, int client_timeout, unsigned int port_max, pid_t wait_pid, - jack_nframes_t frame_time_offset, int nozombies, JSList *drivers) + jack_nframes_t frame_time_offset, int nozombies, int timeout_count_threshold, JSList *drivers) { jack_engine_t *engine; unsigned int i; @@ -1844,7 +1844,7 @@ jack_engine_new (int realtime, int rtpriority, int do_mlock, int do_unlock, engine->driver_exit = jack_engine_driver_exit; engine->transport_cycle_start = jack_transport_cycle_start; engine->client_timeout_msecs = client_timeout; - engine->continuous_stream = 0; + engine->timeout_count = 0; engine->problems = 0; engine->next_client_id = 1; /* 0 is a NULL client ID */ @@ -1862,6 +1862,7 @@ jack_engine_new (int realtime, int rtpriority, int do_mlock, int do_unlock, engine->feedbackcount = 0; engine->wait_pid = wait_pid; engine->nozombies = nozombies; + engine->timeout_count_threshold = timeout_count_threshold; engine->removing_clients = 0; engine->new_clients_allowed = 1; @@ -2422,7 +2423,7 @@ jack_run_one_cycle (jack_engine_t *engine, jack_nframes_t nframes, return 0; } - if (engine->problems || (engine->continuous_stream > 10)) { + if (engine->problems || (engine->timeout_count_threshold && (engine->timeout_count > engine->timeout_count_threshold))) { VERBOSE (engine, "problem-driven null cycle problems=%d", engine->problems); jack_unlock_problems (engine); jack_unlock_graph (engine); @@ -3508,7 +3509,7 @@ jack_sort_graph (jack_engine_t *engine) jack_compute_all_port_total_latencies (engine); jack_rechain_graph (engine); jack_compute_new_latency (engine); - engine->continuous_stream = 0; + engine->timeout_count = 0; VERBOSE (engine, "-- jack_sort_graph"); } diff --git a/jackd/jackd.c b/jackd/jackd.c index 4259ae1..93134ad 100644 --- a/jackd/jackd.c +++ b/jackd/jackd.c @@ -67,6 +67,7 @@ static unsigned int port_max = 256; static int do_unlock = 0; static jack_nframes_t frame_time_offset = 0; static int nozombies = 0; +static int timeout_count_threshold = 0; extern int sanitycheck (int, int); @@ -154,7 +155,7 @@ jack_main (jack_driver_desc_t * driver_desc, JSList * driver_params, JSList * sl do_mlock, do_unlock, server_name, temporary, verbose, client_timeout, port_max, getpid(), frame_time_offset, - nozombies, drivers)) == 0) { + nozombies, timeout_count_threshold, drivers)) == 0) { jack_error ("cannot create engine"); return -1; } @@ -536,6 +537,7 @@ main (int argc, char *argv[]) int show_version = 0; const char *options = "-d:P:uvshVrRZTFlt:mM:n:Np:c:X:"; + const char *options = "-d:P:uvshVrRZTFlt:mM:n:Np:c:X:C:"; struct option long_options[] = { /* keep ordered by single-letter option code */ @@ -562,6 +564,7 @@ main (int argc, char *argv[]) { "verbose", 0, 0, 'v' }, { "slave-driver", 1, 0, 'X' }, { "nozombies", 0, 0, 'Z' }, + { "timeout-thres", 1, 0, 'C' }, { 0, 0, 0, 0 } }; int opt = 0; @@ -599,6 +602,10 @@ main (int argc, char *argv[]) } break; + case 'C': + timeout_count_threshold = atoi (optarg); + break; + case 'd': seen_driver = 1; driver_name = optarg;