From f539b42a03b556f6c3de4379061f3e34d46b3c26 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 26 Sep 2019 11:57:25 +0200 Subject: [PATCH] alsa: improve midi Add some debug Ignore ports without buffers. --- pipewire-jack | 2 +- spa/plugins/alsa/alsa-seq-source.c | 19 ++++++++++++++----- spa/plugins/alsa/alsa-seq.c | 10 ++++++++++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/pipewire-jack b/pipewire-jack index 8d8ef587f..274d616fa 160000 --- a/pipewire-jack +++ b/pipewire-jack @@ -1 +1 @@ -Subproject commit 8d8ef587f5c6475df2887422bd268e5065227411 +Subproject commit 274d616fa6adef0a917f16e1001cf66fdca88e64 diff --git a/spa/plugins/alsa/alsa-seq-source.c b/spa/plugins/alsa/alsa-seq-source.c index f730ca1e0..e5f9b5ae0 100644 --- a/spa/plugins/alsa/alsa-seq-source.c +++ b/spa/plugins/alsa/alsa-seq-source.c @@ -457,16 +457,22 @@ static void update_stream_port(struct seq_state *state, struct seq_stream *strea if (port) free_port(state, port); } else { - if (port != NULL && (caps & stream->caps) != stream->caps) { - spa_log_debug(state->log, "free port %d.%d", addr->client, addr->port); - free_port(state, port); - } - else if (port == NULL && (caps & stream->caps) == stream->caps) { + if (port == NULL && (caps & stream->caps) == stream->caps) { spa_log_debug(state->log, "new port %d.%d", addr->client, addr->port); port = alloc_port(state, stream); if (port == NULL) return; init_port(state, port, addr); + } else if (port != NULL) { + if ((caps & stream->caps) != stream->caps) { + spa_log_debug(state->log, "free port %d.%d", addr->client, addr->port); + free_port(state, port); + } + else { + spa_log_debug(state->log, "update port %d.%d", addr->client, addr->port); + port->info.change_mask = SPA_PORT_CHANGE_MASK_PROPS; + emit_port_info(state, port, false); + } } } } @@ -702,6 +708,9 @@ impl_node_port_use_buffers(void *object, port = GET_PORT(this, direction, port_id); + spa_log_debug(this->log, NAME " %p: port %d.%d buffers:%d format:%d", this, + direction, port_id, n_buffers, port->have_format); + if (!port->have_format) return -EIO; diff --git a/spa/plugins/alsa/alsa-seq.c b/spa/plugins/alsa/alsa-seq.c index 2a7f65c6b..419beff65 100644 --- a/spa/plugins/alsa/alsa-seq.c +++ b/spa/plugins/alsa/alsa-seq.c @@ -216,6 +216,13 @@ static void alsa_seq_on_sys(struct spa_source *source) debug_event(state, ev); switch (ev->type) { + case SND_SEQ_EVENT_CLIENT_START: + case SND_SEQ_EVENT_CLIENT_CHANGE: + spa_log_debug(state->log, "client add/change %d", addr->client); + break; + case SND_SEQ_EVENT_CLIENT_EXIT: + break; + case SND_SEQ_EVENT_PORT_START: case SND_SEQ_EVENT_PORT_CHANGE: { @@ -442,6 +449,9 @@ static int process_read(struct seq_state *state) addr->client, addr->port); continue; } + if (port->io == NULL || port->n_buffers == 0) + continue; + if ((res = prepare_buffer(state, port)) < 0) { spa_log_debug(state->log, "can't prepare buffer port:%p %d.%d: %s", port, addr->client, addr->port, spa_strerror(res));