Page 1 of 1

WebRTC UDP port range issue

PostPosted: Wed May 05, 2021 7:35 am
by AmalKahlout
Hello,
We have .Net desktop app that uses CefSharp. In our app we use WebRTC to create one to one video calls. we are trying to use the chromium policy "WebRtcUdpPortRange" to restrict WebRTC to use a certain UDP ports range, by adding the key "WebRtcUdpPortRange" of type string in registry keys. but the WebRTC is still using random ports, not ports from the range we set in the registry key.

We added Registry string key in the HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE as the following path:
\SOFTWARE\Policies\Chromium
Key name: WebRtcUdpPortRange
Key Value: 52700-60000

Please advice how to restrict the WebRTC to use a certain UDP Ports range.

Thank you.

Re: WebRTC UDP port range issue

PostPosted: Wed May 05, 2021 3:00 pm
by amaitland
CEF doesn't currently support querying the registry so the result you are seeing is expected.

Quick search in the chromium source suggests there is a preference you can try setting.

https://source.chromium.org/chromium/ch ... s=chromium

http://cefsharp.github.io/api/89.0.x/ht ... eAsync.htm
http://cefsharp.github.io/api/89.0.x/ht ... ontext.htm

Re: WebRTC UDP port range issue

PostPosted: Sun May 09, 2021 5:13 pm
by AmalKahlout
Problem solved after adding "webrtc.udp_port_range" preference as following:

Cef.UIThreadTaskFactory.StartNew(delegate
{
using (var context = Cef.GetGlobalRequestContext())
{
string errorMessage;
context.SetPreference("webrtc.udp_port_range", "60000-62500", out errorMessage);
}
});

Thank you!