Unity-Technologies / Unity-Technologies/com.unity.webrtc

[BUG]: even though both clients are "Connected," OnTrack is not called ONLY IF the initial offer was sent *from* CGNAT

Open
#1,083 0 comments 0 reactions 1 assignee View on GitHub

@karasusan is already working on this.

Since Jun 14, 2025.

bug
Dominant language
Assembly
Stars
852
Forks
238
PR merge metrics
No merged PRs in 30d

Description

Package version

3.0.0-pre.8

Environment
* OS: MacOS + iOS (tested both)
* Unity version: 6000.1.6f1
Steps To Reproduce

I will refer to my two clients as DSL and Starlink, based on their ISPs (n.b., DSL=CenturyLink, Starlink=mobile roam unlimited package). In effect, this means Starlink has CGNAT and IPv6, while DSL has neither.

  1. Initiate the offer from DSL -> Starlink. Everything works correctly (i.e., video feed appears)
  2. Invert the WiFi connections (I have two WiFi networks), so the machines now have reversed ISPs. Perform the same connection steps, and notice that no video feed appears (even though the connection succeeds).
Current Behavior

When going Starlink -> DSL (the failure case), all of the "correct" callbacks are fired, including the final "OnIceConnectionStateChanged" with state=RTCPeerConnectionState.Connected (on both sides). However, the OnTrack callback never fires (on either side), and video feeds never appear.

NOTE that there is no technical reason this should not work. In fact, LiteNetLib (another P2P UDP library) works perfectly fine in both directions. The only reason I'm using the WebRtc package at all is for its built-in video encoding, which is otherwise a hard problem with Unity. I use the two packages side-by-side and send all other forms of communication (such as audio streams) via LiteNetLib, which is overall lower latency and more reliable (in fact, my ICE offers are done through LiteNetLib, since that connection is established first).

Expected Behavior

At the very least, the package should not fire a "Succeeded" event when, in fact, the two clients are not talking to each other. Ideally, it should not exhibit problems connecting two clients when there is nothing preventing them from doing so.

Anything else?

I am assuming that the problem here is the CGNAT, though I can't be 100% confident because the Starlink Mobile package is the only CGNAT ISP I have available to test with. I do have a 3rd ISP, which is also non-CGNAT, and it behaves the same as DSL (i.e., succeeds when initiating the offer, and fails when the offer is initiated by Starlink).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.