Re: [webrtc-pc] DataChannel max value for "id" before connecting? (#2158)

The maximum amount of streams is something that will always be negotiated during the SCTP handshake. And since we can't assume the other endpoint is a browser, what you worry about is something that can and will happen.

For example, the browser supports 64k streams but the remote is something tiny and only supports 8 inbound and 8 outbound streams.

1. Calling `createDataChannel('foo')` five times will succeed before the handshake completed. `id` will be `null` for all of them.
2. Once the DTLS role has been established (after offer/answer), `id` will be populated by following the odd/even rule. For example: 0, 2, 4, 6 and 8. (This step isn't crystal clear in the spec.)
3. Once the SCTP association has been established, go through each data channel and fire `close` and `error` on those whose `id >= sctp.maxChannels`. So, channel with id 8 will be closed. It will never open.

As you can see, even if the browser supports 64k streams, this is something inevitable. If a browser supports less than that (albeit not spec-compliant in my eyes), it would be the exact same procedure as that would be ultimatively reflected by `sctp.maxChannels`.


-- 
GitHub Notification of comment by lgrahl
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2158#issuecomment-480486736 using your GitHub account

Received on Saturday, 6 April 2019 08:40:59 UTC