mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
alsa-seq: fix port delete
We need to first mark the removed port as invalid, and then look for the last valid port in the port array otherwise last_port becomes 0 and midi dataflow stops. Fixes #1601
This commit is contained in:
parent
bf29130f84
commit
d793086174
2 changed files with 9 additions and 1 deletions
|
|
@ -384,13 +384,16 @@ static struct seq_port *alloc_port(struct seq_state *state, struct seq_stream *s
|
||||||
|
|
||||||
static void free_port(struct seq_state *state, struct seq_stream *stream, struct seq_port *port)
|
static void free_port(struct seq_state *state, struct seq_stream *stream, struct seq_port *port)
|
||||||
{
|
{
|
||||||
|
port->valid = false;
|
||||||
|
|
||||||
if (port->id + 1 == stream->last_port) {
|
if (port->id + 1 == stream->last_port) {
|
||||||
int i;
|
int i;
|
||||||
for (i = stream->last_port - 1; i >= 0; i--)
|
for (i = stream->last_port - 1; i >= 0; i--)
|
||||||
if (!stream->ports[i].valid)
|
if (stream->ports[i].valid)
|
||||||
break;
|
break;
|
||||||
stream->last_port = i + 1;
|
stream->last_port = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
spa_node_emit_port_info(&state->hooks,
|
spa_node_emit_port_info(&state->hooks,
|
||||||
port->direction, port->id, NULL);
|
port->direction, port->id, NULL);
|
||||||
spa_zero(*port);
|
spa_zero(*port);
|
||||||
|
|
|
||||||
|
|
@ -247,6 +247,11 @@ static void alsa_seq_on_sys(struct spa_source *source)
|
||||||
addr->client, addr->port);
|
addr->client, addr->port);
|
||||||
state->port_info(state->port_info_data, addr, NULL);
|
state->port_info(state->port_info_data, addr, NULL);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
spa_log_info(state->log, "unhandled event %d: %d:%d",
|
||||||
|
ev->type, addr->client, addr->port);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
snd_seq_free_event(ev);
|
snd_seq_free_event(ev);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue