I am streaming video over webRTC in AWS environments, all ports are open, no firewall.
Server 1: Ubuntu 18.04.5 LTS
Server 2: Ubuntu 20.04.6 LTS
With Server 1 after at most 2-3 retries, webRTC chooses the correct candidate pair that has my pc public IP and the remote public IP:
With Server 2 – no matter how many retries, webRTC always chooses the host candidate with my local IP with the remote public IP, thus the connection fails. my PC public IP does appear in the ice candidate list:
All peers on all sides and servers use the same Google stun server stun:stun.l.google.com:19302
. I only stream video data from server to client, so there is no need for TURN.
Also, if all peers over the same network and not AWS, i.e locally, it all works well.
I’ve debugged with wireshark it and also saw that there are responses to the STUN requests but once there is a binding request to the remote server there are no responses (74.125.250.129 is the google stun IP) marked packets have no response.
Stack: client-side written with javascript and native browser API. backend uses python and aiortc
lib. latest chrome.
2
Answers
You are not receiving any STUN responses from the remote side in the second case, shown by responsesReceived still being zero. For AWS this typically suggests that you have not opened up the UDP port.
The binding requests that receive a response are the binding requests sent to the STUN server, it can probably be left out in this case.
In you example for server2, browser will start probing
192.168.1.142->54.73.239.178
. In Wireshark you would see UDP packets being sent to the server. I’d check that on server-side you actually see these packets coming usingtcpdump
. If not – there’s clearly a firewall issue or udp gets blocked somewhere else.Also I’d double-check that during signalling you do receive your srflx candidate on server-side. Aiortc doesn’t have ICE trickle support, so i would just log what’s in "setRemoteDescription".
I’d also check the behaviour in Firefox as their implementation of webrtc is different. Maybe it’ll provide some additional debug information on
about:webrtc
page.