Skip to content

audio: webrtc: add 32/48 kHz AGC support, LL stack config, and Kconfig overlays - #11419

Draft
lgirdwood wants to merge 3 commits into
thesofproject:mainfrom
lgirdwood:topic/webrtc-pr1
Draft

lgirdwood wants to merge 3 commits into
thesofproject:mainfrom
lgirdwood:topic/webrtc-pr1

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Summary

Follow-up improvements for the WebRTC audio processing module suite merged in #11044:

  1. audio: webrtc_agc: add 32 kHz and 48 kHz sample rate support

    • WebRtcAgc_ProcessDigital() natively accepts 8, 16, 32, and 48 kHz sample rates using 160-sample sub-bands (num_bands = 1 at 8/16 kHz, 2 at 32 kHz, 3 at 48 kHz).
    • Extend webrtc_agc and webrtc-agc.conf to support 32 kHz and 48 kHz streams alongside 8 kHz and 16 kHz by polyphase-splitting 10 ms frames into num_bands 160-sample phases with peak-preserving band-0 ordering so the overload limiter tracks full-rate peaks across all sub-frames.
  2. schedule: zephyr_domain: make LL scheduler stack size configurable

    • Add CONFIG_ZEPHYR_LL_STACK_SIZE (default 8192, automatically 16384 when CONFIG_WEBRTC_AEC_BACKEND_AEC3 is enabled) so deep call stacks in the C++17 WebRTC AEC3 backend do not overflow the LL scheduler thread stack.
  3. app: add WebRTC Kconfig overlays and COMP_STUBS defaults

    • Default webrtc_aec, webrtc_agc, and webrtc_hpf to their pass-through stub backends when CONFIG_COMP_STUBS=y (matching webrtc_ns, webrtc_ns2, and webrtc_vad), and enable all six WebRTC modules in app/stub_build_all_ipc4.conf.
    • Add app/webrtc_overlay.conf (real backends + heap sizing) and app/webrtc_stubs_overlay.conf (stub backends).

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit messages are not line wrapped correctly, and webrtc modules will be deployed as llext raher than built in so we need to make sure we can build as llext.

WebRtcAgc_ProcessDigital(&ch->inst, &in_ptr, 1, &out_ptr,
cd->rate, 0);
} else {
const int16_t *in_ptrs[3];

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a large code block after the else, pls inline comment each section to make it clean what is done and why.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — added step-by-step inline comments (2a through 2e) inside the 32/48 kHz multi-band else block explaining the sub-band pointer setup, polyphase deinterleaving, peak-preserving band-0 swap for the overload limiter, WebRtcAgc_ProcessDigital() call, and phase restoration / re-interleaving.

Comment thread app/stub_build_all_ipc4.conf Outdated
Comment on lines +5 to +10
CONFIG_COMP_WEBRTC_VAD=y
CONFIG_COMP_WEBRTC_NS=y
CONFIG_COMP_WEBRTC_AEC=y
CONFIG_COMP_WEBRTC_NS2=y
CONFIG_COMP_WEBRTC_AGC=y
CONFIG_COMP_WEBRTC_HPF=y

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should be llext modules as this is how they will be deployed

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — changed all six CONFIG_COMP_WEBRTC_* entries to =m (LLEXT modules) in app/stub_build_all_ipc4.conf, app/webrtc_overlay.conf, and app/webrtc_stubs_overlay.conf, and verified PTL LLEXT builds in both real-backend and stub modes.

WebRtcAgc_ProcessDigital natively supports 8, 16, 32, and 48 kHz sample
rates using 160-sample sub-bands (1 band at 8/16 kHz, 2 bands at 32 kHz,
3 bands at 48 kHz).

Extend webrtc_agc to accept 32 kHz and 48 kHz streams in addition to
8 kHz and 16 kHz by polyphase-splitting 10 ms frames into num_bands
160-sample phases with peak-preserving band-0 ordering so the overload
limiter tracks full-rate peaks across all sub-frames. Update the
webrtc-agc topology2 widget definition to list 8, 16, 32, and 48 kHz
formats.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add CONFIG_ZEPHYR_LL_STACK_SIZE (default 8192 bytes, or 16384 bytes when
CONFIG_WEBRTC_AEC_BACKEND_AEC3 is enabled) so modules with deep call
stacks such as the C++17 WebRTC AEC3 engine do not overflow the
low-latency scheduler thread stack.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Select the pass-through stub backends by default for webrtc_aec,
webrtc_agc, and webrtc_hpf when CONFIG_COMP_STUBS=y (matching webrtc_ns,
webrtc_ns2, and webrtc_vad), and include all six WebRTC modules as LLEXT
modules (=m) in app/stub_build_all_ipc4.conf.

Add app/webrtc_overlay.conf (LLEXT real backends + heap sizing) and
app/webrtc_stubs_overlay.conf (LLEXT stub backends) for firmware builds.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
@lgirdwood

Copy link
Copy Markdown
Member Author

Updated the branch to address the review comments:

  1. Wrapped all commit messages to <= 72 characters per line.
  2. Added detailed step-by-step inline comments (2a–2e) to the 32/48 kHz multi-band block in src/audio/webrtc_agc/webrtc_agc-agc.c.
  3. Configured all six WebRTC modules (webrtc_vad, webrtc_ns, webrtc_aec, webrtc_ns2, webrtc_agc, webrtc_hpf) as LLEXT modules (=m) across app/stub_build_all_ipc4.conf, app/webrtc_overlay.conf, and app/webrtc_stubs_overlay.conf, and verified PTL LLEXT builds (sof-ptl-openmodules.ri) in both real-backend and stub modes.

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