adapter: pass follower direction to converter

Partially revert 86af9de739

The PortParam does not give enough information to derive the direction
of the converter. If the converter is configured in convert/convert
there is just no way to know when to output a quantum or not.

Fix this by doing a quick probe of the follower and then pass the
direction to the converter.

See !2227
This commit is contained in:
Wim Taymans 2025-01-21 11:38:13 +01:00
parent 4b24619160
commit d2c2276088
2 changed files with 44 additions and 10 deletions

View file

@ -1646,11 +1646,6 @@ static int reconfigure_mode(struct impl *this, enum spa_param_port_config_mode m
i = dir->n_ports++;
init_port(this, direction, i, 0, false, false, true);
}
/* when output is convert mode, we are in OUTPUT (merge) mode, we always output all
* the incoming data to output. When output is DSP, we need to output quantum size
* chunks. */
this->direction = this->dir[SPA_DIRECTION_OUTPUT].mode == SPA_PARAM_PORT_CONFIG_MODE_convert ?
SPA_DIRECTION_OUTPUT : SPA_DIRECTION_INPUT;
this->info.change_mask |= SPA_NODE_CHANGE_MASK_FLAGS | SPA_NODE_CHANGE_MASK_PARAMS;
this->info.flags &= ~SPA_NODE_FLAG_NEED_CONFIGURE;
@ -4060,6 +4055,12 @@ impl_init(const struct spa_handle_factory *factory,
else if (spa_streq(k, "resample.prefill"))
SPA_FLAG_UPDATE(this->resample.options,
RESAMPLE_OPTION_PREFILL, spa_atob(s));
else if (spa_streq(k, "convert.direction")) {
if (spa_streq(s, "output"))
this->direction = SPA_DIRECTION_OUTPUT;
else
this->direction = SPA_DIRECTION_INPUT;
}
else if (spa_streq(k, SPA_KEY_AUDIO_POSITION)) {
if (s != NULL)
spa_audio_parse_position(s, strlen(s), this->props.channel_map,