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
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { RTCSignalingState } from "../types/domain";
|
|
2
|
+
/**
|
|
3
|
+
* W3C negotiation-needed bookkeeping for one RTCPeerConnection.
|
|
4
|
+
*
|
|
5
|
+
* Every change that needs negotiation gets a sequence number. A local offer
|
|
6
|
+
* carries the changes made before it was created, and those count as
|
|
7
|
+
* negotiated once its answer commits (a rollback discards them). The event
|
|
8
|
+
* fires at most once per task, only in `stable`, and only for changes no
|
|
9
|
+
* committed offer carried.
|
|
10
|
+
*/
|
|
11
|
+
export declare class NegotiationNeeded {
|
|
12
|
+
private readonly host;
|
|
13
|
+
/** W3C [[NegotiationNeeded]]. */
|
|
14
|
+
flag: boolean;
|
|
15
|
+
/** A change arrived outside `stable`: re-evaluate when it returns there. */
|
|
16
|
+
recheck: boolean;
|
|
17
|
+
/** Coalesces the changes of one task into a single event. */
|
|
18
|
+
private scheduled;
|
|
19
|
+
/** Sequence number of the latest change that needs negotiation. */
|
|
20
|
+
private changeSeq;
|
|
21
|
+
/** Changes carried by a local offer whose answer committed. */
|
|
22
|
+
private negotiatedSeq;
|
|
23
|
+
/** Changes carried by the applied local offer (discarded on rollback). */
|
|
24
|
+
private pendingOfferSeq?;
|
|
25
|
+
constructor(host: {
|
|
26
|
+
signalingState: () => RTCSignalingState;
|
|
27
|
+
isClosed: () => boolean;
|
|
28
|
+
/** Created offers/answers no longer reflect the state. */
|
|
29
|
+
invalidate: () => void;
|
|
30
|
+
fire: () => void;
|
|
31
|
+
});
|
|
32
|
+
/** Record a change that needs negotiation and schedule the event. */
|
|
33
|
+
change(): void;
|
|
34
|
+
/** Schedule the event if unnegotiated changes remain (also on return to stable). */
|
|
35
|
+
schedule(): void;
|
|
36
|
+
/** The change sequence a created offer includes (kept in its record). */
|
|
37
|
+
noteCreatedOffer(): number;
|
|
38
|
+
/** A created offer, including changes up to `changeSeq`, was applied. */
|
|
39
|
+
noteAppliedOffer(changeSeq: number): void;
|
|
40
|
+
/** The pending local offer was rolled back (explicitly or implicitly). */
|
|
41
|
+
discardPendingOffer(): void;
|
|
42
|
+
/** The answer to the pending local offer committed its changes. */
|
|
43
|
+
commitPendingOffer(): void;
|
|
44
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NegotiationNeeded = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* W3C negotiation-needed bookkeeping for one RTCPeerConnection.
|
|
6
|
+
*
|
|
7
|
+
* Every change that needs negotiation gets a sequence number. A local offer
|
|
8
|
+
* carries the changes made before it was created, and those count as
|
|
9
|
+
* negotiated once its answer commits (a rollback discards them). The event
|
|
10
|
+
* fires at most once per task, only in `stable`, and only for changes no
|
|
11
|
+
* committed offer carried.
|
|
12
|
+
*/
|
|
13
|
+
class NegotiationNeeded {
|
|
14
|
+
constructor(host) {
|
|
15
|
+
Object.defineProperty(this, "host", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true,
|
|
19
|
+
value: void 0
|
|
20
|
+
});
|
|
21
|
+
/** W3C [[NegotiationNeeded]]. */
|
|
22
|
+
Object.defineProperty(this, "flag", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
value: false
|
|
27
|
+
});
|
|
28
|
+
/** A change arrived outside `stable`: re-evaluate when it returns there. */
|
|
29
|
+
Object.defineProperty(this, "recheck", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
configurable: true,
|
|
32
|
+
writable: true,
|
|
33
|
+
value: false
|
|
34
|
+
});
|
|
35
|
+
/** Coalesces the changes of one task into a single event. */
|
|
36
|
+
Object.defineProperty(this, "scheduled", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true,
|
|
40
|
+
value: false
|
|
41
|
+
});
|
|
42
|
+
/** Sequence number of the latest change that needs negotiation. */
|
|
43
|
+
Object.defineProperty(this, "changeSeq", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true,
|
|
46
|
+
writable: true,
|
|
47
|
+
value: 0
|
|
48
|
+
});
|
|
49
|
+
/** Changes carried by a local offer whose answer committed. */
|
|
50
|
+
Object.defineProperty(this, "negotiatedSeq", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
configurable: true,
|
|
53
|
+
writable: true,
|
|
54
|
+
value: 0
|
|
55
|
+
});
|
|
56
|
+
/** Changes carried by the applied local offer (discarded on rollback). */
|
|
57
|
+
Object.defineProperty(this, "pendingOfferSeq", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
configurable: true,
|
|
60
|
+
writable: true,
|
|
61
|
+
value: void 0
|
|
62
|
+
});
|
|
63
|
+
this.host = host;
|
|
64
|
+
}
|
|
65
|
+
/** Record a change that needs negotiation and schedule the event. */
|
|
66
|
+
change() {
|
|
67
|
+
this.changeSeq++;
|
|
68
|
+
this.schedule();
|
|
69
|
+
}
|
|
70
|
+
/** Schedule the event if unnegotiated changes remain (also on return to stable). */
|
|
71
|
+
schedule() {
|
|
72
|
+
this.host.invalidate();
|
|
73
|
+
this.recheck = true;
|
|
74
|
+
if (this.flag ||
|
|
75
|
+
this.scheduled ||
|
|
76
|
+
this.host.signalingState() !== "stable") {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this.recheck = false;
|
|
80
|
+
this.scheduled = true;
|
|
81
|
+
setImmediate(() => {
|
|
82
|
+
this.scheduled = false;
|
|
83
|
+
if (this.host.isClosed())
|
|
84
|
+
return;
|
|
85
|
+
if (this.negotiatedSeq >= this.changeSeq) {
|
|
86
|
+
// 発火前に適用された local offer が変更をすべて含んでいる
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (this.host.signalingState() !== "stable") {
|
|
90
|
+
// stable に戻った時点で改めて判定する
|
|
91
|
+
this.recheck = true;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
this.flag = true;
|
|
95
|
+
this.host.fire();
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/** The change sequence a created offer includes (kept in its record). */
|
|
99
|
+
noteCreatedOffer() {
|
|
100
|
+
return this.changeSeq;
|
|
101
|
+
}
|
|
102
|
+
/** A created offer, including changes up to `changeSeq`, was applied. */
|
|
103
|
+
noteAppliedOffer(changeSeq) {
|
|
104
|
+
this.pendingOfferSeq = changeSeq;
|
|
105
|
+
}
|
|
106
|
+
/** The pending local offer was rolled back (explicitly or implicitly). */
|
|
107
|
+
discardPendingOffer() {
|
|
108
|
+
this.pendingOfferSeq = undefined;
|
|
109
|
+
}
|
|
110
|
+
/** The answer to the pending local offer committed its changes. */
|
|
111
|
+
commitPendingOffer() {
|
|
112
|
+
if (this.pendingOfferSeq == undefined)
|
|
113
|
+
return;
|
|
114
|
+
this.negotiatedSeq = Math.max(this.negotiatedSeq, this.pendingOfferSeq);
|
|
115
|
+
this.pendingOfferSeq = undefined;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.NegotiationNeeded = NegotiationNeeded;
|
|
119
|
+
//# sourceMappingURL=negotiationNeeded.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negotiationNeeded.js","sourceRoot":"","sources":["../../../../src/negotiation/negotiationNeeded.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;GAQG;AACH,MAAa,iBAAiB;IAsB5B,YAAY,IAMX;QA3BgB;;;;;WAMf;QAEF,iCAAiC;QACjC;;;;mBAAO,KAAK;WAAC;QACb,4EAA4E;QAC5E;;;;mBAAU,KAAK;WAAC;QAChB,6DAA6D;QACrD;;;;mBAAY,KAAK;WAAC;QAC1B,mEAAmE;QAC3D;;;;mBAAY,CAAC;WAAC;QACtB,+DAA+D;QACvD;;;;mBAAgB,CAAC;WAAC;QAC1B,0EAA0E;QAClE;;;;;WAAyB;QAS/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,qEAAqE;IACrE,MAAM;QACJ,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAED,oFAAoF;IACpF,QAAQ;QACN,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IACE,IAAI,CAAC,IAAI;YACT,IAAI,CAAC,SAAS;YACd,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,QAAQ,EACvC,CAAC;YACD,OAAO;QACT,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,YAAY,CAAC,GAAG,EAAE;YAChB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;YACvB,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAAE,OAAO;YACjC,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBACzC,qCAAqC;gBACrC,OAAO;YACT,CAAC;YACD,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,QAAQ,EAAE,CAAC;gBAC5C,wBAAwB;gBACxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;gBACpB,OAAO;YACT,CAAC;YACD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,yEAAyE;IACzE,gBAAgB;QACd,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,yEAAyE;IACzE,gBAAgB,CAAC,SAAiB;QAChC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;IACnC,CAAC;IAED,0EAA0E;IAC1E,mBAAmB;QACjB,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;IACnC,CAAC;IAED,mEAAmE;IACnE,kBAAkB;QAChB,IAAI,IAAI,CAAC,eAAe,IAAI,SAAS;YAAE,OAAO;QAC9C,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACxE,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;IACnC,CAAC;CACF;AAzFD,8CAyFC","sourcesContent":["import type { RTCSignalingState } from \"../types/domain\";\n\n/**\n * W3C negotiation-needed bookkeeping for one RTCPeerConnection.\n *\n * Every change that needs negotiation gets a sequence number. A local offer\n * carries the changes made before it was created, and those count as\n * negotiated once its answer commits (a rollback discards them). The event\n * fires at most once per task, only in `stable`, and only for changes no\n * committed offer carried.\n */\nexport class NegotiationNeeded {\n private readonly host: {\n signalingState: () => RTCSignalingState;\n isClosed: () => boolean;\n /** Created offers/answers no longer reflect the state. */\n invalidate: () => void;\n fire: () => void;\n };\n\n /** W3C [[NegotiationNeeded]]. */\n flag = false;\n /** A change arrived outside `stable`: re-evaluate when it returns there. */\n recheck = false;\n /** Coalesces the changes of one task into a single event. */\n private scheduled = false;\n /** Sequence number of the latest change that needs negotiation. */\n private changeSeq = 0;\n /** Changes carried by a local offer whose answer committed. */\n private negotiatedSeq = 0;\n /** Changes carried by the applied local offer (discarded on rollback). */\n private pendingOfferSeq?: number;\n\n constructor(host: {\n signalingState: () => RTCSignalingState;\n isClosed: () => boolean;\n /** Created offers/answers no longer reflect the state. */\n invalidate: () => void;\n fire: () => void;\n }) {\n this.host = host;\n }\n\n /** Record a change that needs negotiation and schedule the event. */\n change() {\n this.changeSeq++;\n this.schedule();\n }\n\n /** Schedule the event if unnegotiated changes remain (also on return to stable). */\n schedule() {\n this.host.invalidate();\n this.recheck = true;\n if (\n this.flag ||\n this.scheduled ||\n this.host.signalingState() !== \"stable\"\n ) {\n return;\n }\n this.recheck = false;\n this.scheduled = true;\n setImmediate(() => {\n this.scheduled = false;\n if (this.host.isClosed()) return;\n if (this.negotiatedSeq >= this.changeSeq) {\n // 発火前に適用された local offer が変更をすべて含んでいる\n return;\n }\n if (this.host.signalingState() !== \"stable\") {\n // stable に戻った時点で改めて判定する\n this.recheck = true;\n return;\n }\n this.flag = true;\n this.host.fire();\n });\n }\n\n /** The change sequence a created offer includes (kept in its record). */\n noteCreatedOffer() {\n return this.changeSeq;\n }\n\n /** A created offer, including changes up to `changeSeq`, was applied. */\n noteAppliedOffer(changeSeq: number) {\n this.pendingOfferSeq = changeSeq;\n }\n\n /** The pending local offer was rolled back (explicitly or implicitly). */\n discardPendingOffer() {\n this.pendingOfferSeq = undefined;\n }\n\n /** The answer to the pending local offer committed its changes. */\n commitPendingOffer() {\n if (this.pendingOfferSeq == undefined) return;\n this.negotiatedSeq = Math.max(this.negotiatedSeq, this.pendingOfferSeq);\n this.pendingOfferSeq = undefined;\n }\n}\n"]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { NegotiationTransaction } from "../negotiationTransaction";
|
|
2
|
+
import type { SessionDescription } from "../sdp";
|
|
3
|
+
import type { SDPManager } from "../sdpManager";
|
|
4
|
+
import type { SecureTransportManager } from "../secureTransportManager";
|
|
5
|
+
import type { RTCIceCandidate, RTCIceCandidateInit } from "../transport/ice";
|
|
6
|
+
import type { RTCSignalingState } from "../types/domain";
|
|
7
|
+
import type { BundleTopology } from "./bundleTopology";
|
|
8
|
+
/**
|
|
9
|
+
* The ICE generation of a candidate is its ufrag, given either as the
|
|
10
|
+
* `usernameFragment` property or as the `ufrag` token of the candidate
|
|
11
|
+
* string. Both forms route the same way; conflicting values are rejected.
|
|
12
|
+
*/
|
|
13
|
+
export declare function normalizeCandidateUfrag(message: RTCIceCandidate | RTCIceCandidateInit | null): RTCIceCandidate | RTCIceCandidateInit | null;
|
|
14
|
+
/**
|
|
15
|
+
* Trickle ICE for remote candidates: routes each candidate or
|
|
16
|
+
* end-of-candidates to the ICE generation (current or pending) of the m-line
|
|
17
|
+
* it targets, records it in that SDP and hands it to the live, pending-only or
|
|
18
|
+
* provisional checklist. Candidates added before any remote description wait
|
|
19
|
+
* in a queue (werift convenience; the WPT runner keeps the strict rejection).
|
|
20
|
+
*
|
|
21
|
+
* - The generation is chosen by the ufrag of the m-line the candidate targets
|
|
22
|
+
* (`sdpMid`, else `sdpMLineIndex`): in a partial BUNDLE split one m-line can
|
|
23
|
+
* keep the current ufrag while another moves to a new one.
|
|
24
|
+
* - During a remote re-offer, a candidate for an m-line whose ufrag is
|
|
25
|
+
* unchanged belongs to both the pending proposal and the live generation:
|
|
26
|
+
* it is recorded in both SDPs and handed to the live checklist once, and a
|
|
27
|
+
* rollback keeps it.
|
|
28
|
+
* - End-of-candidates ends one generation (RFC 8838): every m-line sharing
|
|
29
|
+
* its transport and ufrag is marked complete, in the current or pending SDP,
|
|
30
|
+
* and a later candidate of it reaches neither an SDP nor a checklist. A
|
|
31
|
+
* pending restart ufrag on the same transport stays open; an m-line a
|
|
32
|
+
* proposal splits off stays open even with the same credentials (RFC 8839
|
|
33
|
+
* section 5.4).
|
|
34
|
+
* - Queued candidates are checked against an incoming remote description
|
|
35
|
+
* before any state change; one it cannot place rejects
|
|
36
|
+
* setRemoteDescription and stays queued for a retry.
|
|
37
|
+
* - Duplicates within a generation are idempotent; a callback of a retired
|
|
38
|
+
* generation cannot reach its replacement.
|
|
39
|
+
*/
|
|
40
|
+
export declare class RemoteCandidates {
|
|
41
|
+
private readonly sdp;
|
|
42
|
+
private readonly secure;
|
|
43
|
+
private readonly negotiation;
|
|
44
|
+
private readonly topology;
|
|
45
|
+
private readonly host;
|
|
46
|
+
/** Candidates added before a remote description was applied. */
|
|
47
|
+
readonly queued: Array<RTCIceCandidate | RTCIceCandidateInit | null>;
|
|
48
|
+
constructor(sdp: SDPManager, secure: SecureTransportManager, negotiation: NegotiationTransaction, topology: BundleTopology, host: {
|
|
49
|
+
signalingState: () => RTCSignalingState;
|
|
50
|
+
hasRemoteDescription: () => boolean;
|
|
51
|
+
});
|
|
52
|
+
/** Route a trickled candidate or end-of-candidates to its ICE generation. */
|
|
53
|
+
apply(candidateMessage: RTCIceCandidate | RTCIceCandidateInit | null): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* A re-offer or pranswer that keeps the current transports may still carry
|
|
56
|
+
* new candidates or end-of-candidates for an m-line whose ufrag is
|
|
57
|
+
* unchanged. They belong to the live generation too, so they reach the live
|
|
58
|
+
* checklist and the current SDP (once, and not after its end-of-candidates),
|
|
59
|
+
* exactly like trickled ones. A pending-only transport receives its own.
|
|
60
|
+
*/
|
|
61
|
+
deliverSameGenerationDescription(proposal: SessionDescription): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* End-of-candidates ends an ICE generation on its transport, not one
|
|
64
|
+
* m-line: every m-line of `sdp` on the same finished transport with the
|
|
65
|
+
* same ufrag as `completed` (the rest of its BUNDLE group) is marked
|
|
66
|
+
* complete, so the SDP never promises more candidates to it.
|
|
67
|
+
*/
|
|
68
|
+
completeSharedTransportMedia(sdp: SessionDescription, completed: number[]): void;
|
|
69
|
+
/**
|
|
70
|
+
* A candidate trickled for a pending re-offer whose m-line keeps the current
|
|
71
|
+
* ufrag belongs to the live ICE generation as well. Besides the pending SDP,
|
|
72
|
+
* it is recorded in the current SDP and handed to the live checklist once,
|
|
73
|
+
* so the committed session can use it while the proposal is pending.
|
|
74
|
+
*/
|
|
75
|
+
private deliverSameGenerationCandidate;
|
|
76
|
+
/**
|
|
77
|
+
* Candidates queued before any remote description are checked against the
|
|
78
|
+
* description during validation, so a bad one rejects setRemoteDescription
|
|
79
|
+
* before any state changes and before any application event fires. The rejected
|
|
80
|
+
* candidates leave the queue: their addIceCandidate already resolved, and a
|
|
81
|
+
* retry of the same description must not fail on them again.
|
|
82
|
+
*/
|
|
83
|
+
validateQueued(sdp: SessionDescription): Promise<void>;
|
|
84
|
+
/** Apply the queued candidates once a remote description exists. */
|
|
85
|
+
flushQueued(): Promise<void>;
|
|
86
|
+
}
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RemoteCandidates = void 0;
|
|
4
|
+
exports.normalizeCandidateUfrag = normalizeCandidateUfrag;
|
|
5
|
+
const errors_1 = require("../errors");
|
|
6
|
+
/**
|
|
7
|
+
* The ICE generation of a candidate is its ufrag, given either as the
|
|
8
|
+
* `usernameFragment` property or as the `ufrag` token of the candidate
|
|
9
|
+
* string. Both forms route the same way; conflicting values are rejected.
|
|
10
|
+
*/
|
|
11
|
+
function normalizeCandidateUfrag(message) {
|
|
12
|
+
if (!message)
|
|
13
|
+
return message;
|
|
14
|
+
const fromString = message.candidate?.match(/\bufrag\s+(\S+)/)?.[1];
|
|
15
|
+
const fromProperty = message.usernameFragment ?? undefined;
|
|
16
|
+
if (fromString && fromProperty && fromString !== fromProperty) {
|
|
17
|
+
throw (0, errors_1.createWebRtcDomException)("OperationError", "Candidate ufrag does not match usernameFragment");
|
|
18
|
+
}
|
|
19
|
+
if (!fromString || fromProperty)
|
|
20
|
+
return message;
|
|
21
|
+
const init = "toJSON" in message ? message.toJSON() : { ...message };
|
|
22
|
+
return { ...init, usernameFragment: fromString };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Trickle ICE for remote candidates: routes each candidate or
|
|
26
|
+
* end-of-candidates to the ICE generation (current or pending) of the m-line
|
|
27
|
+
* it targets, records it in that SDP and hands it to the live, pending-only or
|
|
28
|
+
* provisional checklist. Candidates added before any remote description wait
|
|
29
|
+
* in a queue (werift convenience; the WPT runner keeps the strict rejection).
|
|
30
|
+
*
|
|
31
|
+
* - The generation is chosen by the ufrag of the m-line the candidate targets
|
|
32
|
+
* (`sdpMid`, else `sdpMLineIndex`): in a partial BUNDLE split one m-line can
|
|
33
|
+
* keep the current ufrag while another moves to a new one.
|
|
34
|
+
* - During a remote re-offer, a candidate for an m-line whose ufrag is
|
|
35
|
+
* unchanged belongs to both the pending proposal and the live generation:
|
|
36
|
+
* it is recorded in both SDPs and handed to the live checklist once, and a
|
|
37
|
+
* rollback keeps it.
|
|
38
|
+
* - End-of-candidates ends one generation (RFC 8838): every m-line sharing
|
|
39
|
+
* its transport and ufrag is marked complete, in the current or pending SDP,
|
|
40
|
+
* and a later candidate of it reaches neither an SDP nor a checklist. A
|
|
41
|
+
* pending restart ufrag on the same transport stays open; an m-line a
|
|
42
|
+
* proposal splits off stays open even with the same credentials (RFC 8839
|
|
43
|
+
* section 5.4).
|
|
44
|
+
* - Queued candidates are checked against an incoming remote description
|
|
45
|
+
* before any state change; one it cannot place rejects
|
|
46
|
+
* setRemoteDescription and stays queued for a retry.
|
|
47
|
+
* - Duplicates within a generation are idempotent; a callback of a retired
|
|
48
|
+
* generation cannot reach its replacement.
|
|
49
|
+
*/
|
|
50
|
+
class RemoteCandidates {
|
|
51
|
+
constructor(sdp, secure, negotiation, topology, host) {
|
|
52
|
+
Object.defineProperty(this, "sdp", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
writable: true,
|
|
56
|
+
value: void 0
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(this, "secure", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
configurable: true,
|
|
61
|
+
writable: true,
|
|
62
|
+
value: void 0
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(this, "negotiation", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
configurable: true,
|
|
67
|
+
writable: true,
|
|
68
|
+
value: void 0
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(this, "topology", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
configurable: true,
|
|
73
|
+
writable: true,
|
|
74
|
+
value: void 0
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(this, "host", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
configurable: true,
|
|
79
|
+
writable: true,
|
|
80
|
+
value: void 0
|
|
81
|
+
});
|
|
82
|
+
/** Candidates added before a remote description was applied. */
|
|
83
|
+
Object.defineProperty(this, "queued", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
configurable: true,
|
|
86
|
+
writable: true,
|
|
87
|
+
value: []
|
|
88
|
+
});
|
|
89
|
+
this.sdp = sdp;
|
|
90
|
+
this.secure = secure;
|
|
91
|
+
this.negotiation = negotiation;
|
|
92
|
+
this.topology = topology;
|
|
93
|
+
this.host = host;
|
|
94
|
+
}
|
|
95
|
+
/** Route a trickled candidate or end-of-candidates to its ICE generation. */
|
|
96
|
+
async apply(candidateMessage) {
|
|
97
|
+
const current = this.sdp.currentRemoteDescription;
|
|
98
|
+
const pending = this.sdp.pendingRemoteDescription;
|
|
99
|
+
const ufrag = candidateMessage?.usernameFragment;
|
|
100
|
+
// The generation is decided by the m-line the candidate targets: with a
|
|
101
|
+
// partial BUNDLE split one m-line may keep the current ufrag while another
|
|
102
|
+
// moves to a new one within the same pending description.
|
|
103
|
+
const sdpMid = candidateMessage?.sdpMid;
|
|
104
|
+
const sdpMLineIndex = candidateMessage?.sdpMLineIndex;
|
|
105
|
+
const targetMedia = (description) => typeof sdpMid === "string"
|
|
106
|
+
? description.media.filter((media) => media.rtp.muxId === sdpMid)
|
|
107
|
+
: typeof sdpMLineIndex === "number"
|
|
108
|
+
? description.media.slice(sdpMLineIndex, sdpMLineIndex + 1)
|
|
109
|
+
: description.media;
|
|
110
|
+
const matchesUfrag = (description) => targetMedia(description).some((media) => media.iceParams?.usernameFragment === ufrag);
|
|
111
|
+
const sdp = ufrag &&
|
|
112
|
+
current &&
|
|
113
|
+
matchesUfrag(current) &&
|
|
114
|
+
(!pending || !matchesUfrag(pending))
|
|
115
|
+
? current
|
|
116
|
+
: (pending ?? current);
|
|
117
|
+
if (!sdp) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
// A new remote generation is only a proposal during a re-offer. Keep its
|
|
121
|
+
// trickle data in the pending SDP until the final answer activates it.
|
|
122
|
+
const stageOnly = sdp === pending &&
|
|
123
|
+
!!current &&
|
|
124
|
+
(pending?.type === "offer" || pending?.type === "pranswer");
|
|
125
|
+
const appliedCandidate = await this.secure.addIceCandidate(sdp, candidateMessage, !stageOnly);
|
|
126
|
+
const remoteDescription = sdp;
|
|
127
|
+
if (!remoteDescription || !appliedCandidate) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (stageOnly) {
|
|
131
|
+
const targets = new Set(appliedCandidate.mediaIndices
|
|
132
|
+
.map((index) => this.negotiation.transportByMid.get(remoteDescription.media[index]?.rtp.muxId ?? ""))
|
|
133
|
+
.filter((transport) => !!transport &&
|
|
134
|
+
this.negotiation.isPendingOnlyTransport(transport.iceTransport.id)));
|
|
135
|
+
for (const transport of targets) {
|
|
136
|
+
transport.iceTransport.deliverRemoteCandidate(appliedCandidate.kind === "end-of-candidates"
|
|
137
|
+
? undefined
|
|
138
|
+
: appliedCandidate.candidate);
|
|
139
|
+
}
|
|
140
|
+
if (current) {
|
|
141
|
+
await this.deliverSameGenerationCandidate(remoteDescription, current, appliedCandidate);
|
|
142
|
+
}
|
|
143
|
+
if (this.host.signalingState() === "have-local-pranswer" ||
|
|
144
|
+
this.host.signalingState() === "have-remote-pranswer") {
|
|
145
|
+
const provisional = new Set(appliedCandidate.mediaIndices
|
|
146
|
+
.map((index) => this.topology.currentTransportForMid(remoteDescription.media[index]?.rtp.muxId ?? "")?.iceTransport)
|
|
147
|
+
.filter((transport) => !!transport?.hasStagedRestart &&
|
|
148
|
+
!this.negotiation.isPendingOnlyTransport(transport.id)));
|
|
149
|
+
for (const transport of provisional) {
|
|
150
|
+
transport.deliverProvisionalRemoteCandidate(appliedCandidate.kind === "end-of-candidates"
|
|
151
|
+
? undefined
|
|
152
|
+
: appliedCandidate.candidate);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (appliedCandidate.kind === "end-of-candidates") {
|
|
157
|
+
for (const mediaIndex of appliedCandidate.mediaIndices) {
|
|
158
|
+
const media = remoteDescription.media[mediaIndex];
|
|
159
|
+
if (media) {
|
|
160
|
+
media.iceCandidatesComplete = true;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// A pending SDP becomes current at the answer, so it is aligned too.
|
|
164
|
+
this.completeSharedTransportMedia(remoteDescription, appliedCandidate.mediaIndices);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
for (const mediaIndex of appliedCandidate.mediaIndices) {
|
|
168
|
+
const media = remoteDescription.media[mediaIndex];
|
|
169
|
+
if (!media) {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
media.iceCandidates.push(appliedCandidate.candidate);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* A re-offer or pranswer that keeps the current transports may still carry
|
|
177
|
+
* new candidates or end-of-candidates for an m-line whose ufrag is
|
|
178
|
+
* unchanged. They belong to the live generation too, so they reach the live
|
|
179
|
+
* checklist and the current SDP (once, and not after its end-of-candidates),
|
|
180
|
+
* exactly like trickled ones. A pending-only transport receives its own.
|
|
181
|
+
*/
|
|
182
|
+
async deliverSameGenerationDescription(proposal) {
|
|
183
|
+
const current = this.sdp.currentRemoteDescription;
|
|
184
|
+
if (!current)
|
|
185
|
+
return;
|
|
186
|
+
const shared = [...proposal.media.entries()].filter(([, media]) => {
|
|
187
|
+
if (media.port === 0)
|
|
188
|
+
return false;
|
|
189
|
+
const prepared = this.negotiation.transportByMid.get(media.rtp.muxId ?? "");
|
|
190
|
+
return !(prepared &&
|
|
191
|
+
this.negotiation.isPendingOnlyTransport(prepared.iceTransport.id));
|
|
192
|
+
});
|
|
193
|
+
// Candidates first (a non-tag BUNDLE member carries none of its own),
|
|
194
|
+
// then end-of-candidates from any m-line, since it ends the shared
|
|
195
|
+
// generation for the whole group.
|
|
196
|
+
for (const [index, media] of shared) {
|
|
197
|
+
if (this.topology.isBundledNonTag(proposal, media.rtp.muxId))
|
|
198
|
+
continue;
|
|
199
|
+
for (const candidate of media.iceCandidates) {
|
|
200
|
+
await this.deliverSameGenerationCandidate(proposal, current, {
|
|
201
|
+
kind: "candidate",
|
|
202
|
+
candidate,
|
|
203
|
+
mediaIndices: [index],
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
for (const [index, media] of shared) {
|
|
208
|
+
if (!media.iceCandidatesComplete)
|
|
209
|
+
continue;
|
|
210
|
+
await this.deliverSameGenerationCandidate(proposal, current, {
|
|
211
|
+
kind: "end-of-candidates",
|
|
212
|
+
mediaIndices: [index],
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* End-of-candidates ends an ICE generation on its transport, not one
|
|
218
|
+
* m-line: every m-line of `sdp` on the same finished transport with the
|
|
219
|
+
* same ufrag as `completed` (the rest of its BUNDLE group) is marked
|
|
220
|
+
* complete, so the SDP never promises more candidates to it.
|
|
221
|
+
*/
|
|
222
|
+
completeSharedTransportMedia(sdp, completed) {
|
|
223
|
+
const current = this.sdp.currentRemoteDescription;
|
|
224
|
+
if (sdp === current) {
|
|
225
|
+
// The current description is laid out on the committed transports:
|
|
226
|
+
// only the live generation that ended on a transport counts (a pending
|
|
227
|
+
// restart ufrag on the same transport is still open).
|
|
228
|
+
const transportFor = (mid) => this.topology.liveTransportForMid(mid)?.iceTransport;
|
|
229
|
+
const ended = completed.flatMap((index) => {
|
|
230
|
+
const media = sdp.media[index];
|
|
231
|
+
const transport = transportFor(media?.rtp.muxId ?? "");
|
|
232
|
+
const ufrag = media?.iceParams?.usernameFragment;
|
|
233
|
+
return transport?.connection.remoteCandidatesEnd &&
|
|
234
|
+
transport.connection.remoteUsername === ufrag
|
|
235
|
+
? [{ transport, ufrag }]
|
|
236
|
+
: [];
|
|
237
|
+
});
|
|
238
|
+
for (const media of sdp.media) {
|
|
239
|
+
const transport = transportFor(media.rtp.muxId ?? "");
|
|
240
|
+
if (ended.some((generation) => generation.transport === transport &&
|
|
241
|
+
generation.ufrag === media.iceParams?.usernameFragment)) {
|
|
242
|
+
media.iceCandidatesComplete = true;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
// A pending proposal: a generation is identified by the proposal's own
|
|
248
|
+
// BUNDLE ownership (the group tag, or the m-line itself) and ufrag, so an
|
|
249
|
+
// m-line the proposal splits off stays open even with the same
|
|
250
|
+
// credentials (RFC 8839 section 5.4), before any transport is prepared.
|
|
251
|
+
const ownerIn = (description, mid) => this.topology.bundleTagOf(description, mid) ?? mid;
|
|
252
|
+
const keyOf = (media) => `${ownerIn(sdp, media.rtp.muxId ?? "")}\u0000${media.iceParams?.usernameFragment ?? ""}`;
|
|
253
|
+
const ended = new Set();
|
|
254
|
+
for (const index of completed) {
|
|
255
|
+
const media = sdp.media[index];
|
|
256
|
+
const mid = media?.rtp.muxId;
|
|
257
|
+
const ufrag = media?.iceParams?.usernameFragment;
|
|
258
|
+
if (!media || !mid || !ufrag)
|
|
259
|
+
continue;
|
|
260
|
+
// Its end-of-candidates arrived for this proposal, or the proposal
|
|
261
|
+
// repeats a live generation that already ended, on an m-line it keeps
|
|
262
|
+
// with the same owner.
|
|
263
|
+
const live = this.topology.liveTransportForMid(mid)?.iceTransport;
|
|
264
|
+
const repeatsEndedLive = !!current &&
|
|
265
|
+
ownerIn(current, mid) === ownerIn(sdp, mid) &&
|
|
266
|
+
!!live?.connection.remoteCandidatesEnd &&
|
|
267
|
+
live.connection.remoteUsername === ufrag;
|
|
268
|
+
if (media.iceCandidatesComplete || repeatsEndedLive) {
|
|
269
|
+
ended.add(keyOf(media));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
for (const media of sdp.media) {
|
|
273
|
+
if (ended.has(keyOf(media)))
|
|
274
|
+
media.iceCandidatesComplete = true;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* A candidate trickled for a pending re-offer whose m-line keeps the current
|
|
279
|
+
* ufrag belongs to the live ICE generation as well. Besides the pending SDP,
|
|
280
|
+
* it is recorded in the current SDP and handed to the live checklist once,
|
|
281
|
+
* so the committed session can use it while the proposal is pending.
|
|
282
|
+
*/
|
|
283
|
+
async deliverSameGenerationCandidate(pending, current, applied) {
|
|
284
|
+
for (const index of applied.mediaIndices) {
|
|
285
|
+
const mid = pending.media[index]?.rtp.muxId;
|
|
286
|
+
const ufrag = pending.media[index]?.iceParams?.usernameFragment;
|
|
287
|
+
const currentMedia = current.media.find((media) => media.rtp.muxId === mid);
|
|
288
|
+
const iceTransport = mid
|
|
289
|
+
? this.topology.currentTransportForMid(mid)?.iceTransport
|
|
290
|
+
: undefined;
|
|
291
|
+
if (!ufrag ||
|
|
292
|
+
!currentMedia ||
|
|
293
|
+
currentMedia.iceParams?.usernameFragment !== ufrag ||
|
|
294
|
+
!iceTransport ||
|
|
295
|
+
this.negotiation.isPendingOnlyTransport(iceTransport.id) ||
|
|
296
|
+
iceTransport.connection.remoteUsername !== ufrag ||
|
|
297
|
+
// RFC 8838: a generation that signalled end-of-candidates is complete,
|
|
298
|
+
// whichever BUNDLE m-line of the shared transport carried it.
|
|
299
|
+
currentMedia.iceCandidatesComplete ||
|
|
300
|
+
iceTransport.connection.remoteCandidatesEnd) {
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
if (applied.kind === "end-of-candidates") {
|
|
304
|
+
currentMedia.iceCandidatesComplete = true;
|
|
305
|
+
iceTransport.deliverRemoteCandidate(undefined);
|
|
306
|
+
this.completeSharedTransportMedia(current, [
|
|
307
|
+
current.media.indexOf(currentMedia),
|
|
308
|
+
]);
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
const text = applied.candidate.toJSON().candidate;
|
|
312
|
+
if (currentMedia.iceCandidates.some((existing) => existing.toJSON().candidate === text)) {
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
currentMedia.iceCandidates.push(applied.candidate);
|
|
316
|
+
iceTransport.deliverRemoteCandidate(applied.candidate);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Candidates queued before any remote description are checked against the
|
|
321
|
+
* description during validation, so a bad one rejects setRemoteDescription
|
|
322
|
+
* before any state changes and before any application event fires. The rejected
|
|
323
|
+
* candidates leave the queue: their addIceCandidate already resolved, and a
|
|
324
|
+
* retry of the same description must not fail on them again.
|
|
325
|
+
*/
|
|
326
|
+
async validateQueued(sdp) {
|
|
327
|
+
let firstError;
|
|
328
|
+
for (const candidate of [...this.queued]) {
|
|
329
|
+
try {
|
|
330
|
+
await this.secure.addIceCandidate(sdp, candidate ?? null, false);
|
|
331
|
+
}
|
|
332
|
+
catch (error) {
|
|
333
|
+
firstError ?? (firstError = error);
|
|
334
|
+
this.queued.splice(this.queued.indexOf(candidate), 1);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
if (firstError)
|
|
338
|
+
throw firstError;
|
|
339
|
+
}
|
|
340
|
+
/** Apply the queued candidates once a remote description exists. */
|
|
341
|
+
async flushQueued() {
|
|
342
|
+
while (this.queued.length > 0 && this.host.hasRemoteDescription()) {
|
|
343
|
+
const candidate = this.queued.shift();
|
|
344
|
+
await this.apply(candidate ?? null);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
exports.RemoteCandidates = RemoteCandidates;
|
|
349
|
+
//# sourceMappingURL=remoteCandidates.js.map
|