werift 0.25.2 → 0.27.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/README.md +63 -0
- package/THIRD_PARTY_LICENSES_LIBWEBRTC.txt +58 -0
- 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/binary.d.ts +1 -3
- package/lib/common/src/binary.js +8 -6
- package/lib/common/src/binary.js.map +1 -1
- package/lib/common/src/binaryData.js +2 -1
- 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 +142 -12
- 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 +108 -19
- 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 +13 -7
- package/lib/dtls/src/context/cipher.js +58 -106
- package/lib/dtls/src/context/cipher.js.map +1 -1
- package/lib/dtls/src/context/dtls.js +4 -2
- package/lib/dtls/src/context/dtls.js.map +1 -1
- package/lib/dtls/src/context/transport.d.ts +4 -0
- package/lib/dtls/src/context/transport.js +16 -1
- package/lib/dtls/src/context/transport.js.map +1 -1
- package/lib/dtls/src/flight/client/flight1.js +2 -1
- package/lib/dtls/src/flight/client/flight1.js.map +1 -1
- package/lib/dtls/src/flight/client/flight5.js +4 -2
- package/lib/dtls/src/flight/client/flight5.js.map +1 -1
- package/lib/dtls/src/flight/flight.d.ts +1 -1
- package/lib/dtls/src/flight/flight.js +16 -5
- 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 +12 -4
- package/lib/dtls/src/flight/server/flight4.js.map +1 -1
- package/lib/dtls/src/flight/server/flight6.js +2 -1
- package/lib/dtls/src/flight/server/flight6.js.map +1 -1
- package/lib/dtls/src/handshake/const.d.ts +17 -13
- package/lib/dtls/src/handshake/const.js +16 -14
- package/lib/dtls/src/handshake/const.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 +5 -3
- package/lib/dtls/src/handshake/message/alert.js.map +1 -1
- package/lib/dtls/src/handshake/message/certificate.js +3 -2
- package/lib/dtls/src/handshake/message/certificate.js.map +1 -1
- package/lib/dtls/src/handshake/message/changeCipherSpec.js +4 -4
- 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 +5 -3
- package/lib/dtls/src/handshake/message/client/certificateVerify.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/hello.js +15 -8
- package/lib/dtls/src/handshake/message/client/hello.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/keyExchange.js +3 -2
- package/lib/dtls/src/handshake/message/client/keyExchange.js.map +1 -1
- package/lib/dtls/src/handshake/message/finished.js +2 -1
- package/lib/dtls/src/handshake/message/finished.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 +7 -4
- 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 +14 -8
- 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 +5 -3
- 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 +17 -9
- package/lib/dtls/src/handshake/message/server/keyExchange.js.map +1 -1
- package/lib/dtls/src/handshake/random.d.ts +1 -1
- package/lib/dtls/src/handshake/random.js +7 -4
- 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/const.d.ts +43 -33
- package/lib/dtls/src/record/const.js +43 -36
- package/lib/dtls/src/record/const.js.map +1 -1
- package/lib/dtls/src/record/message/fragment.d.ts +1 -1
- package/lib/dtls/src/record/message/fragment.js +15 -9
- package/lib/dtls/src/record/message/fragment.js.map +1 -1
- package/lib/dtls/src/record/message/header.js +12 -7
- package/lib/dtls/src/record/message/header.js.map +1 -1
- package/lib/dtls/src/record/message/plaintext.js +4 -2
- package/lib/dtls/src/record/message/plaintext.js.map +1 -1
- package/lib/dtls/src/record/receive.js +2 -2
- package/lib/dtls/src/record/receive.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 +6 -4
- package/lib/dtls/src/socket.js.map +1 -1
- package/lib/ice/src/candidate.d.ts +1 -1
- package/lib/ice/src/candidate.js +24 -12
- package/lib/ice/src/candidate.js.map +1 -1
- package/lib/ice/src/dns/lookup.d.ts +10 -1
- package/lib/ice/src/dns/lookup.js +42 -7
- package/lib/ice/src/dns/lookup.js.map +1 -1
- package/lib/ice/src/exceptions.d.ts +46 -0
- package/lib/ice/src/exceptions.js +92 -5
- 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 +191 -5
- package/lib/ice/src/ice.js +1048 -156
- package/lib/ice/src/ice.js.map +1 -1
- package/lib/ice/src/iceBase.d.ts +174 -10
- package/lib/ice/src/iceBase.js +165 -12
- 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 +35 -1
- package/lib/ice/src/stun/transaction.js +93 -18
- package/lib/ice/src/stun/transaction.js.map +1 -1
- package/lib/ice/src/turn/credential.d.ts +49 -0
- package/lib/ice/src/turn/credential.js +78 -0
- package/lib/ice/src/turn/credential.js.map +1 -0
- package/lib/ice/src/turn/protocol.d.ts +97 -7
- package/lib/ice/src/turn/protocol.js +357 -55
- 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/attributes.d.ts +2 -0
- package/lib/ice-server/src/stun/attributes.js +7 -1
- package/lib/ice-server/src/stun/attributes.js.map +1 -1
- package/lib/ice-server/src/stun/const.d.ts +24 -16
- package/lib/ice-server/src/stun/const.js +22 -18
- package/lib/ice-server/src/stun/const.js.map +1 -1
- package/lib/ice-server/src/stun/message.d.ts +3 -1
- package/lib/ice-server/src/stun/message.js +41 -6
- 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 +25252 -12664
- package/lib/nonstandard/index.mjs +11015 -8906
- package/lib/polyfill/dom.mjs +30779 -18386
- package/lib/polyfill/index.mjs +30779 -18386
- package/lib/rtp/src/codec/assertPayload.d.ts +4 -0
- package/lib/rtp/src/codec/assertPayload.js +12 -0
- package/lib/rtp/src/codec/assertPayload.js.map +1 -0
- package/lib/rtp/src/codec/av1.js +2 -0
- package/lib/rtp/src/codec/av1.js.map +1 -1
- package/lib/rtp/src/codec/h264.d.ts +1 -1
- package/lib/rtp/src/codec/h264.js +35 -43
- package/lib/rtp/src/codec/h264.js.map +1 -1
- package/lib/rtp/src/codec/vp8.js +11 -5
- package/lib/rtp/src/codec/vp8.js.map +1 -1
- package/lib/rtp/src/codec/vp9.js +12 -0
- package/lib/rtp/src/codec/vp9.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/container.js +2 -1
- package/lib/rtp/src/extra/container/mp4/container.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/exp-golomb.js +2 -1
- package/lib/rtp/src/extra/container/mp4/exp-golomb.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/h264.d.ts +21 -17
- package/lib/rtp/src/extra/container/mp4/h264.js +26 -24
- package/lib/rtp/src/extra/container/mp4/h264.js.map +1 -1
- package/lib/rtp/src/extra/container/ogg/index.d.ts +1 -0
- package/lib/rtp/src/extra/container/ogg/index.js +1 -0
- package/lib/rtp/src/extra/container/ogg/index.js.map +1 -1
- package/lib/rtp/src/extra/container/ogg/writer.d.ts +90 -0
- package/lib/rtp/src/extra/container/ogg/writer.js +300 -0
- package/lib/rtp/src/extra/container/ogg/writer.js.map +1 -0
- 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 +26 -4
- package/lib/rtp/src/extra/container/webm/ebml/ebml.js.map +1 -1
- package/lib/rtp/src/extra/processor/depacketizer.d.ts +6 -1
- package/lib/rtp/src/extra/processor/depacketizer.js +29 -3
- 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/dtx.js +4 -2
- package/lib/rtp/src/extra/processor/dtx.js.map +1 -1
- package/lib/rtp/src/extra/processor/dtxCallback.d.ts +1 -11
- package/lib/rtp/src/extra/processor/index.d.ts +2 -0
- package/lib/rtp/src/extra/processor/index.js +2 -0
- package/lib/rtp/src/extra/processor/index.js.map +1 -1
- 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/jitterBuffer.d.ts +29 -6
- package/lib/rtp/src/extra/processor/jitterBuffer.js +101 -111
- package/lib/rtp/src/extra/processor/jitterBuffer.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/jitterBufferTransformer.js +2 -1
- package/lib/rtp/src/extra/processor/jitterBufferTransformer.js.map +1 -1
- package/lib/rtp/src/extra/processor/lipsync.d.ts +63 -0
- package/lib/rtp/src/extra/processor/lipsync.js +202 -51
- package/lib/rtp/src/extra/processor/lipsync.js.map +1 -1
- package/lib/rtp/src/extra/processor/mp4.d.ts +0 -6
- package/lib/rtp/src/extra/processor/mp4.js +7 -4
- package/lib/rtp/src/extra/processor/mp4.js.map +1 -1
- package/lib/rtp/src/extra/processor/mute.js +4 -2
- package/lib/rtp/src/extra/processor/mute.js.map +1 -1
- package/lib/rtp/src/extra/processor/nack.d.ts +1 -1
- package/lib/rtp/src/extra/processor/nack.js +5 -3
- 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 +4 -6
- 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/ogg.d.ts +72 -0
- package/lib/rtp/src/extra/processor/ogg.js +221 -0
- package/lib/rtp/src/extra/processor/ogg.js.map +1 -0
- package/lib/rtp/src/extra/processor/oggCallback.d.ts +21 -0
- package/lib/rtp/src/extra/processor/oggCallback.js +97 -0
- package/lib/rtp/src/extra/processor/oggCallback.js.map +1 -0
- 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 +3 -2
- 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 +2 -1
- package/lib/rtp/src/extra/processor/rtpStream.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpTime.js +2 -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 +57 -23
- 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 +10 -2
- package/lib/rtp/src/index.js +10 -2
- package/lib/rtp/src/index.js.map +1 -1
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.d.ts +4 -0
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js +6 -1
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js.map +1 -1
- package/lib/rtp/src/rtcp/rtcp.js +9 -4
- package/lib/rtp/src/rtcp/rtcp.js.map +1 -1
- package/lib/rtp/src/rtcp/rtpfb/transportWideSequence.d.ts +58 -0
- package/lib/rtp/src/rtcp/rtpfb/transportWideSequence.js +143 -0
- package/lib/rtp/src/rtcp/rtpfb/transportWideSequence.js.map +1 -0
- package/lib/rtp/src/rtcp/rtpfb/twcc.d.ts +35 -13
- package/lib/rtp/src/rtcp/rtpfb/twcc.js +132 -54
- package/lib/rtp/src/rtcp/rtpfb/twcc.js.map +1 -1
- package/lib/rtp/src/rtcp/rtpfb/twccReceiveTiming.d.ts +13 -0
- package/lib/rtp/src/rtcp/rtpfb/twccReceiveTiming.js +29 -0
- package/lib/rtp/src/rtcp/rtpfb/twccReceiveTiming.js.map +1 -0
- package/lib/rtp/src/rtcp/rtpfb/twccReferenceTime.d.ts +41 -0
- package/lib/rtp/src/rtcp/rtpfb/twccReferenceTime.js +89 -0
- package/lib/rtp/src/rtcp/rtpfb/twccReferenceTime.js.map +1 -0
- package/lib/rtp/src/rtcp/sr.d.ts +4 -3
- package/lib/rtp/src/rtcp/sr.js +4 -2
- package/lib/rtp/src/rtcp/sr.js.map +1 -1
- package/lib/rtp/src/rtp/continuity.d.ts +36 -0
- package/lib/rtp/src/rtp/continuity.js +100 -0
- package/lib/rtp/src/rtp/continuity.js.map +1 -0
- package/lib/rtp/src/rtp/headerExtension.js +41 -21
- package/lib/rtp/src/rtp/headerExtension.js.map +1 -1
- package/lib/rtp/src/rtp/padding.d.ts +17 -0
- package/lib/rtp/src/rtp/padding.js +37 -0
- package/lib/rtp/src/rtp/padding.js.map +1 -0
- package/lib/rtp/src/rtp/red/encoder.d.ts +10 -0
- package/lib/rtp/src/rtp/red/encoder.js +14 -1
- package/lib/rtp/src/rtp/red/encoder.js.map +1 -1
- package/lib/rtp/src/rtp/red/packet.js +24 -8
- package/lib/rtp/src/rtp/red/packet.js.map +1 -1
- package/lib/rtp/src/rtp/rtp.d.ts +24 -1
- package/lib/rtp/src/rtp/rtp.js +70 -29
- package/lib/rtp/src/rtp/rtp.js.map +1 -1
- package/lib/rtp/src/rtp/rtx.js +3 -0
- package/lib/rtp/src/rtp/rtx.js.map +1 -1
- package/lib/rtp/src/rtp/sendHeaderExtensions.d.ts +36 -0
- package/lib/rtp/src/rtp/sendHeaderExtensions.js +85 -0
- package/lib/rtp/src/rtp/sendHeaderExtensions.js.map +1 -0
- package/lib/rtp/src/srtp/cipher/ctr.d.ts +2 -2
- package/lib/rtp/src/srtp/cipher/ctr.js +5 -3
- 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/cipher/index.js +8 -4
- package/lib/rtp/src/srtp/cipher/index.js.map +1 -1
- package/lib/rtp/src/srtp/context/context.d.ts +29 -1
- package/lib/rtp/src/srtp/context/context.js +84 -27
- package/lib/rtp/src/srtp/context/context.js.map +1 -1
- package/lib/rtp/src/srtp/context/srtcp.d.ts +1 -1
- package/lib/rtp/src/srtp/context/srtcp.js +33 -0
- package/lib/rtp/src/srtp/context/srtcp.js.map +1 -1
- package/lib/rtp/src/srtp/context/srtp.d.ts +1 -1
- package/lib/rtp/src/srtp/context/srtp.js +36 -4
- package/lib/rtp/src/srtp/context/srtp.js.map +1 -1
- package/lib/rtp/src/srtp/error.d.ts +8 -0
- package/lib/rtp/src/srtp/error.js +13 -1
- package/lib/rtp/src/srtp/error.js.map +1 -1
- package/lib/rtp/src/srtp/packet.js +4 -1
- package/lib/rtp/src/srtp/packet.js.map +1 -1
- package/lib/rtp/src/srtp/replay.d.ts +24 -0
- package/lib/rtp/src/srtp/replay.js +75 -0
- package/lib/rtp/src/srtp/replay.js.map +1 -0
- package/lib/rtp/src/srtp/session.js +2 -1
- package/lib/rtp/src/srtp/session.js.map +1 -1
- package/lib/rtp/src/srtp/srtcp.js +2 -1
- package/lib/rtp/src/srtp/srtcp.js.map +1 -1
- package/lib/rtp/src/srtp/srtp.js +2 -1
- package/lib/rtp/src/srtp/srtp.js.map +1 -1
- package/lib/rtp/src/util.js +2 -1
- package/lib/rtp/src/util.js.map +1 -1
- package/lib/sctp/src/chunk.d.ts +5 -0
- package/lib/sctp/src/chunk.js +31 -8
- package/lib/sctp/src/chunk.js.map +1 -1
- package/lib/sctp/src/const.d.ts +25 -17
- package/lib/sctp/src/const.js +23 -19
- package/lib/sctp/src/const.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/param.d.ts +6 -2
- package/lib/sctp/src/param.js +22 -8
- package/lib/sctp/src/param.js.map +1 -1
- package/lib/sctp/src/sctp.d.ts +91 -2
- package/lib/sctp/src/sctp.js +700 -134
- package/lib/sctp/src/sctp.js.map +1 -1
- package/lib/sctp/src/transport.js +4 -2
- package/lib/sctp/src/transport.js.map +1 -1
- package/lib/webrtc/src/api/peerConfig.d.ts +307 -0
- package/lib/webrtc/src/api/peerConfig.js +291 -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 +11 -1
- package/lib/webrtc/src/dataChannel.js +25 -5
- 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 +11 -1
- package/lib/webrtc/src/media/index.js +71 -1
- package/lib/webrtc/src/media/index.js.map +1 -1
- package/lib/webrtc/src/media/receiver/nack.js +5 -5
- package/lib/webrtc/src/media/receiver/nack.js.map +1 -1
- package/lib/webrtc/src/media/receiver/receiverTwcc.d.ts +61 -1
- package/lib/webrtc/src/media/receiver/receiverTwcc.js +218 -63
- package/lib/webrtc/src/media/receiver/receiverTwcc.js.map +1 -1
- package/lib/webrtc/src/media/router.d.ts +130 -6
- package/lib/webrtc/src/media/router.js +325 -29
- package/lib/webrtc/src/media/router.js.map +1 -1
- package/lib/webrtc/src/media/rtpReceiver.d.ts +137 -14
- package/lib/webrtc/src/media/rtpReceiver.js +420 -44
- package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
- package/lib/webrtc/src/media/rtpSender.d.ts +232 -65
- package/lib/webrtc/src/media/rtpSender.js +784 -448
- package/lib/webrtc/src/media/rtpSender.js.map +1 -1
- package/lib/webrtc/src/media/rtpTransceiver.d.ts +95 -4
- package/lib/webrtc/src/media/rtpTransceiver.js +121 -9
- package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
- package/lib/webrtc/src/media/sender/bandwidthEstimator.d.ts +249 -0
- package/lib/webrtc/src/media/sender/bandwidthEstimator.js +144 -0
- package/lib/webrtc/src/media/sender/bandwidthEstimator.js.map +1 -0
- package/lib/webrtc/src/media/sender/createBandwidthEstimator.d.ts +20 -0
- package/lib/webrtc/src/media/sender/createBandwidthEstimator.js +26 -0
- package/lib/webrtc/src/media/sender/createBandwidthEstimator.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimatorBinding.d.ts +70 -0
- package/lib/webrtc/src/media/sender/estimatorBinding.js +175 -0
- package/lib/webrtc/src/media/sender/estimatorBinding.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/disabledBwe.d.ts +18 -0
- package/lib/webrtc/src/media/sender/estimators/disabledBwe.js +44 -0
- package/lib/webrtc/src/media/sender/estimators/disabledBwe.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/acknowledgedBitrateEstimator.d.ts +79 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/acknowledgedBitrateEstimator.js +289 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/acknowledgedBitrateEstimator.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/aimdRateControl.d.ts +87 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/aimdRateControl.js +429 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/aimdRateControl.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/alrDetector.d.ts +21 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/alrDetector.js +84 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/alrDetector.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/bandwidthLimitedCause.d.ts +37 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/bandwidthLimitedCause.js +74 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/bandwidthLimitedCause.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/constants.d.ts +383 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/constants.js +408 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/constants.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/gccBwe.d.ts +406 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/gccBwe.js +1391 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/gccBwe.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/index.d.ts +19 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/index.js +75 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/index.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/interArrivalDelta.d.ts +68 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/interArrivalDelta.js +201 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/interArrivalDelta.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/intervalBudget.d.ts +26 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/intervalBudget.js +72 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/intervalBudget.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/linkCapacityEstimator.d.ts +41 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/linkCapacityEstimator.js +99 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/linkCapacityEstimator.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/lossBasedBwe.d.ts +247 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/lossBasedBwe.js +1042 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/lossBasedBwe.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/overuseDetector.d.ts +26 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/overuseDetector.js +132 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/overuseDetector.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/probeController.d.ts +305 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/probeController.js +1073 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/probeController.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/rttBasedBackoff.d.ts +60 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/rttBasedBackoff.js +151 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/rttBasedBackoff.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/trendlineEstimator.d.ts +44 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/trendlineEstimator.js +246 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/trendlineEstimator.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/index.d.ts +7 -0
- package/lib/webrtc/src/media/sender/estimators/index.js +19 -0
- package/lib/webrtc/src/media/sender/estimators/index.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/lightweightBwe.d.ts +64 -0
- package/lib/webrtc/src/media/sender/estimators/lightweightBwe.js +216 -0
- package/lib/webrtc/src/media/sender/estimators/lightweightBwe.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/twccFeedbackAdapter.d.ts +117 -0
- package/lib/webrtc/src/media/sender/estimators/twccFeedbackAdapter.js +250 -0
- package/lib/webrtc/src/media/sender/estimators/twccFeedbackAdapter.js.map +1 -0
- package/lib/webrtc/src/media/sender/outgoingQueue.d.ts +40 -0
- package/lib/webrtc/src/media/sender/outgoingQueue.js +153 -0
- package/lib/webrtc/src/media/sender/outgoingQueue.js.map +1 -0
- package/lib/webrtc/src/media/sender/padding.d.ts +45 -0
- package/lib/webrtc/src/media/sender/padding.js +134 -0
- package/lib/webrtc/src/media/sender/padding.js.map +1 -0
- package/lib/webrtc/src/media/sender/pendingRtp.d.ts +35 -0
- package/lib/webrtc/src/media/sender/pendingRtp.js +120 -0
- package/lib/webrtc/src/media/sender/pendingRtp.js.map +1 -0
- package/lib/webrtc/src/media/sender/rtpWire.d.ts +13 -0
- package/lib/webrtc/src/media/sender/rtpWire.js +38 -0
- package/lib/webrtc/src/media/sender/rtpWire.js.map +1 -0
- package/lib/webrtc/src/media/sender/sendPacer.d.ts +27 -0
- package/lib/webrtc/src/media/sender/sendPacer.js +110 -0
- package/lib/webrtc/src/media/sender/sendPacer.js.map +1 -0
- package/lib/webrtc/src/media/sender/senderBWE.d.ts +8 -32
- package/lib/webrtc/src/media/sender/senderBWE.js +5 -142
- package/lib/webrtc/src/media/sender/senderBWE.js.map +1 -1
- package/lib/webrtc/src/media/sender/senderStats.d.ts +100 -0
- package/lib/webrtc/src/media/sender/senderStats.js +322 -0
- package/lib/webrtc/src/media/sender/senderStats.js.map +1 -0
- package/lib/webrtc/src/media/track.d.ts +21 -3
- package/lib/webrtc/src/media/track.js +24 -6
- package/lib/webrtc/src/media/track.js.map +1 -1
- package/lib/webrtc/src/negotiation/bundleTopology.d.ts +103 -0
- package/lib/webrtc/src/negotiation/bundleTopology.js +384 -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 +267 -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 +119 -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 +349 -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 +414 -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 +356 -0
- package/lib/webrtc/src/negotiation/transportActivation.js.map +1 -0
- package/lib/webrtc/src/negotiationTransaction.d.ts +240 -0
- package/lib/webrtc/src/negotiationTransaction.js +604 -0
- package/lib/webrtc/src/negotiationTransaction.js.map +1 -0
- package/lib/webrtc/src/nonstandard/dummyMedia.js +2 -1
- 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 +4 -3
- package/lib/webrtc/src/nonstandard/navigator.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/index.d.ts +32 -8
- package/lib/webrtc/src/nonstandard/recorder/index.js +81 -20
- package/lib/webrtc/src/nonstandard/recorder/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/index.d.ts +10 -8
- package/lib/webrtc/src/nonstandard/recorder/writer/index.js +2 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/ogg.d.ts +32 -0
- package/lib/webrtc/src/nonstandard/recorder/writer/ogg.js +185 -0
- package/lib/webrtc/src/nonstandard/recorder/writer/ogg.js.map +1 -0
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.d.ts +2 -2
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js +10 -3
- 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 +4 -3
- package/lib/webrtc/src/nonstandard/userMedia.js.map +1 -1
- package/lib/webrtc/src/peerConnection.d.ts +176 -238
- package/lib/webrtc/src/peerConnection.js +1042 -913
- 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 +2 -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 +97 -1
- package/lib/webrtc/src/sctpManager.js +189 -9
- package/lib/webrtc/src/sctpManager.js.map +1 -1
- package/lib/webrtc/src/sdp.js +12 -6
- 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 +89 -28
- package/lib/webrtc/src/secureTransportManager.js +232 -53
- package/lib/webrtc/src/secureTransportManager.js.map +1 -1
- package/lib/webrtc/src/transceiverManager.d.ts +62 -18
- package/lib/webrtc/src/transceiverManager.js +272 -107
- package/lib/webrtc/src/transceiverManager.js.map +1 -1
- package/lib/webrtc/src/transport/dtls.d.ts +64 -3
- package/lib/webrtc/src/transport/dtls.js +166 -42
- package/lib/webrtc/src/transport/dtls.js.map +1 -1
- package/lib/webrtc/src/transport/ice.d.ts +199 -28
- package/lib/webrtc/src/transport/ice.js +666 -71
- 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 +6 -1
- package/lib/webrtc/src/transport/sctp.js +149 -37
- package/lib/webrtc/src/transport/sctp.js.map +1 -1
- package/lib/webrtc/src/utils.d.ts +39 -6
- package/lib/webrtc/src/utils.js +57 -17
- package/lib/webrtc/src/utils.js.map +1 -1
- package/package.json +16 -15
|
@@ -4,11 +4,12 @@ exports.RTCIceParameters = exports.IceCandidate = exports.RTCIceCandidate = expo
|
|
|
4
4
|
exports.candidateFromIce = candidateFromIce;
|
|
5
5
|
exports.candidateToIce = candidateToIce;
|
|
6
6
|
const crypto_1 = require("crypto");
|
|
7
|
-
const common_1 = require("../imports/common");
|
|
8
7
|
const src_1 = require("../../../ice/src");
|
|
9
8
|
const helper_1 = require("../helper");
|
|
9
|
+
const common_1 = require("../imports/common");
|
|
10
10
|
const stats_1 = require("../media/stats");
|
|
11
11
|
const sdp_1 = require("../sdp");
|
|
12
|
+
const iceCandidateAttribute_1 = require("./iceCandidateAttribute");
|
|
12
13
|
const log = (0, common_1.debug)("werift:packages/webrtc/src/transport/ice.ts");
|
|
13
14
|
function mapCandidatePairState(state) {
|
|
14
15
|
switch (state) {
|
|
@@ -27,26 +28,63 @@ function mapCandidatePairState(state) {
|
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
31
|
+
* ICE generations of one transport. An ICE restart (new ufrag/pwd without a
|
|
32
|
+
* BUNDLE topology change) keeps the transport, its sockets and its DTLS
|
|
33
|
+
* association: no role renegotiation, no second handshake (RFC 8842, JSEP).
|
|
34
|
+
* Only a BUNDLE owner change creates a separate pending transport.
|
|
35
|
+
*
|
|
36
|
+
* Restart generations are registered by ufrag (`localGenerationFor`): the
|
|
37
|
+
* latest created offer and the latest created answer each keep theirs until a
|
|
38
|
+
* newer description of the same kind replaces it, whatever is applied, rolled
|
|
39
|
+
* back or committed meanwhile. Applying a description selects the generation
|
|
40
|
+
* its SDP carries, and the final answer switches exactly that one. A new offer
|
|
41
|
+
* reuses the applied pending offer's generation (JSEP 5.2.1) unless
|
|
42
|
+
* `restartIce()` asked to replace it; an answer created again reuses the
|
|
43
|
+
* earlier answer's (JSEP 5.3.1).
|
|
44
|
+
*
|
|
45
|
+
* Provisional generation: while a restart of an established transport is
|
|
46
|
+
* negotiated, a second checklist runs beside the live one on the same sockets.
|
|
47
|
+
* It only exchanges STUN checks; RTP and DataChannel stay on the live selected
|
|
48
|
+
* pair, and it follows the live checklist's rules (pair filter, ICE-lite,
|
|
49
|
+
* nomination, staged-password error responses).
|
|
50
|
+
*
|
|
51
|
+
* - Created when the restart credentials are staged (`stageLocalRestart`): by
|
|
52
|
+
* `createOffer()` while a `restartIce()` request stands, or by
|
|
53
|
+
* `createAnswer()` for a remote offer that changes a live transport's ufrag.
|
|
54
|
+
* It then answers checks for that ufrag.
|
|
55
|
+
* - Fed by the pranswer with the peer's credentials, candidates and
|
|
56
|
+
* end-of-candidates (`setProvisionalRemoteParams`,
|
|
57
|
+
* `addProvisionalRemoteCandidate`); a replacement pranswer restarts it.
|
|
58
|
+
* - Checks start when the pranswer is applied (`startProvisionalChecks`); the
|
|
59
|
+
* controlling side nominates a provisional pair, but the live selected pair
|
|
60
|
+
* and send target never change. A response for an earlier checklist is
|
|
61
|
+
* ignored.
|
|
62
|
+
* - Ends at the final answer, which recreates the live agent with the staged
|
|
63
|
+
* credentials and checks the answered generation from scratch, or at
|
|
64
|
+
* rollback / a replacement offer / selecting another generation, which
|
|
65
|
+
* stops its checks and keeps the live generation.
|
|
66
|
+
*
|
|
67
|
+
* A first negotiation and transports created for a proposal have no
|
|
68
|
+
* provisional generation; they connect normally from the pranswer. The
|
|
69
|
+
* staged-credential methods of `IceConnection` are optional: without them a
|
|
70
|
+
* restart still happens at the final answer, without provisional checks.
|
|
71
|
+
*
|
|
72
|
+
* A restart generation's candidates are fixed when its description is
|
|
73
|
+
* created (host candidates of the kept sockets and their server-reflexive
|
|
74
|
+
* addresses) and are re-advertised at the commit without waiting. With STUN
|
|
75
|
+
* or TURN servers the description carries neither the relay candidate nor
|
|
76
|
+
* end-of-candidates: after the commit the generation gathers again (a new TURN
|
|
77
|
+
* allocation replaces and closes the previous one) and trickles them. A
|
|
78
|
+
* restart's background gathering that a later restart or `close()` replaced
|
|
79
|
+
* signals nothing more. ICE server settings changed after gathering take
|
|
80
|
+
* effect at the next restart (JSEP 4.1.18): the restart generation carries
|
|
81
|
+
* only the kept candidates a fresh gathering with them would produce (none
|
|
82
|
+
* but relay for a relay-only policy, no TCP host candidates without useTcp),
|
|
83
|
+
* in its description and at the commit alike. Settings changed after the
|
|
84
|
+
* description was created still apply to that restart's gathering at the
|
|
85
|
+
* commit: a kept socket they exclude is closed then, so a candidate the
|
|
86
|
+
* description announced for it fails its checks. The old selected pair is
|
|
87
|
+
* dropped at the commit, so RTP pauses until the new generation nominates.
|
|
50
88
|
*/
|
|
51
89
|
class RTCIceTransport {
|
|
52
90
|
constructor(iceGather) {
|
|
@@ -54,7 +92,7 @@ class RTCIceTransport {
|
|
|
54
92
|
enumerable: true,
|
|
55
93
|
configurable: true,
|
|
56
94
|
writable: true,
|
|
57
|
-
value:
|
|
95
|
+
value: void 0
|
|
58
96
|
});
|
|
59
97
|
Object.defineProperty(this, "id", {
|
|
60
98
|
enumerable: true,
|
|
@@ -92,12 +130,89 @@ class RTCIceTransport {
|
|
|
92
130
|
writable: true,
|
|
93
131
|
value: void 0
|
|
94
132
|
});
|
|
133
|
+
Object.defineProperty(this, "startPromise", {
|
|
134
|
+
enumerable: true,
|
|
135
|
+
configurable: true,
|
|
136
|
+
writable: true,
|
|
137
|
+
value: void 0
|
|
138
|
+
});
|
|
139
|
+
/**
|
|
140
|
+
* Connectivity checks were started for the current generation. A restart
|
|
141
|
+
* resets it; the state alone cannot tell (an agent that finished gathering
|
|
142
|
+
* reports "completed" before any check ran).
|
|
143
|
+
* @internal
|
|
144
|
+
*/
|
|
145
|
+
Object.defineProperty(this, "checksStarted", {
|
|
146
|
+
enumerable: true,
|
|
147
|
+
configurable: true,
|
|
148
|
+
writable: true,
|
|
149
|
+
value: false
|
|
150
|
+
});
|
|
95
151
|
Object.defineProperty(this, "renominating", {
|
|
96
152
|
enumerable: true,
|
|
97
153
|
configurable: true,
|
|
98
154
|
writable: true,
|
|
99
155
|
value: false
|
|
100
156
|
});
|
|
157
|
+
/**
|
|
158
|
+
* The restart generation selected for the description being created or
|
|
159
|
+
* applied (the one createOffer / createAnswer put in its SDP, or the one an
|
|
160
|
+
* applied description carries).
|
|
161
|
+
*/
|
|
162
|
+
Object.defineProperty(this, "stagedLocalRestart", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
configurable: true,
|
|
165
|
+
writable: true,
|
|
166
|
+
value: void 0
|
|
167
|
+
});
|
|
168
|
+
/**
|
|
169
|
+
* The restart generations the latest created offer and the latest created
|
|
170
|
+
* answer carry, by ufrag (their generation records). One stays registered
|
|
171
|
+
* until a newer description of the same kind replaces it (unless an
|
|
172
|
+
* applied description still carries it) or the transport stops, whatever
|
|
173
|
+
* is applied, rolled back or committed meanwhile; applying a description
|
|
174
|
+
* that carries it selects it (an ICE restart to those credentials on the
|
|
175
|
+
* kept sockets).
|
|
176
|
+
*/
|
|
177
|
+
Object.defineProperty(this, "localGenerations", {
|
|
178
|
+
enumerable: true,
|
|
179
|
+
configurable: true,
|
|
180
|
+
writable: true,
|
|
181
|
+
value: new Map()
|
|
182
|
+
});
|
|
183
|
+
/**
|
|
184
|
+
* The staged generation an applied description (pending local offer, or a
|
|
185
|
+
* remote offer being answered) carries. It stays until that description is
|
|
186
|
+
* committed, replaced or rolled back; an unapplied createOffer cannot drop it.
|
|
187
|
+
*/
|
|
188
|
+
Object.defineProperty(this, "appliedLocalRestart", {
|
|
189
|
+
enumerable: true,
|
|
190
|
+
configurable: true,
|
|
191
|
+
writable: true,
|
|
192
|
+
value: void 0
|
|
193
|
+
});
|
|
194
|
+
/**
|
|
195
|
+
* Gatherer events of an ICE restart committed by a local answer, held until
|
|
196
|
+
* that answer is applied (`emitCommittedCandidates`), in their order: the
|
|
197
|
+
* re-advertised candidates first, then what the servers add and
|
|
198
|
+
* end-of-candidates.
|
|
199
|
+
*/
|
|
200
|
+
Object.defineProperty(this, "heldCandidateEvents", {
|
|
201
|
+
enumerable: true,
|
|
202
|
+
configurable: true,
|
|
203
|
+
writable: true,
|
|
204
|
+
value: void 0
|
|
205
|
+
});
|
|
206
|
+
/**
|
|
207
|
+
* ICE servers set (setConfiguration) after this transport gathered. They
|
|
208
|
+
* apply to the next gathering, that is the next ICE restart (JSEP 4.1.18).
|
|
209
|
+
*/
|
|
210
|
+
Object.defineProperty(this, "nextGatherIceServers", {
|
|
211
|
+
enumerable: true,
|
|
212
|
+
configurable: true,
|
|
213
|
+
writable: true,
|
|
214
|
+
value: void 0
|
|
215
|
+
});
|
|
101
216
|
Object.defineProperty(this, "events", {
|
|
102
217
|
enumerable: true,
|
|
103
218
|
configurable: true,
|
|
@@ -168,12 +283,16 @@ class RTCIceTransport {
|
|
|
168
283
|
}
|
|
169
284
|
}
|
|
170
285
|
});
|
|
286
|
+
this.iceGather = iceGather;
|
|
171
287
|
this.connection = this.iceGather.connection;
|
|
172
288
|
this.connection.stateChanged.subscribe((state) => {
|
|
173
289
|
this.setState(state);
|
|
174
290
|
});
|
|
175
291
|
this.iceGather.onIceCandidate = (candidate) => {
|
|
176
|
-
this.
|
|
292
|
+
if (this.heldCandidateEvents)
|
|
293
|
+
this.heldCandidateEvents.push(candidate);
|
|
294
|
+
else
|
|
295
|
+
this.onIceCandidate.execute(candidate);
|
|
177
296
|
};
|
|
178
297
|
this.iceGather.onGatheringStateChange.subscribe(() => {
|
|
179
298
|
this.ongatheringstatechange?.();
|
|
@@ -193,10 +312,301 @@ class RTCIceTransport {
|
|
|
193
312
|
return this.iceGather.gatheringState;
|
|
194
313
|
}
|
|
195
314
|
get localCandidates() {
|
|
196
|
-
return this.
|
|
315
|
+
return this.describedLocalGeneration().candidates;
|
|
316
|
+
}
|
|
317
|
+
/** Whether the local description may carry `a=end-of-candidates`. */
|
|
318
|
+
get localCandidatesComplete() {
|
|
319
|
+
return this.describedLocalGeneration().complete;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* The local ICE generation a description carries: its credentials,
|
|
323
|
+
* candidates and whether they are complete. A description being created
|
|
324
|
+
* carries a staged restart. One already applied (refreshed when the live
|
|
325
|
+
* generation gathers more) carries the staged restart only if it applied
|
|
326
|
+
* it; a later createOffer() that staged another generation without applying
|
|
327
|
+
* it does not change an applied description.
|
|
328
|
+
* @internal
|
|
329
|
+
*/
|
|
330
|
+
describedLocalGeneration({ applied = false } = {}) {
|
|
331
|
+
const staged = this.stagedLocalRestart;
|
|
332
|
+
if (!staged || (applied && staged !== this.appliedLocalRestart)) {
|
|
333
|
+
return {
|
|
334
|
+
parameters: this.iceGather.localParameters,
|
|
335
|
+
candidates: this.iceGather.localCandidates,
|
|
336
|
+
// The gatherer signals end-of-candidates (and the description that
|
|
337
|
+
// records it refreshes) just before its state becomes "complete".
|
|
338
|
+
complete: this.gatheringState === "complete" ||
|
|
339
|
+
this.connection.localCandidatesEnd,
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
const pending = this.stagedGatherPending();
|
|
343
|
+
return {
|
|
344
|
+
parameters: new RTCIceParameters({
|
|
345
|
+
iceLite: this.connection.iceLite,
|
|
346
|
+
usernameFragment: staged.usernameFragment,
|
|
347
|
+
password: staged.password,
|
|
348
|
+
}),
|
|
349
|
+
candidates: pending
|
|
350
|
+
? staged.candidates.filter((candidate) => candidate.type !== "relay")
|
|
351
|
+
: staged.candidates,
|
|
352
|
+
complete: this.gatheringState === "complete" && !pending,
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* A staged restart whose generation keeps gathering from its servers after
|
|
357
|
+
* the commit; its relay candidates and end-of-candidates come then.
|
|
358
|
+
*/
|
|
359
|
+
stagedGatherPending() {
|
|
360
|
+
const staged = this.stagedLocalRestart;
|
|
361
|
+
if (!staged)
|
|
362
|
+
return false;
|
|
363
|
+
if (staged.emitted)
|
|
364
|
+
return !!staged.endDeferred;
|
|
365
|
+
return !!this.nextGatherIceServers || !!this.connection.gathersFromServers;
|
|
197
366
|
}
|
|
198
367
|
get localParameters() {
|
|
199
|
-
return this.
|
|
368
|
+
return this.describedLocalGeneration().parameters;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Prepare an ICE generation for SDP without touching the selected pair.
|
|
372
|
+
* `answering` is the remote offer an answer is created for.
|
|
373
|
+
*/
|
|
374
|
+
stageLocalRestart({ answering, replacing, } = {}) {
|
|
375
|
+
// The generation a description of this kind already carries is reused,
|
|
376
|
+
// whatever was selected since: a new offer reuses the one of the pending
|
|
377
|
+
// applied offer (JSEP 5.2.1) unless restartIce() asked to replace it, and
|
|
378
|
+
// an answer created again for the same remote offer reuses the one the
|
|
379
|
+
// earlier answer carries (JSEP 5.3.1).
|
|
380
|
+
const applied = this.appliedLocalRestart;
|
|
381
|
+
const reused = answering
|
|
382
|
+
? [...this.localGenerations.values()].find((generation) => generation.answering === answering)
|
|
383
|
+
: applied && !replacing?.has(applied.usernameFragment)
|
|
384
|
+
? applied
|
|
385
|
+
: undefined;
|
|
386
|
+
if (reused) {
|
|
387
|
+
this.selectGeneration(reused);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
this.unselectLocalRestart();
|
|
391
|
+
const usernameFragment = (0, crypto_1.randomBytes)(6).toString("base64url");
|
|
392
|
+
const random = (0, crypto_1.randomBytes)(24).toString("base64url");
|
|
393
|
+
// The configured prefix (icePasswordPrefix) marks every generation's
|
|
394
|
+
// password, as the agent's own restart does.
|
|
395
|
+
const prefix = this.connection.options.localPasswordPrefix ?? "";
|
|
396
|
+
const password = prefix + random.slice(prefix.length);
|
|
397
|
+
// The generation gathers with the options set for it (a relay-only
|
|
398
|
+
// policy, useTcp turned off), so it carries only the kept candidates a
|
|
399
|
+
// fresh gathering with them would produce; the agent re-advertises the
|
|
400
|
+
// same ones at the commit.
|
|
401
|
+
const iceServers = this.nextGatherIceServers;
|
|
402
|
+
const gatherOptions = iceServers
|
|
403
|
+
? (0, src_1.mergeIceServerOptions)(this.connection.options, iceServers)
|
|
404
|
+
: this.connection.options;
|
|
405
|
+
const candidates = this.iceGather.localCandidates
|
|
406
|
+
.filter((candidate) => (0, src_1.isCandidateAllowedByGatherOptions)({ type: candidate.type, transport: candidate.protocol }, gatherOptions))
|
|
407
|
+
.map((candidate) => {
|
|
408
|
+
const copy = Object.assign(new IceCandidate(candidate.component, candidate.foundation, candidate.ip, candidate.port, candidate.priority, candidate.protocol, candidate.type, this.connection.generation + 1, usernameFragment), {
|
|
409
|
+
relatedAddress: candidate.relatedAddress,
|
|
410
|
+
relatedPort: candidate.relatedPort,
|
|
411
|
+
tcpType: candidate.tcpType,
|
|
412
|
+
});
|
|
413
|
+
return copy;
|
|
414
|
+
});
|
|
415
|
+
const generation = {
|
|
416
|
+
usernameFragment,
|
|
417
|
+
password,
|
|
418
|
+
candidates,
|
|
419
|
+
emitted: false,
|
|
420
|
+
answering,
|
|
421
|
+
createdBy: answering ? "answer" : "offer",
|
|
422
|
+
gatherOptions,
|
|
423
|
+
};
|
|
424
|
+
// The previous description of this kind is no longer the latest one.
|
|
425
|
+
for (const [ufrag, previous] of this.localGenerations) {
|
|
426
|
+
if (previous.createdBy === generation.createdBy &&
|
|
427
|
+
previous !== this.appliedLocalRestart) {
|
|
428
|
+
this.localGenerations.delete(ufrag);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
this.localGenerations.set(usernameFragment, generation);
|
|
432
|
+
this.stagedLocalRestart = generation;
|
|
433
|
+
// Existing sockets can respond to provisional STUN checks for the new
|
|
434
|
+
// ufrag while the old generation continues to carry media.
|
|
435
|
+
this.connection.stageLocalCredentials?.(usernameFragment, password, gatherOptions);
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* The local generation a description with these credentials carries:
|
|
439
|
+
* `"live"` for the agent's current credentials, the restart generation the
|
|
440
|
+
* latest created offer or answer carries, or `undefined` when the
|
|
441
|
+
* credentials belong to no generation the transport can take.
|
|
442
|
+
* @internal
|
|
443
|
+
*/
|
|
444
|
+
localGenerationFor(usernameFragment, password) {
|
|
445
|
+
const live = this.iceGather.localParameters;
|
|
446
|
+
if (live.usernameFragment === usernameFragment &&
|
|
447
|
+
live.password === password) {
|
|
448
|
+
return "live";
|
|
449
|
+
}
|
|
450
|
+
const generation = this.localGenerations.get(usernameFragment);
|
|
451
|
+
if (generation?.password === password)
|
|
452
|
+
return generation;
|
|
453
|
+
return undefined;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Select the local generation an applied description carries (see
|
|
457
|
+
* `localGenerationFor`). Returns false if the credentials belong to none.
|
|
458
|
+
* @internal
|
|
459
|
+
*/
|
|
460
|
+
selectLocalGeneration(usernameFragment, password) {
|
|
461
|
+
const generation = this.localGenerationFor(usernameFragment, password);
|
|
462
|
+
if (!generation)
|
|
463
|
+
return false;
|
|
464
|
+
if (generation === "live") {
|
|
465
|
+
this.unselectLocalRestart();
|
|
466
|
+
return true;
|
|
467
|
+
}
|
|
468
|
+
this.selectGeneration(generation);
|
|
469
|
+
return true;
|
|
470
|
+
}
|
|
471
|
+
selectGeneration(generation) {
|
|
472
|
+
if (this.stagedLocalRestart === generation)
|
|
473
|
+
return;
|
|
474
|
+
this.unselectLocalRestart();
|
|
475
|
+
this.stagedLocalRestart = generation;
|
|
476
|
+
this.connection.stageLocalCredentials?.(generation.usernameFragment, generation.password, generation.gatherOptions);
|
|
477
|
+
}
|
|
478
|
+
/** Stop answering checks for the selected generation; it stays registered. */
|
|
479
|
+
unselectLocalRestart() {
|
|
480
|
+
const staged = this.stagedLocalRestart;
|
|
481
|
+
if (!staged)
|
|
482
|
+
return;
|
|
483
|
+
this.connection.discardStagedLocalCredentials?.(staged.usernameFragment);
|
|
484
|
+
this.stagedLocalRestart = undefined;
|
|
485
|
+
}
|
|
486
|
+
get hasStagedRestart() {
|
|
487
|
+
return !!this.stagedLocalRestart;
|
|
488
|
+
}
|
|
489
|
+
/** Feed a pranswer's ICE generation to the provisional checklist. */
|
|
490
|
+
setProvisionalRemoteParams(remoteParameters) {
|
|
491
|
+
if (!this.stagedLocalRestart)
|
|
492
|
+
return;
|
|
493
|
+
this.connection.setProvisionalRemoteParams?.(remoteParameters);
|
|
494
|
+
}
|
|
495
|
+
addProvisionalRemoteCandidate(candidate) {
|
|
496
|
+
if (!this.stagedLocalRestart)
|
|
497
|
+
return;
|
|
498
|
+
return this.connection.addProvisionalRemoteCandidate?.(candidate ? candidateToIce(candidate) : undefined);
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Hand a remote candidate (`undefined`: end-of-candidates) to the ICE agent
|
|
502
|
+
* without waiting for it. A host candidate is added synchronously; an mDNS
|
|
503
|
+
* name may take seconds to resolve, and the agent itself orders that
|
|
504
|
+
* resolution against end-of-candidates and generation changes, so the
|
|
505
|
+
* description operation queue must not wait for it.
|
|
506
|
+
*/
|
|
507
|
+
deliverRemoteCandidate(candidate) {
|
|
508
|
+
void Promise.resolve(this.addRemoteCandidate(candidate)).catch((error) => log("addRemoteCandidate failed", error));
|
|
509
|
+
}
|
|
510
|
+
/** `deliverRemoteCandidate` for the provisional (pranswer) generation. */
|
|
511
|
+
deliverProvisionalRemoteCandidate(candidate) {
|
|
512
|
+
void Promise.resolve(this.addProvisionalRemoteCandidate(candidate)).catch((error) => log("addProvisionalRemoteCandidate failed", error));
|
|
513
|
+
}
|
|
514
|
+
startProvisionalChecks() {
|
|
515
|
+
if (!this.stagedLocalRestart)
|
|
516
|
+
return;
|
|
517
|
+
this.connection.startProvisionalChecks?.();
|
|
518
|
+
}
|
|
519
|
+
emitStagedCandidates() {
|
|
520
|
+
const staged = this.stagedLocalRestart;
|
|
521
|
+
if (!staged || staged.emitted)
|
|
522
|
+
return;
|
|
523
|
+
const candidates = this.localCandidates;
|
|
524
|
+
staged.endDeferred = this.stagedGatherPending();
|
|
525
|
+
staged.emitted = true;
|
|
526
|
+
for (const candidate of candidates) {
|
|
527
|
+
// A copy: the listener rewrites the event's foundation and m-line,
|
|
528
|
+
// while these candidates still render the local description.
|
|
529
|
+
this.onIceCandidate.execute(Object.assign(Object.create(Object.getPrototypeOf(candidate)), candidate));
|
|
530
|
+
}
|
|
531
|
+
if (!staged.endDeferred)
|
|
532
|
+
this.onIceCandidate.execute(undefined);
|
|
533
|
+
}
|
|
534
|
+
rollbackLocalRestart() {
|
|
535
|
+
this.appliedLocalRestart = undefined;
|
|
536
|
+
// A description applying this generation again signals its candidates
|
|
537
|
+
// again (the remote side rolled back too).
|
|
538
|
+
if (this.stagedLocalRestart)
|
|
539
|
+
this.stagedLocalRestart.emitted = false;
|
|
540
|
+
this.unselectLocalRestart();
|
|
541
|
+
}
|
|
542
|
+
/** The staged generation now belongs to an applied description. */
|
|
543
|
+
markLocalRestartApplied() {
|
|
544
|
+
this.appliedLocalRestart = this.stagedLocalRestart;
|
|
545
|
+
}
|
|
546
|
+
/** Drop only what an unapplied createOffer staged; keep the applied one. */
|
|
547
|
+
discardUnappliedLocalRestart() {
|
|
548
|
+
const staged = this.stagedLocalRestart;
|
|
549
|
+
const applied = this.appliedLocalRestart;
|
|
550
|
+
if (!staged || staged === applied)
|
|
551
|
+
return;
|
|
552
|
+
this.unselectLocalRestart();
|
|
553
|
+
if (applied) {
|
|
554
|
+
this.stagedLocalRestart = applied;
|
|
555
|
+
this.connection.stageLocalCredentials?.(applied.usernameFragment, applied.password, applied.gatherOptions);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Called unconditionally on every answer; actually restarts ICE only if
|
|
560
|
+
* this transport has a staged local restart. No-op otherwise.
|
|
561
|
+
*/
|
|
562
|
+
async commitLocalRestartIfStaged() {
|
|
563
|
+
const staged = this.stagedLocalRestart;
|
|
564
|
+
if (!staged)
|
|
565
|
+
return;
|
|
566
|
+
// The description already finalized this generation's candidates with
|
|
567
|
+
// end-of-candidates: it only re-advertises the kept sockets, and a server
|
|
568
|
+
// change waits for the next restart. Otherwise the generation keeps
|
|
569
|
+
// gathering from its servers (a fresh STUN mapping, a new TURN allocation)
|
|
570
|
+
// after the commit and trickles what they add.
|
|
571
|
+
const regather = this.stagedGatherPending();
|
|
572
|
+
this.restart(false, regather);
|
|
573
|
+
if (this.connection.commitLocalCredentials) {
|
|
574
|
+
this.connection.commitLocalCredentials(staged.usernameFragment, staged.password);
|
|
575
|
+
}
|
|
576
|
+
else {
|
|
577
|
+
this.connection.localUsername = staged.usernameFragment;
|
|
578
|
+
this.connection.localPassword = staged.password;
|
|
579
|
+
}
|
|
580
|
+
this.stagedLocalRestart = undefined;
|
|
581
|
+
this.appliedLocalRestart = undefined;
|
|
582
|
+
// A local answer signals its candidates after it is applied.
|
|
583
|
+
if (!staged.emitted)
|
|
584
|
+
this.heldCandidateEvents = [];
|
|
585
|
+
// The generation is live now. Its registration stays with the
|
|
586
|
+
// description that carries it (a later commit of another generation does
|
|
587
|
+
// not end it): applying that description again restarts to it, and its
|
|
588
|
+
// candidates are signalled again then.
|
|
589
|
+
staged.emitted = false;
|
|
590
|
+
staged.endDeferred = undefined;
|
|
591
|
+
// The kept sockets are re-advertised synchronously; nothing here waits
|
|
592
|
+
// for a server, so the commit never holds the new generation's checks.
|
|
593
|
+
const gathering = this.gather();
|
|
594
|
+
if (regather) {
|
|
595
|
+
void gathering.catch((error) => log("restart gathering failed", error));
|
|
596
|
+
}
|
|
597
|
+
else {
|
|
598
|
+
await gathering;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
/** Signal the candidates an ICE restart committed by a local answer gathered. */
|
|
602
|
+
emitCommittedCandidates() {
|
|
603
|
+
const held = this.heldCandidateEvents;
|
|
604
|
+
if (!held)
|
|
605
|
+
return;
|
|
606
|
+
this.heldCandidateEvents = undefined;
|
|
607
|
+
for (const candidate of held) {
|
|
608
|
+
this.onIceCandidate.execute(candidate);
|
|
609
|
+
}
|
|
200
610
|
}
|
|
201
611
|
getRemoteCandidates() {
|
|
202
612
|
return this.connection.remoteCandidates
|
|
@@ -231,6 +641,10 @@ class RTCIceTransport {
|
|
|
231
641
|
});
|
|
232
642
|
}
|
|
233
643
|
setState(state, emitEvent = true) {
|
|
644
|
+
// closed is final: checks that stop() interrupted must not report
|
|
645
|
+
// "failed" (or anything else) afterwards.
|
|
646
|
+
if (this.state === "closed")
|
|
647
|
+
return;
|
|
234
648
|
if (state !== this.state) {
|
|
235
649
|
this.state = state;
|
|
236
650
|
this.onStateChange.execute(state);
|
|
@@ -244,9 +658,20 @@ class RTCIceTransport {
|
|
|
244
658
|
return this.iceGather.gather();
|
|
245
659
|
}
|
|
246
660
|
setIceServers(options) {
|
|
661
|
+
this.nextGatherIceServers = undefined;
|
|
247
662
|
this.iceGather.setIceServers(options);
|
|
248
663
|
}
|
|
249
|
-
|
|
664
|
+
/** Keep ICE servers for the next gathering (an ICE restart). */
|
|
665
|
+
deferIceServers(options) {
|
|
666
|
+
this.nextGatherIceServers = options;
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* `keepLocalCredentials`: the remote credentials come from an answer or
|
|
670
|
+
* pranswer, so the local ones are fixed by the applied local offer. Changed
|
|
671
|
+
* remote credentials restart the checks for the new remote generation
|
|
672
|
+
* without new local credentials (nothing would describe them to the peer).
|
|
673
|
+
*/
|
|
674
|
+
setRemoteParams(remoteParameters, renomination = false, { keepLocalCredentials = false } = {}) {
|
|
250
675
|
if (renomination) {
|
|
251
676
|
this.renominating = true;
|
|
252
677
|
}
|
|
@@ -257,8 +682,15 @@ class RTCIceTransport {
|
|
|
257
682
|
if (this.renominating) {
|
|
258
683
|
log("renomination", remoteParameters);
|
|
259
684
|
this.connection.resetNominatedPair();
|
|
685
|
+
// The kept checklist holds only the new remote generation's
|
|
686
|
+
// candidates (and ones without a ufrag, as develop kept them).
|
|
687
|
+
this.connection.dropOtherRemoteGenerations?.(remoteParameters.usernameFragment);
|
|
260
688
|
this.renominating = false;
|
|
261
689
|
}
|
|
690
|
+
else if (keepLocalCredentials && this.connection.restartRemote) {
|
|
691
|
+
log("remote restart", remoteParameters);
|
|
692
|
+
this.resetRemoteGeneration();
|
|
693
|
+
}
|
|
262
694
|
else {
|
|
263
695
|
log("restart", remoteParameters);
|
|
264
696
|
this.restart();
|
|
@@ -266,15 +698,35 @@ class RTCIceTransport {
|
|
|
266
698
|
}
|
|
267
699
|
this.connection.setRemoteParams(remoteParameters);
|
|
268
700
|
}
|
|
269
|
-
|
|
701
|
+
/**
|
|
702
|
+
* Internal: drop the remote generation and its checks, keeping the local
|
|
703
|
+
* credentials and candidates a description already carries (a remote-only
|
|
704
|
+
* restart, or a proposal transport a replacement pranswer left unused).
|
|
705
|
+
*/
|
|
706
|
+
resetRemoteGeneration() {
|
|
707
|
+
if (!this.connection.restartRemote)
|
|
708
|
+
return;
|
|
709
|
+
this.connection.restartRemote();
|
|
710
|
+
this.setState("new");
|
|
711
|
+
this.waitStart = undefined;
|
|
712
|
+
this.startPromise = undefined;
|
|
713
|
+
this.checksStarted = false;
|
|
714
|
+
}
|
|
715
|
+
restart(notifyNegotiation = true, applyNextGatherIceServers = true) {
|
|
270
716
|
this.iceRestarts++;
|
|
271
717
|
this.connection.restart();
|
|
718
|
+
const servers = this.nextGatherIceServers;
|
|
719
|
+
if (servers && applyNextGatherIceServers)
|
|
720
|
+
this.setIceServers(servers);
|
|
272
721
|
this.setState("new");
|
|
273
722
|
// Use setGatheringState so onGatheringStateChange fires and the
|
|
274
723
|
// SecureTransportManager aggregate iceGatheringState stays in sync.
|
|
275
724
|
this.iceGather.setGatheringState("new");
|
|
276
725
|
this.waitStart = undefined;
|
|
277
|
-
this.
|
|
726
|
+
this.startPromise = undefined;
|
|
727
|
+
this.checksStarted = false;
|
|
728
|
+
if (notifyNegotiation)
|
|
729
|
+
this.onNegotiationNeeded.execute();
|
|
278
730
|
}
|
|
279
731
|
async start() {
|
|
280
732
|
if (this.state === "closed") {
|
|
@@ -283,23 +735,51 @@ class RTCIceTransport {
|
|
|
283
735
|
if (!this.connection.remotePassword || !this.connection.remoteUsername) {
|
|
284
736
|
throw new Error("remoteParams missing");
|
|
285
737
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
this.
|
|
738
|
+
// Concurrent callers for the same generation share the active checks and
|
|
739
|
+
// their result. Waiting for the event and then continuing would start a
|
|
740
|
+
// second connection attempt after the first one settles.
|
|
741
|
+
if (this.startPromise)
|
|
742
|
+
return this.startPromise;
|
|
743
|
+
const waitStart = new common_1.Event();
|
|
744
|
+
this.waitStart = waitStart;
|
|
745
|
+
this.checksStarted = true;
|
|
290
746
|
this.setState("checking");
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
catch (error) {
|
|
747
|
+
const startPromise = Promise.resolve()
|
|
748
|
+
.then(() => this.connection.connect())
|
|
749
|
+
.catch((error) => {
|
|
295
750
|
this.setState("failed");
|
|
296
751
|
throw error;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
752
|
+
})
|
|
753
|
+
.finally(() => {
|
|
754
|
+
// A failed start releases its waiters too.
|
|
755
|
+
waitStart.execute();
|
|
756
|
+
waitStart.complete();
|
|
757
|
+
if (this.waitStart === waitStart)
|
|
758
|
+
this.waitStart = undefined;
|
|
759
|
+
if (this.startPromise === startPromise)
|
|
760
|
+
this.startPromise = undefined;
|
|
761
|
+
});
|
|
762
|
+
this.startPromise = startPromise;
|
|
763
|
+
return startPromise;
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Settles when the checks a running start() makes finish (at once if none run).
|
|
767
|
+
* @internal
|
|
768
|
+
*/
|
|
769
|
+
async checksSettled() {
|
|
770
|
+
const waitStart = this.waitStart;
|
|
771
|
+
if (waitStart)
|
|
772
|
+
await waitStart.asPromise();
|
|
301
773
|
}
|
|
302
774
|
async stop() {
|
|
775
|
+
this.localGenerations.clear();
|
|
776
|
+
// Whoever awaits the checks of this transport settles now (checksSettled).
|
|
777
|
+
const waitStart = this.waitStart;
|
|
778
|
+
this.waitStart = undefined;
|
|
779
|
+
if (waitStart && !waitStart.ended) {
|
|
780
|
+
waitStart.execute();
|
|
781
|
+
waitStart.complete();
|
|
782
|
+
}
|
|
303
783
|
if (this.state !== "closed") {
|
|
304
784
|
this.setState("closed", false);
|
|
305
785
|
await this.connection.close();
|
|
@@ -404,7 +884,7 @@ class RTCIceGatherer {
|
|
|
404
884
|
enumerable: true,
|
|
405
885
|
configurable: true,
|
|
406
886
|
writable: true,
|
|
407
|
-
value:
|
|
887
|
+
value: void 0
|
|
408
888
|
});
|
|
409
889
|
Object.defineProperty(this, "onIceCandidate", {
|
|
410
890
|
enumerable: true,
|
|
@@ -430,6 +910,7 @@ class RTCIceGatherer {
|
|
|
430
910
|
writable: true,
|
|
431
911
|
value: new common_1.Event()
|
|
432
912
|
});
|
|
913
|
+
this.options = options;
|
|
433
914
|
this.connection = new src_1.Connection(false, this.options);
|
|
434
915
|
this.connection.onIceCandidate.subscribe((candidate) => {
|
|
435
916
|
this.onIceCandidate(candidateFromIce(candidate));
|
|
@@ -438,7 +919,14 @@ class RTCIceGatherer {
|
|
|
438
919
|
async gather() {
|
|
439
920
|
if (this.gatheringState === "new") {
|
|
440
921
|
this.setState("gathering");
|
|
922
|
+
const generation = this.connection.generation;
|
|
441
923
|
await this.connection.gatherCandidates();
|
|
924
|
+
// Gathering an ICE restart (or close) replaced in the meantime does not
|
|
925
|
+
// complete the new generation: that one signals its own end.
|
|
926
|
+
if (this.connection.generation !== generation ||
|
|
927
|
+
this.connection.state === "closed") {
|
|
928
|
+
return;
|
|
929
|
+
}
|
|
442
930
|
this.onIceCandidate(undefined);
|
|
443
931
|
this.setState("complete");
|
|
444
932
|
}
|
|
@@ -483,13 +971,37 @@ function candidateFromIce(c) {
|
|
|
483
971
|
function candidateToIce(x) {
|
|
484
972
|
return new src_1.Candidate(x.foundation, x.component, x.protocol, x.priority, x.ip, x.port, x.type, x.relatedAddress, x.relatedPort, x.tcpType, x.generation, x.ufrag);
|
|
485
973
|
}
|
|
974
|
+
/** Module-private key for handing already parsed fields to the constructor. */
|
|
975
|
+
const parsedFields = Symbol("RTCIceCandidate.parsedFields");
|
|
976
|
+
/** Create an `RTCIceCandidate` whose fields come from typed values, without reparsing. */
|
|
977
|
+
function createRTCIceCandidate(init, fields) {
|
|
978
|
+
return new RTCIceCandidate({
|
|
979
|
+
...init,
|
|
980
|
+
[parsedFields]: fields,
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* Browser-shaped ICE candidate. Besides the signaling fields it exposes the
|
|
985
|
+
* readonly fields of the W3C interface parsed from the candidate a-line
|
|
986
|
+
* (`foundation`, `component`, `priority`, `address`, `protocol`, `port`,
|
|
987
|
+
* `type`, `tcpType`, `relatedAddress`, `relatedPort`). Which candidates give
|
|
988
|
+
* `null` fields is specified on {@link RTCIceCandidateFields}. Candidates
|
|
989
|
+
* werift creates carry them without reparsing; `toJSON()` keeps only the
|
|
990
|
+
* signaling fields (RTCIceCandidateInit). `relayProtocol` and `url` are not
|
|
991
|
+
* implemented.
|
|
992
|
+
*/
|
|
486
993
|
class RTCIceCandidate {
|
|
487
|
-
|
|
994
|
+
/**
|
|
995
|
+
* Like the browser constructor, only the `RTCIceCandidateInit` members are
|
|
996
|
+
* read; the parsed fields always come from `init.candidate` (`""` when
|
|
997
|
+
* omitted).
|
|
998
|
+
*/
|
|
999
|
+
constructor(init = {}) {
|
|
488
1000
|
Object.defineProperty(this, "candidate", {
|
|
489
1001
|
enumerable: true,
|
|
490
1002
|
configurable: true,
|
|
491
1003
|
writable: true,
|
|
492
|
-
value:
|
|
1004
|
+
value: ""
|
|
493
1005
|
});
|
|
494
1006
|
Object.defineProperty(this, "sdpMid", {
|
|
495
1007
|
enumerable: true,
|
|
@@ -509,12 +1021,84 @@ class RTCIceCandidate {
|
|
|
509
1021
|
writable: true,
|
|
510
1022
|
value: void 0
|
|
511
1023
|
});
|
|
512
|
-
Object.
|
|
1024
|
+
Object.defineProperty(this, "foundation", {
|
|
1025
|
+
enumerable: true,
|
|
1026
|
+
configurable: true,
|
|
1027
|
+
writable: true,
|
|
1028
|
+
value: void 0
|
|
1029
|
+
});
|
|
1030
|
+
Object.defineProperty(this, "component", {
|
|
1031
|
+
enumerable: true,
|
|
1032
|
+
configurable: true,
|
|
1033
|
+
writable: true,
|
|
1034
|
+
value: void 0
|
|
1035
|
+
});
|
|
1036
|
+
Object.defineProperty(this, "priority", {
|
|
1037
|
+
enumerable: true,
|
|
1038
|
+
configurable: true,
|
|
1039
|
+
writable: true,
|
|
1040
|
+
value: void 0
|
|
1041
|
+
});
|
|
1042
|
+
Object.defineProperty(this, "address", {
|
|
1043
|
+
enumerable: true,
|
|
1044
|
+
configurable: true,
|
|
1045
|
+
writable: true,
|
|
1046
|
+
value: void 0
|
|
1047
|
+
});
|
|
1048
|
+
Object.defineProperty(this, "protocol", {
|
|
1049
|
+
enumerable: true,
|
|
1050
|
+
configurable: true,
|
|
1051
|
+
writable: true,
|
|
1052
|
+
value: void 0
|
|
1053
|
+
});
|
|
1054
|
+
Object.defineProperty(this, "port", {
|
|
1055
|
+
enumerable: true,
|
|
1056
|
+
configurable: true,
|
|
1057
|
+
writable: true,
|
|
1058
|
+
value: void 0
|
|
1059
|
+
});
|
|
1060
|
+
Object.defineProperty(this, "type", {
|
|
1061
|
+
enumerable: true,
|
|
1062
|
+
configurable: true,
|
|
1063
|
+
writable: true,
|
|
1064
|
+
value: void 0
|
|
1065
|
+
});
|
|
1066
|
+
Object.defineProperty(this, "tcpType", {
|
|
1067
|
+
enumerable: true,
|
|
1068
|
+
configurable: true,
|
|
1069
|
+
writable: true,
|
|
1070
|
+
value: void 0
|
|
1071
|
+
});
|
|
1072
|
+
Object.defineProperty(this, "relatedAddress", {
|
|
1073
|
+
enumerable: true,
|
|
1074
|
+
configurable: true,
|
|
1075
|
+
writable: true,
|
|
1076
|
+
value: void 0
|
|
1077
|
+
});
|
|
1078
|
+
Object.defineProperty(this, "relatedPort", {
|
|
1079
|
+
enumerable: true,
|
|
1080
|
+
configurable: true,
|
|
1081
|
+
writable: true,
|
|
1082
|
+
value: void 0
|
|
1083
|
+
});
|
|
1084
|
+
const { sdpMid, sdpMLineIndex, usernameFragment } = init;
|
|
1085
|
+
const candidate = init.candidate ?? "";
|
|
1086
|
+
const fields = init[parsedFields] ??
|
|
1087
|
+
(0, iceCandidateAttribute_1.candidateFieldsFromValues)((0, iceCandidateAttribute_1.parseCandidateAttribute)(candidate));
|
|
1088
|
+
Object.assign(this, fields, {
|
|
1089
|
+
candidate,
|
|
1090
|
+
sdpMid,
|
|
1091
|
+
sdpMLineIndex,
|
|
1092
|
+
usernameFragment,
|
|
1093
|
+
});
|
|
513
1094
|
}
|
|
1095
|
+
/**
|
|
1096
|
+
* Same as `new RTCIceCandidate({ candidate: sdp })`, plus `usernameFragment`
|
|
1097
|
+
* taken from the `ufrag` extension attribute of a valid candidate.
|
|
1098
|
+
*/
|
|
514
1099
|
static fromSdp(sdp) {
|
|
515
|
-
const
|
|
516
|
-
|
|
517
|
-
return candidate.toJSON();
|
|
1100
|
+
const values = (0, iceCandidateAttribute_1.parseCandidateAttribute)(sdp);
|
|
1101
|
+
return createRTCIceCandidate({ candidate: sdp, usernameFragment: values?.ufrag }, (0, iceCandidateAttribute_1.candidateFieldsFromValues)(values));
|
|
518
1102
|
}
|
|
519
1103
|
static isThis(o) {
|
|
520
1104
|
if (typeof o?.candidate === "string")
|
|
@@ -536,55 +1120,55 @@ class IceCandidate {
|
|
|
536
1120
|
enumerable: true,
|
|
537
1121
|
configurable: true,
|
|
538
1122
|
writable: true,
|
|
539
|
-
value:
|
|
1123
|
+
value: void 0
|
|
540
1124
|
});
|
|
541
1125
|
Object.defineProperty(this, "foundation", {
|
|
542
1126
|
enumerable: true,
|
|
543
1127
|
configurable: true,
|
|
544
1128
|
writable: true,
|
|
545
|
-
value:
|
|
1129
|
+
value: void 0
|
|
546
1130
|
});
|
|
547
1131
|
Object.defineProperty(this, "ip", {
|
|
548
1132
|
enumerable: true,
|
|
549
1133
|
configurable: true,
|
|
550
1134
|
writable: true,
|
|
551
|
-
value:
|
|
1135
|
+
value: void 0
|
|
552
1136
|
});
|
|
553
1137
|
Object.defineProperty(this, "port", {
|
|
554
1138
|
enumerable: true,
|
|
555
1139
|
configurable: true,
|
|
556
1140
|
writable: true,
|
|
557
|
-
value:
|
|
1141
|
+
value: void 0
|
|
558
1142
|
});
|
|
559
1143
|
Object.defineProperty(this, "priority", {
|
|
560
1144
|
enumerable: true,
|
|
561
1145
|
configurable: true,
|
|
562
1146
|
writable: true,
|
|
563
|
-
value:
|
|
1147
|
+
value: void 0
|
|
564
1148
|
});
|
|
565
1149
|
Object.defineProperty(this, "protocol", {
|
|
566
1150
|
enumerable: true,
|
|
567
1151
|
configurable: true,
|
|
568
1152
|
writable: true,
|
|
569
|
-
value:
|
|
1153
|
+
value: void 0
|
|
570
1154
|
});
|
|
571
1155
|
Object.defineProperty(this, "type", {
|
|
572
1156
|
enumerable: true,
|
|
573
1157
|
configurable: true,
|
|
574
1158
|
writable: true,
|
|
575
|
-
value:
|
|
1159
|
+
value: void 0
|
|
576
1160
|
});
|
|
577
1161
|
Object.defineProperty(this, "generation", {
|
|
578
1162
|
enumerable: true,
|
|
579
1163
|
configurable: true,
|
|
580
1164
|
writable: true,
|
|
581
|
-
value:
|
|
1165
|
+
value: void 0
|
|
582
1166
|
});
|
|
583
1167
|
Object.defineProperty(this, "ufrag", {
|
|
584
1168
|
enumerable: true,
|
|
585
1169
|
configurable: true,
|
|
586
1170
|
writable: true,
|
|
587
|
-
value:
|
|
1171
|
+
value: void 0
|
|
588
1172
|
});
|
|
589
1173
|
// """
|
|
590
1174
|
// The :class:`RTCIceCandidate` interface represents a candidate Interactive
|
|
@@ -621,29 +1205,40 @@ class IceCandidate {
|
|
|
621
1205
|
writable: true,
|
|
622
1206
|
value: void 0
|
|
623
1207
|
});
|
|
1208
|
+
this.component = component;
|
|
1209
|
+
this.foundation = foundation;
|
|
1210
|
+
this.ip = ip;
|
|
1211
|
+
this.port = port;
|
|
1212
|
+
this.priority = priority;
|
|
1213
|
+
this.protocol = protocol;
|
|
1214
|
+
this.type = type;
|
|
1215
|
+
this.generation = generation;
|
|
1216
|
+
this.ufrag = ufrag;
|
|
624
1217
|
}
|
|
1218
|
+
/** The parsed fields are validated from these typed values, not by reparsing. */
|
|
625
1219
|
toJSON() {
|
|
626
|
-
return
|
|
1220
|
+
return createRTCIceCandidate({
|
|
627
1221
|
candidate: (0, sdp_1.candidateToSdp)(this),
|
|
628
1222
|
sdpMLineIndex: this.sdpMLineIndex,
|
|
629
1223
|
sdpMid: this.sdpMid,
|
|
630
1224
|
usernameFragment: this.ufrag,
|
|
631
|
-
});
|
|
1225
|
+
}, (0, iceCandidateAttribute_1.candidateFieldsFromValues)(this));
|
|
632
1226
|
}
|
|
1227
|
+
/**
|
|
1228
|
+
* Returns `undefined` when `data.candidate` is empty or violates the grammar
|
|
1229
|
+
* documented on {@link RTCIceCandidateFields}.
|
|
1230
|
+
*/
|
|
633
1231
|
static fromJSON(data) {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
return candidate;
|
|
645
|
-
}
|
|
646
|
-
catch (error) { }
|
|
1232
|
+
const values = (0, iceCandidateAttribute_1.parseCandidateAttribute)(data.candidate ?? "");
|
|
1233
|
+
if (!values)
|
|
1234
|
+
return;
|
|
1235
|
+
const candidate = new IceCandidate(values.component, values.foundation, values.ip, values.port, values.priority, values.protocol, values.type, values.generation, values.ufrag);
|
|
1236
|
+
candidate.relatedAddress = values.relatedAddress;
|
|
1237
|
+
candidate.relatedPort = values.relatedPort;
|
|
1238
|
+
candidate.tcpType = values.tcpType;
|
|
1239
|
+
candidate.sdpMLineIndex = data.sdpMLineIndex ?? undefined;
|
|
1240
|
+
candidate.sdpMid = data.sdpMid ?? undefined;
|
|
1241
|
+
return candidate;
|
|
647
1242
|
}
|
|
648
1243
|
}
|
|
649
1244
|
exports.IceCandidate = IceCandidate;
|