mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
fix last_port
This commit is contained in:
parent
d8cac792f4
commit
9ee0cd7d8d
1 changed files with 5 additions and 5 deletions
|
|
@ -253,8 +253,8 @@ static int impl_node_add_port(struct spa_node *node, enum spa_direction directio
|
||||||
SPA_PORT_INFO_FLAG_IN_PLACE;
|
SPA_PORT_INFO_FLAG_IN_PLACE;
|
||||||
|
|
||||||
this->port_count++;
|
this->port_count++;
|
||||||
if (this->last_port < port_id)
|
if (this->last_port <= port_id)
|
||||||
this->last_port = port_id;
|
this->last_port = port_id + 1;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -280,14 +280,14 @@ impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint3
|
||||||
}
|
}
|
||||||
spa_memzero(port, sizeof(struct port));
|
spa_memzero(port, sizeof(struct port));
|
||||||
|
|
||||||
if (port_id == this->last_port) {
|
if (port_id == this->last_port + 1) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = this->last_port; i > 0; i--)
|
for (i = this->last_port; i >= 0; i--)
|
||||||
if (GET_IN_PORT (this, i)->valid)
|
if (GET_IN_PORT (this, i)->valid)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
this->last_port = i;
|
this->last_port = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue