audioconvert: improve renegotiation

When the follower updates EnumFormat, it probably wants to renegotiate
to a new format, so clear the current format so that we do that when
starting the next time.

EnumFormat should also not only return the current format in case we
are negotiated but it should return all possible formats.

See #2832
This commit is contained in:
Wim Taymans 2022-11-17 19:26:46 +01:00
parent 72912c9589
commit 90f5b4a4bf
2 changed files with 5 additions and 6 deletions

View file

@ -1096,6 +1096,10 @@ static void follower_port_info(void *data,
spa_log_debug(this->log, "latency: %d (%s)", res, spa_log_debug(this->log, "latency: %d (%s)", res,
spa_strerror(res)); spa_strerror(res));
} }
if (idx == IDX_EnumFormat) {
this->have_format = false;
spa_log_debug(this->log, "new formats");
}
this->info.change_mask |= SPA_NODE_CHANGE_MASK_PARAMS; this->info.change_mask |= SPA_NODE_CHANGE_MASK_PARAMS;
if (!this->add_listener) { if (!this->add_listener) {

View file

@ -1646,7 +1646,6 @@ static int port_enum_formats(void *object,
struct spa_pod_builder *builder) struct spa_pod_builder *builder)
{ {
struct impl *this = object; struct impl *this = object;
struct port *port = GET_PORT(this, direction, port_id);
switch (index) { switch (index) {
case 0: case 0:
@ -1660,11 +1659,7 @@ static int port_enum_formats(void *object,
SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat, SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_application), SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_application),
SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control)); SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control));
} else if (port->have_format) { } else {
*param = spa_format_audio_raw_build(builder,
SPA_PARAM_EnumFormat, &this->dir[direction].format.info.raw);
}
else {
uint32_t rate = this->io_position ? uint32_t rate = this->io_position ?
this->io_position->clock.rate.denom : DEFAULT_RATE; this->io_position->clock.rate.denom : DEFAULT_RATE;