From 9ee0cd7d8d2c7f4c15325f6f0287c6f28fb1f0b4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 28 Jun 2017 16:53:10 +0200 Subject: [PATCH] fix last_port --- spa/plugins/audiomixer/audiomixer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spa/plugins/audiomixer/audiomixer.c b/spa/plugins/audiomixer/audiomixer.c index 738bf9c4f..525c13f21 100644 --- a/spa/plugins/audiomixer/audiomixer.c +++ b/spa/plugins/audiomixer/audiomixer.c @@ -253,8 +253,8 @@ static int impl_node_add_port(struct spa_node *node, enum spa_direction directio SPA_PORT_INFO_FLAG_IN_PLACE; this->port_count++; - if (this->last_port < port_id) - this->last_port = port_id; + if (this->last_port <= port_id) + this->last_port = port_id + 1; 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)); - if (port_id == this->last_port) { + if (port_id == this->last_port + 1) { 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) break; - this->last_port = i; + this->last_port = i + 1; } return SPA_RESULT_OK;