File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -386,7 +386,7 @@ export default class RTCPeerConnection extends EventTarget(PEER_CONNECTION_EVENT
386386 // is reserved due to SCTP INIT and INIT-ACK chunks only allowing a
387387 // maximum of 65535 streams to be negotiated (as defined by the WebRTC
388388 // Data Channel Establishment Protocol).
389- for ( id = 0 ; id < 65535 && dataChannelIds . has ( id ) ; ++ id ) ;
389+ for ( id = 1 ; id < 65535 && dataChannelIds . has ( id ) ; ++ id ) ;
390390 // TODO Throw an error if no unused id is available.
391391 dataChannelDict = Object . assign ( { id} , dataChannelDict ) ;
392392 }
Original file line number Diff line number Diff line change @@ -29,12 +29,10 @@ @implementation WebRTCModule (RTCDataChannel)
2929{
3030 RTCPeerConnection *peerConnection = self.peerConnections [peerConnectionId];
3131 RTCDataChannel *dataChannel = [peerConnection dataChannelForLabel: label configuration: config];
32- // XXX RTP data channels are not defined by the WebRTC standard, have been
33- // deprecated in Chromium, and Google have decided (in 2015) to no longer
34- // support them (in the face of multiple reported issues of breakages).
35- if (-1 != dataChannel.channelId ) {
32+ if (dataChannel != nil && (dataChannel.readyState == RTCDataChannelStateConnecting
33+ || dataChannel.readyState == RTCDataChannelStateOpen)) {
3634 dataChannel.peerConnectionId = peerConnectionId;
37- NSNumber *dataChannelId = [NSNumber numberWithInteger: dataChannel .channelId];
35+ NSNumber *dataChannelId = [NSNumber numberWithInteger: config .channelId];
3836 peerConnection.dataChannels [dataChannelId] = dataChannel;
3937 dataChannel.delegate = self;
4038 }
You can’t perform that action at this time.
0 commit comments