Skip to content

test-case: add WebRTC DSP and lifecycle verification suite - #1365

Open
lgirdwood wants to merge 2 commits into
thesofproject:mainfrom
lgirdwood:topic/webrtc-tests
Open

lgirdwood wants to merge 2 commits into
thesofproject:mainfrom
lgirdwood:topic/webrtc-tests

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Add automated sof-test helpers and functional test cases for the WebRTC processing modules (webrtc_hpf, webrtc_vad, webrtc_ns, webrtc_ns2, webrtc_agc, webrtc_aec) paired with thesofproject/sof#11426.

Summary

  • Tools & shared helpers
    • tools/topo_webrtc_kcontrols.py: inspects compiled .tplg binaries via tplgtool2.py (DapmType.EFFECT) for webrtc-* widgets and their MIXER Switch kcontrols.
    • tools/sof-webrtc-tool.py: generates deterministic chirp-synced test stimuli (450 -> 2800 Hz sync chirp + labeled payload segments) and performs cross-correlation-aligned objective DSP checks (hpf, ns, ns2, agc, vad, aec) with numpy fast paths and stdlib-only (wave/array/math) fallback for bare DUTs.
    • case-lib/webrtc.sh: topology kcontrol discovery (with amixer fallback), exit-safe mixer state save/restore chaining func_exit_handler, USB audio card auto-detection, and unified stimulus routing across:
      • -m ssp: same-card nocodec SSP loopback (SSP0 / SSP0+SSP2 for AEC)
      • -m usb: local DUT external USB sound card injection
      • -m loopback: passive analog/acoustic speaker-to-mic loopback (--single-talk-only when no external near-end mixer is present)
      • -m host: remote host-PC playback stimulus via SSH / command hook (-H)
  • Test cases (test-case/)
    • verify-webrtc-controls.sh: verifies WebRTC Switch kcontrol readback/toggling under active PCM streaming.
    • check-webrtc-hpf.sh: 40 Hz rumble rejection vs 1 kHz passband preservation (HPF Switch ON vs OFF A/B).
    • check-webrtc-ns.sh: post-convergence noise reduction and speech-band SNR for webrtc-ns (16 kHz) and webrtc-ns2 (48 kHz).
    • check-webrtc-agc.sh: quiet-signal boost + near-full-scale limiting (AGC Switch ON vs OFF A/B).
    • check-webrtc-vad.sh: VAD pass-through contrast across supported PCM formats (S16_LE / S32_LE) and NOTIFIER_ID_VAD runtime stability.
    • check-webrtc-aec.sh: Phase 1 capture-only / playback-only / dynamic mid-stream playback attach-detach lifecycle checks, plus Phase 2 single-talk ERLE & double-talk near-end preservation (AEC Switch ON vs OFF A/B).

Validation Status

  • bash -n on all shell scripts and py_compile on both Python tools passed.
  • topo_webrtc_kcontrols.py verified against all 14 *webrtc*.tplg topologies from thesofproject/sof#11426.
  • Synthetic offline DSP calibration tests (hpf, ns, ns2, agc, vad, aec, plus uncancelled AEC failure check) passed under both numpy/scipy and pure-stdlib Python.
  • Marked Draft pending live DUT/SSP hardware runs and CI shellcheck/pylint execution.

@lgirdwood

Copy link
Copy Markdown
Member Author

@harajend @singalsu fyi - this is the starting point

Add infrastructure for automated WebRTC module verification:
- tools/topo_webrtc_kcontrols.py: inspect .tplg binaries via tplgtool2.py
  for webrtc-{hpf,vad,ns,ns2,agc,aec} widgets and mixer Switch kcontrols.
- tools/sof-webrtc-tool.py: generate deterministic chirp-synced stimuli
  and run cross-correlation aligned DSP checks (HPF rumble rejection,
  NS/NS2 noise attenuation, AGC compression & peak limiting, VAD pass-
  through contrast, and AEC single-talk ERLE + double-talk preservation)
  with numpy fast paths and stdlib-only DUT fallback.
- case-lib/webrtc.sh: topology control resolution, safe trap switch
  restore, and unified SSP loopback / local USB card / SSH host PC
  stimulus injection helpers.

Signed-off-by: Liam Girdwood <[email protected]>
Add test cases for upstreamed WebRTC processing modules supporting SSP
loopback (-m ssp), local USB audio (-m usb), and external host PC
injection (-m host), plus HDA/SDW analog loopback (-m loopback):
- verify-webrtc-controls.sh: discover and toggle WebRTC Switch kcontrols
  under active streaming.
- check-webrtc-hpf.sh: 40 Hz rumble attenuation vs 1 kHz passband A/B.
- check-webrtc-ns.sh: stationary noise suppression and speech-band SNR
  for webrtc-ns (16 kHz) and webrtc-ns2 (48 kHz RNNoise).
- check-webrtc-agc.sh: quiet boost + loud peak limiting (AGC ON vs OFF).
- check-webrtc-vad.sh: VAD pass-through contrast across supported PCM
  formats and NOTIFIER_ID_VAD stability.
- check-webrtc-aec.sh: single-source / dynamic mid-stream reference
  lifecycle plus single-talk ERLE and double-talk preservation.

Signed-off-by: Liam Girdwood <[email protected]>
@lgirdwood
lgirdwood marked this pull request as ready for review November 18, 2026 14:39
@lgirdwood
lgirdwood requested review from a team and marc-hb as code owners November 18, 2026 14:39
@marc-hb
marc-hb removed their request for review November 18, 2026 17:01
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