Usage of webrtcdsp and webrtcechoprobe

Hello community members,

I am using the webrtcdsp and webrtcechoprobe elements from the GStreamer bad plugins with GStreamer v1.22.12.

I am developing a WebRTC-based application on a Yocto-based embedded device. The device has a digital microphone and a speaker placed very close to each other, so there is heavy acoustic echo and crosstalk (speaker output is picked up by the mic).

I am using Nirbheek’s sendrecv WebRTC example as a reference.

  • Current setup
    • The embedded device captures audio + video and sends them to a WebRTC UI.
    • The WebRTC UI sends audio back to the embedded device.
    • That received audio is played on the speaker.
    • The microphone picks up the speaker audio, causing echo.

I tried several combinations of webrtcdsp properties and opusenc tuning. Echo is reduced, but far from acceptable, echo is still clearly audible.

Send pipeline (Embedded → WebRTC UI)

webrtcbin bundle-policy=max-bundle name=sendrecv v4l2src device=/dev/video6 do-timestamp=true io-mode=2 do-timestamp=true ! video/x-raw, format=(string)NV12, width=640, height=480, framerate=30/1 ! clockoverlay name=TextOverLay font-desc="DejaVu Sans Bold, 8" time-format="%Y-%m-%d %H:%M:%S" halignment=left valignment=bottom ! queue ! v4l2h264enc ! rtph264pay ! application/x-rtp, media=video, encoding-name=H264, payload=96 ! queue ! ! sendrecv. alsasrc device=hw:0,14 buffer-time=50000 latency-time=10000 do-timestamp=true provide-clock=true ! audioconvert ! audio/x-raw, format=S16LE, channels=2, rate=48000, layout=interleaved, channel-mask=(bitmask)0x0000000000000003 ! audioresample ! webrtcdsp delay-agnostic=true echo-suppression-level=2 qos=true ! queue ! opusenc ! rtpopuspay ! queue ! application/x-rtp, media=audio, encoding-name=OPUS, payload=97 ! sendrecv.

Receive pipeline (WebRTC UI → Embedded speaker)

WebRTCPad (Audio) → Queue → AudioConvert → AudioResample → WebRTCEchoProbe → Queue → AlsaSink

Even with webrtcdsp and webrtcechoprobe, I cannot eliminate the echo. It is reduced, but still very noticeable.

I would like to know whether my overall pipeline design is correct and whether I am using webrtcdsp and webrtcechoprobe properly. I have already tried extensively tweaking the properties of both opusenc and webrtcdsp, but so far I have not been able to achieve acceptable echo cancellation. I am looking for recommended property settings, any known limitations of WebRTC acoustic echo cancellation in GStreamer, and whether anyone has a working reference pipeline for a similar embedded echo-cancellation use case.

If needed, I can also share the full sendrecv-based C code. Any help from someone who has worked on a similar problem would be greatly appreciated.

Thanks,
Vivek Karna