[pulseaudio-discuss] Problems with loading the module-echo-cancel with webrtc

Tanu Kaskinen tanuk at iki.fi
Sat May 6 16:58:48 UTC 2017


On Thu, 2017-05-04 at 15:35 +0200, Koenraad Verheyden wrote:
> Hey all,
> 
> I'm using the module-echo-cancel using webrtc. I'm having two problems
> loading the module:
> 
> 1) I can't figure out how to pass multiple aec_args. When I do
> 
> $ pactl load-module module-echo-cancel aec_method=webrtc aec_args="mobile=1
> comfort_noise=1"
> 
> I get the following logs:
> 
> E: [pulseaudio] module-echo-cancel.c: Failed to parse module arguments.
> E: [pulseaudio] module.c: Failed to load module "module-echo-cancel"
> (argument:"aec_method=webrtc aec_args=mobile=1 comfort_noise=1"):
> initialization failed.
> 
> It seems pactl strips away the quotation marks around the arguments? Both
> arguments are recognized if I only supply them separately, so I know they
> are correct.

The quotation marks are stripped already by the shell, and pactl isn't
smart enough to automatically add quotation marks when it sees that a
module argument was passed with a space in it. The arguments are
concatenated into a single string that will then be parsed by the
server, and since the string doesn't contain any quotation marks at
that point, the server can't know that comfort_noise=1 is actually a
part of the aec_args argument. This should work better:

$ pactl load-module module-echo-cancel aec_method=webrtc aec_args="\"mobile=1 comfort_noise=1\""

> 2) pactl load-module seems to ignore format, rate and channels arguments.
> When I execute

pactl doesn't ignore them, module-echo-cancel does that. It looks like
it doesn't at least currently support manually configuring the format,
rate and channels. You can pass use_master_format=true, though, which
should make the filter sink and source use the master sink and source
parameters. The webrtc canceller has some constraints of its own,
though, which you can see in webrtc_ec_fixate_spec() in
src/modules/echo-cancel/webrtc.cc. For example, it will force the
sample format to be float.

> $ pactl load-module module-echo-cancel aec_method=webrtc
> source_name=echo_cancel_source sink_name=echo_cancel_sink format=s16le
> rate=44100 channels=2
> 
> The module loads successfully. But when I check the sinks and sources, my
> sources are not stereo or 44,1 kHz.
> The sample rate isn't really an issue, but I have to use stereo AEC.
> 
> 4    echo_cancel_source    module-echo-cancel.c    float32le 2ch 32000Hz
> SUSPENDED
> 5    echo_cancel_sink.monitor    module-echo-cancel.c    float32le 1ch
> 32000Hz    SUSPENDED
> 
> 2    echo_cancel_sink    module-echo-cancel.c    float32le 1ch 32000Hz
> SUSPENDED
> 
> And I get the following log:
> 
> I: [pulseaudio] module-echo-cancel.c: Using AEC engine: webrtc
> I: [pulseaudio] module-echo-cancel.c: Sample rates of play and out stream
> differ. Adjusting rate of play stream.
> I: [pulseaudio] source.c: Created source 4 "echo_cancel_source" with sample
> spec float32le 2ch 32000Hz and channel map front-left,front-right
> I: [pulseaudio] source.c:     device.master_device =
> "alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo"
> I: [pulseaudio] source.c:     device.class = "filter"
> I: [pulseaudio] source.c:     device.intended_roles = "phone"
> I: [pulseaudio] source.c:     device.description = "USB Audio CODEC  Analog
> Stereo (echo cancelled with USB Audio CODEC  Analog Stereo)"
> I: [pulseaudio] source.c:     device.icon_name = "audio-input-microphone"
> I: [pulseaudio] sink.c: Created sink 2 "echo_cancel_sink" with sample spec
> float32le 1ch 32000Hz and channel map mono
> I: [pulseaudio] sink.c:     device.master_device =
> "alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo"
> I: [pulseaudio] sink.c:     device.class = "filter"
> I: [pulseaudio] sink.c:     device.intended_roles = "phone"
> I: [pulseaudio] sink.c:     device.description = "USB Audio CODEC  Analog
> Stereo (echo cancelled with USB Audio CODEC  Analog Stereo)"
> I: [pulseaudio] sink.c:     device.icon_name = "audio-card"
> I: [pulseaudio] source.c: Created source 5 "echo_cancel_sink.monitor" with
> sample spec float32le 1ch 32000Hz and channel map mono
> I: [pulseaudio] source.c:     device.description = "Monitor of USB Audio
> CODEC  Analog Stereo (echo cancelled with USB Audio CODEC  Analog Stereo)"
> I: [pulseaudio] source.c:     device.class = "monitor"
> I: [pulseaudio] source.c:     device.icon_name = "audio-input-microphone"
> I: [pulseaudio] source-output.c: Trying to change sample rate
> I: [pulseaudio] alsa-source.c: Updating rate for device front:1, new rate
> is 48000
> I: [pulseaudio] source.c: Changed sampling rate successfully
> I: [pulseaudio] source-output.c: Rate changed to 48000 Hz
> I: [alsa-source-USB Audio] alsa-source.c: Trying resume...
> I: [alsa-source-USB Audio] alsa-source.c: Resumed successfully...
> I: [alsa-source-USB Audio] alsa-source.c: Starting capture.
> I: [pulseaudio] source-output.c: Created output 1 "Echo-Cancel Source
> Stream" on
> alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo with
> sample spec float32le 2ch 32000Hz and channel map front-left,front-right
> I: [pulseaudio] source-output.c:     media.name = "Echo-Cancel Source
> Stream"
> I: [pulseaudio] source-output.c:     media.role = "filter"
> I: [pulseaudio] source-output.c:     module-stream-restore.id =
> "source-output-by-media-role:filter"
> I: [alsa-sink-USB Audio] alsa-sink.c: Trying resume...
> I: [alsa-sink-USB Audio] alsa-sink.c: Resumed successfully...
> I: [alsa-sink-USB Audio] alsa-sink.c: Starting playback.
> I: [pulseaudio] resampler.c: Resampler 'ffmpeg' cannot do variable rate,
> reverting to resampler 'auto'.
> I: [pulseaudio] remap_neon.c: Using ARM NEON mono to stereo remapping
> I: [pulseaudio] speex.c: Choosing speex quality setting 1.
> I: [pulseaudio] sink-input.c: Created input 2 "Echo-Cancel Sink Stream" on
> alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo with
> sample spec float32le 1ch 32000Hz and channel map mono
> I: [pulseaudio] sink-input.c:     media.name = "Echo-Cancel Sink Stream"
> I: [pulseaudio] sink-input.c:     media.role = "filter"
> I: [pulseaudio] sink-input.c:     module-stream-restore.id =
> "sink-input-by-media-role:filter"
> I: [pulseaudio] module.c: Loaded "module-echo-cancel" (index: #19;
> argument: "aec_method=webrtc source_name=echo_cancel_source
> sink_name=echo_cancel_sink format=s16le rate=44100 channels=2").
> E: [alsa-source-USB Audio] module-echo-cancel.c: Doing resync
> E: [alsa-source-USB Audio] module-echo-cancel.c: Playback too far ahead
> (96683), drop source 24744
> 
> Do you have any idea what causes this?

Do you mean the errors at the end of the log? I don't know what causes
it. I suspect a resync is a fairly normal thing, and shouldn't be
logged as an error. I have never used module-echo-cancel seriously, but
often when I've loaded it to investigate some bug, I've seen the resync
error messages too. Arun might know better.

-- 
Tanu

https://www.patreon.com/tanuk


More information about the pulseaudio-discuss mailing list