audioconvert: reset converter format as well

Reset the format of the converter so that when we go back to DSP mode,
we don't expose the old ports again.
.
This commit is contained in:
Wim Taymans 2021-08-20 15:09:38 +02:00
parent 8f7a972a48
commit 2427eeae2b

View file

@ -725,17 +725,17 @@ static int reconfigure_mode(struct impl *this, enum spa_param_port_config_mode m
this->mode[direction] = mode; this->mode[direction] = mode;
if (info && new != NULL) { if (new != NULL) {
struct spa_pod_builder b = { 0 }; struct spa_pod_builder b = { 0 };
uint8_t buffer[1024]; uint8_t buffer[1024];
struct spa_pod *param; struct spa_pod *param = NULL;
spa_log_debug(this->log, NAME " %p: port config %d", this, info->info.raw.channels);
spa_pod_builder_init(&b, buffer, sizeof(buffer)); spa_pod_builder_init(&b, buffer, sizeof(buffer));
param = spa_format_audio_raw_build(&b, SPA_PARAM_Format, &info->info.raw); if (info) {
spa_log_info(this->log, NAME " %p: port config %d", this, info->info.raw.channels);
param = spa_format_audio_raw_build(&b, SPA_PARAM_Format, &info->info.raw);
}
if (mode == SPA_PARAM_PORT_CONFIG_MODE_dsp) { if (mode == SPA_PARAM_PORT_CONFIG_MODE_dsp) {
param = spa_pod_builder_add_object(&b, param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamPortConfig, SPA_PARAM_PortConfig, SPA_TYPE_OBJECT_ParamPortConfig, SPA_PARAM_PortConfig,
@ -748,7 +748,6 @@ static int reconfigure_mode(struct impl *this, enum spa_param_port_config_mode m
res = spa_node_port_set_param(this->fmt[direction], direction, 0, res = spa_node_port_set_param(this->fmt[direction], direction, 0,
SPA_PARAM_Format, 0, param); SPA_PARAM_Format, 0, param);
} }
if (res < 0) if (res < 0)
return res; return res;