werift 0.25.2 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/src/asn1.d.ts +42 -0
- package/lib/common/src/asn1.js +163 -0
- package/lib/common/src/asn1.js.map +1 -0
- package/lib/common/src/binaryData.js.map +1 -1
- package/lib/common/src/index.d.ts +6 -5
- package/lib/common/src/index.js +6 -5
- package/lib/common/src/index.js.map +1 -1
- package/lib/common/src/log.d.ts +12 -1
- package/lib/common/src/log.js +137 -5
- package/lib/common/src/log.js.map +1 -1
- package/lib/common/src/network.js.map +1 -1
- package/lib/common/src/queue.d.ts +41 -0
- package/lib/common/src/queue.js +146 -0
- package/lib/common/src/queue.js.map +1 -0
- package/lib/common/src/transport.d.ts +15 -2
- package/lib/common/src/transport.js +98 -14
- package/lib/common/src/transport.js.map +1 -1
- package/lib/dtls/src/cipher/create.js.map +1 -1
- package/lib/dtls/src/cipher/ec.js +8 -8
- package/lib/dtls/src/cipher/ec.js.map +1 -1
- package/lib/dtls/src/cipher/namedCurve.js +6 -7
- package/lib/dtls/src/cipher/namedCurve.js.map +1 -1
- package/lib/dtls/src/cipher/prf.d.ts +2 -2
- package/lib/dtls/src/cipher/prf.js +29 -8
- package/lib/dtls/src/cipher/prf.js.map +1 -1
- package/lib/dtls/src/cipher/suites/aead.d.ts +1 -1
- package/lib/dtls/src/context/certificate.d.ts +32 -0
- package/lib/dtls/src/context/certificate.js +54 -0
- package/lib/dtls/src/context/certificate.js.map +1 -0
- package/lib/dtls/src/context/cipher.d.ts +12 -6
- package/lib/dtls/src/context/cipher.js +52 -103
- package/lib/dtls/src/context/cipher.js.map +1 -1
- package/lib/dtls/src/context/transport.d.ts +4 -0
- package/lib/dtls/src/context/transport.js +14 -0
- package/lib/dtls/src/context/transport.js.map +1 -1
- package/lib/dtls/src/flight/client/flight5.js.map +1 -1
- package/lib/dtls/src/flight/flight.js +8 -1
- package/lib/dtls/src/flight/flight.js.map +1 -1
- package/lib/dtls/src/flight/server/flight2.js.map +1 -1
- package/lib/dtls/src/flight/server/flight4.d.ts +2 -1
- package/lib/dtls/src/flight/server/flight4.js +8 -2
- package/lib/dtls/src/flight/server/flight4.js.map +1 -1
- package/lib/dtls/src/handshake/extensions/signature.d.ts +1 -1
- package/lib/dtls/src/handshake/extensions/signature.js.map +1 -1
- package/lib/dtls/src/handshake/message/alert.js +1 -1
- package/lib/dtls/src/handshake/message/alert.js.map +1 -1
- package/lib/dtls/src/handshake/message/certificate.js +1 -1
- package/lib/dtls/src/handshake/message/certificate.js.map +1 -1
- package/lib/dtls/src/handshake/message/changeCipherSpec.js +2 -3
- package/lib/dtls/src/handshake/message/changeCipherSpec.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/certificateVerify.d.ts +1 -1
- package/lib/dtls/src/handshake/message/client/certificateVerify.js +1 -1
- package/lib/dtls/src/handshake/message/client/certificateVerify.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/hello.js +1 -1
- package/lib/dtls/src/handshake/message/client/hello.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/keyExchange.js +1 -1
- package/lib/dtls/src/handshake/message/client/keyExchange.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/certificateRequest.d.ts +1 -1
- package/lib/dtls/src/handshake/message/server/certificateRequest.js +1 -1
- package/lib/dtls/src/handshake/message/server/certificateRequest.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/hello.d.ts +1 -1
- package/lib/dtls/src/handshake/message/server/hello.js +2 -2
- package/lib/dtls/src/handshake/message/server/hello.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/helloDone.js +1 -1
- package/lib/dtls/src/handshake/message/server/helloDone.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js +1 -1
- package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/keyExchange.d.ts +1 -1
- package/lib/dtls/src/handshake/message/server/keyExchange.js +1 -1
- package/lib/dtls/src/handshake/message/server/keyExchange.js.map +1 -1
- package/lib/dtls/src/handshake/random.d.ts +2 -2
- package/lib/dtls/src/handshake/random.js +2 -2
- package/lib/dtls/src/handshake/random.js.map +1 -1
- package/lib/dtls/src/imports/common.d.ts +1 -0
- package/lib/dtls/src/imports/common.js +1 -0
- package/lib/dtls/src/imports/common.js.map +1 -1
- package/lib/dtls/src/index.d.ts +2 -2
- package/lib/dtls/src/index.js +2 -2
- package/lib/dtls/src/index.js.map +1 -1
- package/lib/dtls/src/record/message/fragment.d.ts +1 -1
- package/lib/dtls/src/record/message/fragment.js +3 -3
- package/lib/dtls/src/record/message/fragment.js.map +1 -1
- package/lib/dtls/src/record/message/header.js +2 -2
- package/lib/dtls/src/record/message/header.js.map +1 -1
- package/lib/dtls/src/server.js +1 -1
- package/lib/dtls/src/server.js.map +1 -1
- package/lib/dtls/src/socket.d.ts +2 -2
- package/lib/dtls/src/socket.js +2 -2
- package/lib/dtls/src/socket.js.map +1 -1
- package/lib/ice/src/exceptions.d.ts +30 -0
- package/lib/ice/src/exceptions.js +43 -1
- package/lib/ice/src/exceptions.js.map +1 -1
- package/lib/ice/src/helper.d.ts +1 -1
- package/lib/ice/src/ice.d.ts +142 -0
- package/lib/ice/src/ice.js +809 -53
- package/lib/ice/src/ice.js.map +1 -1
- package/lib/ice/src/iceBase.d.ts +49 -0
- package/lib/ice/src/iceBase.js.map +1 -1
- package/lib/ice/src/index.d.ts +5 -5
- package/lib/ice/src/index.js +5 -5
- package/lib/ice/src/index.js.map +1 -1
- package/lib/ice/src/internal/resolveHostAddresses.d.ts +26 -0
- package/lib/ice/src/internal/resolveHostAddresses.js +45 -0
- package/lib/ice/src/internal/resolveHostAddresses.js.map +1 -0
- package/lib/ice/src/stun/protocol.d.ts +3 -1
- package/lib/ice/src/stun/protocol.js +16 -0
- package/lib/ice/src/stun/protocol.js.map +1 -1
- package/lib/ice/src/stun/tcpProtocol.d.ts +2 -0
- package/lib/ice/src/stun/tcpProtocol.js +16 -1
- package/lib/ice/src/stun/tcpProtocol.js.map +1 -1
- package/lib/ice/src/stun/transaction.d.ts +5 -0
- package/lib/ice/src/stun/transaction.js +7 -1
- package/lib/ice/src/stun/transaction.js.map +1 -1
- package/lib/ice/src/turn/protocol.d.ts +73 -4
- package/lib/ice/src/turn/protocol.js +241 -12
- package/lib/ice/src/turn/protocol.js.map +1 -1
- package/lib/ice/src/utils.js.map +1 -1
- package/lib/ice-server/src/stun/message.d.ts +5 -1
- package/lib/ice-server/src/stun/message.js +33 -2
- package/lib/ice-server/src/stun/message.js.map +1 -1
- package/lib/ice-server/src/turn/auth.d.ts +1 -1
- package/lib/index.mjs +16273 -10807
- package/lib/nonstandard/index.mjs +8644 -7911
- package/lib/polyfill/dom.mjs +22435 -16965
- package/lib/polyfill/index.mjs +22435 -16965
- package/lib/rtp/src/codec/h264.d.ts +1 -1
- package/lib/rtp/src/codec/h264.js.map +1 -1
- package/lib/rtp/src/extra/container/webm/container.d.ts +1 -1
- package/lib/rtp/src/extra/container/webm/ebml/ebml.d.ts +6 -0
- package/lib/rtp/src/extra/container/webm/ebml/ebml.js +20 -1
- package/lib/rtp/src/extra/container/webm/ebml/ebml.js.map +1 -1
- package/lib/rtp/src/extra/processor/depacketizer.d.ts +1 -1
- package/lib/rtp/src/extra/processor/depacketizer.js +1 -1
- package/lib/rtp/src/extra/processor/depacketizer.js.map +1 -1
- package/lib/rtp/src/extra/processor/depacketizerCallback.d.ts +1 -11
- package/lib/rtp/src/extra/processor/depacketizerTransformer.d.ts +1 -1
- package/lib/rtp/src/extra/processor/dtxCallback.d.ts +1 -11
- package/lib/rtp/src/extra/processor/interface.d.ts +16 -11
- package/lib/rtp/src/extra/processor/interface.js.map +1 -1
- package/lib/rtp/src/extra/processor/jitterBufferCallback.d.ts +1 -11
- package/lib/rtp/src/extra/processor/jitterBufferTransformer.d.ts +1 -1
- package/lib/rtp/src/extra/processor/mp4.js +1 -1
- package/lib/rtp/src/extra/processor/mp4.js.map +1 -1
- package/lib/rtp/src/extra/processor/nack.d.ts +1 -1
- package/lib/rtp/src/extra/processor/nack.js +1 -1
- package/lib/rtp/src/extra/processor/nack.js.map +1 -1
- package/lib/rtp/src/extra/processor/nackHandlerCallback.d.ts +1 -11
- package/lib/rtp/src/extra/processor/ntpTime.js.map +1 -1
- package/lib/rtp/src/extra/processor/ntpTimeCallback.d.ts +1 -11
- package/lib/rtp/src/extra/processor/rtcpCallback.d.ts +1 -1
- package/lib/rtp/src/extra/processor/rtcpCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpCallback.d.ts +1 -1
- package/lib/rtp/src/extra/processor/rtpCallback.js +1 -1
- package/lib/rtp/src/extra/processor/rtpCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpStream.d.ts +2 -2
- package/lib/rtp/src/extra/processor/rtpStream.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpTime.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpTimeCallback.d.ts +1 -11
- package/lib/rtp/src/extra/processor/webm.d.ts +27 -0
- package/lib/rtp/src/extra/processor/webm.js +43 -16
- package/lib/rtp/src/extra/processor/webm.js.map +1 -1
- package/lib/rtp/src/extra/processor/webmCallback.js +6 -1
- package/lib/rtp/src/extra/processor/webmCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/webmStream.js.map +1 -1
- package/lib/rtp/src/helper.d.ts +2 -2
- package/lib/rtp/src/helper.js +2 -6
- package/lib/rtp/src/helper.js.map +1 -1
- package/lib/rtp/src/index.d.ts +3 -2
- package/lib/rtp/src/index.js +3 -2
- package/lib/rtp/src/index.js.map +1 -1
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js +2 -1
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js.map +1 -1
- package/lib/rtp/src/rtcp/rtcp.js +2 -1
- package/lib/rtp/src/rtcp/rtcp.js.map +1 -1
- package/lib/rtp/src/rtcp/sr.d.ts +4 -3
- package/lib/rtp/src/rtcp/sr.js +3 -2
- package/lib/rtp/src/rtcp/sr.js.map +1 -1
- package/lib/rtp/src/srtp/cipher/ctr.d.ts +2 -2
- package/lib/rtp/src/srtp/cipher/ctr.js +1 -1
- package/lib/rtp/src/srtp/cipher/ctr.js.map +1 -1
- package/lib/rtp/src/srtp/cipher/gcm.d.ts +1 -1
- package/lib/rtp/src/srtp/cipher/gcm.js +1 -1
- package/lib/rtp/src/srtp/cipher/gcm.js.map +1 -1
- package/lib/rtp/src/srtp/context/context.d.ts +29 -1
- package/lib/rtp/src/srtp/context/context.js +78 -24
- package/lib/rtp/src/srtp/context/context.js.map +1 -1
- package/lib/rtp/src/srtp/context/srtp.js +23 -15
- package/lib/rtp/src/srtp/context/srtp.js.map +1 -1
- package/lib/sctp/src/index.d.ts +4 -3
- package/lib/sctp/src/index.js +10 -8
- package/lib/sctp/src/index.js.map +1 -1
- package/lib/sctp/src/sctp.d.ts +11 -2
- package/lib/sctp/src/sctp.js +47 -28
- package/lib/sctp/src/sctp.js.map +1 -1
- package/lib/webrtc/src/api/peerConfig.d.ts +264 -0
- package/lib/webrtc/src/api/peerConfig.js +250 -0
- package/lib/webrtc/src/api/peerConfig.js.map +1 -0
- package/lib/webrtc/src/api/peerConnectionEvents.d.ts +36 -0
- package/lib/webrtc/src/api/peerConnectionEvents.js +44 -0
- package/lib/webrtc/src/api/peerConnectionEvents.js.map +1 -0
- package/lib/webrtc/src/dataChannel.d.ts +1 -1
- package/lib/webrtc/src/dataChannel.js +1 -1
- package/lib/webrtc/src/dataChannel.js.map +1 -1
- package/lib/webrtc/src/index.d.ts +2 -2
- package/lib/webrtc/src/index.js +2 -2
- package/lib/webrtc/src/index.js.map +1 -1
- package/lib/webrtc/src/media/index.d.ts +1 -1
- package/lib/webrtc/src/media/index.js +1 -1
- package/lib/webrtc/src/media/index.js.map +1 -1
- package/lib/webrtc/src/media/receiver/nack.js +3 -4
- package/lib/webrtc/src/media/receiver/nack.js.map +1 -1
- package/lib/webrtc/src/media/receiver/receiverTwcc.js.map +1 -1
- package/lib/webrtc/src/media/router.d.ts +116 -5
- package/lib/webrtc/src/media/router.js +281 -29
- package/lib/webrtc/src/media/router.js.map +1 -1
- package/lib/webrtc/src/media/rtpReceiver.d.ts +107 -12
- package/lib/webrtc/src/media/rtpReceiver.js +255 -28
- package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
- package/lib/webrtc/src/media/rtpSender.d.ts +56 -3
- package/lib/webrtc/src/media/rtpSender.js +180 -21
- package/lib/webrtc/src/media/rtpSender.js.map +1 -1
- package/lib/webrtc/src/media/rtpTransceiver.d.ts +94 -1
- package/lib/webrtc/src/media/rtpTransceiver.js +111 -2
- package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
- package/lib/webrtc/src/media/sender/senderBWE.d.ts +2 -1
- package/lib/webrtc/src/media/sender/senderBWE.js +22 -10
- package/lib/webrtc/src/media/sender/senderBWE.js.map +1 -1
- package/lib/webrtc/src/media/track.d.ts +1 -1
- package/lib/webrtc/src/media/track.js +1 -1
- package/lib/webrtc/src/media/track.js.map +1 -1
- package/lib/webrtc/src/negotiation/bundleTopology.d.ts +107 -0
- package/lib/webrtc/src/negotiation/bundleTopology.js +380 -0
- package/lib/webrtc/src/negotiation/bundleTopology.js.map +1 -0
- package/lib/webrtc/src/negotiation/descriptionValidation.d.ts +51 -0
- package/lib/webrtc/src/negotiation/descriptionValidation.js +261 -0
- package/lib/webrtc/src/negotiation/descriptionValidation.js.map +1 -0
- package/lib/webrtc/src/negotiation/iceRestartRequest.d.ts +21 -0
- package/lib/webrtc/src/negotiation/iceRestartRequest.js +61 -0
- package/lib/webrtc/src/negotiation/iceRestartRequest.js.map +1 -0
- package/lib/webrtc/src/negotiation/internalState.d.ts +34 -0
- package/lib/webrtc/src/negotiation/internalState.js +21 -0
- package/lib/webrtc/src/negotiation/internalState.js.map +1 -0
- package/lib/webrtc/src/negotiation/negotiationNeeded.d.ts +44 -0
- package/lib/webrtc/src/negotiation/negotiationNeeded.js +118 -0
- package/lib/webrtc/src/negotiation/negotiationNeeded.js.map +1 -0
- package/lib/webrtc/src/negotiation/remoteCandidates.d.ts +86 -0
- package/lib/webrtc/src/negotiation/remoteCandidates.js +344 -0
- package/lib/webrtc/src/negotiation/remoteCandidates.js.map +1 -0
- package/lib/webrtc/src/negotiation/remoteMediaApplication.d.ts +71 -0
- package/lib/webrtc/src/negotiation/remoteMediaApplication.js +398 -0
- package/lib/webrtc/src/negotiation/remoteMediaApplication.js.map +1 -0
- package/lib/webrtc/src/negotiation/transportActivation.d.ts +59 -0
- package/lib/webrtc/src/negotiation/transportActivation.js +345 -0
- package/lib/webrtc/src/negotiation/transportActivation.js.map +1 -0
- package/lib/webrtc/src/negotiationTransaction.d.ts +233 -0
- package/lib/webrtc/src/negotiationTransaction.js +591 -0
- package/lib/webrtc/src/negotiationTransaction.js.map +1 -0
- package/lib/webrtc/src/nonstandard/dummyMedia.js.map +1 -1
- package/lib/webrtc/src/nonstandard/index.d.ts +1 -1
- package/lib/webrtc/src/nonstandard/index.js +1 -1
- package/lib/webrtc/src/nonstandard/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/navigator.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/index.d.ts +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.d.ts +2 -2
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js +2 -2
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js.map +1 -1
- package/lib/webrtc/src/nonstandard/userMedia/packetizer.d.ts +2 -2
- package/lib/webrtc/src/nonstandard/userMedia/packetizer.js.map +1 -1
- package/lib/webrtc/src/nonstandard/userMedia.d.ts +2 -2
- package/lib/webrtc/src/nonstandard/userMedia.js +2 -2
- package/lib/webrtc/src/nonstandard/userMedia.js.map +1 -1
- package/lib/webrtc/src/peerConnection.d.ts +132 -237
- package/lib/webrtc/src/peerConnection.js +971 -908
- package/lib/webrtc/src/peerConnection.js.map +1 -1
- package/lib/webrtc/src/polyfill/api.d.ts +5 -5
- package/lib/webrtc/src/polyfill/api.js.map +1 -1
- package/lib/webrtc/src/polyfill/index.js.map +1 -1
- package/lib/webrtc/src/polyfill/install.js +1 -1
- package/lib/webrtc/src/polyfill/install.js.map +1 -1
- package/lib/webrtc/src/polyfill/mediaDevices.js.map +1 -1
- package/lib/webrtc/src/polyfill/registers/mp4Webm.js.map +1 -1
- package/lib/webrtc/src/polyfill/registers/rtpRtcp.js.map +1 -1
- package/lib/webrtc/src/polyfill/selectSettings.js.map +1 -1
- package/lib/webrtc/src/polyfill/sourceIo.js.map +1 -1
- package/lib/webrtc/src/sctpManager.d.ts +66 -2
- package/lib/webrtc/src/sctpManager.js +122 -5
- package/lib/webrtc/src/sctpManager.js.map +1 -1
- package/lib/webrtc/src/sdp.js.map +1 -1
- package/lib/webrtc/src/sdpManager.d.ts +55 -11
- package/lib/webrtc/src/sdpManager.js +364 -87
- package/lib/webrtc/src/sdpManager.js.map +1 -1
- package/lib/webrtc/src/secureTransportManager.d.ts +38 -25
- package/lib/webrtc/src/secureTransportManager.js +130 -34
- package/lib/webrtc/src/secureTransportManager.js.map +1 -1
- package/lib/webrtc/src/transceiverManager.d.ts +62 -18
- package/lib/webrtc/src/transceiverManager.js +264 -104
- package/lib/webrtc/src/transceiverManager.js.map +1 -1
- package/lib/webrtc/src/transport/dtls.d.ts +11 -2
- package/lib/webrtc/src/transport/dtls.js +37 -13
- package/lib/webrtc/src/transport/dtls.js.map +1 -1
- package/lib/webrtc/src/transport/ice.d.ts +254 -7
- package/lib/webrtc/src/transport/ice.js +608 -52
- package/lib/webrtc/src/transport/ice.js.map +1 -1
- package/lib/webrtc/src/transport/iceCandidateAttribute.d.ts +98 -0
- package/lib/webrtc/src/transport/iceCandidateAttribute.js +129 -0
- package/lib/webrtc/src/transport/iceCandidateAttribute.js.map +1 -0
- package/lib/webrtc/src/transport/sctp.d.ts +4 -1
- package/lib/webrtc/src/transport/sctp.js +83 -17
- package/lib/webrtc/src/transport/sctp.js.map +1 -1
- package/lib/webrtc/src/utils.d.ts +3 -3
- package/lib/webrtc/src/utils.js +1 -1
- package/lib/webrtc/src/utils.js.map +1 -1
- package/package.json +13 -14
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RemoteMediaApplication = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Applies the m-lines of a remote description inside the negotiation
|
|
6
|
+
* transaction: associates each m-line with a transceiver or the SCTP
|
|
7
|
+
* transport, decides the BUNDLE transport ownership, applies RTP / SCTP
|
|
8
|
+
* parameters (accept or mark rejected), and plans the transport parameter
|
|
9
|
+
* updates the caller runs after every fallible step.
|
|
10
|
+
*/
|
|
11
|
+
class RemoteMediaApplication {
|
|
12
|
+
constructor(sdp, transceivers, sctp, router, negotiation, host) {
|
|
13
|
+
Object.defineProperty(this, "sdp", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true,
|
|
17
|
+
value: sdp
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(this, "transceivers", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: transceivers
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(this, "sctp", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true,
|
|
29
|
+
value: sctp
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(this, "router", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
value: router
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(this, "negotiation", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: negotiation
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(this, "host", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true,
|
|
46
|
+
writable: true,
|
|
47
|
+
value: host
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** Resolve all m-line codecs without mutating the current transaction. */
|
|
51
|
+
planCodecs(remoteSdp) {
|
|
52
|
+
const associated = new Set();
|
|
53
|
+
return this.transceivers.planRemoteRtpCodecs(remoteSdp, (remoteMedia, index) => {
|
|
54
|
+
const transceiver = this.findTransceiver(remoteMedia, index, associated);
|
|
55
|
+
if (transceiver)
|
|
56
|
+
associated.add(transceiver);
|
|
57
|
+
return transceiver;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
apply(remoteSdp, codecPlan = new Map()) {
|
|
61
|
+
const bundleGroups = this.sdp.bundlePolicy === "disable"
|
|
62
|
+
? []
|
|
63
|
+
: remoteSdp.group.filter((group) => group.semantic === "BUNDLE");
|
|
64
|
+
const preserveCurrentTransport = (remoteSdp.type === "offer" || remoteSdp.type === "pranswer") &&
|
|
65
|
+
!!this.sdp.currentRemoteDescription;
|
|
66
|
+
const plan = {
|
|
67
|
+
preserveCurrentTransport,
|
|
68
|
+
transportUpdates: [],
|
|
69
|
+
endOfCandidates: [],
|
|
70
|
+
provisionalIce: [],
|
|
71
|
+
associated: new Set(),
|
|
72
|
+
};
|
|
73
|
+
const entries = this.associate(remoteSdp, plan.associated);
|
|
74
|
+
this.assignTransports(remoteSdp, entries, bundleGroups, preserveCurrentTransport);
|
|
75
|
+
const accepted = this.accept(remoteSdp, entries, plan, codecPlan);
|
|
76
|
+
this.planTransportUpdates(remoteSdp, entries, bundleGroups, accepted, plan);
|
|
77
|
+
return plan;
|
|
78
|
+
}
|
|
79
|
+
associate(remoteSdp, associated) {
|
|
80
|
+
const entries = remoteSdp.media.map((remoteMedia, i) => {
|
|
81
|
+
if (remoteMedia.kind === "application") {
|
|
82
|
+
if (remoteMedia.port === 0)
|
|
83
|
+
return { remoteMedia, index: i };
|
|
84
|
+
let sctpTransport = this.sctp.sctpTransport;
|
|
85
|
+
if (!sctpTransport) {
|
|
86
|
+
sctpTransport = this.host.createSctpTransport();
|
|
87
|
+
sctpTransport.mid = remoteMedia.rtp.muxId;
|
|
88
|
+
}
|
|
89
|
+
else if (sctpTransport.mid !== undefined &&
|
|
90
|
+
sctpTransport.mid !== remoteMedia.rtp.muxId &&
|
|
91
|
+
(this.rejectedInCurrent(sctpTransport.mid) ||
|
|
92
|
+
(remoteSdp.type === "offer" && !this.inCurrent(sctpTransport.mid)))) {
|
|
93
|
+
// The offer reuses the rejected application position with a new
|
|
94
|
+
// MID (JSEP 5.2.2), or names the application m-line of an SCTP
|
|
95
|
+
// transport no description has negotiated yet (its MID was only
|
|
96
|
+
// reserved by an unapplied createOffer): the SCTP transport follows
|
|
97
|
+
// the offer's MID, so the answer does not repeat a MID. A rollback
|
|
98
|
+
// restores the binding with the rest of the SCTP baseline.
|
|
99
|
+
sctpTransport.mid = remoteMedia.rtp.muxId;
|
|
100
|
+
}
|
|
101
|
+
return { remoteMedia, index: i, sctpTransport };
|
|
102
|
+
}
|
|
103
|
+
if (!["audio", "video"].includes(remoteMedia.kind)) {
|
|
104
|
+
throw new Error("invalid media kind");
|
|
105
|
+
}
|
|
106
|
+
let transceiver = this.findTransceiver(remoteMedia, i, associated);
|
|
107
|
+
if (!transceiver) {
|
|
108
|
+
// 未知の MID の拒否済み m-line には transceiver を関連付けない
|
|
109
|
+
if (remoteMedia.port === 0)
|
|
110
|
+
return { remoteMedia, index: i };
|
|
111
|
+
// JSEP 5.2.2: a new MID on an existing m-line recycles it, so the
|
|
112
|
+
// transceiver that owned it is stopped. The flags are part of the
|
|
113
|
+
// rollback baseline; its sender/receiver stop at the answer.
|
|
114
|
+
const displaced = this.transceivers.getTransceivers().find((t) => !t.stopped &&
|
|
115
|
+
t.mLineIndex === i &&
|
|
116
|
+
!!t.mid &&
|
|
117
|
+
t.mid !== remoteMedia.rtp.muxId &&
|
|
118
|
+
// Only the transceiver that owns this m-line in the
|
|
119
|
+
// current session is displaced by its recycling.
|
|
120
|
+
this.sdp.currentRemoteDescription?.media[i]?.rtp.muxId === t.mid);
|
|
121
|
+
if (displaced) {
|
|
122
|
+
displaced.stopping = true;
|
|
123
|
+
displaced.stopped = true;
|
|
124
|
+
this.router.unregisterTransceiver(displaced);
|
|
125
|
+
this.negotiation.rememberDisplacedTransceiver(displaced);
|
|
126
|
+
}
|
|
127
|
+
// Not an application operation: no negotiationneeded and no
|
|
128
|
+
// takeover of an inactive current transceiver. A stopped
|
|
129
|
+
// transceiver at the same index is replaced, never revived.
|
|
130
|
+
transceiver = this.transceivers.addTransceiver(remoteMedia.kind, this.host.createTransport(), { direction: "recvonly" }, { remoteMLineIndex: i });
|
|
131
|
+
transceiver.mid = remoteMedia.rtp.muxId ?? null;
|
|
132
|
+
this.negotiation.rememberRemoteTransceiver(transceiver);
|
|
133
|
+
this.host.onRemoteTransceiverAdded(transceiver);
|
|
134
|
+
}
|
|
135
|
+
else if (transceiver.mid == null) {
|
|
136
|
+
this.transceivers.associateMLine(transceiver, i);
|
|
137
|
+
}
|
|
138
|
+
associated.add(transceiver);
|
|
139
|
+
return { remoteMedia, index: i, transceiver };
|
|
140
|
+
});
|
|
141
|
+
if (remoteSdp.type === "offer") {
|
|
142
|
+
// 関連付けられなかった未交渉 transceiver の位置の予約を解除する
|
|
143
|
+
this.transceivers.releaseUnassociatedReservations(associated, remoteSdp.media.length);
|
|
144
|
+
}
|
|
145
|
+
return entries;
|
|
146
|
+
}
|
|
147
|
+
/** Whether a current description has an m-line with `mid`. */
|
|
148
|
+
inCurrent(mid) {
|
|
149
|
+
return [
|
|
150
|
+
this.sdp.currentLocalDescription,
|
|
151
|
+
this.sdp.currentRemoteDescription,
|
|
152
|
+
].some((description) => description?.media.some((media) => media.rtp.muxId === mid));
|
|
153
|
+
}
|
|
154
|
+
/** Whether the current session rejected (port 0) the m-line `mid`. */
|
|
155
|
+
rejectedInCurrent(mid) {
|
|
156
|
+
return [
|
|
157
|
+
this.sdp.currentLocalDescription,
|
|
158
|
+
this.sdp.currentRemoteDescription,
|
|
159
|
+
].some((description) => description?.media.find((media) => media.rtp.muxId === mid)?.port === 0);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* remote m-line に対応する transceiver を探す。MID の一致を優先し、
|
|
163
|
+
* 未関連付け transceiver は同じ offer 内で異なる m-line に割り当てる。
|
|
164
|
+
*/
|
|
165
|
+
findTransceiver(remoteMedia, index, associated) {
|
|
166
|
+
const candidates = this.transceivers
|
|
167
|
+
.getTransceivers()
|
|
168
|
+
.filter((t) => !associated.has(t) && t.kind === remoteMedia.kind);
|
|
169
|
+
const mid = remoteMedia.rtp.muxId;
|
|
170
|
+
const byMid = mid != undefined ? candidates.find((t) => t.mid === mid) : undefined;
|
|
171
|
+
if (byMid) {
|
|
172
|
+
return byMid;
|
|
173
|
+
}
|
|
174
|
+
if (remoteMedia.port === 0) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const unassociated = candidates.filter((t) => t.mid == null && !t.stopping && !t.stopped);
|
|
178
|
+
return unassociated.find((t) => t.mLineIndex === index) ?? unassociated[0];
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Transport ownership. BUNDLE group ごとに 1 つの transport を共有する。remote offer
|
|
182
|
+
* の所有関係は bundlePolicy によらず offer の group だけで決まり (max-bundle は自分の
|
|
183
|
+
* offer にだけ効く)、異なる group や group 外の m-line とは共有しない。
|
|
184
|
+
*/
|
|
185
|
+
assignTransports(remoteSdp, entries, bundleGroups, preserveCurrentTransport) {
|
|
186
|
+
const isRemoteOffer = remoteSdp.type === "offer";
|
|
187
|
+
// A current owner keeps its transport while a re-offer or pranswer is
|
|
188
|
+
// pending; a staged BUNDLE topology switches it at the answer.
|
|
189
|
+
const keepsCurrent = (entry) => preserveCurrentTransport &&
|
|
190
|
+
(entry.transceiver
|
|
191
|
+
? !!entry.transceiver.currentDirection
|
|
192
|
+
: !!this.sctp.sctpRemotePort);
|
|
193
|
+
const membersOf = (group) => entries.filter((entry) => !!ownerOf(entry) &&
|
|
194
|
+
entry.remoteMedia.port !== 0 &&
|
|
195
|
+
group.items.includes(entry.remoteMedia.rtp.muxId));
|
|
196
|
+
if (preserveCurrentTransport) {
|
|
197
|
+
// A re-offer or pranswer on a live session keeps every current
|
|
198
|
+
// owner on its transport: a new BUNDLE topology (split, merge, a new
|
|
199
|
+
// owner outside the group) is prepared for the answer and switches
|
|
200
|
+
// only at the commit. New members join their group tag's transport.
|
|
201
|
+
for (const group of bundleGroups) {
|
|
202
|
+
const members = membersOf(group);
|
|
203
|
+
const tag = members.find((entry) => entry.remoteMedia.rtp.muxId === group.items[0]) ?? members[0];
|
|
204
|
+
const shared = tag && ownerOf(tag).dtlsTransport;
|
|
205
|
+
for (const entry of members) {
|
|
206
|
+
const owner = ownerOf(entry);
|
|
207
|
+
if (shared &&
|
|
208
|
+
!keepsCurrent(entry) &&
|
|
209
|
+
owner.dtlsTransport !== shared) {
|
|
210
|
+
owner.setDtlsTransport(shared);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const claimed = new Set();
|
|
217
|
+
// A transport that inherited another owner's ICE credentials is the
|
|
218
|
+
// same ICE session on the wire, so it counts as claimed as well.
|
|
219
|
+
const ufragOf = (transport) => transport.iceTransport.localParameters.usernameFragment;
|
|
220
|
+
const isClaimed = (transport) => claimed.has(transport) ||
|
|
221
|
+
[...claimed].some((other) => ufragOf(other) === ufragOf(transport));
|
|
222
|
+
for (const group of bundleGroups) {
|
|
223
|
+
const members = membersOf(group);
|
|
224
|
+
if (members.length === 0)
|
|
225
|
+
continue;
|
|
226
|
+
// The tag's transport first, then any other member's.
|
|
227
|
+
const preferred = [
|
|
228
|
+
...members.filter((entry) => entry.remoteMedia.rtp.muxId === group.items[0]),
|
|
229
|
+
...members,
|
|
230
|
+
];
|
|
231
|
+
let shared = preferred
|
|
232
|
+
.map((entry) => ownerOf(entry).dtlsTransport)
|
|
233
|
+
.find((transport) => liveTransport(transport) &&
|
|
234
|
+
(!isRemoteOffer || !isClaimed(transport)));
|
|
235
|
+
if (!shared)
|
|
236
|
+
shared = this.host.createOwnerTransport();
|
|
237
|
+
claimed.add(shared);
|
|
238
|
+
for (const entry of members) {
|
|
239
|
+
const owner = ownerOf(entry);
|
|
240
|
+
if (owner.dtlsTransport !== shared)
|
|
241
|
+
owner.setDtlsTransport(shared);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
if (isRemoteOffer) {
|
|
245
|
+
// group 外 (group のない offer を含む) で受け入れる m-line は、max-bundle でも
|
|
246
|
+
// 独立した transport と ICE credentials を持つ
|
|
247
|
+
for (const entry of entries) {
|
|
248
|
+
const owner = ownerOf(entry);
|
|
249
|
+
if (!owner ||
|
|
250
|
+
entry.remoteMedia.port === 0 ||
|
|
251
|
+
groupOf(bundleGroups, entry.remoteMedia.rtp.muxId)) {
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
if (!liveTransport(owner.dtlsTransport) ||
|
|
255
|
+
isClaimed(owner.dtlsTransport)) {
|
|
256
|
+
owner.setDtlsTransport(this.host.createOwnerTransport());
|
|
257
|
+
}
|
|
258
|
+
claimed.add(owner.dtlsTransport);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/** Apply RTP / SCTP parameters: the entries accepted (not rejected). */
|
|
263
|
+
accept(remoteSdp, entries, plan, codecPlan) {
|
|
264
|
+
const accepted = new Set();
|
|
265
|
+
for (const entry of entries) {
|
|
266
|
+
const { remoteMedia, index: i, transceiver } = entry;
|
|
267
|
+
if (transceiver) {
|
|
268
|
+
if (remoteMedia.port !== 0) {
|
|
269
|
+
if (this.transceivers.setRemoteRTP(transceiver, remoteMedia, remoteSdp.type, i, codecPlan.get(i) ?? [])) {
|
|
270
|
+
accepted.add(entry);
|
|
271
|
+
}
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
// remote port 0: an offer or pranswer only marks the rejection
|
|
275
|
+
// (the current pipeline keeps running until the answer); an
|
|
276
|
+
// answer stops it once every fallible step has passed.
|
|
277
|
+
transceiver.mLineIndex = i;
|
|
278
|
+
if (transceiver.stopped)
|
|
279
|
+
continue;
|
|
280
|
+
if (remoteSdp.type === "answer") {
|
|
281
|
+
plan.transportUpdates.push(() => transceiver.commitStopped({ rejected: !transceiver.stopping }));
|
|
282
|
+
}
|
|
283
|
+
else if (!transceiver.stopping) {
|
|
284
|
+
transceiver.pendingRejection = true;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
else if (entry.sctpTransport) {
|
|
288
|
+
if (!plan.preserveCurrentTransport || !this.sctp.sctpRemotePort) {
|
|
289
|
+
this.sctp.setRemoteSCTP(remoteMedia, i);
|
|
290
|
+
}
|
|
291
|
+
else if (remoteSdp.type === "pranswer") {
|
|
292
|
+
// A renegotiation offer leaves the current value until the answer
|
|
293
|
+
// side applies it; a pranswer updates it on the kept association.
|
|
294
|
+
this.sctp.updateRemoteMaxMessageSize(remoteMedia);
|
|
295
|
+
}
|
|
296
|
+
accepted.add(entry);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return accepted;
|
|
300
|
+
}
|
|
301
|
+
/** Plan the ICE / DTLS parameters, candidates and role of every transport. */
|
|
302
|
+
planTransportUpdates(remoteSdp, entries, bundleGroups, accepted, plan) {
|
|
303
|
+
const { preserveCurrentTransport } = plan;
|
|
304
|
+
// ICE / DTLS パラメータは group で最初に受け入れた member (通常は tag) から適用する
|
|
305
|
+
// (codec 不一致で拒否した member のパラメータは使わない)
|
|
306
|
+
const groupParamSources = new Map();
|
|
307
|
+
for (const group of bundleGroups) {
|
|
308
|
+
for (const mid of group.items) {
|
|
309
|
+
const entry = entries.find((e) => e.remoteMedia.rtp.muxId === mid &&
|
|
310
|
+
e.remoteMedia.port !== 0 &&
|
|
311
|
+
accepted.has(e));
|
|
312
|
+
if (entry) {
|
|
313
|
+
groupParamSources.set(group, entry);
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
for (const entry of entries) {
|
|
319
|
+
const { remoteMedia } = entry;
|
|
320
|
+
const owner = ownerOf(entry);
|
|
321
|
+
const group = groupOf(bundleGroups, remoteMedia.rtp.muxId);
|
|
322
|
+
if (!owner ||
|
|
323
|
+
remoteMedia.port === 0 ||
|
|
324
|
+
// group 外の拒否 section の transport は使わない
|
|
325
|
+
(!accepted.has(entry) && !group)) {
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
const preparedTransport = remoteMedia.rtp.muxId
|
|
329
|
+
? this.negotiation.transportByMid.get(remoteMedia.rtp.muxId)
|
|
330
|
+
: undefined;
|
|
331
|
+
const pendingTransport = preparedTransport &&
|
|
332
|
+
this.negotiation.isPendingOnlyTransport(preparedTransport.iceTransport.id)
|
|
333
|
+
? preparedTransport
|
|
334
|
+
: undefined;
|
|
335
|
+
const dtlsTransport = preserveCurrentTransport && pendingTransport
|
|
336
|
+
? pendingTransport
|
|
337
|
+
: owner.dtlsTransport;
|
|
338
|
+
if (!liveTransport(dtlsTransport))
|
|
339
|
+
continue;
|
|
340
|
+
const iceTransport = dtlsTransport.iceTransport;
|
|
341
|
+
const bundledNonTag = !!group && groupParamSources.get(group) !== entry;
|
|
342
|
+
const ownsGeneration = !preserveCurrentTransport || !!pendingTransport;
|
|
343
|
+
plan.transportUpdates.push(() => {
|
|
344
|
+
if (remoteMedia.iceParams && ownsGeneration && !bundledNonTag) {
|
|
345
|
+
// A rejected (port 0) m-line is not inactive media.
|
|
346
|
+
const renomination = remoteSdp.media.some((media) => media.port !== 0 && media.direction === "inactive");
|
|
347
|
+
iceTransport.setRemoteParams(remoteMedia.iceParams, renomination, {
|
|
348
|
+
keepLocalCredentials: remoteSdp.type !== "offer",
|
|
349
|
+
});
|
|
350
|
+
// One agent full, one lite: The full agent MUST take the controlling role, and the lite agent MUST take the controlled role
|
|
351
|
+
// RFC 8445 S6.1.1
|
|
352
|
+
if (remoteMedia.iceParams.iceLite &&
|
|
353
|
+
!iceTransport.connection.iceLite) {
|
|
354
|
+
iceTransport.connection.iceControlling = true;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (remoteMedia.dtlsParams && ownsGeneration && !bundledNonTag) {
|
|
358
|
+
dtlsTransport.setRemoteParams(remoteMedia.dtlsParams);
|
|
359
|
+
}
|
|
360
|
+
// # add ICE candidates
|
|
361
|
+
if (ownsGeneration && !bundledNonTag) {
|
|
362
|
+
remoteMedia.iceCandidates.forEach(iceTransport.addRemoteCandidate);
|
|
363
|
+
}
|
|
364
|
+
// End-of-candidates ends the shared generation whichever BUNDLE
|
|
365
|
+
// m-line carries it; it runs after every m-line's candidates.
|
|
366
|
+
if (remoteMedia.iceCandidatesComplete && ownsGeneration) {
|
|
367
|
+
plan.endOfCandidates.push(iceTransport);
|
|
368
|
+
}
|
|
369
|
+
if (remoteSdp.type === "pranswer" &&
|
|
370
|
+
preserveCurrentTransport &&
|
|
371
|
+
!pendingTransport &&
|
|
372
|
+
!bundledNonTag &&
|
|
373
|
+
iceTransport.hasStagedRestart) {
|
|
374
|
+
plan.provisionalIce.push([iceTransport, remoteMedia]);
|
|
375
|
+
}
|
|
376
|
+
// # set DTLS role
|
|
377
|
+
// An answer's `actpass` names no role: a live association keeps its
|
|
378
|
+
// role, a new one becomes client as before.
|
|
379
|
+
const keepsLiveRole = remoteMedia.dtlsParams?.role === "auto" &&
|
|
380
|
+
["connecting", "connected"].includes(dtlsTransport.state);
|
|
381
|
+
if ((remoteSdp.type === "answer" || remoteSdp.type === "pranswer") &&
|
|
382
|
+
remoteMedia.dtlsParams?.role &&
|
|
383
|
+
!bundledNonTag &&
|
|
384
|
+
!keepsLiveRole) {
|
|
385
|
+
dtlsTransport.role =
|
|
386
|
+
remoteMedia.dtlsParams.role === "client" ? "server" : "client";
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
exports.RemoteMediaApplication = RemoteMediaApplication;
|
|
393
|
+
const ownerOf = (entry) => entry.transceiver ?? entry.sctpTransport;
|
|
394
|
+
const liveTransport = (transport) => !!transport && transport.state !== "closed";
|
|
395
|
+
const groupOf = (bundleGroups, mid) => mid == undefined
|
|
396
|
+
? undefined
|
|
397
|
+
: bundleGroups.find((group) => group.items.includes(mid));
|
|
398
|
+
//# sourceMappingURL=remoteMediaApplication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remoteMediaApplication.js","sourceRoot":"","sources":["../../../../src/negotiation/remoteMediaApplication.ts"],"names":[],"mappings":";;;AA2CA;;;;;;GAMG;AACH,MAAa,sBAAsB;IACjC,YACmB,GAAe,EACf,YAAgC,EAChC,IAA0B,EAC1B,MAAiB,EACjB,WAAmC,EACnC,IAOhB;QAZD;;;;mBAAiB,GAAG;WAAY;QAChC;;;;mBAAiB,YAAY;WAAoB;QACjD;;;;mBAAiB,IAAI;WAAsB;QAC3C;;;;mBAAiB,MAAM;WAAW;QAClC;;;;mBAAiB,WAAW;WAAwB;QACpD;;;;mBAAiB,IAAI;WAOpB;IACA,CAAC;IAEJ,0EAA0E;IAC1E,UAAU,CAAC,SAA6B;QACtC,MAAM,UAAU,GAAG,IAAI,GAAG,EAAqB,CAAC;QAChD,OAAO,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAC1C,SAAS,EACT,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE;YACrB,MAAM,WAAW,GAAG,IAAI,CAAC,eAAe,CACtC,WAAW,EACX,KAAK,EACL,UAAU,CACX,CAAC;YACF,IAAI,WAAW;gBAAE,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAC7C,OAAO,WAAW,CAAC;QACrB,CAAC,CACF,CAAC;IACJ,CAAC;IAED,KAAK,CACH,SAA6B,EAC7B,YAAkD,IAAI,GAAG,EAAE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C,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;gBACnE,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAzdD,wDAydC;AAED,MAAM,OAAO,GAAG,CAAC,KAAuB,EAAE,EAAE,CAC1C,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,aAAa,CAAC;AAE3C,MAAM,aAAa,GAAG,CACpB,SAAuC,EACR,EAAE,CAAC,CAAC,CAAC,SAAS,IAAI,SAAS,CAAC,KAAK,KAAK,QAAQ,CAAC;AAEhF,MAAM,OAAO,GAAG,CAAC,YAAgC,EAAE,GAAuB,EAAE,EAAE,CAC5E,GAAG,IAAI,SAAS;IACd,CAAC,CAAC,SAAS;IACX,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC","sourcesContent":["import type {\n RTCRtpCodecParameters,\n RTCRtpTransceiver,\n RtpRouter,\n TransceiverManager,\n} from \"../media\";\nimport type { NegotiationTransaction } from \"../negotiationTransaction\";\nimport type { SctpTransportManager } from \"../sctpManager\";\nimport type {\n GroupDescription,\n MediaDescription,\n SessionDescription,\n} from \"../sdp\";\nimport type { SDPManager } from \"../sdpManager\";\nimport type { RTCDtlsTransport } from \"../transport/dtls\";\nimport type { RTCIceTransport } from \"../transport/ice\";\nimport type { RTCSctpTransport } from \"../transport/sctp\";\n\ntype RemoteMediaEntry = {\n remoteMedia: MediaDescription;\n index: number;\n transceiver?: RTCRtpTransceiver;\n sctpTransport?: RTCSctpTransport;\n};\n\n/** What applying the m-lines of a remote description left for the caller. */\nexport type RemoteMediaPlan = {\n /** A re-offer or pranswer on a live session keeps the current transports. */\n preserveCurrentTransport: boolean;\n /**\n * Live transport and media stop operations. They run only after every\n * m-line applied without error, so a failure leaves the ICE generation,\n * selected pair and DTLS/SCTP bindings untouched.\n */\n transportUpdates: (() => void)[];\n /** Transports whose remote generation ended (run after every candidate). */\n endOfCandidates: RTCIceTransport[];\n /** Pranswer credentials for a transport with a staged ICE restart. */\n provisionalIce: [RTCIceTransport, MediaDescription][];\n /** Transceivers associated with an m-line of the description. */\n associated: Set<RTCRtpTransceiver>;\n};\n\n/**\n * Applies the m-lines of a remote description inside the negotiation\n * transaction: associates each m-line with a transceiver or the SCTP\n * transport, decides the BUNDLE transport ownership, applies RTP / SCTP\n * parameters (accept or mark rejected), and plans the transport parameter\n * updates the caller runs after every fallible step.\n */\nexport class RemoteMediaApplication {\n constructor(\n private readonly sdp: SDPManager,\n private readonly transceivers: TransceiverManager,\n private readonly sctp: SctpTransportManager,\n private readonly router: RtpRouter,\n private readonly negotiation: NegotiationTransaction,\n private readonly host: {\n createSctpTransport: () => RTCSctpTransport;\n /** The transport a new transceiver starts on. */\n createTransport: () => RTCDtlsTransport;\n /** An independent transport (own ICE credentials) for ownership. */\n createOwnerTransport: () => RTCDtlsTransport;\n onRemoteTransceiverAdded: (transceiver: RTCRtpTransceiver) => void;\n },\n ) {}\n\n /** Resolve all m-line codecs without mutating the current transaction. */\n planCodecs(remoteSdp: SessionDescription) {\n const associated = new Set<RTCRtpTransceiver>();\n return this.transceivers.planRemoteRtpCodecs(\n remoteSdp,\n (remoteMedia, index) => {\n const transceiver = this.findTransceiver(\n remoteMedia,\n index,\n associated,\n );\n if (transceiver) associated.add(transceiver);\n return transceiver;\n },\n );\n }\n\n apply(\n remoteSdp: SessionDescription,\n codecPlan: Map<number, RTCRtpCodecParameters[]> = new Map(),\n ): RemoteMediaPlan {\n const bundleGroups =\n this.sdp.bundlePolicy === \"disable\"\n ? []\n : remoteSdp.group.filter((group) => group.semantic === \"BUNDLE\");\n const preserveCurrentTransport =\n (remoteSdp.type === \"offer\" || remoteSdp.type === \"pranswer\") &&\n !!this.sdp.currentRemoteDescription;\n const plan: RemoteMediaPlan = {\n preserveCurrentTransport,\n transportUpdates: [],\n endOfCandidates: [],\n provisionalIce: [],\n associated: new Set(),\n };\n\n const entries = this.associate(remoteSdp, plan.associated);\n this.assignTransports(\n remoteSdp,\n entries,\n bundleGroups,\n preserveCurrentTransport,\n );\n const accepted = this.accept(remoteSdp, entries, plan, codecPlan);\n this.planTransportUpdates(remoteSdp, entries, bundleGroups, accepted, plan);\n return plan;\n }\n\n private associate(\n remoteSdp: SessionDescription,\n associated: Set<RTCRtpTransceiver>,\n ): RemoteMediaEntry[] {\n const entries = remoteSdp.media.map((remoteMedia, i) => {\n if (remoteMedia.kind === \"application\") {\n if (remoteMedia.port === 0) return { remoteMedia, index: i };\n let sctpTransport = this.sctp.sctpTransport;\n if (!sctpTransport) {\n sctpTransport = this.host.createSctpTransport();\n sctpTransport.mid = remoteMedia.rtp.muxId;\n } else if (\n sctpTransport.mid !== undefined &&\n sctpTransport.mid !== remoteMedia.rtp.muxId &&\n (this.rejectedInCurrent(sctpTransport.mid) ||\n (remoteSdp.type === \"offer\" && !this.inCurrent(sctpTransport.mid)))\n ) {\n // The offer reuses the rejected application position with a new\n // MID (JSEP 5.2.2), or names the application m-line of an SCTP\n // transport no description has negotiated yet (its MID was only\n // reserved by an unapplied createOffer): the SCTP transport follows\n // the offer's MID, so the answer does not repeat a MID. A rollback\n // restores the binding with the rest of the SCTP baseline.\n sctpTransport.mid = remoteMedia.rtp.muxId;\n }\n return { remoteMedia, index: i, sctpTransport };\n }\n if (![\"audio\", \"video\"].includes(remoteMedia.kind)) {\n throw new Error(\"invalid media kind\");\n }\n let transceiver = this.findTransceiver(remoteMedia, i, associated);\n if (!transceiver) {\n // 未知の MID の拒否済み m-line には transceiver を関連付けない\n if (remoteMedia.port === 0) return { remoteMedia, index: i };\n // JSEP 5.2.2: a new MID on an existing m-line recycles it, so the\n // transceiver that owned it is stopped. The flags are part of the\n // rollback baseline; its sender/receiver stop at the answer.\n const displaced = this.transceivers.getTransceivers().find(\n (t) =>\n !t.stopped &&\n t.mLineIndex === i &&\n !!t.mid &&\n t.mid !== remoteMedia.rtp.muxId &&\n // Only the transceiver that owns this m-line in the\n // current session is displaced by its recycling.\n this.sdp.currentRemoteDescription?.media[i]?.rtp.muxId === t.mid,\n );\n if (displaced) {\n displaced.stopping = true;\n displaced.stopped = true;\n this.router.unregisterTransceiver(displaced);\n this.negotiation.rememberDisplacedTransceiver(displaced);\n }\n // Not an application operation: no negotiationneeded and no\n // takeover of an inactive current transceiver. A stopped\n // transceiver at the same index is replaced, never revived.\n transceiver = this.transceivers.addTransceiver(\n remoteMedia.kind,\n this.host.createTransport(),\n { direction: \"recvonly\" },\n { remoteMLineIndex: i },\n );\n transceiver.mid = remoteMedia.rtp.muxId ?? null;\n this.negotiation.rememberRemoteTransceiver(transceiver);\n this.host.onRemoteTransceiverAdded(transceiver);\n } else if (transceiver.mid == null) {\n this.transceivers.associateMLine(transceiver, i);\n }\n associated.add(transceiver);\n return { remoteMedia, index: i, transceiver };\n });\n if (remoteSdp.type === \"offer\") {\n // 関連付けられなかった未交渉 transceiver の位置の予約を解除する\n this.transceivers.releaseUnassociatedReservations(\n associated,\n remoteSdp.media.length,\n );\n }\n return entries;\n }\n\n /** Whether a current description has an m-line with `mid`. */\n private inCurrent(mid: string) {\n return [\n this.sdp.currentLocalDescription,\n this.sdp.currentRemoteDescription,\n ].some((description) =>\n description?.media.some((media) => media.rtp.muxId === mid),\n );\n }\n\n /** Whether the current session rejected (port 0) the m-line `mid`. */\n private rejectedInCurrent(mid: string) {\n return [\n this.sdp.currentLocalDescription,\n this.sdp.currentRemoteDescription,\n ].some(\n (description) =>\n description?.media.find((media) => media.rtp.muxId === mid)?.port === 0,\n );\n }\n\n /**\n * remote m-line に対応する transceiver を探す。MID の一致を優先し、\n * 未関連付け transceiver は同じ offer 内で異なる m-line に割り当てる。\n */\n private findTransceiver(\n remoteMedia: MediaDescription,\n index: number,\n associated: Set<RTCRtpTransceiver>,\n ) {\n const candidates = this.transceivers\n .getTransceivers()\n .filter((t) => !associated.has(t) && t.kind === remoteMedia.kind);\n const mid = remoteMedia.rtp.muxId;\n const byMid =\n mid != undefined ? candidates.find((t) => t.mid === mid) : undefined;\n if (byMid) {\n return byMid;\n }\n if (remoteMedia.port === 0) {\n return;\n }\n const unassociated = candidates.filter(\n (t) => t.mid == null && !t.stopping && !t.stopped,\n );\n return unassociated.find((t) => t.mLineIndex === index) ?? unassociated[0];\n }\n\n /**\n * Transport ownership. BUNDLE group ごとに 1 つの transport を共有する。remote offer\n * の所有関係は bundlePolicy によらず offer の group だけで決まり (max-bundle は自分の\n * offer にだけ効く)、異なる group や group 外の m-line とは共有しない。\n */\n private assignTransports(\n remoteSdp: SessionDescription,\n entries: RemoteMediaEntry[],\n bundleGroups: GroupDescription[],\n preserveCurrentTransport: boolean,\n ) {\n const isRemoteOffer = remoteSdp.type === \"offer\";\n // A current owner keeps its transport while a re-offer or pranswer is\n // pending; a staged BUNDLE topology switches it at the answer.\n const keepsCurrent = (entry: RemoteMediaEntry) =>\n preserveCurrentTransport &&\n (entry.transceiver\n ? !!entry.transceiver.currentDirection\n : !!this.sctp.sctpRemotePort);\n const membersOf = (group: GroupDescription) =>\n entries.filter(\n (entry) =>\n !!ownerOf(entry) &&\n entry.remoteMedia.port !== 0 &&\n group.items.includes(entry.remoteMedia.rtp.muxId!),\n );\n\n if (preserveCurrentTransport) {\n // A re-offer or pranswer on a live session keeps every current\n // owner on its transport: a new BUNDLE topology (split, merge, a new\n // owner outside the group) is prepared for the answer and switches\n // only at the commit. New members join their group tag's transport.\n for (const group of bundleGroups) {\n const members = membersOf(group);\n const tag =\n members.find(\n (entry) => entry.remoteMedia.rtp.muxId === group.items[0],\n ) ?? members[0];\n const shared = tag && ownerOf(tag)!.dtlsTransport;\n for (const entry of members) {\n const owner = ownerOf(entry)!;\n if (\n shared &&\n !keepsCurrent(entry) &&\n owner.dtlsTransport !== shared\n ) {\n owner.setDtlsTransport(shared);\n }\n }\n }\n return;\n }\n\n const claimed = new Set<RTCDtlsTransport>();\n // A transport that inherited another owner's ICE credentials is the\n // same ICE session on the wire, so it counts as claimed as well.\n const ufragOf = (transport: RTCDtlsTransport) =>\n transport.iceTransport.localParameters.usernameFragment;\n const isClaimed = (transport: RTCDtlsTransport) =>\n claimed.has(transport) ||\n [...claimed].some((other) => ufragOf(other) === ufragOf(transport));\n for (const group of bundleGroups) {\n const members = membersOf(group);\n if (members.length === 0) continue;\n // The tag's transport first, then any other member's.\n const preferred = [\n ...members.filter(\n (entry) => entry.remoteMedia.rtp.muxId === group.items[0],\n ),\n ...members,\n ];\n let shared = preferred\n .map((entry) => ownerOf(entry)!.dtlsTransport)\n .find(\n (transport) =>\n liveTransport(transport) &&\n (!isRemoteOffer || !isClaimed(transport)),\n );\n if (!shared) shared = this.host.createOwnerTransport();\n claimed.add(shared);\n for (const entry of members) {\n const owner = ownerOf(entry)!;\n if (owner.dtlsTransport !== shared) owner.setDtlsTransport(shared);\n }\n }\n if (isRemoteOffer) {\n // group 外 (group のない offer を含む) で受け入れる m-line は、max-bundle でも\n // 独立した transport と ICE credentials を持つ\n for (const entry of entries) {\n const owner = ownerOf(entry);\n if (\n !owner ||\n entry.remoteMedia.port === 0 ||\n groupOf(bundleGroups, entry.remoteMedia.rtp.muxId)\n ) {\n continue;\n }\n if (\n !liveTransport(owner.dtlsTransport) ||\n isClaimed(owner.dtlsTransport)\n ) {\n owner.setDtlsTransport(this.host.createOwnerTransport());\n }\n claimed.add(owner.dtlsTransport);\n }\n }\n }\n\n /** Apply RTP / SCTP parameters: the entries accepted (not rejected). */\n private accept(\n remoteSdp: SessionDescription,\n entries: RemoteMediaEntry[],\n plan: RemoteMediaPlan,\n codecPlan: Map<number, RTCRtpCodecParameters[]>,\n ) {\n const accepted = new Set<RemoteMediaEntry>();\n for (const entry of entries) {\n const { remoteMedia, index: i, transceiver } = entry;\n if (transceiver) {\n if (remoteMedia.port !== 0) {\n if (\n this.transceivers.setRemoteRTP(\n transceiver,\n remoteMedia,\n remoteSdp.type,\n i,\n codecPlan.get(i) ?? [],\n )\n ) {\n accepted.add(entry);\n }\n continue;\n }\n // remote port 0: an offer or pranswer only marks the rejection\n // (the current pipeline keeps running until the answer); an\n // answer stops it once every fallible step has passed.\n transceiver.mLineIndex = i;\n if (transceiver.stopped) continue;\n if (remoteSdp.type === \"answer\") {\n plan.transportUpdates.push(() =>\n transceiver.commitStopped({ rejected: !transceiver.stopping }),\n );\n } else if (!transceiver.stopping) {\n transceiver.pendingRejection = true;\n }\n } else if (entry.sctpTransport) {\n if (!plan.preserveCurrentTransport || !this.sctp.sctpRemotePort) {\n this.sctp.setRemoteSCTP(remoteMedia, i);\n } else if (remoteSdp.type === \"pranswer\") {\n // A renegotiation offer leaves the current value until the answer\n // side applies it; a pranswer updates it on the kept association.\n this.sctp.updateRemoteMaxMessageSize(remoteMedia);\n }\n accepted.add(entry);\n }\n }\n return accepted;\n }\n\n /** Plan the ICE / DTLS parameters, candidates and role of every transport. */\n private planTransportUpdates(\n remoteSdp: SessionDescription,\n entries: RemoteMediaEntry[],\n bundleGroups: GroupDescription[],\n accepted: Set<RemoteMediaEntry>,\n plan: RemoteMediaPlan,\n ) {\n const { preserveCurrentTransport } = plan;\n // ICE / DTLS パラメータは group で最初に受け入れた member (通常は tag) から適用する\n // (codec 不一致で拒否した member のパラメータは使わない)\n const groupParamSources = new Map<GroupDescription, RemoteMediaEntry>();\n for (const group of bundleGroups) {\n for (const mid of group.items) {\n const entry = entries.find(\n (e) =>\n e.remoteMedia.rtp.muxId === mid &&\n e.remoteMedia.port !== 0 &&\n accepted.has(e),\n );\n if (entry) {\n groupParamSources.set(group, entry);\n break;\n }\n }\n }\n\n for (const entry of entries) {\n const { remoteMedia } = entry;\n const owner = ownerOf(entry);\n const group = groupOf(bundleGroups, remoteMedia.rtp.muxId);\n if (\n !owner ||\n remoteMedia.port === 0 ||\n // group 外の拒否 section の transport は使わない\n (!accepted.has(entry) && !group)\n ) {\n continue;\n }\n const preparedTransport = remoteMedia.rtp.muxId\n ? this.negotiation.transportByMid.get(remoteMedia.rtp.muxId)\n : undefined;\n const pendingTransport =\n preparedTransport &&\n this.negotiation.isPendingOnlyTransport(\n preparedTransport.iceTransport.id,\n )\n ? preparedTransport\n : undefined;\n const dtlsTransport =\n preserveCurrentTransport && pendingTransport\n ? pendingTransport\n : owner.dtlsTransport;\n if (!liveTransport(dtlsTransport)) continue;\n const iceTransport = dtlsTransport.iceTransport;\n const bundledNonTag = !!group && groupParamSources.get(group) !== entry;\n const ownsGeneration = !preserveCurrentTransport || !!pendingTransport;\n\n plan.transportUpdates.push(() => {\n if (remoteMedia.iceParams && ownsGeneration && !bundledNonTag) {\n // A rejected (port 0) m-line is not inactive media.\n const renomination = remoteSdp.media.some(\n (media) => media.port !== 0 && media.direction === \"inactive\",\n );\n iceTransport.setRemoteParams(remoteMedia.iceParams, renomination, {\n keepLocalCredentials: remoteSdp.type !== \"offer\",\n });\n\n // One agent full, one lite: The full agent MUST take the controlling role, and the lite agent MUST take the controlled role\n // RFC 8445 S6.1.1\n if (\n remoteMedia.iceParams.iceLite &&\n !iceTransport.connection.iceLite\n ) {\n iceTransport.connection.iceControlling = true;\n }\n }\n if (remoteMedia.dtlsParams && ownsGeneration && !bundledNonTag) {\n dtlsTransport.setRemoteParams(remoteMedia.dtlsParams);\n }\n\n // # add ICE candidates\n if (ownsGeneration && !bundledNonTag) {\n remoteMedia.iceCandidates.forEach(iceTransport.addRemoteCandidate);\n }\n\n // End-of-candidates ends the shared generation whichever BUNDLE\n // m-line carries it; it runs after every m-line's candidates.\n if (remoteMedia.iceCandidatesComplete && ownsGeneration) {\n plan.endOfCandidates.push(iceTransport);\n }\n\n if (\n remoteSdp.type === \"pranswer\" &&\n preserveCurrentTransport &&\n !pendingTransport &&\n !bundledNonTag &&\n iceTransport.hasStagedRestart\n ) {\n plan.provisionalIce.push([iceTransport, remoteMedia]);\n }\n\n // # set DTLS role\n // An answer's `actpass` names no role: a live association keeps its\n // role, a new one becomes client as before.\n const keepsLiveRole =\n remoteMedia.dtlsParams?.role === \"auto\" &&\n [\"connecting\", \"connected\"].includes(dtlsTransport.state);\n if (\n (remoteSdp.type === \"answer\" || remoteSdp.type === \"pranswer\") &&\n remoteMedia.dtlsParams?.role &&\n !bundledNonTag &&\n !keepsLiveRole\n ) {\n dtlsTransport.role =\n remoteMedia.dtlsParams.role === \"client\" ? \"server\" : \"client\";\n }\n });\n }\n }\n}\n\nconst ownerOf = (entry: RemoteMediaEntry) =>\n entry.transceiver ?? entry.sctpTransport;\n\nconst liveTransport = (\n transport: RTCDtlsTransport | undefined,\n): transport is RTCDtlsTransport => !!transport && transport.state !== \"closed\";\n\nconst groupOf = (bundleGroups: GroupDescription[], mid: string | undefined) =>\n mid == undefined\n ? undefined\n : bundleGroups.find((group) => group.items.includes(mid));\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { TransceiverManager } from "../media";
|
|
2
|
+
import type { NegotiationTransaction } from "../negotiationTransaction";
|
|
3
|
+
import type { SctpTransportManager } from "../sctpManager";
|
|
4
|
+
import type { MediaDescription } from "../sdp";
|
|
5
|
+
import type { SDPManager } from "../sdpManager";
|
|
6
|
+
import type { SecureTransportManager } from "../secureTransportManager";
|
|
7
|
+
import type { RTCDtlsTransport } from "../transport/dtls";
|
|
8
|
+
import type { RTCIceTransport } from "../transport/ice";
|
|
9
|
+
import type { RTCSignalingState } from "../types/domain";
|
|
10
|
+
import type { BundleTopology } from "./bundleTopology";
|
|
11
|
+
/**
|
|
12
|
+
* Starting transports for a negotiation: connecting the live ICE / DTLS /
|
|
13
|
+
* SCTP bindings, connecting a provisional (pranswer) generation beside them,
|
|
14
|
+
* activating the transport parameters a re-offer staged once its answer
|
|
15
|
+
* commits, and retiring a first negotiation's provisional connection.
|
|
16
|
+
*/
|
|
17
|
+
export declare class TransportActivation {
|
|
18
|
+
private readonly sdp;
|
|
19
|
+
private readonly secure;
|
|
20
|
+
private readonly transceivers;
|
|
21
|
+
private readonly sctp;
|
|
22
|
+
private readonly negotiation;
|
|
23
|
+
private readonly topology;
|
|
24
|
+
private readonly host;
|
|
25
|
+
/**
|
|
26
|
+
* Bumped when a first negotiation's provisional connection is retired: a
|
|
27
|
+
* connect() still running for it no longer reports a connection state.
|
|
28
|
+
*/
|
|
29
|
+
private connectEpoch;
|
|
30
|
+
constructor(sdp: SDPManager, secure: SecureTransportManager, transceivers: TransceiverManager, sctp: SctpTransportManager, negotiation: NegotiationTransaction, topology: BundleTopology, host: {
|
|
31
|
+
signalingState: () => RTCSignalingState;
|
|
32
|
+
/** The transport a transceiver starts on (BUNDLE policy aware). */
|
|
33
|
+
createTransport: () => RTCDtlsTransport;
|
|
34
|
+
});
|
|
35
|
+
/** Retire a first negotiation's provisional connection without losing app objects. */
|
|
36
|
+
cleanupInitialProvisional(): Promise<void>;
|
|
37
|
+
/** Activate a re-offer's staged transport parameters at its final answer. */
|
|
38
|
+
activatePendingRemote(pendingOnly?: boolean): Promise<void>;
|
|
39
|
+
applyProvisionalIce(iceTransport: RTCIceTransport, media: MediaDescription, candidates?: import("..").IceCandidate[], endOfCandidates?: boolean): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Start ICE, DTLS and SCTP on every live transport that still needs it.
|
|
42
|
+
*
|
|
43
|
+
* ICE checks start only for a generation that has not run them (the first
|
|
44
|
+
* negotiation or a committed restart); checks already running are
|
|
45
|
+
* awaited, and an established, completed or failed generation is left to
|
|
46
|
+
* its own state machine (consent freshness, a later ICE restart). A DTLS
|
|
47
|
+
* handshake already running is awaited rather than started again. The
|
|
48
|
+
* connection state changes only when this call started or awaited work.
|
|
49
|
+
*/
|
|
50
|
+
connect(): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* An SCTP transport that joined an already connected DTLS transport (the
|
|
53
|
+
* first application m-line of a renegotiation) starts its association
|
|
54
|
+
* there; the DTLS start above only covers a new transport.
|
|
55
|
+
*/
|
|
56
|
+
private startJoinedSctp;
|
|
57
|
+
/** Connect a provisional ICE/DTLS generation without changing live bindings. */
|
|
58
|
+
connectPending(): Promise<void>;
|
|
59
|
+
}
|