From 9d63c817e337be677e50c67cea2e4375c7b51297 Mon Sep 17 00:00:00 2001 From: pbd Date: Wed, 5 Dec 2001 04:59:05 +0000 Subject: [PATCH] mixdown now works; sigsegv causes clean exit from audiothread git-svn-id: svn+ssh://jackaudio.org/trunk/jack@53 0c269be4-1314-0410-8aa9-9f06e86f4224 --- client.c | 1 - engine.c | 5 +++-- jack/port.h | 14 +++++++------- jackd.c | 11 +++++++++++ 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/client.c b/client.c index 067ea59..535058e 100644 --- a/client.c +++ b/client.c @@ -183,7 +183,6 @@ jack_client_handle_port_connection (jack_client_t *client, jack_event_t *event) shared = jack_port_shared_by_id (client, event->y.other_id); control_port = jack_port_by_id (client, event->x.self_id); control_port->connections = g_slist_prepend (control_port->connections, shared); - printf ("%s connected to %s\n", control_port->shared->name, shared->name); break; case PortDisconnected: diff --git a/engine.c b/engine.c index 59064fb..a887a15 100644 --- a/engine.c +++ b/engine.c @@ -1834,14 +1834,14 @@ jack_port_do_connect (jack_engine_t *engine, pthread_mutex_lock (&engine->graph_lock); - if (dstport->shared->type_info.mixdown == NULL && dstport->connections) { + if (dstport->connections && dstport->shared->type_info.mixdown == NULL) { jack_error ("cannot make multiple connections to a port of type [%s]", dstport->shared->type_info.type_name); free (connection); return -1; } else { dstport->connections = g_slist_prepend (dstport->connections, connection); srcport->connections = g_slist_prepend (srcport->connections, connection); - + jack_sort_graph (engine, FALSE); jack_send_connection_notification (engine, srcport->shared->client_id, src_id, dst_id, TRUE); @@ -2305,6 +2305,7 @@ jack_audio_port_mixdown (jack_port_t *port, nframes_t nframes) node = port->connections; input = (jack_port_shared_t *) node->data; + memcpy (port->shared->buffer, input->buffer, sizeof (sample_t) * nframes); for (node = g_slist_next (node); node; node = g_slist_next (node)) { diff --git a/jack/port.h b/jack/port.h index 90d4104..fea9aa2 100644 --- a/jack/port.h +++ b/jack/port.h @@ -27,7 +27,7 @@ typedef struct _jack_port_type_info { const char *type_name; /* what do you think ? */ - void (*mixdown)(jack_port_t *, nframes_t); /* function to mixdown multiple inputs to a buffer. can be + void (*mixdown)(jack_port_t *, nframes_t); /* function to mixdown multiple inputs to a buffer. can be NULL, indicating that multiple input connections are not legal for this data type. */ @@ -55,10 +55,10 @@ typedef struct _jack_port_shared { void *buffer; unsigned long flags; unsigned long buffer_size; - jack_port_id_t id; + jack_port_id_t id; char name[JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE+2]; - jack_port_type_info_t type_info; - jack_client_id_t client_id; + jack_port_type_info_t type_info; + jack_client_id_t client_id; char in_use : 1; char locked : 1; @@ -71,9 +71,9 @@ typedef struct _jack_port_shared { struct _jack_port { struct _jack_port_shared *shared; - GSList *connections; + GSList *connections; struct _jack_port *tied; - void *own_buffer; + void *own_buffer; }; /* this is the structure allocated by the engine in local @@ -82,7 +82,7 @@ struct _jack_port { typedef struct _jack_port_internal { struct _jack_port_shared *shared; - GSList *connections; + GSList *connections; } jack_port_internal_t; #endif /* __jack_port_h__ */ diff --git a/jackd.c b/jackd.c index b28a0fc..ec37bf5 100644 --- a/jackd.c +++ b/jackd.c @@ -53,6 +53,17 @@ catch_signals (void) sigaddset(&signals, SIGTTIN); sigaddset(&signals, SIGTTOU); + /* this can make debugging a pain, but it also makes + segv-exits cleanup after themselves rather than + leaving the audio thread active. i still + find it truly wierd that _exit() or whatever is done + by the default SIGSEGV handler does not + cancel all threads in a process, but what + else can we do? + */ + + sigaddset(&signals, SIGSEGV); + /* all child threads will inherit this mask */ pthread_sigmask (SIG_BLOCK, &signals, 0);