Repository navigation
Conversation
Add an SDW_SPK_AEC_CAPTURE_PCM option that routes the speaker echo reference to a webrtc-aec module instead of the echo reference host PCM. The SoundWire DMIC capture from module-copier.41.0 and the speaker echo reference are both downmixed to mono with micsel and resampled from 48 kHz to 16 kHz with SRC before the AEC, so the AECm backend cancels the echo of both speaker channels. The echo cancelled signal is captured with a new mono 16 kHz "Microphone AEC Capture" PCM 14. The AEC pins use 10 ms buffers to match the AEC processing block size. Add the development target sof-ptl-rt713-l3-rt1320-l12-aec for testing. The topologies without SDW_SPK_AEC_CAPTURE_PCM are binary identical. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
…ntext The IPC4 base config extension pin formats were allocated from the heap of the module allocation context. For a userspace DP module that heap is the shared system user heap, which is not mapped into the DP thread memory domain, so a module reading its input pin formats in prepare faulted with a load/store privilege exception. Allocate and free the pin formats with sof_ctx_alloc() and sof_ctx_free() so they are placed in the module vregion when one exists, the same as the module and device objects. Modules without a vregion keep using the heap as before. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
There was a problem hiding this comment.
🟡 Changes recommended
Critical topology instance collisions leave pipeline 120 without matching widgets, while IPC4-specific source-ID handling can swap microphone and reference inputs in IPC3 builds.
2 open issues
What changed in this PR
This PR adds a SoundWire capture topology for mono 16 kHz WebRTC acoustic echo cancellation and updates firmware and build support for practical use.
Changes:
- Adds an AEC capture path using SoundWire microphones and speaker echo reference.
- Enables the floating-point AEC backend in loadable modules and updates resource requirements.
- Adjusts input selection, reference-format validation, and module configuration allocation.
| File | Description |
|---|---|
| tools/topology/topology2/platform/intel/sdw-amp-echo-ref.conf | Gates host echo-reference capture when AEC capture is enabled. |
| tools/topology/topology2/platform/intel/sdw-amp-aec.conf | Adds microphone and reference downmixing, resampling, and AEC capture. |
| tools/topology/topology2/include/components/webrtc-aec.conf | Declares the AEC heap requirement. |
| tools/topology/topology2/development/tplg-targets.cmake | Registers the PTL RT713/RT1320 AEC topology target. |
| tools/topology/topology2/cavs-sdw.conf | Adds AEC includes and feature gating. |
| src/audio/webrtc_aec/webrtc_aec.toml | Sets the module initialization configuration field. |
| src/audio/webrtc_aec/webrtc_aec.cmake | Selects backend sources and rebuilds the library when script settings change. |
| src/audio/webrtc_aec/webrtc_aec.c | Uses input pin IDs and validates reference-format metadata. |
| src/audio/webrtc_aec/webrtc_aec-shims.c | Removes the unavailable panic call from the realloc shim. |
| src/audio/webrtc_aec/webrtc_aec-math.c | Adds a loadable-module square-root implementation. |
| src/audio/webrtc_aec/llext/CMakeLists.txt | Selects floating-point or fixed-point backend glue. |
| src/audio/webrtc_aec/Kconfig | Allows the floating-point backend for loadable modules. |
| src/audio/module_adapter/module_adapter.c | Frees pin metadata through the allocation context. |
| src/audio/module_adapter/module_adapter_ipc4.c | Allocates pin metadata through the allocation context. |
Review effort: Balanced
The microphone and echo reference were identified by comparing the source pipeline IDs with the sink pipeline. When neither source is in the output pipeline, e.g. both arrive via SRC pipelines, the code fell back to the bind order and could pass the reference through as the microphone. With IPC4 use the destination queue ID of each source instead, pin 0 is the microphone and pin 1 the reference. IPC3 has no queue IDs in the buffer ID, so it keeps the pipeline based selection. Set init_config in the manifest so the kernel sends the per-pin formats that prepare uses for the reference, and fail prepare cleanly if they are missing. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The AECm LLEXT module did not load since the cross-built library referenced __assert_func and the realloc shim called k_panic(), neither of which is exported to modules. Build the library with NDEBUG and drop the panic from the unused realloc shim. The library build script is now regenerated only on content change and is a dependency of the library, so flag changes trigger a rebuild. The float AEC backend was limited to built-in builds. Let the same script cross-build either the float AEC or the AECm sources and link the matching glue code into the module. The float AEC needs sqrtf(), which is provided in the module math helpers for LLEXT builds. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The default 24 KiB DP module heap is not enough for the AEC module private data and the WebRTC echo canceller state. Request 256 KiB, which covers the float AEC backend with margin. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Add an overlay that enables only the WebRTC AEC module as LLEXT with the fixed-point AECm backend. It is lighter than the full WebRTC overlay and is the configuration tested with the SoundWire microphone AEC capture topology on PTL. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
d0836c5 to
6404b7c
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The new SoundWire AEC topology and floating-point LLEXT backend require PTL build and runtime validation of linking, module loading, and playback/capture behavior beyond what the source-only snapshot supports.
No open issues 🎉
2 resolved since last review
Review effort: Balanced
PR 11442: test resultsRun date: 2026-11-11 13:00 UTC Tested commit: 6404b7c4fb67d76adce1dea2213ea033153814ba |

No description provided.