From dc5e5ecb81aec83d231b83ec0c902ab009312c17 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 181e883fafa3..8eaac3d5a0cb 100644 --- a/src/audio/google/google_rtc_audio_processing.c +++ b/src/audio/google/google_rtc_audio_processing.c @@ -594,6 +594,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", @@ -629,6 +632,11 @@ static int google_rtc_audio_processing_prepare(struct processing_module *mod, 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. */