From ea8221ac1347a3c0b41029766e4515bcb7c4c966 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Tue, 12 Dec 2023 12:35:56 -0800 Subject: [PATCH] google_rtc_audio_processing: Call SetStreamFormats at prepare() time IPC3 would always send a default config blob at component creation, ensuring we reach the SetStreamFormats() call before any data arrives. IPC4 doesn't do that, so we should affirmatively configure AEC in the prepare() method. Really this is the right way to do things anyway; all the needed info is available dynamically from the stream config anyway, there's no need for host involvement. Signed-off-by: Andy Ross --- src/audio/google/google_rtc_audio_processing.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/audio/google/google_rtc_audio_processing.c b/src/audio/google/google_rtc_audio_processing.c index 2c41c2714370..b0952af4a217 100644 --- a/src/audio/google/google_rtc_audio_processing.c +++ b/src/audio/google/google_rtc_audio_processing.c @@ -602,6 +602,9 @@ static int google_rtc_audio_processing_prepare(struct processing_module *mod, ret = -EINVAL; } + cd->num_aec_reference_channels = MIN(ref_chan, REF_CHAN_MAX); + cd->num_capture_channels = MIN(mic_chan, MIC_CHAN_MAX); + if (ref_rate != mic_rate || ref_rate != out_rate || ref_rate != CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING_SAMPLE_RATE_HZ) { comp_err(dev, "Incorrect source/sink sample rate, expect %d\n", @@ -636,6 +639,11 @@ static int google_rtc_audio_processing_prepare(struct processing_module *mod, cd->ref_frame_bytes = sizeof(mic_sample_t) * source_get_channels(sources[cd->aec_reference_source]); cd->out_frame_bytes = cd->ref_frame_bytes; + ret = GoogleRtcAudioProcessingSetStreamFormats(cd->state, mic_rate, + cd->num_capture_channels, + cd->num_capture_channels, + ref_rate, cd->num_aec_reference_channels); + /* Blobs sent during COMP_STATE_READY is assigned to blob_handler->data * directly, so comp_is_new_data_blob_available always returns false. */