audio: asrc: Update stream params from base config

The input stream params may not be updated by the source module. So
update the stream params from the config. Also, update the source/sink
ibuffer formats based on the base config audio format.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
This commit is contained in:
Ranjani Sridharan 2023-07-06 18:10:27 -07:00 committed by Liam Girdwood
parent a1776860b6
commit 7427d7fe36
1 changed files with 10 additions and 0 deletions

View File

@ -539,6 +539,10 @@ static int asrc_params(struct comp_dev *dev,
comp_info(dev, "asrc_params()");
#if CONFIG_IPC_MAJOR_4
ipc4_base_module_cfg_to_stream_params(&cd->ipc_config.base, pcm_params);
#endif
err = asrc_verify_params(dev, pcm_params);
if (err < 0) {
comp_err(dev, "asrc_params(): pcm params verification failed.");
@ -553,6 +557,12 @@ static int asrc_params(struct comp_dev *dev,
source_c = buffer_acquire(sourceb);
sink_c = buffer_acquire(sinkb);
#if CONFIG_IPC_MAJOR_4
/* update the source/sink buffer formats. Sink rate will be modified below */
ipc4_update_buffer_format(source_c, &cd->ipc_config.base.audio_fmt);
ipc4_update_buffer_format(sink_c, &cd->ipc_config.base.audio_fmt);
#endif
/* Don't change sink rate if value from IPC is 0 (auto detect) */
if (asrc_get_sink_rate(&cd->ipc_config))
audio_stream_set_rate(&sink_c->stream, asrc_get_sink_rate(&cd->ipc_config));