audioconvert: only Suspend should trigger negotiate

A Suspend should clear all the negotiated state and start a new
negotiation in Start. Use a flag to control this.

This avoids recalculation of state for each pause/play state change.

See #2701
This commit is contained in:
Wim Taymans 2022-09-23 15:32:36 +02:00
parent 9119e8a26e
commit e8aef6b4bd

View file

@ -215,6 +215,7 @@ struct impl {
uint32_t in_offset;
uint32_t out_offset;
unsigned int started:1;
unsigned int setup:1;
unsigned int peaks:1;
unsigned int is_passthrough:1;
unsigned int drained:1;
@ -1463,6 +1464,12 @@ static int setup_convert(struct impl *this)
in = &this->dir[SPA_DIRECTION_INPUT];
out = &this->dir[SPA_DIRECTION_OUTPUT];
spa_log_debug(this->log, "%p: setup:%d in_format:%d out_format:%d", this,
this->setup, in->have_format, out->have_format);
if (this->setup)
return 0;
if (!in->have_format || !out->have_format)
return -EINVAL;
@ -1506,6 +1513,7 @@ static int setup_convert(struct impl *this)
this->tmp_datas[1][i] = SPA_PTROFF(this->tmp[1], this->empty_size * i, void);
this->tmp_datas[1][i] = SPA_PTR_ALIGN(this->tmp_datas[1][i], MAX_ALIGN, void);
}
this->setup = true;
emit_node_info(this, false);
@ -1537,6 +1545,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
this->started = true;
break;
case SPA_NODE_COMMAND_Suspend:
this->setup = false;
SPA_FALLTHROUGH;
case SPA_NODE_COMMAND_Flush:
reset_node(this);