audio latency optimization in webrtc

67 views
Skip to first unread message

Jakob Ashtar

unread,
Nov 9, 2025, 5:59:38 AM (3 days ago) Nov 9
to discuss...@googlegroups.com
Hello,

Could someone tell me what are the typical areas where you can aggressively optimize the WebRTC audio pipeline so that audio latency is as low as possible (even sacrificing smooth audio playback for low latency) ?

Is FEC ever enabled for Opus? What is the default setting? Under which circumstances will it be on and off?  Where is it controlled?

Is rtx-time something that is used for audio in WebRTC? If yes, where is it controlled? (I believe the answer is no, but looking for confirmation)

Is RED something that is used for audio in WebRTC? If so, is it off by default and under which circumstances will it be enabled? Where is it controlled?

Lastly, unrelated to the above: Is there currently a bug in WebRTC that is causing device selection/switch to be laggy and even deadlocked on MacOS?

Thanks 
Jake

guest271314

unread,
Nov 9, 2025, 11:01:55 AM (3 days ago) Nov 9
to discuss-webrtc
You can try constructing a Web Audio API AudioContext with latencyHint option set to 0, then create an AudioWorkletNode, then connect the AudioWorkletNode to a MediaStreamAudioDestinationNode, then do stuff with that MediaStreamTrack.

Jakob Ashtar

unread,
Nov 9, 2025, 11:29:22 AM (3 days ago) Nov 9
to discuss...@googlegroups.com
Thank you. I'm not sure what that translates to in the C/C++ WebRTC stack?  



--
This list falls under the WebRTC Code of Conduct - https://webrtc.org/support/code-of-conduct.
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/discuss-webrtc/6e6bde63-b7ff-46ec-a43c-a64a3fb5eda3n%40googlegroups.com.

guest271314

unread,
Nov 9, 2025, 11:48:23 AM (3 days ago) Nov 9
to discuss...@googlegroups.com
Me either. That's how I do it in the front-end.
> You received this message because you are subscribed to a topic in the Google Groups "discuss-webrtc" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/discuss-webrtc/kdXMDaeHkEs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to discuss-webrt...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/discuss-webrtc/CAB-OoAAjfcEJ77V%3DdgowUZMPA0dEOqiixJ-3Qog8%3DgxXT41jTA%40mail.gmail.com.

Sean DuBois

unread,
Nov 9, 2025, 11:58:24 AM (3 days ago) Nov 9
to discuss...@googlegroups.com
The easiest solution (and if you want to avoid client modifications) is https://webrtc.googlesource.com/src/+/main/docs/native-code/rtp-hdrext/playout-delay/README.md

Can you describe more about your setup? Is this P2P between two C++ processes? Do you have a server in the mix at all?

Thanks 

--
This list falls under the WebRTC Code of Conduct - https://webrtc.org/support/code-of-conduct.
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.

Jakob Ashtar

unread,
Nov 9, 2025, 12:31:18 PM (3 days ago) Nov 9
to discuss...@googlegroups.com
Thank you for that link. I will definitely check that out.

To answer your question....

It's a Flutter WebRTC audio communication application based on these two:

[1] https://github.com/flutter-webrtc/flutter-webrtc
[2] https://github.com/webrtc-sdk/webrtc

The application supports direct P2P calls (when possible) and calls where a server is in the middle for media relay (livekit).

My goal is to find out how to minimize the end-to-end audio latency as much as possible by tweaking, optimizing and changing configuration parameters in [2] where applicable.

If you have any suggestions on immediate-reward paths that I should take to get low audio latency, then please share your wisdom :-)

Also struggling with long call setup times which is annoying (5+ seconds). Any idea what that is typically caused by and how to fix it? I have a feeling that it has something to do with a sub-optimal configuration for how ICE discovery works, but I'm not an expert on that so I'm not sure.

And finally, if anyone has some insights on the other questions I asked about RED, FEC, rtx-time in [2] and a possible issue on MacOS (very laggy audio device selection, sometimes deadlock causing freezes) I would be happy to hear about that too.

Thanks!





Jakob Ashtar

unread,
Nov 9, 2025, 12:31:25 PM (3 days ago) Nov 9
to discuss...@googlegroups.com
Sean,

I checked out the link you sent and browsed through the WebRTC code, but it looks like this is something that is related to video, refer to VideoDelayTimings in \modules\video_coding\timing\timing.h ??

Thanks!

On Sun, Nov 9, 2025 at 11:58 AM Sean DuBois <se...@pion.ly> wrote:
Reply all
Reply to author
Forward
0 new messages