Skip to content

Commit

Permalink
google_rtc_audio_processing: Call SetStreamFormats at prepare() time
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
andyross committed Dec 13, 2023
1 parent 34e0030 commit dc5e5ec
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/audio/google/google_rtc_audio_processing.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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.
*/
Expand Down

0 comments on commit dc5e5ec

Please sign in to comment.