audioconvert: don't clear profile when format is cleared

This commit is contained in:
Wim Taymans 2018-11-02 17:19:15 +01:00
parent 4733bd32c8
commit 7b6df9e127
2 changed files with 14 additions and 2 deletions

View file

@ -88,6 +88,8 @@ struct impl {
bool started; bool started;
convert_func_t convert; convert_func_t convert;
bool have_profile;
float empty[MAX_SAMPLES]; float empty[MAX_SAMPLES];
}; };
@ -203,6 +205,7 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
port->have_format = true; port->have_format = true;
port->format = info; port->format = info;
this->have_profile = true;
this->port_count = info.info.raw.channels; this->port_count = info.info.raw.channels;
for (i = 0; i < this->port_count; i++) { for (i = 0; i < this->port_count; i++) {
init_port(this, i, info.info.raw.rate, init_port(this, i, info.info.raw.rate,
@ -582,7 +585,10 @@ static int port_set_format(struct spa_node *node,
if (format == NULL) { if (format == NULL) {
if (port->have_format) { if (port->have_format) {
port->have_format = false; if (direction == SPA_DIRECTION_OUTPUT)
port->have_format = this->have_profile;
else
port->have_format = false;
clear_buffers(this, port); clear_buffers(this, port);
} }
} else { } else {

View file

@ -89,6 +89,8 @@ struct impl {
bool started; bool started;
convert_func_t convert; convert_func_t convert;
bool have_profile;
float empty[MAX_SAMPLES]; float empty[MAX_SAMPLES];
}; };
@ -204,6 +206,7 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
if (port->have_format && memcmp(&port->format, &info, sizeof(info)) == 0) if (port->have_format && memcmp(&port->format, &info, sizeof(info)) == 0)
return 0; return 0;
this->have_profile = true;
this->port_count = info.info.raw.channels; this->port_count = info.info.raw.channels;
for (i = 0; i < this->port_count; i++) { for (i = 0; i < this->port_count; i++) {
init_port(this, i, info.info.raw.rate, init_port(this, i, info.info.raw.rate,
@ -595,7 +598,10 @@ static int port_set_format(struct spa_node *node,
if (format == NULL) { if (format == NULL) {
if (port->have_format) { if (port->have_format) {
port->have_format = false; if (direction == SPA_DIRECTION_INPUT)
port->have_format = this->profile;
else
port->have_format = false;
clear_buffers(this, port); clear_buffers(this, port);
} }
} else { } else {