Repository navigation
audio: webrtc: build WebRTC audio processing modules as standalone LLEXTs - #11520
Conversation
473f6f9 to
8306d61
Compare
lgirdwood
left a comment
There was a problem hiding this comment.
Need to fix commit messages fro correct line wrap, code is for ipc4 only.
|
|
||
|
|
||
| float fabsf(float x) | ||
| __attribute__((weak)) float fabsf(float x) |
There was a problem hiding this comment.
The is a STB_WEAK linkage gap in Zephyr that needs fixed here, lets mark this as a TODO
There was a problem hiding this comment.
Marked the Zephyr llext_link_plt() STB_WEAK relocation workaround with explicit TODO comments in webrtc_ns-shims.c and webrtc_ns2-shims.c (matching webrtc_aec-math.c).
| #if defined(__ZEPHYR__) && defined(CONFIG_SOF_FULL_ZEPHYR_APPLICATION) | ||
| #include <sof/compiler_attributes.h> | ||
|
|
||
| __syscall void notifier_event(const void *caller_id, enum notify_id event_type, | ||
| uint32_t core_mask, void *caller_data, uint32_t data_size); | ||
| #include <zephyr/syscalls/notifier.h> | ||
| #else | ||
| void z_impl_notifier_event(const void *caller_id, enum notify_id event_type, | ||
| uint32_t core_mask, void *caller_data, uint32_t data_size); | ||
| #define notifier_event z_impl_notifier_event | ||
| #endif |
There was a problem hiding this comment.
pls have a look at main branch KPB and intel/wov-uaol-d0i3 branch as notifier is deprecated
There was a problem hiding this comment.
Reverted all notifier_event syscall additions (notifier.h, notifier.c, zephyr/syscall/notifier.c, zephyr/CMakeLists.txt) and removed the deprecated notifier_event(NOTIFIER_ID_VAD) calls from webrtc_vad.c and webrtc_ns2.c, replacing them with transition state tracking / comp_dbg() and a TODO to wire future consumers via AMS, Zephyr k_msgq (as in kpb.c), or IPC4 control notifications.
| } | ||
| webrtc_aec_reset_resamplers(cd); | ||
|
|
||
| #ifdef CONFIG_IPC_MAJOR_4 |
There was a problem hiding this comment.
this will be ipc4 only
There was a problem hiding this comment.
Removed #ifdef CONFIG_IPC_MAJOR_4 and consolidated the duplicate reference pin format update in webrtc_aec.c, and added depends on IPC_MAJOR_4 across all remaining WebRTC module Kconfigs (webrtc_agc, webrtc_hpf, webrtc_ns, webrtc_ns2, webrtc_vad).
Compile external WebRTC static libraries (AECm, NS, RNNoise, libfvad) with -fno-pic -fno-pie -mlongcalls -mtext-section-literals -DNDEBUG when building relocatable Xtensa LLEXTs. Without these flags, GCC emits R_XTENSA_PLT internal relocations that the Zephyr LLEXT loader cannot resolve against static archive symbols. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Zephyr sets LL_EXTENSION_BUILD rather than LLEXT_MODULE when compiling relocatable LLEXT sources; check both macros in the WebRTC shims and in webrtc_vad-fvad.c's webrtc_vad_set_active_mod() declaration so active_vad_mod, malloc/free wrappers, and non-userspace BSS placement match the build mode. Also remove the unused <rtos/panic.h> include and k_panic() call from webrtc_aec-shims.c. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Provide __attribute__((weak)) soft-float logf, log10f, expf, cosf, sinf, and atanf shims compiled unconditionally so both relocatable LLEXT and built-in IPC4 firmware builds link without an external libm or duplicate symbol collisions. Implement log2f and exp2f via range reduction into [sqrt(2)/2, sqrt(2)] and [-0.5, 0.5] so inputs across the full positive domain stay accurate and continuous. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Remove notifier_event(NOTIFIER_ID_VAD) calls from webrtc_vad and webrtc_ns2 instead of exposing notifier_event() as a Zephyr syscall. The SOF notifier bus is deprecated and not usable from userspace LLEXTs; no consumer registers for NOTIFIER_ID_VAD, and future consumers should use AMS, a Zephyr k_msgq (as in KPB), or an IPC4 control notification instead. Keep last_decision/last_vad state tracking and log transitions via comp_dbg() with a TODO marker. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Drop 'LIB openmodules' from all six WebRTC module LLEXT builds (webrtc_aec, webrtc_agc, webrtc_hpf, webrtc_ns, webrtc_ns2, webrtc_vad) so each builds and signs as an individual <mod>.llext with its <UUID>.bin symlink instead of being bundled inside sof-<plat>-openmodules.ri. Each standalone module keeps sequential module_size VMA advancement so multiple WebRTC stages (e.g. HPF -> AEC -> NS/NS2 -> AGC -> VAD) can load and run concurrently in the same capture pipeline (total 0xbc000 on PTL relocatable). Also mark all WebRTC modules as IPC4-only via depends on IPC_MAJOR_4 in Kconfig, matching webrtc_aec and their unconditional <ipc4/header.h> usage. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Support both 16-bit and 32-bit PCM formats cleanly across
webrtc_{aec,agc,hpf,ns,vad}, remove redundant #ifdef CONFIG_IPC_MAJOR_4
and duplicate pin format updates in webrtc_aec (IPC4 only), make LLEXT
soft-float math shims non-weak with safe Newton sqrtf in
webrtc_ns-shims.c and webrtc_aec-math.c (marking the Zephyr
llext_link_plt() STB_WEAK gap with TODO comments), and preserve
multi-format routing.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Mark the LLEXT weak-symbol workaround in webrtc_ns2-shims.c with a TODO comment for Zephyr STB_WEAK relocation support, add RNNoise scratch pre-init and OOM NULL checks, and switch webrtc_ns2 to the DP domain with required stack/heap sizes and updated topology UUID. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Update rnnoise from 24dbb35115c6 to 5bd733d7a950 to bring in rnnoise scratch pre-initialization and OOM allocation guards required by webrtc_ns2: 5bd733d rnnoise: add scratch pre-init and OOM allocation guards Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Extract compiler archiver and Xtensa target/PIC flag resolution into scripts/cmake/xtensa_ext_cc.cmake for the four WebRTC standalone LLEXT external library builds, adding Clang target/mcpu/sysroot support and avoiding duplicated flag logic. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
8306d61 to
6cee312
Compare
|
Updated
Rebuilt both PTL |
PR 11520: test resultsRun date: 2026-11-29 14:25 UTC Tested commit: 6cee312517be662b92c64e5f97733fe8da22338f |
Summary
Convert all six WebRTC audio processing modules from
LIB openmodules(bundled insidesof-<plat>-openmodules.ri) into individual standalone.llextmodules with dedicated<UUID>.binsymlinks:webrtc_aec.llext(e5da7b5b-133a-ba46-b517651d6300bb83)webrtc_agc.llext(0af7b529-9dc7-4bee-a8b159e8fbe414f3)webrtc_hpf.llext(6dfb1bea-d858-4ef7-92abcf5b4ee48159)webrtc_ns.llext(0fc8faef-945f-004b-8d5f315047f1136a)webrtc_ns2.llext(eacfacdc-2a87-c942-97e894c917a740db)webrtc_vad.llext(c790b11d-5d14-e54e-be36ba4ad732cc14)Sequential
module_sizeVMA advancement is preserved so multiple WebRTC stages (e.g. HPF -> AEC -> NS/NS2 -> AGC -> VAD) can load and run concurrently in a single capture pipeline.Dependencies
topic/webrtc-pr2): includes its four LLEXT runtime/toolchain prerequisites (-fno-pic -fno-pie -mlongcalls -mtext-section-literalsfor external WebRTC archives,LL_EXTENSION_BUILDshim macro handling, weak soft-float math shims forwebrtc_ns/webrtc_ns2, and the validatednotifier_eventZephyr syscall needed bywebrtc_vadandwebrtc_ns2underCONFIG_USERSPACE=y). These prerequisite commits can be dropped on rebase once topology2: add WebRTC HPF/AGC capture chaining, HDA AEC, and PTL targets #11426 merges.Verification
CONFIG_LLEXT_TYPE_ELF_RELOCATABLE=y):webrtc_aec.llextloaded standalone fromsof-ipc4-lib/ptl/community/e5da7b5b-....bin, initialized theaecmbackend in DP userspace withheap_bytes_requirement 262144, and captured192044bytes cleanly viaarecord.intel_adsp/ace30/ptl,CONFIG_COMP_BT_CODEC=nlocally):CONFIG_LLEXT_TYPE_ELF_RELOCATABLE=y(webrtc_overlay.conf): all 6 standalone.llexts built and signed cleanly withrimage(module_size=0xbc000, fits default0x100000library region), zero missing imports againstllext_const_symbol_area.CONFIG_LLEXT_TYPE_ELF_SHAREDLIB=y(webrtc_overlay.conf): all 6 standalone.llexts built and signed cleanly withrimage(module_size=0x131000), zero missing.dyn-symsagainstllext_const_symbol_area.webrtc_aecFloat backend (CONFIG_WEBRTC_AEC_BACKEND_FLOAT=y,=m): built and signed cleanly with zero missing exports.webrtc_stubs_overlay.conf(=m+STUB=y) and all 6 built-in (=ywith float AEC): built cleanly.Related