Skip to content

audio: webrtc: build WebRTC audio processing modules as standalone LLEXTs - #11520

Draft
lgirdwood wants to merge 5 commits into
thesofproject:mainfrom
lgirdwood:topic/webrtc-llext-split
Draft

lgirdwood wants to merge 5 commits into
thesofproject:mainfrom
lgirdwood:topic/webrtc-llext-split

Conversation

@lgirdwood

@lgirdwood lgirdwood commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Convert all six WebRTC audio processing modules from LIB openmodules (bundled inside sof-<plat>-openmodules.ri) into individual standalone .llext modules with dedicated <UUID>.bin symlinks:

  • 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_size VMA 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

Verification

  • Hardware verified on Damsel Fly (PTL / ACE 3.0) (CONFIG_LLEXT_TYPE_ELF_RELOCATABLE=y):
    • webrtc_aec.llext loaded standalone from sof-ipc4-lib/ptl/community/e5da7b5b-....bin, initialized the aecm backend in DP userspace with heap_bytes_requirement 262144, and captured 192044 bytes cleanly via arecord.
  • Build & Static Checks (intel_adsp/ace30/ptl, CONFIG_COMP_BT_CODEC=n locally):
    • CONFIG_LLEXT_TYPE_ELF_RELOCATABLE=y (webrtc_overlay.conf): all 6 standalone .llexts built and signed cleanly with rimage (module_size=0xbc000, fits default 0x100000 library region), zero missing imports against llext_const_symbol_area.
    • CONFIG_LLEXT_TYPE_ELF_SHAREDLIB=y (webrtc_overlay.conf): all 6 standalone .llexts built and signed cleanly with rimage (module_size=0x131000), zero missing .dyn-syms against llext_const_symbol_area.
    • webrtc_aec Float 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 (=y with float AEC): built cleanly.

Related

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 shim files 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
monolithic builds (e.g. CAVS 2.5 where CONFIG_LIBRARY_MANAGER=n) 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>
When CONFIG_USERSPACE is enabled, webrtc_vad runs in a user thread and
invokes notifier_event() on VAD state changes. Instead of exporting raw
notifier_event() directly to LLEXT/userspace (where host_notify state is
not partitioned for user access), expose notifier_event() via a Zephyr
__syscall wrapper.

In z_vrfy_notifier_event(), restrict userspace delivery to
NOTIFIER_ID_VAD on the local core only, verify the exact int payload
size, and copy the VAD state into kernel stack storage via
k_usermode_from_copy() before invoking z_impl_notifier_event().

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).

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants