Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Diagnosing WebRTC ICE Failures

For the last three years, whenever I use WebRTC, somewhere or other I will be dogged by the following error:

ICE Failed, see about:webrtc for more details

The error seems to have pop up in a variety of places: If the network is turned off for either peer, causing a failure of WebRTC (this is to be expected); If an answer or offer SDP is created too soon after receiving one; And, seemingly, at random times during signalling for no particular reason.

Whenever this occurs and I can't explain it, I'll head over to about:webrtc and try to find my way through the errors, but since I don't have an idea of what I'm looking for (and there is no "ICE failed because of this thing"), I can never quite figure out what's wrong. As a result, I'm usually doomed to hit-and-miss testing my code.

Obviously, this isn't the best way of doing it. So, my question is, how do I go about diagnosing ICE Failed errors in WebRTC? What should I look for in about:webrtc, what are common errors in my code that could cause this, and are there any diagnostic tools I should know about?

like image 432
Laef Avatar asked Feb 06 '17 19:02

Laef


People also ask

Why WebRTC connection fails?

If the connection fails, it could be a problem of: Signaling: your browser (or iQunet Server) is not allowed to contact peer.iqunet.lu SSL port 80/443. WebRTC data traffic: your computer (or iQunet Server) are behind a very strict firewall that drops all UDP, STUN, TURN etc.

How do I check WebRTC connection?

If you're using Chrome, you can navigate to chrome://webrtc-internals . This will show you the offer, answer, ICE states, and statistics about the connection (once it has been established).

Why do some WebRTC connections fail?

Failed WebRTC connections can be caused by restrictive networks behind symmetric NATs, port blocks and even protocol blocks at the application & transport layers. We will delve in the intricate process of establishing a peer 2 peer WebRTC connection and lay out the mechanisms that can lead to failed connections.

What are ice candidates in WebRTC?

Once a response is received the WebRTC endpoint will send the pair to the other party through the signaling channel. These ip:port pairs are called ICE candidates. There are three types of ICE candidates:

What is the WebRTC connection test?

The WebRTC connection test is a very useful tool for checking everything from discovered ICE candidates and thus network restrictions to supported camera resolutions. We send it out to clients and analyze the text report it generates for troubles.

How to increase connection rates for WebRTC signaling?

Running your signaling over port 80 or 443 is one of the 1st things you can do to ensure high connection rates for WebRTC. Step Two: Discovery (STUN and TURN) Once a signaling connection is established between the (2) WebRTC endpoints and the signaling server, information can be exchanged.


2 Answers

In Chrome, the ICE failure state will be reached if all connections have timed out, not receiving a successful STUN response within 15 seconds.

There are a lot of ICE debug messages in the native log: https://webrtc.org/native-code/logging/

But these log statements would be difficult to interpret without being familiar with the code. If you believe ICE is reaching the failed state and it shouldn't, I'd recommend filing a bug and including the native log.

like image 132
Taylor Brandstetter Avatar answered Sep 28 '22 16:09

Taylor Brandstetter


I guess giving a full answer will be hard to do here.

The best approach is to look at chrome://webrtc-internals and follow the API trace. There's a detailed explanation about what to look for and what the common errors are here: http://testrtc.com/webrtc-api-trace/

like image 42
Tsahi Levent-Levi Avatar answered Sep 28 '22 16:09

Tsahi Levent-Levi