audioconvert: do _port_set_param on fmtconvert if convert mode

The fmtconvert plugin does not support SPA_PARAM_PortConfig. Instead, we need to
set the format in the specific port with SPA_PARAM_Format.
This commit is contained in:
Julian Bouzas 2021-08-20 14:46:34 -04:00 committed by Wim Taymans
parent dedc08cdf8
commit b368bea98c
2 changed files with 17 additions and 8 deletions

View file

@ -729,13 +729,20 @@ static int reconfigure_mode(struct impl *this, enum spa_param_port_config_mode m
spa_pod_builder_init(&b, buffer, sizeof(buffer));
param = spa_format_audio_raw_build(&b, SPA_PARAM_Format, &info->info.raw);
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamPortConfig, SPA_PARAM_PortConfig,
SPA_PARAM_PORT_CONFIG_direction, SPA_POD_Id(direction),
SPA_PARAM_PORT_CONFIG_mode, SPA_POD_Id(SPA_PARAM_PORT_CONFIG_MODE_dsp),
SPA_PARAM_PORT_CONFIG_monitor, SPA_POD_Bool(monitor),
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param));
res = spa_node_set_param(this->fmt[direction], SPA_PARAM_PortConfig, 0, param);
if (mode == SPA_PARAM_PORT_CONFIG_MODE_dsp) {
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamPortConfig, SPA_PARAM_PortConfig,
SPA_PARAM_PORT_CONFIG_direction, SPA_POD_Id(direction),
SPA_PARAM_PORT_CONFIG_mode, SPA_POD_Id(SPA_PARAM_PORT_CONFIG_MODE_dsp),
SPA_PARAM_PORT_CONFIG_monitor, SPA_POD_Bool(monitor),
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param));
res = spa_node_set_param(this->fmt[direction], SPA_PARAM_PortConfig, 0, param);
} else {
res = spa_node_port_set_param(this->fmt[direction], direction, 0,
SPA_PARAM_Format, 0, param);
}
if (res < 0)
return res;