[webrtc-pc] RTCDataChannel.id assignment

lgrahl has just created a new issue for https://github.com/w3c/webrtc-pc:

== RTCDataChannel.id assignment ==
I'm currently writing a bunch of WPT tests and found that channel ID assignment in particular trips all implementations in several places. I found out that channel id assignment is extremely hard to get right since it can fail in at least three different places even though the spec only speaks of one (the second case):

1. Before the DTLS role is known when creating a data channel (this is not defined in the spec since no ID is being assigned at that point but people aren't silly and do test for the maximum number of streams they support).
2. As soon as the DTLS role is known and already created data channels will be assigned an ID or closed followed by an error event (in case no ID can be assigned).
3. As soon as the SCTP association is established and the number of streams has been negotiated. The negotiated number may be lower than what has been assumed earlier.

I'm not sure if we need to update the spec but we probably should because at least the third case is not covered.
The second case is covered by the spec but DTLS role changes in a subsequent remote description after the channels have been assigned an ID is not covered... I don't even know what to suggest for that... just panic? :wink: 

(The Cpt. Hindsight in me says: A promise for `createDataChannel` would have been much less prone to error because we could have delayed all of this until the SCTP association had been established.)

Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/1818 using your GitHub account

Received on Tuesday, 27 March 2018 22:49:59 UTC