matrix-org / waterfall

A cascading stream forwarding unit for scalable, distributed voice and video conferencing over Matrix
Apache License 2.0
98 stars 5 forks source link

Certain participants cannot establish a WebRTC connection to the SFU for the first time #148

Open daniel-abramov opened 1 year ago

daniel-abramov commented 1 year ago

This so far has happened only with @robintown, but it's not clear why it happens.

We do get an incoming connection in the SFU, and the ICE connection gets established without any errors. Still, the peer connection never goes to the connected state, i.e. we never get an onStateChanged() callback in the SFU.

We would need to dig deeper to understand why despite a successful creation of an ICE connection, the peer connection is not established.

AFAIK, after the connecting stage (connecting with the ICE) the following happens: first, the DTLS handshake is done over the connection established with ICE, it compares the certificates used for DTLS to match the fingerprints exchanged during the signaling phase. DTLS is used for DataChannel messages later on. RTP is used for media communication secured by SRTP that extracts keys from the negotiated DTLS session. At this point is considered established (and we get the onStateChanged callback with the state connected).