From 646dd40fba3036ede5d02f87aa11352c3bcd7a7e Mon Sep 17 00:00:00 2001 From: pieterpalmers Date: Fri, 28 Dec 2007 21:16:04 +0000 Subject: [PATCH] Fix bad behavior when jack clients return a nonzero value in their process callback. (as reported by Rui and Fernando) git-svn-id: svn+ssh://jackaudio.org/trunk/jack@1073 0c269be4-1314-0410-8aa9-9f06e86f4224 --- configure.ac | 6 +++--- jack/internal.h | 1 + jackd/engine.c | 6 ++++++ libjack/client.c | 12 ++++++------ 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 8a7d424..b906136 100644 --- a/configure.ac +++ b/configure.ac @@ -16,8 +16,8 @@ dnl micro version = incremented when implementation-only dnl changes are made dnl --- JACK_MAJOR_VERSION=0 -JACK_MINOR_VERSION=107 -JACK_MICRO_VERSION=9 +JACK_MINOR_VERSION=108 +JACK_MICRO_VERSION=0 dnl --- dnl HOWTO: updating the jack protocol version @@ -27,7 +27,7 @@ dnl made to the way libjack communicates with jackd dnl that would break applications linked with an older dnl version of libjack. dnl --- -JACK_PROTOCOL_VERSION=21 +JACK_PROTOCOL_VERSION=22 dnl --- dnl HOWTO: updating the libjack interface version diff --git a/jack/internal.h b/jack/internal.h index fde3e18..5d1e460 100644 --- a/jack/internal.h +++ b/jack/internal.h @@ -225,6 +225,7 @@ typedef volatile struct { volatile uint64_t signalled_at; volatile uint64_t awake_at; volatile uint64_t finished_at; + volatile int32_t last_status; /* w: client, r: engine and client */ /* JOQ: all these pointers are trouble for 32/64 compatibility, * they should move to non-shared memory. diff --git a/jackd/engine.c b/jackd/engine.c index ad0676a..f4aab66 100644 --- a/jackd/engine.c +++ b/jackd/engine.c @@ -2032,6 +2032,12 @@ jack_run_one_cycle (jack_engine_t *engine, jack_nframes_t nframes, client->control->name); client->error++; } + if(client->control->last_status != 0) { + VERBOSE(engine, + "client %s has nonzero process callback status (%d)\n", + client->control->name, client->control->last_status); + client->error++; + } } DEBUG ("client %s errors = %d", client->control->name, diff --git a/libjack/client.c b/libjack/client.c index 220313e..b0ca00b 100644 --- a/libjack/client.c +++ b/libjack/client.c @@ -1470,20 +1470,20 @@ jack_thread_first_wait (jack_client_t* client) jack_nframes_t jack_thread_wait (jack_client_t* client, int status) { - jack_client_control_t *control = client->control; + client->control->last_status = status; /* SECTION ONE: HOUSEKEEPING/CLEANUP FROM LAST DATA PROCESSING */ /* housekeeping/cleanup after data processing */ - if (status == 0 && control->timebase_cb) { + if (status == 0 && client->control->timebase_cb) { jack_call_timebase_master (client); } /* end preemption checking */ CHECK_PREEMPTION (client->engine, FALSE); - control->finished_at = jack_get_microseconds(); + client->control->finished_at = jack_get_microseconds(); /* wake the next client in the chain (could be the server), and check if we were killed during the process @@ -1509,15 +1509,15 @@ jack_thread_wait (jack_client_t* client, int status) /* Time to do data processing */ - control->state = Running; + client->control->state = Running; /* begin preemption checking */ CHECK_PREEMPTION (client->engine, TRUE); - if (control->sync_cb) + if (client->control->sync_cb) jack_call_sync_client (client); - return control->nframes; + return client->control->nframes; } static void *