Comment 15 for bug 2025058

Revision history for this message
Gary.Wang (gary-wzl77) wrote :

The error message in the above logs has implied that something is wrong during the signaling.

```
cicn3s78dq6c2rvmnl80:1 Uncaught (in promise) DOMException: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection': Failed to set remote answer sdp: The order of m-lines in answer doesn't match order in offer. Rejecting answer.
```
I don't think it's related to the browser the chaowen has been using.
The issue here was that: the Anbox Cloud that chaowen has deployed on OCI may not be as near as possible. So when he tried to create/join a new session, due to the fact that a short timeout of discover message(0.5), the client used the fallback API for the signaling, which will send the settings and answer to the container via the chain(gw->nats->agent). However later the `resp:discover` message was arriving on the client side. With our current SDK, we will send the settings and offer second time.
So from the chrome:://webrtc-internals, we'll see there're 6 lines of `m-lines` in the offer

https://pastebin.ubuntu.com/p/FBdn9yXM4h/

but 3 lines of 'm-lines' in the answer received by the client.

https://pastebin.ubuntu.com/p/nWCtS5fyxk/

This essentially caused the issue you saw in the console.
```
cicn3s78dq6c2rvmnl80:1 Uncaught (in promise) DOMException: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection': Failed to set remote answer sdp: The order of m-lines in answer doesn't match order in offer. Rejecting answer.
```
I can easily reproduce the same issue when streaming from China and connecting to the Anbox Cloud deployed APAC or US.

What you saw the following
```
Now the problem is sometime working, sometime not working
```
has nothing to do with open ports. It totally depends on the network condition the time you launch the stream. If it worked for you, it implies the the timeout of the discover message didn't occur and API version 2 is in use in this case while API version 1 is in use but a bug in JS SDK blocked the signaling process due to the above bug.

There is a fix for this but need to discuss with the team internally how we deliver this and in which version.

BR
Gary