Pulseaudio and module-echo-cancel YOCTO recipe

Hello @jbruno,

I tested this again and was able to run into the issue you reported.

By setting log-level = debug in /etc/pulse/daemon.conf and running pulseaudio in the foreground, you can see the error that happens when trying to load module-echo-cancel:

root@verdin-imx8mm-06898561:~# pulseaudio -vvv &
...
root@verdin-imx8mm-06898561:~# pactl load-module module-echo-cancel
I: [pulseaudio] client.c: Created 3 "Native client (UNIX socket client)"
D: [pulseaudio] protocol-native.c: Protocol version: remote 35, local 35
I: [pulseaudio] protocol-native.c: Got credentials: uid=0 gid=0 success=1
D: [pulseaudio] protocol-native.c: SHM possible: yes
D: [pulseaudio] protocol-native.c: Negotiated SHM: yes
D: [pulseaudio] protocol-native.c: Memfd possible: yes
D: [pulseaudio] protocol-native.c: Negotiated SHM type: shared memfd
D: [pulseaudio] memblock.c: Using shared memfd memory pool with 1024 slots of size 64.0 KiB each, total size is 64.0 MiB, maximum usable slot size is 65472
D: [pulseaudio] srbchannel.c: SHM block is 65472 bytes, ringbuffer capacity is 2 * 32712 bytes
D: [pulseaudio] protocol-native.c: Enabling srbchannel...
D: [pulseaudio] module-augment-properties.c: Looking for .desktop file for pactl
D: [pulseaudio] protocol-native.c: Client enabled srbchannel.
E: [pulseaudio] module-echo-cancel.c: Can't cancel echo between a sink and its monitor
E: [pulseaudio] module.c: Failed to load module "module-echo-cancel" (argument: ""): initialization failed.
Failure: Module initialization failed
I: [pulseaudio] client.c: Freed 3 "pactl"
I: [pulseaudio] protocol-native.c: Connection died.

Please give special attention to the following line from the log:

E: [pulseaudio] module-echo-cancel.c: Can't cancel echo between a sink and its monitor

Therefore, I don’t believe this is a problem with the compilation of pulseaudio or the echo cancellation module, but you need to specify the source_master and the sink_master that module-echo-cancel needs to use, as documented it: Modules – PulseAudio


Regarding the problem with the card not being listed by pulseaudio, please make sure to select the correct device tree for the Dahlia Carrier Board before the first boot, preferably in your Yocto build.
The reason for this is that the default device tree which is loaded is the one for the Verdin Development Board, which uses a different audio codec than the one on the Dahlia Carrier Board.
From BSP 6.7.0, we made some changes that ensure that changing the device tree even after the first boot results in working audio when using alsa, however pulseaudio seems to not detect the audio codec if the device tree was wrong in the first boot.

Here is an example output with the audio codec properly detected in the Dahlia Carrier Board:

root@verdin-imx8mm-06898561:~# pactl list cards
Card #0
	Name: alsa_card.platform-sound-card
	Driver: module-alsa-card.c
	Owner Module: 6
	Properties:
		alsa.card = "0"
		alsa.card_name = "verdin-wm8904"
		alsa.long_card_name = "verdin-wm8904"
		device.bus_path = "platform-sound-card"
		sysfs.path = "/devices/platform/sound-card/sound/card0"
		device.form_factor = "internal"
		device.string = "0"
		device.description = "Built-in Audio"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card"
	Profiles:
		HiFi: Default (sinks: 0, sources: 0, priority: 8000, available: yes)
		off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
	Active Profile: HiFi

Best Regards,
Bruno