# WebRTC Optimise for Latency

**URL:** <https://community.wowza.com/t/webrtc-optimise-for-latency/92027>\
**Category:** Wowza Streaming Engine\
**Tags:** webrtc, low-latency\
**Created:** [September 30, 2020, 2:29pm UTC](https://community.wowza.com/t/webrtc-optimise-for-latency/92027 "2020-09-30T14:29:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Haywood1](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@Simon\_Haywood1](https://community.wowza.com/u/Simon_Haywood1)\
**Post date:** [September 30, 2020, 2:29pm UTC](https://community.wowza.com/t/webrtc-optimise-for-latency/92027/1 "2020-09-30T14:29:09Z")

</div>

Hi!

We have a self hosted Wowza Streaming Engine. We’ve built an application that you can think of as “just another web conferencing tool” ;-). WebRTC is published from a browser to the WSE, and that stream is then consumed over WebRTC by a different browser.

We’re seeing browser-to-browser latency of about 1 to 2 seconds. That’s ok - but we want it to go faster.

I’m aware of a number of optimisations within the WSE for buffer size and flushing - to reduce the latency of (for example) transcoding. However, I can’t find any reference to similar optimisations for WebRTC.

So firstly, can I optimise the buffer for WebRTC? and if so, how?  
And secondly, are there any other optimisation suggestions for this workflow?

Thanks!

---

<div class="post-metadata">

**Author:** ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)\
**Post date:** [September 30, 2020, 6:33pm UTC](https://community.wowza.com/t/webrtc-optimise-for-latency/92027/2 "2020-09-30T18:33:02Z")

</div>

> [@Simon\_Haywood1](#):
>
> And secondly, are there any other optimisation suggestions for this workflow?

Hi @Simon_Haywood1, I’ll see what I can put together for a webrtc optimization article, but in the meantime, you could try adjusting your audio and video bitrates in the encoder and check the quality until you find the right balance. Another suggestion is to try UDP vs TCP as the Ice candidate (if you have TCP listed as first priority and UDP second).

---

<div class="post-metadata">

**Author:** ![Simon\_Haywood1](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@Simon\_Haywood1](https://community.wowza.com/u/Simon_Haywood1)\
**Post date:** [September 30, 2020, 7:58pm UTC](https://community.wowza.com/t/webrtc-optimise-for-latency/92027/3 "2020-09-30T19:58:31Z")

</div>

Good suggestion. I’ll try UDP.

Are there any buffer-like settings I can tweak?

Thanks!

---

<div class="post-metadata">

**Author:** ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)\
**Post date:** [September 30, 2020, 8:22pm UTC](https://community.wowza.com/t/webrtc-optimise-for-latency/92027/4 "2020-09-30T20:22:35Z")

</div>

Yes! Webrtc does not like B-frames and that is something that can be disabled in the encoder settings. If you encode with H.264 Main or High profile, the stream will contain _B_ - _frames_ .WebRTC protocol which is developed for low latency would not be able to handle B-frames which are dependent to other later frames and it will cause jittering.

WebRTC sacrifices B-frames from the GOP structure to enable real-time delivery, which can impact quality.

---

<div class="post-metadata">

**Author:** ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)\
**Post date:** [September 30, 2020, 8:28pm UTC](https://community.wowza.com/t/webrtc-optimise-for-latency/92027/5 "2020-09-30T20:28:14Z")

</div>

We actually suggest UDP for WebRTC over TCP- it’s a bit faster and in Firefox browser, TCP is not supported with WebRTC.

---

<div class="post-metadata">

**Author:** ![Remy\_G](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/remy_g/32/487_2.png) [@Remy\_G](https://community.wowza.com/u/Remy_G)\
**Post date:** [October 1, 2020, 12:57pm UTC](https://community.wowza.com/t/webrtc-optimise-for-latency/92027/6 "2020-10-01T12:57:44Z")

</div>

And if you use UDP, make sure to enable Nack in Wowza (currently not enabled by default). It will help to compensate packet loss by requesting missed packets from the publisher. Instructions to do so on this page (search for Nack): [http://wowza.com/docs/wowza-streaming-engine-software-updates](http://wowza.com/docs/wowza-streaming-engine-software-updates)
