Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/stub_build_all_ipc4.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ CONFIG_COMP_STUBS=y
CONFIG_COMP_ARIA=y
CONFIG_COMP_CHAIN_DMA=y
CONFIG_COMP_UP_DOWN_MIXER=y
CONFIG_COMP_WEBRTC_VAD=m
CONFIG_COMP_WEBRTC_NS=m
CONFIG_COMP_WEBRTC_AEC=m
CONFIG_COMP_WEBRTC_NS2=m
CONFIG_COMP_WEBRTC_AGC=m
CONFIG_COMP_WEBRTC_HPF=m
CONFIG_IPC_MAJOR_4=y
CONFIG_SAMPLES=y
CONFIG_SAMPLE_SMART_AMP=y
Expand Down
44 changes: 44 additions & 0 deletions app/webrtc_overlay.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# WebRTC Audio Processing Modules Kconfig overlay (LLEXT real backends)

# WebRTC NS (classic spectral Wiener filter)
CONFIG_COMP_WEBRTC_NS=m
CONFIG_COMP_WEBRTC_NS_STUB=n
CONFIG_WEBRTC_NS_LEVEL=2
CONFIG_WEBRTC_NS_SAMPLE_RATE_HZ=16000

# WebRTC VAD (libfvad Voice Activity Detector)
CONFIG_COMP_WEBRTC_VAD=m
CONFIG_COMP_WEBRTC_VAD_STUB=n
CONFIG_WEBRTC_VAD_MODE=2
CONFIG_WEBRTC_VAD_FRAME_MS=10

# WebRTC AEC (Acoustic Echo Canceller)
CONFIG_COMP_WEBRTC_AEC=m
CONFIG_WEBRTC_AEC_BACKEND_AECM=y
CONFIG_WEBRTC_AEC_FILTER_LEN_MS=64
CONFIG_WEBRTC_AEC_SUPPRESSION_LEVEL=1
CONFIG_WEBRTC_AEC_SAMPLE_RATE_HZ=16000

# WebRTC NS2 (RNNoise neural network noise suppression)
CONFIG_COMP_WEBRTC_NS2=m
CONFIG_COMP_WEBRTC_NS2_STUB=n
CONFIG_WEBRTC_NS2_CHANNELS_MAX=2
CONFIG_WEBRTC_NS2_VAD_THRESHOLD_PCT=60
CONFIG_WEBRTC_NS2_VAD_NOTIFY=y

# WebRTC HPF (High-Pass Filter 80 Hz biquad)
CONFIG_COMP_WEBRTC_HPF=m
CONFIG_COMP_WEBRTC_HPF_STUB=n

# WebRTC AGC (Automatic Gain Control & Limiter)
CONFIG_COMP_WEBRTC_AGC=m
CONFIG_COMP_WEBRTC_AGC_STUB=n
CONFIG_WEBRTC_AGC_TARGET_DBFS=3
CONFIG_WEBRTC_AGC_COMPRESSION_GAIN_DB=9
CONFIG_WEBRTC_AGC_LIMITER=y

# Heap and stack sizing for full WebRTC suite
CONFIG_HEAP_MEM_POOL_SIZE=131072
CONFIG_SOF_ZEPHYR_HEAP_SIZE=0x80000
16 changes: 16 additions & 0 deletions app/webrtc_stubs_overlay.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# WebRTC Audio Processing Modules Kconfig overlay (LLEXT pass-through stub backends)

CONFIG_COMP_WEBRTC_VAD=m
CONFIG_COMP_WEBRTC_VAD_STUB=y
CONFIG_COMP_WEBRTC_NS=m
CONFIG_COMP_WEBRTC_NS_STUB=y
CONFIG_COMP_WEBRTC_AEC=m
CONFIG_COMP_WEBRTC_AEC_STUB=y
CONFIG_COMP_WEBRTC_NS2=m
CONFIG_COMP_WEBRTC_NS2_STUB=y
CONFIG_COMP_WEBRTC_AGC=m
CONFIG_COMP_WEBRTC_AGC_STUB=y
CONFIG_COMP_WEBRTC_HPF=m
CONFIG_COMP_WEBRTC_HPF_STUB=y
1 change: 1 addition & 0 deletions src/audio/webrtc_aec/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if COMP_WEBRTC_AEC

choice WEBRTC_AEC_BACKEND
prompt "WebRTC AEC processing backend"
default COMP_WEBRTC_AEC_STUB if COMP_STUBS
default WEBRTC_AEC_BACKEND_FLOAT if COMP_WEBRTC_AEC = y
default WEBRTC_AEC_BACKEND_AECM

Expand Down
51 changes: 41 additions & 10 deletions src/audio/webrtc_aec/webrtc_aec.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,14 +641,35 @@ static int webrtc_aec_get_config(struct processing_module *mod, uint32_t config_
return -EINVAL;
}

static bool webrtc_aec_is_ready_to_process(struct processing_module *mod,
struct sof_source **sources,
int num_of_sources,
struct sof_sink **sinks,
int num_of_sinks)
{
struct webrtc_aec_comp_data *cd = module_get_private_data(mod);
struct sof_source *mic;
struct sof_sink *out;

if (!cd || !cd->configured || num_of_sources <= cd->mic_src || num_of_sinks < 1)
return false;

mic = sources[cd->mic_src];
out = sinks[0];

return source_get_data_available(mic) >= source_get_min_available(mic) &&
sink_get_free_size(out) >= sink_get_min_free_space(out);
}

static const struct module_interface webrtc_aec_interface = {
.init = webrtc_aec_init,
.prepare = webrtc_aec_prepare,
.process = webrtc_aec_process,
.set_configuration = webrtc_aec_set_config,
.get_configuration = webrtc_aec_get_config,
.reset = webrtc_aec_reset,
.free = webrtc_aec_free,
.init = webrtc_aec_init,
.prepare = webrtc_aec_prepare,
.is_ready_to_process = webrtc_aec_is_ready_to_process,
.process = webrtc_aec_process,
.set_configuration = webrtc_aec_set_config,
.get_configuration = webrtc_aec_get_config,
.reset = webrtc_aec_reset,
.free = webrtc_aec_free,
};

#if CONFIG_COMP_WEBRTC_AEC_MODULE
Expand All @@ -657,9 +678,19 @@ static const struct module_interface webrtc_aec_interface = {
#include <module/module/llext.h>
#include <rimage/sof/user/manifest.h>

static const struct sof_man_module_manifest mod_manifest __section(".module") __used =
SOF_LLEXT_MODULE_MANIFEST("WRTCAEC", &webrtc_aec_interface, 2,
SOF_REG_UUID(webrtc_aec), 40);
static const struct sof_man_module_manifest mod_manifest __section(".module") __used = {
.module = {
.name = "WRTCAEC",
.uuid = SOF_REG_UUID(webrtc_aec),
.entry_point = (uint32_t)(&webrtc_aec_interface),
.instance_max_count = 40,
.type = {
.load_type = SOF_MAN_MOD_TYPE_LLEXT,
.domain_dp = 1,
},
.affinity_mask = 2,
}
};

SOF_LLEXT_BUILDINFO;

Expand Down
2 changes: 1 addition & 1 deletion src/audio/webrtc_aec/webrtc_aec.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
uuid = UUIDREG_STR_WEBRTC_AEC
affinity_mask = "0x1"
instance_count = "40"
domain_types = "0"
domain_types = "1"
load_type = LOAD_TYPE
module_type = "9"
auto_start = "0"
Expand Down
1 change: 1 addition & 0 deletions src/audio/webrtc_agc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ else()
"${SOF_WEBRTC_APM_SRC_DIR}/webrtc/common_audio/signal_processing/division_operations.c"
"${SOF_WEBRTC_APM_SRC_DIR}/webrtc/common_audio/signal_processing/resample_by_2_internal.c"
"${SOF_WEBRTC_APM_SRC_DIR}/webrtc/common_audio/signal_processing/resample_fractional.c"
"${SOF_WEBRTC_APM_SRC_DIR}/webrtc/common_audio/signal_processing/resample_48khz.c"
)

set_source_files_properties(
Expand Down
2 changes: 1 addition & 1 deletion src/audio/webrtc_agc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if COMP_WEBRTC_AGC

config COMP_WEBRTC_AGC_STUB
bool "Build with pass-through stub backend"
default n
default y if COMP_STUBS
help
Select to build with the pass-through stub backend instead of the real AGC.

Expand Down
2 changes: 1 addition & 1 deletion src/audio/webrtc_agc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Wraps WebRTC's digital Automatic Gain Control (`digital_agc.c`) behind the SOF `

- **Adaptive Speech Leveling**: Analyzes short-term speech envelope and applies dynamic digital gain to boost quiet talkers without amplifying background stationary noise.
- **Integrated Saturation Limiter**: S-curve saturation limiter with fast lookahead attack and smooth release decay, guaranteeing zero digital overs.
- **Framing FIFO Engine**: Transparently decouples pipeline period sizes (e.g., 1 ms, 2 ms, or 5 ms) by buffering streaming audio into standard 10 ms WebRTC analysis frames (160 samples @ 16 kHz, 80 samples @ 8 kHz).
- **Framing FIFO Engine**: Transparently decouples pipeline period sizes (e.g., 1 ms, 2 ms, or 5 ms) by buffering streaming audio into standard 10 ms WebRTC analysis frames (80/160/320/480 samples @ 8/16/32/48 kHz).
- **Pure Fixed-Point Implementation**: Pure integer Q15/Q31 arithmetic with zero floating-point unit dependencies (`CONFIG_FPU=n`).
- **ALSA IPC4 Switch Control**: Runtime bypass/enable toggling via standard ALSA mixer controls (`SOF_IPC4_SWITCH_CONTROL_PARAM_ID`).
- **Multichannel Support**: Accommodates up to 4 audio channels with per-channel state instances.
Expand Down
2 changes: 2 additions & 0 deletions src/audio/webrtc_agc/llext/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ else()
${SOF_WEBRTC_APM_SRC_DIR}/webrtc/common_audio/signal_processing/dot_product_with_scale.c
${SOF_WEBRTC_APM_SRC_DIR}/webrtc/common_audio/signal_processing/resample_by_2.c
${SOF_WEBRTC_APM_SRC_DIR}/webrtc/common_audio/signal_processing/resample_by_2_internal.c
${SOF_WEBRTC_APM_SRC_DIR}/webrtc/common_audio/signal_processing/resample_fractional.c
${SOF_WEBRTC_APM_SRC_DIR}/webrtc/common_audio/signal_processing/resample_48khz.c
INCLUDES "${SOF_WEBRTC_APM_SRC_DIR}"
"${SOF_WEBRTC_APM_SRC_DIR}/webrtc/modules/audio_processing/agc/legacy"
"${SOF_WEBRTC_APM_SRC_DIR}/webrtc/common_audio/signal_processing/include"
Expand Down
Loading
Loading