werift 0.25.1 → 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 +24263 -16477
- package/lib/nonstandard/index.mjs +9272 -6178
- package/lib/polyfill/dom.mjs +24872 -20543
- package/lib/polyfill/index.mjs +24872 -20543
- package/lib/rtp/src/codec/av1.d.ts +61 -1
- package/lib/rtp/src/codec/av1.js +332 -33
- package/lib/rtp/src/codec/av1.js.map +1 -1
- package/lib/rtp/src/codec/base.d.ts +49 -1
- package/lib/rtp/src/codec/base.js +81 -1
- package/lib/rtp/src/codec/base.js.map +1 -1
- package/lib/rtp/src/codec/g711.d.ts +37 -0
- package/lib/rtp/src/codec/g711.js +109 -0
- package/lib/rtp/src/codec/g711.js.map +1 -0
- package/lib/rtp/src/codec/g722.d.ts +31 -0
- package/lib/rtp/src/codec/g722.js +82 -0
- package/lib/rtp/src/codec/g722.js.map +1 -0
- package/lib/rtp/src/codec/h264.d.ts +81 -7
- package/lib/rtp/src/codec/h264.js +382 -21
- package/lib/rtp/src/codec/h264.js.map +1 -1
- package/lib/rtp/src/codec/h265.d.ts +101 -0
- package/lib/rtp/src/codec/h265.js +615 -0
- package/lib/rtp/src/codec/h265.js.map +1 -0
- package/lib/rtp/src/codec/index.d.ts +6 -1
- package/lib/rtp/src/codec/index.js +25 -0
- package/lib/rtp/src/codec/index.js.map +1 -1
- package/lib/rtp/src/codec/mp4a.d.ts +88 -0
- package/lib/rtp/src/codec/mp4a.js +386 -0
- package/lib/rtp/src/codec/mp4a.js.map +1 -0
- package/lib/rtp/src/codec/opus.d.ts +14 -2
- package/lib/rtp/src/codec/opus.js +32 -2
- package/lib/rtp/src/codec/opus.js.map +1 -1
- package/lib/rtp/src/codec/telephoneEvent.d.ts +102 -0
- package/lib/rtp/src/codec/telephoneEvent.js +176 -0
- package/lib/rtp/src/codec/telephoneEvent.js.map +1 -0
- package/lib/rtp/src/codec/vp8.d.ts +26 -1
- package/lib/rtp/src/codec/vp8.js +76 -2
- package/lib/rtp/src/codec/vp8.js.map +1 -1
- package/lib/rtp/src/codec/vp9.d.ts +25 -1
- package/lib/rtp/src/codec/vp9.js +64 -2
- package/lib/rtp/src/codec/vp9.js.map +1 -1
- package/lib/rtp/src/const.d.ts +1 -0
- package/lib/rtp/src/const.js +5 -0
- package/lib/rtp/src/const.js.map +1 -0
- package/lib/rtp/src/extra/container/mp4/container.js +4 -1
- package/lib/rtp/src/extra/container/mp4/container.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/h264.d.ts +26 -0
- package/lib/rtp/src/extra/container/mp4/h264.js +54 -0
- package/lib/rtp/src/extra/container/mp4/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.d.ts +16 -0
- package/lib/rtp/src/extra/processor/mp4.js +55 -21
- 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 +4 -2
- package/lib/rtp/src/index.js +4 -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/rtp/mediaClock.d.ts +283 -0
- package/lib/rtp/src/rtp/mediaClock.js +655 -0
- package/lib/rtp/src/rtp/mediaClock.js.map +1 -0
- 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/rtp/src/util.d.ts +59 -6
- package/lib/rtp/src/util.js +88 -10
- package/lib/rtp/src/util.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/codec.d.ts +18 -0
- package/lib/webrtc/src/media/codec.js +43 -2
- package/lib/webrtc/src/media/codec.js.map +1 -1
- package/lib/webrtc/src/media/codecCompatibility.d.ts +5 -0
- package/lib/webrtc/src/media/codecCompatibility.js +15 -4
- package/lib/webrtc/src/media/codecCompatibility.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 +20 -6
- 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 +4 -4
- package/lib/webrtc/src/nonstandard/userMedia/packetizer.js +61 -306
- package/lib/webrtc/src/nonstandard/userMedia/packetizer.js.map +1 -1
- package/lib/webrtc/src/nonstandard/userMedia.d.ts +4 -2
- package/lib/webrtc/src/nonstandard/userMedia.js +43 -9
- 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 -906
- 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 +367 -89
- 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 +266 -105
- 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
package/lib/rtp/src/util.d.ts
CHANGED
|
@@ -1,11 +1,64 @@
|
|
|
1
|
+
import type { RtpMediaClock, RtpMediaClockTick } from "./rtp/mediaClock";
|
|
1
2
|
import { RtpPacket } from "./rtp/rtp";
|
|
3
|
+
interface RtpBuilderCommonProps {
|
|
4
|
+
/** Default: 96 */
|
|
5
|
+
payloadType?: number;
|
|
6
|
+
/** Default: 0 */
|
|
7
|
+
ssrc?: number;
|
|
8
|
+
/** Default marker bit. Default: false */
|
|
9
|
+
marker?: boolean;
|
|
10
|
+
/** Default: true */
|
|
11
|
+
extension?: boolean;
|
|
12
|
+
/** Sequence number of the first created packet. Default: random */
|
|
13
|
+
initialSequenceNumber?: number;
|
|
14
|
+
/** Timeline origin before the first advance. Default: random */
|
|
15
|
+
initialTimestamp?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* - `{ between, clockRate }`: legacy fixed pacing. Each `create()` advances the
|
|
19
|
+
* timestamp by `between * clockRate / 1000` (before the first packet too).
|
|
20
|
+
* - `{ clock }`: `create()` uses the timestamp of the clock's latest tick.
|
|
21
|
+
* - `{}`: explicit timeline via `advanceSamples()` / `create()` options.
|
|
22
|
+
*/
|
|
23
|
+
export type RtpBuilderProps = (RtpBuilderCommonProps & {
|
|
24
|
+
between: number;
|
|
25
|
+
clockRate: number;
|
|
26
|
+
clock?: undefined;
|
|
27
|
+
}) | (RtpBuilderCommonProps & {
|
|
28
|
+
clock: RtpMediaClock;
|
|
29
|
+
between?: undefined;
|
|
30
|
+
clockRate?: number;
|
|
31
|
+
}) | (RtpBuilderCommonProps & {
|
|
32
|
+
between?: undefined;
|
|
33
|
+
clock?: undefined;
|
|
34
|
+
clockRate?: number;
|
|
35
|
+
});
|
|
36
|
+
export interface RtpBuilderCreateOptions {
|
|
37
|
+
/** Samples to advance for this packet. `0` keeps the current timestamp. */
|
|
38
|
+
elapsedSamples?: number;
|
|
39
|
+
/** Absolute RTP timestamp (application-owned timeline, e.g. relay). */
|
|
40
|
+
timestamp?: number;
|
|
41
|
+
/** Use the timestamp of a media clock tick (or `RtpMediaPacer` tick). */
|
|
42
|
+
tick?: Pick<RtpMediaClockTick, "timestamp">;
|
|
43
|
+
marker?: boolean;
|
|
44
|
+
}
|
|
2
45
|
export declare class RtpBuilder {
|
|
3
46
|
private props;
|
|
47
|
+
/** Sequence number of the last created packet. */
|
|
4
48
|
sequenceNumber: number;
|
|
5
|
-
timestamp
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
49
|
+
/** uint32 timestamp the timeline was last anchored to */
|
|
50
|
+
private baseTimestamp;
|
|
51
|
+
/** count of legacy `between` advances since the anchor */
|
|
52
|
+
private betweenCount;
|
|
53
|
+
/** explicit samples advanced since the anchor (may be fractional) */
|
|
54
|
+
private advancedSamples;
|
|
55
|
+
private readonly betweenSamples?;
|
|
56
|
+
constructor(props: RtpBuilderProps);
|
|
57
|
+
/** Current RTP timestamp (uint32). */
|
|
58
|
+
get timestamp(): number;
|
|
59
|
+
set timestamp(timestamp: number);
|
|
60
|
+
/** Advances the timestamp only; the sequence number is unchanged. */
|
|
61
|
+
advanceSamples(samples: number): number;
|
|
62
|
+
create(payload: Buffer, options?: RtpBuilderCreateOptions): RtpPacket;
|
|
11
63
|
}
|
|
64
|
+
export {};
|
package/lib/rtp/src/util.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RtpBuilder = void 0;
|
|
4
4
|
const src_1 = require("../../common/src");
|
|
5
5
|
const rtp_1 = require("./rtp/rtp");
|
|
6
|
+
const UINT32_MODULO = 4294967296;
|
|
6
7
|
class RtpBuilder {
|
|
7
8
|
constructor(props) {
|
|
8
9
|
Object.defineProperty(this, "props", {
|
|
@@ -11,29 +12,102 @@ class RtpBuilder {
|
|
|
11
12
|
writable: true,
|
|
12
13
|
value: props
|
|
13
14
|
});
|
|
15
|
+
/** Sequence number of the last created packet. */
|
|
14
16
|
Object.defineProperty(this, "sequenceNumber", {
|
|
15
17
|
enumerable: true,
|
|
16
18
|
configurable: true,
|
|
17
19
|
writable: true,
|
|
18
|
-
value:
|
|
20
|
+
value: void 0
|
|
19
21
|
});
|
|
20
|
-
|
|
22
|
+
/** uint32 timestamp the timeline was last anchored to */
|
|
23
|
+
Object.defineProperty(this, "baseTimestamp", {
|
|
21
24
|
enumerable: true,
|
|
22
25
|
configurable: true,
|
|
23
26
|
writable: true,
|
|
24
|
-
value:
|
|
27
|
+
value: void 0
|
|
25
28
|
});
|
|
29
|
+
/** count of legacy `between` advances since the anchor */
|
|
30
|
+
Object.defineProperty(this, "betweenCount", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true,
|
|
34
|
+
value: 0
|
|
35
|
+
});
|
|
36
|
+
/** explicit samples advanced since the anchor (may be fractional) */
|
|
37
|
+
Object.defineProperty(this, "advancedSamples", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: 0
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(this, "betweenSamples", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true,
|
|
46
|
+
writable: true,
|
|
47
|
+
value: void 0
|
|
48
|
+
});
|
|
49
|
+
this.sequenceNumber =
|
|
50
|
+
props.initialSequenceNumber !== undefined
|
|
51
|
+
? (0, src_1.uint16Add)(props.initialSequenceNumber, -1)
|
|
52
|
+
: (0, src_1.random16)();
|
|
53
|
+
this.baseTimestamp = toUint32(Math.round(props.initialTimestamp ?? (0, src_1.random32)()));
|
|
54
|
+
if (props.between !== undefined) {
|
|
55
|
+
this.betweenSamples = (props.between * props.clockRate) / 1000;
|
|
56
|
+
if (!Number.isFinite(this.betweenSamples) || this.betweenSamples < 0) {
|
|
57
|
+
throw new RangeError("between * clockRate must be a finite number");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
26
60
|
}
|
|
27
|
-
|
|
61
|
+
/** Current RTP timestamp (uint32). */
|
|
62
|
+
get timestamp() {
|
|
63
|
+
const samples = this.betweenCount * (this.betweenSamples ?? 0) + this.advancedSamples;
|
|
64
|
+
return toUint32(this.baseTimestamp + Math.round(samples));
|
|
65
|
+
}
|
|
66
|
+
set timestamp(timestamp) {
|
|
67
|
+
this.baseTimestamp = toUint32(Math.round(timestamp));
|
|
68
|
+
this.betweenCount = 0;
|
|
69
|
+
this.advancedSamples = 0;
|
|
70
|
+
}
|
|
71
|
+
/** Advances the timestamp only; the sequence number is unchanged. */
|
|
72
|
+
advanceSamples(samples) {
|
|
73
|
+
if (!Number.isFinite(samples) || samples < 0) {
|
|
74
|
+
throw new RangeError("samples must be a non-negative finite number");
|
|
75
|
+
}
|
|
76
|
+
this.advancedSamples += samples;
|
|
77
|
+
return this.timestamp;
|
|
78
|
+
}
|
|
79
|
+
create(payload, options = {}) {
|
|
80
|
+
const timelineOptions = [
|
|
81
|
+
options.elapsedSamples,
|
|
82
|
+
options.timestamp,
|
|
83
|
+
options.tick,
|
|
84
|
+
].filter((v) => v !== undefined);
|
|
85
|
+
if (timelineOptions.length > 1) {
|
|
86
|
+
throw new TypeError("elapsedSamples, timestamp and tick are mutually exclusive");
|
|
87
|
+
}
|
|
88
|
+
if (options.tick) {
|
|
89
|
+
this.timestamp = options.tick.timestamp;
|
|
90
|
+
}
|
|
91
|
+
else if (options.timestamp !== undefined) {
|
|
92
|
+
this.timestamp = options.timestamp;
|
|
93
|
+
}
|
|
94
|
+
else if (options.elapsedSamples !== undefined) {
|
|
95
|
+
this.advanceSamples(options.elapsedSamples);
|
|
96
|
+
}
|
|
97
|
+
else if (this.props.clock) {
|
|
98
|
+
this.timestamp = this.props.clock.timestamp;
|
|
99
|
+
}
|
|
100
|
+
else if (this.betweenSamples !== undefined) {
|
|
101
|
+
this.betweenCount++;
|
|
102
|
+
}
|
|
28
103
|
this.sequenceNumber = (0, src_1.uint16Add)(this.sequenceNumber, 1);
|
|
29
|
-
const elapsed = (this.props.between * this.props.clockRate) / 1000;
|
|
30
|
-
this.timestamp = (0, src_1.uint32Add)(this.timestamp, elapsed);
|
|
31
104
|
const header = new rtp_1.RtpHeader({
|
|
32
105
|
sequenceNumber: this.sequenceNumber,
|
|
33
|
-
timestamp:
|
|
34
|
-
payloadType: 96,
|
|
35
|
-
|
|
36
|
-
|
|
106
|
+
timestamp: this.timestamp,
|
|
107
|
+
payloadType: this.props.payloadType ?? 96,
|
|
108
|
+
ssrc: this.props.ssrc ?? 0,
|
|
109
|
+
extension: this.props.extension ?? true,
|
|
110
|
+
marker: options.marker ?? this.props.marker ?? false,
|
|
37
111
|
padding: false,
|
|
38
112
|
});
|
|
39
113
|
const rtp = new rtp_1.RtpPacket(header, payload);
|
|
@@ -41,4 +115,8 @@ class RtpBuilder {
|
|
|
41
115
|
}
|
|
42
116
|
}
|
|
43
117
|
exports.RtpBuilder = RtpBuilder;
|
|
118
|
+
function toUint32(value) {
|
|
119
|
+
const mod = value % UINT32_MODULO;
|
|
120
|
+
return mod < 0 ? mod + UINT32_MODULO : mod;
|
|
121
|
+
}
|
|
44
122
|
//# sourceMappingURL=util.js.map
|
package/lib/rtp/src/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../../rtp/src/util.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../../rtp/src/util.ts"],"names":[],"mappings":"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","sourcesContent":["import { random16, random32, uint16Add } from \"../../common/src\";\nimport type { RtpMediaClock, RtpMediaClockTick } from \"./rtp/mediaClock\";\nimport { RtpHeader, RtpPacket } from \"./rtp/rtp\";\n\nconst UINT32_MODULO = 0x1_0000_0000;\n\ninterface RtpBuilderCommonProps {\n /** Default: 96 */\n payloadType?: number;\n /** Default: 0 */\n ssrc?: number;\n /** Default marker bit. Default: false */\n marker?: boolean;\n /** Default: true */\n extension?: boolean;\n /** Sequence number of the first created packet. Default: random */\n initialSequenceNumber?: number;\n /** Timeline origin before the first advance. Default: random */\n initialTimestamp?: number;\n}\n\n/**\n * - `{ between, clockRate }`: legacy fixed pacing. Each `create()` advances the\n * timestamp by `between * clockRate / 1000` (before the first packet too).\n * - `{ clock }`: `create()` uses the timestamp of the clock's latest tick.\n * - `{}`: explicit timeline via `advanceSamples()` / `create()` options.\n */\nexport type RtpBuilderProps =\n | (RtpBuilderCommonProps & {\n between: number;\n clockRate: number;\n clock?: undefined;\n })\n | (RtpBuilderCommonProps & {\n clock: RtpMediaClock;\n between?: undefined;\n clockRate?: number;\n })\n | (RtpBuilderCommonProps & {\n between?: undefined;\n clock?: undefined;\n clockRate?: number;\n });\n\nexport interface RtpBuilderCreateOptions {\n /** Samples to advance for this packet. `0` keeps the current timestamp. */\n elapsedSamples?: number;\n /** Absolute RTP timestamp (application-owned timeline, e.g. relay). */\n timestamp?: number;\n /** Use the timestamp of a media clock tick (or `RtpMediaPacer` tick). */\n tick?: Pick<RtpMediaClockTick, \"timestamp\">;\n marker?: boolean;\n}\n\nexport class RtpBuilder {\n /** Sequence number of the last created packet. */\n sequenceNumber: number;\n\n /** uint32 timestamp the timeline was last anchored to */\n private baseTimestamp: number;\n /** count of legacy `between` advances since the anchor */\n private betweenCount = 0;\n /** explicit samples advanced since the anchor (may be fractional) */\n private advancedSamples = 0;\n private readonly betweenSamples?: number;\n\n constructor(private props: RtpBuilderProps) {\n this.sequenceNumber =\n props.initialSequenceNumber !== undefined\n ? uint16Add(props.initialSequenceNumber, -1)\n : random16();\n this.baseTimestamp = toUint32(\n Math.round(props.initialTimestamp ?? random32()),\n );\n if (props.between !== undefined) {\n this.betweenSamples = (props.between * props.clockRate) / 1000;\n if (!Number.isFinite(this.betweenSamples) || this.betweenSamples < 0) {\n throw new RangeError(\"between * clockRate must be a finite number\");\n }\n }\n }\n\n /** Current RTP timestamp (uint32). */\n get timestamp() {\n const samples =\n this.betweenCount * (this.betweenSamples ?? 0) + this.advancedSamples;\n return toUint32(this.baseTimestamp + Math.round(samples));\n }\n\n set timestamp(timestamp: number) {\n this.baseTimestamp = toUint32(Math.round(timestamp));\n this.betweenCount = 0;\n this.advancedSamples = 0;\n }\n\n /** Advances the timestamp only; the sequence number is unchanged. */\n advanceSamples(samples: number) {\n if (!Number.isFinite(samples) || samples < 0) {\n throw new RangeError(\"samples must be a non-negative finite number\");\n }\n this.advancedSamples += samples;\n return this.timestamp;\n }\n\n create(payload: Buffer, options: RtpBuilderCreateOptions = {}) {\n const timelineOptions = [\n options.elapsedSamples,\n options.timestamp,\n options.tick,\n ].filter((v) => v !== undefined);\n if (timelineOptions.length > 1) {\n throw new TypeError(\n \"elapsedSamples, timestamp and tick are mutually exclusive\",\n );\n }\n\n if (options.tick) {\n this.timestamp = options.tick.timestamp;\n } else if (options.timestamp !== undefined) {\n this.timestamp = options.timestamp;\n } else if (options.elapsedSamples !== undefined) {\n this.advanceSamples(options.elapsedSamples);\n } else if (this.props.clock) {\n this.timestamp = this.props.clock.timestamp;\n } else if (this.betweenSamples !== undefined) {\n this.betweenCount++;\n }\n\n this.sequenceNumber = uint16Add(this.sequenceNumber, 1);\n\n const header = new RtpHeader({\n sequenceNumber: this.sequenceNumber,\n timestamp: this.timestamp,\n payloadType: this.props.payloadType ?? 96,\n ssrc: this.props.ssrc ?? 0,\n extension: this.props.extension ?? true,\n marker: options.marker ?? this.props.marker ?? false,\n padding: false,\n });\n const rtp = new RtpPacket(header, payload);\n return rtp;\n }\n}\n\nfunction toUint32(value: number) {\n const mod = value % UINT32_MODULO;\n return mod < 0 ? mod + UINT32_MODULO : mod;\n}\n"]}
|
package/lib/sctp/src/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export { SCTP_CHUNK_HEADER_SIZE, SCTP_COMMON_HEADER_SIZE, SCTP_DATA_CHUNK_HEADER_SIZE, SCTP_DATA_FIXED_HEADER_SIZE, SCTP_PADDING_MULTIPLE, } from "./chunk";
|
|
1
2
|
export { SCTP_STATE, WEBRTC_PPID } from "./const";
|
|
2
|
-
export {
|
|
3
|
+
export { FifoQueue } from "./imports/common";
|
|
3
4
|
export type { SCTPOptions } from "./sctp";
|
|
4
|
-
export {
|
|
5
|
-
export { createUdpTransport, UdpTransport } from "./transport";
|
|
5
|
+
export { DEFAULT_SCTP_MTU, maxPayloadSizeForMtu, SCTP, validateSctpMtu, } from "./sctp";
|
|
6
6
|
export type { Transport } from "./transport";
|
|
7
|
+
export { createUdpTransport, UdpTransport } from "./transport";
|
package/lib/sctp/src/index.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UdpTransport = exports.createUdpTransport = exports.
|
|
3
|
+
exports.UdpTransport = exports.createUdpTransport = exports.validateSctpMtu = exports.SCTP = exports.maxPayloadSizeForMtu = exports.DEFAULT_SCTP_MTU = exports.FifoQueue = exports.WEBRTC_PPID = exports.SCTP_STATE = exports.SCTP_PADDING_MULTIPLE = exports.SCTP_DATA_FIXED_HEADER_SIZE = exports.SCTP_DATA_CHUNK_HEADER_SIZE = exports.SCTP_COMMON_HEADER_SIZE = exports.SCTP_CHUNK_HEADER_SIZE = void 0;
|
|
4
|
+
var chunk_1 = require("./chunk");
|
|
5
|
+
Object.defineProperty(exports, "SCTP_CHUNK_HEADER_SIZE", { enumerable: true, get: function () { return chunk_1.SCTP_CHUNK_HEADER_SIZE; } });
|
|
6
|
+
Object.defineProperty(exports, "SCTP_COMMON_HEADER_SIZE", { enumerable: true, get: function () { return chunk_1.SCTP_COMMON_HEADER_SIZE; } });
|
|
7
|
+
Object.defineProperty(exports, "SCTP_DATA_CHUNK_HEADER_SIZE", { enumerable: true, get: function () { return chunk_1.SCTP_DATA_CHUNK_HEADER_SIZE; } });
|
|
8
|
+
Object.defineProperty(exports, "SCTP_DATA_FIXED_HEADER_SIZE", { enumerable: true, get: function () { return chunk_1.SCTP_DATA_FIXED_HEADER_SIZE; } });
|
|
9
|
+
Object.defineProperty(exports, "SCTP_PADDING_MULTIPLE", { enumerable: true, get: function () { return chunk_1.SCTP_PADDING_MULTIPLE; } });
|
|
4
10
|
var const_1 = require("./const");
|
|
5
11
|
Object.defineProperty(exports, "SCTP_STATE", { enumerable: true, get: function () { return const_1.SCTP_STATE; } });
|
|
6
12
|
Object.defineProperty(exports, "WEBRTC_PPID", { enumerable: true, get: function () { return const_1.WEBRTC_PPID; } });
|
|
13
|
+
var common_1 = require("./imports/common");
|
|
14
|
+
Object.defineProperty(exports, "FifoQueue", { enumerable: true, get: function () { return common_1.FifoQueue; } });
|
|
7
15
|
var sctp_1 = require("./sctp");
|
|
8
|
-
Object.defineProperty(exports, "SCTP", { enumerable: true, get: function () { return sctp_1.SCTP; } });
|
|
9
16
|
Object.defineProperty(exports, "DEFAULT_SCTP_MTU", { enumerable: true, get: function () { return sctp_1.DEFAULT_SCTP_MTU; } });
|
|
10
17
|
Object.defineProperty(exports, "maxPayloadSizeForMtu", { enumerable: true, get: function () { return sctp_1.maxPayloadSizeForMtu; } });
|
|
18
|
+
Object.defineProperty(exports, "SCTP", { enumerable: true, get: function () { return sctp_1.SCTP; } });
|
|
11
19
|
Object.defineProperty(exports, "validateSctpMtu", { enumerable: true, get: function () { return sctp_1.validateSctpMtu; } });
|
|
12
|
-
var chunk_1 = require("./chunk");
|
|
13
|
-
Object.defineProperty(exports, "SCTP_COMMON_HEADER_SIZE", { enumerable: true, get: function () { return chunk_1.SCTP_COMMON_HEADER_SIZE; } });
|
|
14
|
-
Object.defineProperty(exports, "SCTP_CHUNK_HEADER_SIZE", { enumerable: true, get: function () { return chunk_1.SCTP_CHUNK_HEADER_SIZE; } });
|
|
15
|
-
Object.defineProperty(exports, "SCTP_DATA_FIXED_HEADER_SIZE", { enumerable: true, get: function () { return chunk_1.SCTP_DATA_FIXED_HEADER_SIZE; } });
|
|
16
|
-
Object.defineProperty(exports, "SCTP_DATA_CHUNK_HEADER_SIZE", { enumerable: true, get: function () { return chunk_1.SCTP_DATA_CHUNK_HEADER_SIZE; } });
|
|
17
|
-
Object.defineProperty(exports, "SCTP_PADDING_MULTIPLE", { enumerable: true, get: function () { return chunk_1.SCTP_PADDING_MULTIPLE; } });
|
|
18
20
|
var transport_1 = require("./transport");
|
|
19
21
|
Object.defineProperty(exports, "createUdpTransport", { enumerable: true, get: function () { return transport_1.createUdpTransport; } });
|
|
20
22
|
Object.defineProperty(exports, "UdpTransport", { enumerable: true, get: function () { return transport_1.UdpTransport; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../sctp/src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../sctp/src/index.ts"],"names":[],"mappings":";;;AAAA,iCAMiB;AALf,+GAAA,sBAAsB,OAAA;AACtB,gHAAA,uBAAuB,OAAA;AACvB,oHAAA,2BAA2B,OAAA;AAC3B,oHAAA,2BAA2B,OAAA;AAC3B,8GAAA,qBAAqB,OAAA;AAEvB,iCAAkD;AAAzC,mGAAA,UAAU,OAAA;AAAE,oGAAA,WAAW,OAAA;AAChC,2CAA6C;AAApC,mGAAA,SAAS,OAAA;AAElB,+BAKgB;AAJd,wGAAA,gBAAgB,OAAA;AAChB,4GAAA,oBAAoB,OAAA;AACpB,4FAAA,IAAI,OAAA;AACJ,uGAAA,eAAe,OAAA;AAGjB,yCAA+D;AAAtD,+GAAA,kBAAkB,OAAA;AAAE,yGAAA,YAAY,OAAA","sourcesContent":["export {\n SCTP_CHUNK_HEADER_SIZE,\n SCTP_COMMON_HEADER_SIZE,\n SCTP_DATA_CHUNK_HEADER_SIZE,\n SCTP_DATA_FIXED_HEADER_SIZE,\n SCTP_PADDING_MULTIPLE,\n} from \"./chunk\";\nexport { SCTP_STATE, WEBRTC_PPID } from \"./const\";\nexport { FifoQueue } from \"./imports/common\";\nexport type { SCTPOptions } from \"./sctp\";\nexport {\n DEFAULT_SCTP_MTU,\n maxPayloadSizeForMtu,\n SCTP,\n validateSctpMtu,\n} from \"./sctp\";\nexport type { Transport } from \"./transport\";\nexport { createUdpTransport, UdpTransport } from \"./transport\";\n"]}
|
package/lib/sctp/src/sctp.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Chunk, DataChunk, ForwardTsnChunk } from "./chunk";
|
|
2
2
|
import { SCTP_STATE } from "./const";
|
|
3
3
|
import { type Unpacked } from "./helper";
|
|
4
|
-
import { Event } from "./imports/common";
|
|
4
|
+
import { Event, FifoQueue } from "./imports/common";
|
|
5
5
|
import { OutgoingSSNResetRequestParam, type StreamParam } from "./param";
|
|
6
6
|
import type { Transport } from "./transport";
|
|
7
7
|
export declare const DEFAULT_SCTP_MTU = 1191;
|
|
@@ -59,7 +59,13 @@ export declare class SCTP {
|
|
|
59
59
|
private fastRecoveryTransmit;
|
|
60
60
|
private forwardTsnChunk?;
|
|
61
61
|
private flightSize;
|
|
62
|
-
|
|
62
|
+
/** DATA chunks waiting to be transmitted for the first time. */
|
|
63
|
+
readonly outboundQueue: FifoQueue<DataChunk>;
|
|
64
|
+
/**
|
|
65
|
+
* Pending send() calls in queue order, each waiting for its last chunk to
|
|
66
|
+
* leave outboundQueue. Resolved head-first, so completion is O(1) per call.
|
|
67
|
+
*/
|
|
68
|
+
private sendWaiters;
|
|
63
69
|
private outboundStreamSeq;
|
|
64
70
|
_outboundStreamsCount: number;
|
|
65
71
|
/**local transmission sequence number */
|
|
@@ -118,6 +124,9 @@ export declare class SCTP {
|
|
|
118
124
|
maxRetransmits?: number | undefined;
|
|
119
125
|
ordered?: boolean;
|
|
120
126
|
}) => Promise<void>;
|
|
127
|
+
private resolveSendWaiters;
|
|
128
|
+
/** Settles every pending send() so no caller is left waiting after close. */
|
|
129
|
+
private releaseSendWaiters;
|
|
121
130
|
private transmit;
|
|
122
131
|
private transmitOnce;
|
|
123
132
|
transmitReconfigRequest(): Promise<void>;
|
package/lib/sctp/src/sctp.js
CHANGED
|
@@ -315,11 +315,22 @@ class SCTP {
|
|
|
315
315
|
writable: true,
|
|
316
316
|
value: 0
|
|
317
317
|
});
|
|
318
|
+
/** DATA chunks waiting to be transmitted for the first time. */
|
|
318
319
|
Object.defineProperty(this, "outboundQueue", {
|
|
319
320
|
enumerable: true,
|
|
320
321
|
configurable: true,
|
|
321
322
|
writable: true,
|
|
322
|
-
value:
|
|
323
|
+
value: new common_1.FifoQueue()
|
|
324
|
+
});
|
|
325
|
+
/**
|
|
326
|
+
* Pending send() calls in queue order, each waiting for its last chunk to
|
|
327
|
+
* leave outboundQueue. Resolved head-first, so completion is O(1) per call.
|
|
328
|
+
*/
|
|
329
|
+
Object.defineProperty(this, "sendWaiters", {
|
|
330
|
+
enumerable: true,
|
|
331
|
+
configurable: true,
|
|
332
|
+
writable: true,
|
|
333
|
+
value: new common_1.FifoQueue()
|
|
323
334
|
});
|
|
324
335
|
Object.defineProperty(this, "outboundStreamSeq", {
|
|
325
336
|
enumerable: true,
|
|
@@ -362,7 +373,7 @@ class SCTP {
|
|
|
362
373
|
enumerable: true,
|
|
363
374
|
configurable: true,
|
|
364
375
|
writable: true,
|
|
365
|
-
value:
|
|
376
|
+
value: new common_1.FifoQueue()
|
|
366
377
|
});
|
|
367
378
|
Object.defineProperty(this, "transmitting", {
|
|
368
379
|
enumerable: true,
|
|
@@ -533,16 +544,23 @@ class SCTP {
|
|
|
533
544
|
this.localTsn = tsnPlusOne(this.localTsn);
|
|
534
545
|
chunks.push(chunk);
|
|
535
546
|
}
|
|
536
|
-
|
|
547
|
+
for (const chunk of chunks) {
|
|
537
548
|
this.outboundQueue.push(chunk);
|
|
538
|
-
}
|
|
549
|
+
}
|
|
539
550
|
if (ordered) {
|
|
540
551
|
this.outboundStreamSeq[streamId] = (0, common_1.uint16Add)(streamSeqNum, 1);
|
|
541
552
|
}
|
|
553
|
+
// Resolves once this call's last chunk is handed to the network (moved to
|
|
554
|
+
// sentQueue), not when the whole outboundQueue drains, so N queued sends
|
|
555
|
+
// do not wake N waiters on every transmit.
|
|
556
|
+
const lastChunk = chunks[chunks.length - 1];
|
|
557
|
+
const sent = lastChunk && !this.isStopped
|
|
558
|
+
? new Promise((resolve) => {
|
|
559
|
+
this.sendWaiters.push({ chunk: lastChunk, resolve });
|
|
560
|
+
})
|
|
561
|
+
: undefined;
|
|
542
562
|
await this.transmit();
|
|
543
|
-
|
|
544
|
-
await this.flush.asPromise();
|
|
545
|
-
}
|
|
563
|
+
await sent;
|
|
546
564
|
}
|
|
547
565
|
});
|
|
548
566
|
Object.defineProperty(this, "timer1Expired", {
|
|
@@ -1070,7 +1088,7 @@ class SCTP {
|
|
|
1070
1088
|
let done = 0, doneBytes = 0;
|
|
1071
1089
|
// # handle acknowledged data
|
|
1072
1090
|
while (this.sentQueue.length > 0 &&
|
|
1073
|
-
(0, common_1.uint32Gte)(this.lastSackedTsn, this.sentQueue
|
|
1091
|
+
(0, common_1.uint32Gte)(this.lastSackedTsn, this.sentQueue.peek().tsn)) {
|
|
1074
1092
|
const sChunk = this.sentQueue.shift();
|
|
1075
1093
|
done++;
|
|
1076
1094
|
if (!sChunk?.acked) {
|
|
@@ -1081,10 +1099,6 @@ class SCTP {
|
|
|
1081
1099
|
this.updateRto(receivedTime - sChunk.sentTime);
|
|
1082
1100
|
}
|
|
1083
1101
|
}
|
|
1084
|
-
// Furthermore, this exposed an issue I've seen in v8 in other projects: using an array as a queue seems to result in long calls to shift (it does an array copy under the hood?). The problem seems to get worse the more times it shifts. Resetting the queue to empty array mitigates this.
|
|
1085
|
-
if (!this.sentQueue.length) {
|
|
1086
|
-
this.sentQueue = [];
|
|
1087
|
-
}
|
|
1088
1102
|
// # handle gap blocks
|
|
1089
1103
|
let loss = false;
|
|
1090
1104
|
if (chunk.gaps.length > 0) {
|
|
@@ -1145,7 +1159,7 @@ class SCTP {
|
|
|
1145
1159
|
this.ssthresh = Math.max(Math.floor(this.cwnd / 2), 4 * this.maxPayloadSize);
|
|
1146
1160
|
this.cwnd = this.ssthresh;
|
|
1147
1161
|
this.partialBytesAcked = 0;
|
|
1148
|
-
this.fastRecoveryExit = this.sentQueue
|
|
1162
|
+
this.fastRecoveryExit = this.sentQueue.last().tsn;
|
|
1149
1163
|
this.fastRecoveryTransmit = true;
|
|
1150
1164
|
}
|
|
1151
1165
|
}
|
|
@@ -1241,6 +1255,19 @@ class SCTP {
|
|
|
1241
1255
|
this.sackMisOrdered = new Set([...this.sackMisOrdered].filter(isObsolete));
|
|
1242
1256
|
return false;
|
|
1243
1257
|
}
|
|
1258
|
+
resolveSendWaiters(sentChunk) {
|
|
1259
|
+
if (this.sendWaiters.peek()?.chunk === sentChunk) {
|
|
1260
|
+
this.sendWaiters.shift().resolve();
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
/** Settles every pending send() so no caller is left waiting after close. */
|
|
1264
|
+
releaseSendWaiters() {
|
|
1265
|
+
const waiters = this.sendWaiters;
|
|
1266
|
+
this.sendWaiters = new common_1.FifoQueue();
|
|
1267
|
+
for (const waiter of waiters) {
|
|
1268
|
+
waiter.resolve();
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1244
1271
|
async transmit() {
|
|
1245
1272
|
if (this.isStopped)
|
|
1246
1273
|
return;
|
|
@@ -1305,14 +1332,13 @@ class SCTP {
|
|
|
1305
1332
|
while (this.outboundQueue.length > 0 &&
|
|
1306
1333
|
this.flightSize < cwnd &&
|
|
1307
1334
|
this.peerRwnd > 0) {
|
|
1308
|
-
const chunk = this.outboundQueue.
|
|
1309
|
-
if (!chunk)
|
|
1310
|
-
break;
|
|
1335
|
+
const chunk = this.outboundQueue.peek();
|
|
1311
1336
|
if (chunk.bookSize > this.peerRwnd && this.flightSize > 0) {
|
|
1312
|
-
this.outboundQueue.unshift(chunk);
|
|
1313
1337
|
break;
|
|
1314
1338
|
}
|
|
1339
|
+
this.outboundQueue.shift();
|
|
1315
1340
|
this.sentQueue.push(chunk);
|
|
1341
|
+
this.resolveSendWaiters(chunk);
|
|
1316
1342
|
this.flightSizeIncrease(chunk);
|
|
1317
1343
|
// # update counters
|
|
1318
1344
|
chunk.sentCount++;
|
|
@@ -1324,10 +1350,6 @@ class SCTP {
|
|
|
1324
1350
|
this.timer3Start();
|
|
1325
1351
|
}
|
|
1326
1352
|
}
|
|
1327
|
-
if (!this.outboundQueue.length) {
|
|
1328
|
-
// Resetting the queue to empty array mitigates this.
|
|
1329
|
-
this.outboundQueue = [];
|
|
1330
|
-
}
|
|
1331
1353
|
this.flush.execute();
|
|
1332
1354
|
}
|
|
1333
1355
|
async transmitReconfigRequest() {
|
|
@@ -1472,7 +1494,7 @@ class SCTP {
|
|
|
1472
1494
|
}
|
|
1473
1495
|
let done = 0;
|
|
1474
1496
|
const streams = {};
|
|
1475
|
-
while (this.sentQueue.length > 0 && this.sentQueue
|
|
1497
|
+
while (this.sentQueue.length > 0 && this.sentQueue.peek().abandoned) {
|
|
1476
1498
|
const chunk = this.sentQueue.shift();
|
|
1477
1499
|
this.advancedPeerAckTsn = chunk.tsn;
|
|
1478
1500
|
done++;
|
|
@@ -1480,10 +1502,6 @@ class SCTP {
|
|
|
1480
1502
|
streams[chunk.streamId] = chunk.streamSeqNum;
|
|
1481
1503
|
}
|
|
1482
1504
|
}
|
|
1483
|
-
// Resetting the queue to empty array mitigates this.
|
|
1484
|
-
if (!this.sentQueue.length) {
|
|
1485
|
-
this.sentQueue = [];
|
|
1486
|
-
}
|
|
1487
1505
|
if (done) {
|
|
1488
1506
|
this.forwardTsnChunk = new chunk_1.ForwardTsnChunk(0, undefined);
|
|
1489
1507
|
this.forwardTsnChunk.cumulativeTsn = this.advancedPeerAckTsn;
|
|
@@ -1502,7 +1520,7 @@ class SCTP {
|
|
|
1502
1520
|
return false;
|
|
1503
1521
|
const chunkPos = this.sentQueue.findIndex((v) => v.type === chunk.type);
|
|
1504
1522
|
for (let pos = chunkPos; pos >= 0; pos--) {
|
|
1505
|
-
const oChunk = this.sentQueue
|
|
1523
|
+
const oChunk = this.sentQueue.at(pos);
|
|
1506
1524
|
oChunk.abandoned = true;
|
|
1507
1525
|
oChunk.retransmit = false;
|
|
1508
1526
|
if (oChunk.flags & SCTP_DATA_LAST_FRAG) {
|
|
@@ -1510,7 +1528,7 @@ class SCTP {
|
|
|
1510
1528
|
}
|
|
1511
1529
|
}
|
|
1512
1530
|
for (let pos = chunkPos; pos < this.sentQueue.length; pos++) {
|
|
1513
|
-
const oChunk = this.sentQueue
|
|
1531
|
+
const oChunk = this.sentQueue.at(pos);
|
|
1514
1532
|
oChunk.abandoned = true;
|
|
1515
1533
|
oChunk.retransmit = false;
|
|
1516
1534
|
if (oChunk.flags & SCTP_DATA_LAST_FRAG) {
|
|
@@ -1597,6 +1615,7 @@ class SCTP {
|
|
|
1597
1615
|
}
|
|
1598
1616
|
this.setConnectionState("closed");
|
|
1599
1617
|
this.removeAllListeners();
|
|
1618
|
+
this.releaseSendWaiters();
|
|
1600
1619
|
}
|
|
1601
1620
|
}
|
|
1602
1621
|
setConnectionState(state) {
|