From 65d22c405e79b1b86880c566315b016ae1810637 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Fri, 23 Oct 2026 16:31:58 +0300 Subject: [PATCH] topology2: webrtc-aec: use single format on the input pins The webrtc-aec has two input pins: pin0 for the microphone data and pin1 for the echo reference. The format of the module's pins is set at instantiation time; pin0 via the base config and pin1 via the base config extension. There is no way to change it afterwards. When a module has multiple input pins, the host can only configure them correctly if each pin has a single format: the module can be instantiated from either path. When the echo reference path is set up first, the host has no information on which of the pin0 formats (S16 or S32) is going to be used by the microphone path, and the pin1 format is always taken as the first one listed. Remove the S32 formats from the class definition, leaving a single S16 format on each pin and on the output. The output uses the sample format of pin0 in the firmware. The only user, the nocodec webrtc-aec topology uses S16. Signed-off-by: Peter Ujfalusi --- .../include/components/webrtc-aec.conf | 30 +++++-------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/tools/topology/topology2/include/components/webrtc-aec.conf b/tools/topology/topology2/include/components/webrtc-aec.conf index efb46bdbc603..f83f8cd5d25e 100644 --- a/tools/topology/topology2/include/components/webrtc-aec.conf +++ b/tools/topology/topology2/include/components/webrtc-aec.conf @@ -100,9 +100,13 @@ Class.Widget."webrtc-aec" { } } - # 4 input formats: pin0 (mic) S16/S32 + pin1 (ref) S16/S32 - num_input_audio_formats 4 - num_output_audio_formats 2 + # pin0 is the microphone and pin1 is the echo reference. The module has multiple + # input pins, each pin must have a single format since the formats of the pins + # cannot be selected at runtime. The output uses the sample format of pin0. + # Override the formats in the widget object for S32 (pin0 and output) or for a + # different channel count. + num_input_audio_formats 2 + num_output_audio_formats 1 Object.Base.input_audio_format [ # Pin 0 — microphone S16 @@ -112,13 +116,6 @@ Class.Widget."webrtc-aec" { in_valid_bit_depth 16 ibs "$[(($in_channels * ($[($in_rate + 999)] / 1000)) * ($in_bit_depth / 8)) * $WEBRTC_AEC_PERIOD_MS]" } - # Pin 0 — microphone S32 - { - input_pin_index 0 - in_bit_depth 32 - in_valid_bit_depth 32 - ibs "$[(($in_channels * ($[($in_rate + 999)] / 1000)) * ($in_bit_depth / 8)) * $WEBRTC_AEC_PERIOD_MS]" - } # Pin 1 — echo reference S16 { input_pin_index 1 @@ -126,13 +123,6 @@ Class.Widget."webrtc-aec" { in_valid_bit_depth 16 ibs "$[(($in_channels * ($[($in_rate + 999)] / 1000)) * ($in_bit_depth / 8)) * $WEBRTC_AEC_PERIOD_MS]" } - # Pin 1 — echo reference S32 - { - input_pin_index 1 - in_bit_depth 32 - in_valid_bit_depth 32 - ibs "$[(($in_channels * ($[($in_rate + 999)] / 1000)) * ($in_bit_depth / 8)) * $WEBRTC_AEC_PERIOD_MS]" - } ] Object.Base.output_audio_format [ @@ -142,12 +132,6 @@ Class.Widget."webrtc-aec" { out_valid_bit_depth 16 obs "$[(($out_channels * ($[($out_rate + 999)] / 1000)) * ($out_bit_depth / 8)) * $WEBRTC_AEC_PERIOD_MS]" } - # S32 output - { - out_bit_depth 32 - out_valid_bit_depth 32 - obs "$[(($out_channels * ($[($out_rate + 999)] / 1000)) * ($out_bit_depth / 8)) * $WEBRTC_AEC_PERIOD_MS]" - } ] # UUID: e5da7b5b-133a-ba46-b517651d6300bb83