werift 0.26.0 → 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/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/log.js +5 -7
- package/lib/common/src/log.js.map +1 -1
- package/lib/common/src/transport.js +10 -5
- package/lib/common/src/transport.js.map +1 -1
- package/lib/dtls/src/context/cipher.d.ts +1 -1
- package/lib/dtls/src/context/cipher.js +6 -3
- 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.js +2 -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 +8 -4
- package/lib/dtls/src/flight/flight.js.map +1 -1
- package/lib/dtls/src/flight/server/flight4.js +4 -2
- 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/message/alert.js +4 -2
- package/lib/dtls/src/handshake/message/alert.js.map +1 -1
- package/lib/dtls/src/handshake/message/certificate.js +2 -1
- package/lib/dtls/src/handshake/message/certificate.js.map +1 -1
- package/lib/dtls/src/handshake/message/changeCipherSpec.js +2 -1
- package/lib/dtls/src/handshake/message/changeCipherSpec.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/certificateVerify.js +4 -2
- package/lib/dtls/src/handshake/message/client/certificateVerify.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/hello.js +14 -7
- package/lib/dtls/src/handshake/message/client/hello.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/keyExchange.js +2 -1
- 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.js +6 -3
- package/lib/dtls/src/handshake/message/server/certificateRequest.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/hello.js +12 -6
- package/lib/dtls/src/handshake/message/server/hello.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/helloDone.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js +4 -2
- package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/keyExchange.js +16 -8
- 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 +5 -2
- package/lib/dtls/src/handshake/random.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.js +12 -6
- package/lib/dtls/src/record/message/fragment.js.map +1 -1
- package/lib/dtls/src/record/message/header.js +10 -5
- 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/socket.js +4 -2
- 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 +21 -5
- package/lib/ice/src/exceptions.js +58 -13
- package/lib/ice/src/exceptions.js.map +1 -1
- package/lib/ice/src/ice.d.ts +52 -8
- package/lib/ice/src/ice.js +288 -152
- package/lib/ice/src/ice.js.map +1 -1
- package/lib/ice/src/iceBase.d.ts +126 -11
- package/lib/ice/src/iceBase.js +165 -12
- package/lib/ice/src/iceBase.js.map +1 -1
- package/lib/ice/src/stun/transaction.d.ts +30 -1
- package/lib/ice/src/stun/transaction.js +86 -17
- 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 +29 -8
- package/lib/ice/src/turn/protocol.js +121 -48
- package/lib/ice/src/turn/protocol.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 +1 -3
- package/lib/ice-server/src/stun/message.js +13 -9
- package/lib/ice-server/src/stun/message.js.map +1 -1
- package/lib/index.mjs +9770 -2648
- package/lib/nonstandard/index.mjs +2428 -1052
- package/lib/polyfill/dom.mjs +8738 -1815
- package/lib/polyfill/index.mjs +8738 -1815
- 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.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/ebml/ebml.js +6 -3
- package/lib/rtp/src/extra/container/webm/ebml/ebml.js.map +1 -1
- package/lib/rtp/src/extra/processor/depacketizer.d.ts +5 -0
- package/lib/rtp/src/extra/processor/depacketizer.js +28 -2
- package/lib/rtp/src/extra/processor/depacketizer.js.map +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/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/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/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 +6 -3
- 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.js +4 -2
- package/lib/rtp/src/extra/processor/nack.js.map +1 -1
- 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/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/rtpCallback.js +2 -1
- package/lib/rtp/src/extra/processor/rtpCallback.js.map +1 -1
- 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/webm.js +14 -7
- package/lib/rtp/src/extra/processor/webm.js.map +1 -1
- package/lib/rtp/src/extra/processor/webmCallback.js.map +1 -1
- package/lib/rtp/src/index.d.ts +7 -0
- package/lib/rtp/src/index.js +7 -0
- 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 +4 -0
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js.map +1 -1
- package/lib/rtp/src/rtcp/rtcp.js +8 -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.js +1 -0
- 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.js +4 -2
- package/lib/rtp/src/srtp/cipher/ctr.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.js +6 -3
- 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 +34 -10
- 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/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 +80 -0
- package/lib/sctp/src/sctp.js +655 -108
- 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 +48 -5
- package/lib/webrtc/src/api/peerConfig.js +41 -0
- package/lib/webrtc/src/api/peerConfig.js.map +1 -1
- package/lib/webrtc/src/dataChannel.d.ts +10 -0
- package/lib/webrtc/src/dataChannel.js +24 -4
- package/lib/webrtc/src/dataChannel.js.map +1 -1
- package/lib/webrtc/src/media/index.d.ts +10 -0
- package/lib/webrtc/src/media/index.js +70 -0
- package/lib/webrtc/src/media/index.js.map +1 -1
- package/lib/webrtc/src/media/receiver/nack.js +2 -1
- 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 +14 -1
- package/lib/webrtc/src/media/router.js +46 -2
- package/lib/webrtc/src/media/router.js.map +1 -1
- package/lib/webrtc/src/media/rtpReceiver.d.ts +30 -2
- package/lib/webrtc/src/media/rtpReceiver.js +175 -26
- package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
- package/lib/webrtc/src/media/rtpSender.d.ts +184 -70
- package/lib/webrtc/src/media/rtpSender.js +626 -449
- package/lib/webrtc/src/media/rtpSender.js.map +1 -1
- package/lib/webrtc/src/media/rtpTransceiver.d.ts +1 -3
- package/lib/webrtc/src/media/rtpTransceiver.js +10 -7
- 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 -33
- package/lib/webrtc/src/media/sender/senderBWE.js +5 -154
- 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 +20 -2
- package/lib/webrtc/src/media/track.js +23 -5
- package/lib/webrtc/src/media/track.js.map +1 -1
- package/lib/webrtc/src/negotiation/bundleTopology.d.ts +1 -5
- package/lib/webrtc/src/negotiation/bundleTopology.js +15 -11
- package/lib/webrtc/src/negotiation/bundleTopology.js.map +1 -1
- package/lib/webrtc/src/negotiation/descriptionValidation.js +12 -6
- package/lib/webrtc/src/negotiation/descriptionValidation.js.map +1 -1
- package/lib/webrtc/src/negotiation/negotiationNeeded.js +2 -1
- package/lib/webrtc/src/negotiation/negotiationNeeded.js.map +1 -1
- package/lib/webrtc/src/negotiation/remoteCandidates.js +10 -5
- package/lib/webrtc/src/negotiation/remoteCandidates.js.map +1 -1
- package/lib/webrtc/src/negotiation/remoteMediaApplication.d.ts +1 -1
- package/lib/webrtc/src/negotiation/remoteMediaApplication.js +22 -6
- package/lib/webrtc/src/negotiation/remoteMediaApplication.js.map +1 -1
- package/lib/webrtc/src/negotiation/transportActivation.js +19 -8
- package/lib/webrtc/src/negotiation/transportActivation.js.map +1 -1
- package/lib/webrtc/src/negotiationTransaction.d.ts +8 -1
- package/lib/webrtc/src/negotiationTransaction.js +18 -5
- package/lib/webrtc/src/negotiationTransaction.js.map +1 -1
- package/lib/webrtc/src/nonstandard/dummyMedia.js +2 -1
- package/lib/webrtc/src/nonstandard/dummyMedia.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 +9 -7
- 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.js +8 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js.map +1 -1
- package/lib/webrtc/src/nonstandard/userMedia.js +2 -1
- package/lib/webrtc/src/nonstandard/userMedia.js.map +1 -1
- package/lib/webrtc/src/peerConnection.d.ts +44 -1
- package/lib/webrtc/src/peerConnection.js +74 -8
- package/lib/webrtc/src/peerConnection.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/sctpManager.d.ts +46 -14
- package/lib/webrtc/src/sctpManager.js +88 -25
- 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/secureTransportManager.d.ts +52 -4
- package/lib/webrtc/src/secureTransportManager.js +106 -23
- package/lib/webrtc/src/secureTransportManager.js.map +1 -1
- package/lib/webrtc/src/transceiverManager.js +8 -3
- package/lib/webrtc/src/transceiverManager.js.map +1 -1
- package/lib/webrtc/src/transport/dtls.d.ts +53 -1
- package/lib/webrtc/src/transport/dtls.js +131 -31
- package/lib/webrtc/src/transport/dtls.js.map +1 -1
- package/lib/webrtc/src/transport/ice.d.ts +10 -86
- package/lib/webrtc/src/transport/ice.js +70 -31
- package/lib/webrtc/src/transport/ice.js.map +1 -1
- package/lib/webrtc/src/transport/sctp.d.ts +2 -0
- package/lib/webrtc/src/transport/sctp.js +66 -20
- package/lib/webrtc/src/transport/sctp.js.map +1 -1
- package/lib/webrtc/src/utils.d.ts +36 -3
- package/lib/webrtc/src/utils.js +56 -16
- package/lib/webrtc/src/utils.js.map +1 -1
- package/package.json +8 -6
|
@@ -3,6 +3,7 @@ import type { CandidatePair, Message, Protocol } from "../imports/ice";
|
|
|
3
3
|
import type { RTCRtpCodecParameters, RTCRtpHeaderExtensionParameters } from "../media/parameters";
|
|
4
4
|
import { type KeyFrameRequestRouting } from "../media/router";
|
|
5
5
|
import type { RTCRtpSenderOptions } from "../media/rtpSender";
|
|
6
|
+
import type { BandwidthEstimatorOption } from "../media/sender/createBandwidthEstimator";
|
|
6
7
|
import type { BundlePolicy } from "../sdp";
|
|
7
8
|
import type { MLineReuse } from "../sdpManager";
|
|
8
9
|
import type { DtlsKeys, RTCCertificate } from "../transport/dtls";
|
|
@@ -33,6 +34,13 @@ export interface PeerConfig {
|
|
|
33
34
|
/** Advertise local ICE lite and operate in the controlled role. */
|
|
34
35
|
iceLite: boolean;
|
|
35
36
|
iceServers: RTCIceServer[];
|
|
37
|
+
/**
|
|
38
|
+
* Fall back to the built-in public STUN server (`stun.l.google.com:19302`)
|
|
39
|
+
* when `iceServers` contains no STUN URL (empty or TURN-only).
|
|
40
|
+
* Set to false to gather server-reflexive candidates only from the STUN
|
|
41
|
+
* servers given in `iceServers`. Defaults to true.
|
|
42
|
+
*/
|
|
43
|
+
iceUseDefaultStunServer: boolean;
|
|
36
44
|
/**Minimum port and Maximum port must not be the same value */
|
|
37
45
|
icePortRange: [number, number] | undefined;
|
|
38
46
|
/**
|
|
@@ -91,10 +99,26 @@ export interface PeerConfig {
|
|
|
91
99
|
rtcpMuxPolicy: "require";
|
|
92
100
|
iceCandidatePoolSize: number;
|
|
93
101
|
certificates: RTCCertificate[];
|
|
102
|
+
/**
|
|
103
|
+
* Which default DTLS certificate is used when neither `certificates` nor `dtls.keys` is given.
|
|
104
|
+
* Cannot be changed after construction.
|
|
105
|
+
* - `"process"` (default): one certificate shared by every RTCPeerConnection in the process
|
|
106
|
+
* (legacy behavior), so their `a=fingerprint` values are identical.
|
|
107
|
+
* - `"peerConnection"`: each RTCPeerConnection generates its own certificate (browser behavior).
|
|
108
|
+
* All DTLS transports of that connection share it.
|
|
109
|
+
*/
|
|
110
|
+
certificateScope: CertificateScope;
|
|
94
111
|
debug: DebugConfig;
|
|
95
112
|
midSuffix: boolean;
|
|
96
113
|
/** Advertised local SCTP max-message-size in SDP. Use 0 for unlimited. */
|
|
97
114
|
maxMessageSize: number;
|
|
115
|
+
/**
|
|
116
|
+
* When true, padding-only RTP is omitted from onReceiveRtp and later media
|
|
117
|
+
* sequence numbers are compacted. Default false preserves wire RTP events.
|
|
118
|
+
*/
|
|
119
|
+
filterProbePaddingOnReceiveRtp: boolean;
|
|
120
|
+
/** Send-side estimator used by each new sender; defaults to `"lightweight"`. */
|
|
121
|
+
bandwidthEstimator: BandwidthEstimatorOption;
|
|
98
122
|
/** SCTP outbound packet MTU used for DATA chunk fragmentation. */
|
|
99
123
|
sctp: {
|
|
100
124
|
mtu: number;
|
|
@@ -119,6 +143,7 @@ export interface PeerConfig {
|
|
|
119
143
|
*/
|
|
120
144
|
keyFrameRequestRouting: KeyFrameRequestRouting;
|
|
121
145
|
}
|
|
146
|
+
export type CertificateScope = "process" | "peerConnection";
|
|
122
147
|
export declare const findCodecByMimeType: (codecs: RTCRtpCodecParameters[], target: RTCRtpCodecParameters) => RTCRtpCodecParameters | undefined;
|
|
123
148
|
export type RTCIceServer = {
|
|
124
149
|
urls: string | string[];
|
|
@@ -184,6 +209,13 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
|
|
|
184
209
|
iceTransportPolicy: "all" | "relay";
|
|
185
210
|
/** Advertise local ICE lite and operate in the controlled role. */
|
|
186
211
|
iceLite: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Fall back to the built-in public STUN server (`stun.l.google.com:19302`)
|
|
214
|
+
* when `iceServers` contains no STUN URL (empty or TURN-only).
|
|
215
|
+
* Set to false to gather server-reflexive candidates only from the STUN
|
|
216
|
+
* servers given in `iceServers`. Defaults to true.
|
|
217
|
+
*/
|
|
218
|
+
iceUseDefaultStunServer: boolean;
|
|
187
219
|
/**
|
|
188
220
|
* Local addresses to bind the ICE UDP host sockets to, per family
|
|
189
221
|
* (`udp4` / `udp6`).
|
|
@@ -231,9 +263,25 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
|
|
|
231
263
|
bundlePolicy: BundlePolicy;
|
|
232
264
|
rtcpMuxPolicy: "require";
|
|
233
265
|
iceCandidatePoolSize: number;
|
|
266
|
+
/**
|
|
267
|
+
* Which default DTLS certificate is used when neither `certificates` nor `dtls.keys` is given.
|
|
268
|
+
* Cannot be changed after construction.
|
|
269
|
+
* - `"process"` (default): one certificate shared by every RTCPeerConnection in the process
|
|
270
|
+
* (legacy behavior), so their `a=fingerprint` values are identical.
|
|
271
|
+
* - `"peerConnection"`: each RTCPeerConnection generates its own certificate (browser behavior).
|
|
272
|
+
* All DTLS transports of that connection share it.
|
|
273
|
+
*/
|
|
274
|
+
certificateScope: CertificateScope;
|
|
234
275
|
midSuffix: boolean;
|
|
235
276
|
/** Advertised local SCTP max-message-size in SDP. Use 0 for unlimited. */
|
|
236
277
|
maxMessageSize: number;
|
|
278
|
+
/**
|
|
279
|
+
* When true, padding-only RTP is omitted from onReceiveRtp and later media
|
|
280
|
+
* sequence numbers are compacted. Default false preserves wire RTP events.
|
|
281
|
+
*/
|
|
282
|
+
filterProbePaddingOnReceiveRtp: boolean;
|
|
283
|
+
/** Send-side estimator used by each new sender; defaults to `"lightweight"`. */
|
|
284
|
+
bandwidthEstimator: BandwidthEstimatorOption;
|
|
237
285
|
/**
|
|
238
286
|
* How local SDP marks inactive / stopped m-lines. Cannot be changed after construction.
|
|
239
287
|
* - `"compatible"` (default): an accepted `inactive` m-line keeps a non-zero port.
|
|
@@ -249,11 +297,6 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
|
|
|
249
297
|
*/
|
|
250
298
|
keyFrameRequestRouting: KeyFrameRequestRouting;
|
|
251
299
|
};
|
|
252
|
-
/**
|
|
253
|
-
* `setConfiguration`: validate `input` against the current `config`, then
|
|
254
|
-
* merge it in place. Returns the normalized input; side effects on live
|
|
255
|
-
* transports (SCTP limits, ICE servers) stay with the caller.
|
|
256
|
-
*/
|
|
257
300
|
export declare function mergePeerConfiguration(config: PeerConfig, input: RTCPeerConnectionConfig, { isReconfiguration, hasLocalDescription, hasSctpTransport, }: {
|
|
258
301
|
isReconfiguration: boolean;
|
|
259
302
|
hasLocalDescription: boolean;
|
|
@@ -15,6 +15,10 @@ const codecCompatibility_1 = require("../media/codecCompatibility");
|
|
|
15
15
|
const router_1 = require("../media/router");
|
|
16
16
|
const sctp_1 = require("../transport/sctp");
|
|
17
17
|
const utils_1 = require("../utils");
|
|
18
|
+
const CertificateScopes = [
|
|
19
|
+
"process",
|
|
20
|
+
"peerConnection",
|
|
21
|
+
];
|
|
18
22
|
const MLineReuseModes = ["compatible", "aggressive"];
|
|
19
23
|
const findCodecByMimeType = (codecs, target) => codecs.find((localCodec) => (0, codecCompatibility_1.normalizeCodecMimeType)(localCodec.mimeType) ===
|
|
20
24
|
(0, codecCompatibility_1.normalizeCodecMimeType)(target.mimeType))
|
|
@@ -58,6 +62,7 @@ function generateDefaultPeerConfig() {
|
|
|
58
62
|
iceTransportPolicy: "all",
|
|
59
63
|
iceLite: false,
|
|
60
64
|
iceServers: [{ urls: "stun:stun.l.google.com:19302" }],
|
|
65
|
+
iceUseDefaultStunServer: true,
|
|
61
66
|
icePortRange: undefined,
|
|
62
67
|
iceInterfaceAddresses: undefined,
|
|
63
68
|
iceAdditionalHostAddresses: undefined,
|
|
@@ -79,10 +84,13 @@ function generateDefaultPeerConfig() {
|
|
|
79
84
|
rtcpMuxPolicy: "require",
|
|
80
85
|
iceCandidatePoolSize: 0,
|
|
81
86
|
certificates: [],
|
|
87
|
+
certificateScope: "process",
|
|
82
88
|
debug: {},
|
|
83
89
|
midSuffix: false,
|
|
84
90
|
forceTurnTCP: false,
|
|
85
91
|
maxMessageSize: sctp_1.DEFAULT_MAX_MESSAGE_SIZE,
|
|
92
|
+
filterProbePaddingOnReceiveRtp: false,
|
|
93
|
+
bandwidthEstimator: "lightweight",
|
|
86
94
|
sctp: { mtu: src_1.DEFAULT_SCTP_MTU },
|
|
87
95
|
pendingRtp: false,
|
|
88
96
|
mLineReuse: "compatible",
|
|
@@ -169,6 +177,11 @@ function clonePeerConfiguration(config) {
|
|
|
169
177
|
* merge it in place. Returns the normalized input; side effects on live
|
|
170
178
|
* transports (SCTP limits, ICE servers) stay with the caller.
|
|
171
179
|
*/
|
|
180
|
+
const CLEARABLE_TURN_KEYS = [
|
|
181
|
+
"turnTransport",
|
|
182
|
+
"turnTlsOptions",
|
|
183
|
+
"turnUdpFamily",
|
|
184
|
+
];
|
|
172
185
|
function mergePeerConfiguration(config, input, { isReconfiguration, hasLocalDescription, hasSctpTransport, }) {
|
|
173
186
|
const normalizedConfig = normalizePeerConfiguration(input);
|
|
174
187
|
if (normalizedConfig.rtcpMuxPolicy &&
|
|
@@ -185,6 +198,15 @@ function mergePeerConfiguration(config, input, { isReconfiguration, hasLocalDesc
|
|
|
185
198
|
normalizedConfig.bundlePolicy !== config.bundlePolicy) {
|
|
186
199
|
throw new Error("bundlePolicy cannot be changed");
|
|
187
200
|
}
|
|
201
|
+
if (normalizedConfig.certificateScope !== undefined &&
|
|
202
|
+
!CertificateScopes.includes(normalizedConfig.certificateScope)) {
|
|
203
|
+
throw (0, errors_1.createWebRtcTypeError)(`certificateScope must be one of ${CertificateScopes.join(", ")}`);
|
|
204
|
+
}
|
|
205
|
+
if (isReconfiguration &&
|
|
206
|
+
normalizedConfig.certificateScope !== undefined &&
|
|
207
|
+
normalizedConfig.certificateScope !== config.certificateScope) {
|
|
208
|
+
throw (0, errors_1.createWebRtcDomException)("InvalidModificationError", "certificateScope cannot be changed");
|
|
209
|
+
}
|
|
188
210
|
if (normalizedConfig.mLineReuse !== undefined &&
|
|
189
211
|
!MLineReuseModes.includes(normalizedConfig.mLineReuse)) {
|
|
190
212
|
throw (0, errors_1.createWebRtcTypeError)(`mLineReuse must be one of ${MLineReuseModes.join(", ")}`);
|
|
@@ -225,6 +247,25 @@ function mergePeerConfiguration(config, input, { isReconfiguration, hasLocalDesc
|
|
|
225
247
|
}
|
|
226
248
|
}
|
|
227
249
|
(0, utils_1.deepMerge)(config, normalizedConfig);
|
|
250
|
+
// Omitted keys keep their value, but an explicit `undefined` unsets these
|
|
251
|
+
// optional TURN settings (deepMerge skips undefined).
|
|
252
|
+
for (const key of CLEARABLE_TURN_KEYS) {
|
|
253
|
+
if (Object.hasOwn(normalizedConfig, key) && normalizedConfig[key] == null) {
|
|
254
|
+
// Union-key writes require the intersection of all indexed property
|
|
255
|
+
// types. Narrow the key so each optional setting can be cleared safely.
|
|
256
|
+
switch (key) {
|
|
257
|
+
case "turnTransport":
|
|
258
|
+
config.turnTransport = undefined;
|
|
259
|
+
break;
|
|
260
|
+
case "turnTlsOptions":
|
|
261
|
+
config.turnTlsOptions = undefined;
|
|
262
|
+
break;
|
|
263
|
+
case "turnUdpFamily":
|
|
264
|
+
config.turnUdpFamily = undefined;
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
228
269
|
config.sctp = {
|
|
229
270
|
mtu: config.sctp?.mtu ?? src_1.DEFAULT_SCTP_MTU,
|
|
230
271
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peerConfig.js","sourceRoot":"","sources":["../../../../src/api/peerConfig.ts"],"names":[],"mappings":";;;AAqOA,8DAwCC;AAgED,wDAkCC;AAOD,wDAuIC;AA7fD,yEAAyE;AACzE,6EAA6E;AAC7E,wDAAwD;AACxD,2CAAsE;AACtE,sCAA4E;AAC5E,sCAAsC;AAOtC,0CAA+C;AAC/C,oEAAqE;AAKrE,4CAGyB;AAKzB,4CAA6D;AAC7D,oCAAqC;AAqHrC,MAAM,eAAe,GAA0B,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AAErE,MAAM,mBAAmB,GAAG,CACjC,MAA+B,EAC/B,MAA6B,EAC7B,EAAE,CACF,MAAM,CAAC,IAAI,CACT,CAAC,UAAU,EAAE,EAAE,CACb,IAAA,2CAAsB,EAAC,UAAU,CAAC,QAAQ,CAAC;IAC3C,IAAA,2CAAsB,EAAC,MAAM,CAAC,QAAQ,CAAC,CAC1C;IACC,CAAC,CAAC,MAAM;IACR,CAAC,CAAC,SAAS,CAAC;AAVH,QAAA,mBAAmB,uBAUhB;AAEhB,SAAS,yBAAyB,CAAC,MAAkB;IACnD,KAAK,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,IAAI,IAAA,kBAAS,EAAC;QACvC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;QAC9B,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;KAC/B,CAAC,EAAE,CAAC;QACH,IAAI,WAAW,CAAC,WAAW,IAAI,SAAS,EAAE,CAAC;YACzC,SAAS;QACX,CAAC;QAED,WAAW,CAAC,WAAW,GAAG,EAAE,GAAG,CAAC,CAAC;QACjC,QAAQ,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,E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EAAE,gBAAuC,CAAC,CAAC;IAC3D,MAAM,CAAC,IAAI,GAAG;QACZ,GAAG,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,sBAAgB;KAC1C,CAAC;IAEF,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACxB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC;QACvC,IAAI,GAAG,KAAK,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC7D,IAAI,GAAG,IAAI,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnE,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,MAAM,CAAC,cAAc,GAAG,CAAC,EAAE,CAAC;QAC1E,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IAED,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAElC;QACE,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,IAAI,EAAE,CAAC;QACxC,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,IAAI,EAAE,CAAC;KACzC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACjB,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["// RTCPeerConnection configuration: the public configuration types, their\n// defaults, input normalization (W3C RTCConfiguration compatibility) and the\n// validation `setConfiguration` applies before merging.\nimport { DEFAULT_SCTP_MTU, validateSctpMtu } from \"../../../sctp/src\";\nimport { createWebRtcDomException, createWebRtcTypeError } from \"../errors\";\nimport { enumerate } from \"../helper\";\nimport type {\n Address,\n InterfaceAddresses,\n TlsConnectionOptions,\n} from \"../imports/common\";\nimport type { CandidatePair, Message, Protocol } from \"../imports/ice\";\nimport { defaultCodecs } from \"../media/codec\";\nimport { normalizeCodecMimeType } from \"../media/codecCompatibility\";\nimport type {\n RTCRtpCodecParameters,\n RTCRtpHeaderExtensionParameters,\n} from \"../media/parameters\";\nimport {\n type KeyFrameRequestRouting,\n KeyFrameRequestRoutingModes,\n} from \"../media/router\";\nimport type { RTCRtpSenderOptions } from \"../media/rtpSender\";\nimport type { BundlePolicy } from \"../sdp\";\nimport type { MLineReuse } from \"../sdpManager\";\nimport type { DtlsKeys, RTCCertificate } from \"../transport/dtls\";\nimport { DEFAULT_MAX_MESSAGE_SIZE } from \"../transport/sctp\";\nimport { deepMerge } from \"../utils\";\n\nexport type DebugConfig = Partial<{\n /**% */\n inboundPacketLoss: number;\n /**% */\n outboundPacketLoss: number;\n /**ms */\n receiverReportDelay: number;\n disableSendNack: boolean;\n disableRecvRetransmit: boolean;\n}>;\n\nexport interface PeerConfig {\n codecs: Partial<{\n /**\n * When specifying a codec with a fixed payloadType such as PCMU,\n * it is necessary to set the correct PayloadType in RTCRtpCodecParameters in advance.\n */\n audio: RTCRtpCodecParameters[];\n video: RTCRtpCodecParameters[];\n }>;\n headerExtensions: Partial<{\n audio: RTCRtpHeaderExtensionParameters[];\n video: RTCRtpHeaderExtensionParameters[];\n }>;\n iceTransportPolicy: \"all\" | \"relay\";\n /** Advertise local ICE lite and operate in the controlled role. */\n iceLite: boolean;\n iceServers: RTCIceServer[];\n /**Minimum port and Maximum port must not be the same value */\n icePortRange: [number, number] | undefined;\n /**\n * Local addresses to bind the ICE UDP host sockets to, per family\n * (`udp4` / `udp6`).\n *\n * The address given for a family is the only host address of that family:\n * its host candidate advertises the address the socket is actually bound\n * to, even when it is not an enumerated interface address (loopback, tun,\n * VPN, ...). If the bind fails, the family has no UDP host candidate.\n * A family left unspecified while the other one is set gathers no\n * enumerated addresses (only its `iceAdditionalHostAddresses`).\n */\n iceInterfaceAddresses: InterfaceAddresses | undefined;\n /** Add additional host (local) addresses to use for candidate gathering.\n * Notably, you can include hosts that are normally excluded, such as loopback, tun interfaces, etc.\n * For a family bound by `iceInterfaceAddresses`, addresses other than the bound one are ignored.\n */\n iceAdditionalHostAddresses: string[] | undefined;\n iceUseIpv4: boolean;\n iceUseIpv6: boolean;\n iceUseTcp: boolean;\n /** Gather passive (listening) TCP host candidates. Defaults to true. */\n iceTcpPassive: boolean;\n /**\n * Seconds to wait for server-reflexive candidates while gathering.\n * Defaults to 5 when undefined.\n */\n iceStunGatherTimeout: number | undefined;\n /**\n * Seconds to wait for a TURN TCP/TLS connection to be established.\n * Defaults to 8 when undefined.\n */\n iceTurnConnectTimeout: number | undefined;\n turnTransport: \"udp\" | \"tcp\" | \"tls\" | undefined;\n turnTlsOptions: TlsConnectionOptions | undefined;\n /**\n * Preferred IP family of the TURN/UDP socket, applied only when the TURN\n * server is a hostname. Ignored for an IP literal server, whose own family\n * always selects the socket. Defaults to 4 when undefined.\n */\n turnUdpFamily: 4 | 6 | undefined;\n /** @deprecated Prefer turn URL transport parameters or turnTransport. */\n forceTurnTCP: boolean;\n /** such as google cloud run */\n iceUseLinkLocalAddress: boolean | undefined;\n /** If provided, is called on each STUN request.\n * Return `true` if a STUN response should be sent, false if it should be skipped. */\n iceFilterStunResponse:\n | ((message: Message, addr: Address, protocol: Protocol) => boolean)\n | undefined;\n iceFilterCandidatePair: ((pair: CandidatePair) => boolean) | undefined;\n dtls: Partial<{\n keys: DtlsKeys;\n }>;\n icePasswordPrefix: string | undefined;\n bundlePolicy: BundlePolicy;\n rtcpMuxPolicy: \"require\";\n iceCandidatePoolSize: number;\n certificates: RTCCertificate[];\n debug: DebugConfig;\n midSuffix: boolean;\n /** Advertised local SCTP max-message-size in SDP. Use 0 for unlimited. */\n maxMessageSize: number;\n /** SCTP outbound packet MTU used for DATA chunk fragmentation. */\n sctp: { mtu: number };\n /**\n * Queue outbound RTP on each sender until DTLS is connected.\n * Disabled by default. Pass `true` or `{ enabled: true, maxLength }` to buffer.\n */\n pendingRtp: NonNullable<RTCRtpSenderOptions[\"pendingRtp\"]>;\n /**\n * How local SDP marks inactive / stopped m-lines. Cannot be changed after construction.\n * - `\"compatible\"` (default): an accepted `inactive` m-line keeps a non-zero port.\n * Only rejected (no common codec / remote port 0) or stopped m-lines use port 0,\n * and only those negotiated port 0 positions are reused by new transceivers.\n * - `\"aggressive\"`: legacy behavior. `inactive` m-lines are also written with port 0.\n */\n mLineReuse: MLineReuse;\n /**\n * Where a PLI / FIR goes when no route has its target SSRC. See {@link KeyFrameRequestRouting}.\n * - `\"compatible\"` (default): the sender whose RTX SSRC it is, else the only video sender.\n * - `\"strict\"`: not delivered, as RFC 4585 / RFC 5104 define the target.\n */\n keyFrameRequestRouting: KeyFrameRequestRouting;\n}\n\nconst MLineReuseModes: readonly MLineReuse[] = [\"compatible\", \"aggressive\"];\n\nexport const findCodecByMimeType = (\n codecs: RTCRtpCodecParameters[],\n target: RTCRtpCodecParameters,\n) =>\n codecs.find(\n (localCodec) =>\n normalizeCodecMimeType(localCodec.mimeType) ===\n normalizeCodecMimeType(target.mimeType),\n )\n ? target\n : undefined;\n\nfunction assignDynamicPayloadTypes(config: PeerConfig) {\n for (const [i, codecParams] of enumerate([\n ...(config.codecs.audio || []),\n ...(config.codecs.video || []),\n ])) {\n if (codecParams.payloadType != undefined) {\n continue;\n }\n\n codecParams.payloadType = 96 + i;\n switch (codecParams.name.toLowerCase()) {\n case \"rtx\":\n {\n codecParams.parameters = `apt=${codecParams.payloadType - 1}`;\n }\n break;\n case \"red\":\n {\n if (codecParams.contentType === \"audio\") {\n const redundant = codecParams.payloadType + 1;\n codecParams.parameters = `${redundant}/${redundant}`;\n codecParams.payloadType = 63;\n }\n }\n break;\n }\n }\n}\n\nexport type RTCIceServer = {\n urls: string | string[];\n username?: string;\n credential?: string;\n};\n\nexport type RTCBundlePolicy = \"balanced\" | \"max-compat\" | \"max-bundle\";\nexport type RTCRtcpMuxPolicy = \"require\";\n\nexport interface RTCSctpConfiguration {\n /** SCTP outbound packet MTU used for DATA chunk fragmentation. Defaults to 1191. */\n mtu?: number;\n}\n\nexport interface RTCConfiguration {\n iceServers?: RTCIceServer[];\n iceTransportPolicy?: PeerConfig[\"iceTransportPolicy\"];\n bundlePolicy?: RTCBundlePolicy;\n rtcpMuxPolicy?: RTCRtcpMuxPolicy;\n iceCandidatePoolSize?: number;\n certificates?: RTCCertificate[];\n}\n\ntype RTCPeerConnectionRTCConfiguration = Omit<\n RTCConfiguration,\n \"bundlePolicy\"\n> & {\n bundlePolicy?: PeerConfig[\"bundlePolicy\"] | RTCBundlePolicy;\n};\n\nexport type RTCPeerConnectionConfig = Partial<\n Omit<\n PeerConfig,\n | \"bundlePolicy\"\n | \"rtcpMuxPolicy\"\n | \"iceCandidatePoolSize\"\n | \"certificates\"\n | \"sctp\"\n >\n> &\n RTCPeerConnectionRTCConfiguration & { sctp?: RTCSctpConfiguration };\n\nexport function generateDefaultPeerConfig(): PeerConfig {\n return {\n codecs: defaultCodecs(),\n headerExtensions: {\n audio: [],\n video: [],\n },\n iceTransportPolicy: \"all\",\n iceLite: false,\n iceServers: [{ urls: \"stun:stun.l.google.com:19302\" }],\n icePortRange: undefined,\n iceInterfaceAddresses: undefined,\n iceAdditionalHostAddresses: undefined,\n iceUseIpv4: true,\n iceUseIpv6: true,\n iceUseTcp: false,\n iceTcpPassive: true,\n iceStunGatherTimeout: undefined,\n iceTurnConnectTimeout: undefined,\n turnTransport: undefined,\n turnTlsOptions: undefined,\n turnUdpFamily: undefined,\n iceFilterStunResponse: undefined,\n iceFilterCandidatePair: undefined,\n icePasswordPrefix: undefined,\n iceUseLinkLocalAddress: undefined,\n dtls: {},\n bundlePolicy: \"max-compat\",\n rtcpMuxPolicy: \"require\",\n iceCandidatePoolSize: 0,\n certificates: [],\n debug: {},\n midSuffix: false,\n forceTurnTCP: false,\n maxMessageSize: DEFAULT_MAX_MESSAGE_SIZE,\n sctp: { mtu: DEFAULT_SCTP_MTU },\n pendingRtp: false,\n mLineReuse: \"compatible\",\n keyFrameRequestRouting: \"compatible\",\n };\n}\nexport const defaultPeerConfig: PeerConfig = generateDefaultPeerConfig();\n\nfunction normalizePeerConfiguration(\n config: RTCPeerConnectionConfig,\n): Partial<PeerConfig> & { sctp?: RTCSctpConfiguration } {\n const input = Object(config ?? {}) as RTCPeerConnectionConfig;\n const normalizedConfig = { ...input } as Partial<PeerConfig> & {\n sctp?: RTCSctpConfiguration;\n };\n\n if (input.sctp !== undefined) {\n normalizedConfig.sctp = { ...input.sctp } as PeerConfig[\"sctp\"];\n }\n\n if (input.bundlePolicy === \"balanced\") {\n normalizedConfig.bundlePolicy = \"max-compat\";\n }\n\n if (\"certificates\" in input) {\n if (input.certificates === undefined) {\n normalizedConfig.certificates = undefined;\n } else if (\n !Array.isArray(input.certificates) ||\n input.certificates.some((certificate) => certificate == null)\n ) {\n throw createWebRtcTypeError(\n \"certificates must be an array of RTCCertificate\",\n );\n } else {\n normalizedConfig.certificates = [...input.certificates];\n }\n }\n\n if (\"iceCandidatePoolSize\" in input) {\n normalizedConfig.iceCandidatePoolSize = coerceUnsignedShort(\n input.iceCandidatePoolSize,\n \"iceCandidatePoolSize\",\n );\n }\n\n return normalizedConfig;\n}\n\nfunction coerceUnsignedShort(value: unknown, name: string) {\n const coerced = Number(value);\n if (\n !Number.isFinite(coerced) ||\n !Number.isInteger(coerced) ||\n coerced < 0 ||\n coerced > 65535\n ) {\n throw createWebRtcTypeError(`${name} must be an unsigned short`);\n }\n return coerced;\n}\n\nfunction hasSameCertificates(left: RTCCertificate[], right: RTCCertificate[]) {\n return (\n left.length === right.length &&\n left.every((certificate, index) => certificate === right[index])\n );\n}\n\nexport function clonePeerConfiguration(config: PeerConfig) {\n return {\n ...config,\n codecs: {\n audio: config.codecs.audio ? [...config.codecs.audio] : undefined,\n video: config.codecs.video ? [...config.codecs.video] : undefined,\n },\n headerExtensions: {\n audio: config.headerExtensions.audio\n ? [...config.headerExtensions.audio]\n : undefined,\n video: config.headerExtensions.video\n ? [...config.headerExtensions.video]\n : undefined,\n },\n iceServers: config.iceServers.map((server) => ({\n ...server,\n urls: Array.isArray(server.urls) ? [...server.urls] : server.urls,\n })),\n icePortRange: config.icePortRange\n ? ([...config.icePortRange] as [number, number])\n : undefined,\n iceAdditionalHostAddresses: config.iceAdditionalHostAddresses\n ? [...config.iceAdditionalHostAddresses]\n : undefined,\n dtls: { ...config.dtls },\n certificates: [...config.certificates],\n debug: { ...config.debug },\n sctp: { ...config.sctp },\n pendingRtp:\n typeof config.pendingRtp === \"object\" && config.pendingRtp != undefined\n ? { ...config.pendingRtp }\n : config.pendingRtp,\n };\n}\n\n/**\n * `setConfiguration`: validate `input` against the current `config`, then\n * merge it in place. Returns the normalized input; side effects on live\n * transports (SCTP limits, ICE servers) stay with the caller.\n */\nexport function mergePeerConfiguration(\n config: PeerConfig,\n input: RTCPeerConnectionConfig,\n {\n isReconfiguration,\n hasLocalDescription,\n hasSctpTransport,\n }: {\n isReconfiguration: boolean;\n hasLocalDescription: boolean;\n hasSctpTransport: boolean;\n },\n) {\n const normalizedConfig = normalizePeerConfiguration(input);\n\n if (\n normalizedConfig.rtcpMuxPolicy &&\n normalizedConfig.rtcpMuxPolicy !== \"require\"\n ) {\n throw new Error(\"rtcpMuxPolicy must be require\");\n }\n\n if (\n normalizedConfig.iceCandidatePoolSize !== undefined &&\n (!Number.isInteger(normalizedConfig.iceCandidatePoolSize) ||\n normalizedConfig.iceCandidatePoolSize < 0)\n ) {\n throw new Error(\"iceCandidatePoolSize must be a non-negative integer\");\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.bundlePolicy !== undefined &&\n normalizedConfig.bundlePolicy !== config.bundlePolicy\n ) {\n throw new Error(\"bundlePolicy cannot be changed\");\n }\n\n if (\n normalizedConfig.mLineReuse !== undefined &&\n !MLineReuseModes.includes(normalizedConfig.mLineReuse)\n ) {\n throw createWebRtcTypeError(\n `mLineReuse must be one of ${MLineReuseModes.join(\", \")}`,\n );\n }\n\n if (\n normalizedConfig.keyFrameRequestRouting !== undefined &&\n !KeyFrameRequestRoutingModes.includes(\n normalizedConfig.keyFrameRequestRouting,\n )\n ) {\n throw createWebRtcTypeError(\n `keyFrameRequestRouting must be one of ${KeyFrameRequestRoutingModes.join(\", \")}`,\n );\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.mLineReuse !== undefined &&\n normalizedConfig.mLineReuse !== config.mLineReuse\n ) {\n throw createWebRtcDomException(\n \"InvalidModificationError\",\n \"mLineReuse cannot be changed\",\n );\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.rtcpMuxPolicy !== undefined &&\n normalizedConfig.rtcpMuxPolicy !== config.rtcpMuxPolicy\n ) {\n throw new Error(\"rtcpMuxPolicy cannot be changed\");\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.certificates !== undefined &&\n !hasSameCertificates(normalizedConfig.certificates, config.certificates)\n ) {\n throw new Error(\"certificates cannot be changed\");\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.iceCandidatePoolSize !== undefined &&\n hasLocalDescription &&\n normalizedConfig.iceCandidatePoolSize !== config.iceCandidatePoolSize\n ) {\n throw new Error(\n \"iceCandidatePoolSize cannot be changed after setLocalDescription\",\n );\n }\n\n if ((normalizedConfig.iceCandidatePoolSize ?? 0) > 0) {\n throw new Error(\"iceCandidatePoolSize > 0 is not supported\");\n }\n\n if (normalizedConfig.sctp !== undefined) {\n const requestedSctpMtu = normalizedConfig.sctp.mtu ?? DEFAULT_SCTP_MTU;\n validateSctpMtu(requestedSctpMtu);\n if (hasSctpTransport && requestedSctpMtu !== config.sctp.mtu) {\n throw new Error(\n \"sctp.mtu cannot be changed after SCTP transport creation\",\n );\n }\n }\n\n deepMerge(config, normalizedConfig as Partial<PeerConfig>);\n config.sctp = {\n mtu: config.sctp?.mtu ?? DEFAULT_SCTP_MTU,\n };\n\n if (config.icePortRange) {\n const [min, max] = config.icePortRange;\n if (min === max) throw new Error(\"should not be same value\");\n if (min >= max) throw new Error(\"The min must be less than max\");\n }\n\n if (!Number.isInteger(config.maxMessageSize) || config.maxMessageSize < 0) {\n throw new Error(\"maxMessageSize must be a non-negative integer\");\n }\n\n assignDynamicPayloadTypes(config);\n\n [\n ...(config.headerExtensions.audio || []),\n ...(config.headerExtensions.video || []),\n ].forEach((v, i) => {\n v.id = 1 + i;\n });\n\n return normalizedConfig;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"peerConfig.js","sourceRoot":"","sources":["../../../../src/api/peerConfig.ts"],"names":[],"mappings":";;;AAmQA,8DA4CC;AAgED,wDAkCC;AAaD,wDA8KC;AA5kBD,yEAAyE;AACzE,6EAA6E;AAC7E,wDAAwD;AACxD,2CAAsE;AACtE,sCAA4E;AAC5E,sCAAsC;AAOtC,0CAA+C;AAC/C,oEAAqE;AAKrE,4CAGyB;AAMzB,4CAA6D;AAC7D,oCAAqC;AA6IrC,MAAM,iBAAiB,GAAgC;IACrD,SAAS;IACT,gBAAgB;CACjB,CAAC;AAEF,MAAM,eAAe,GAA0B,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AAErE,MAAM,mBAAmB,GAAG,CACjC,MAA+B,EAC/B,MAA6B,EAC7B,EAAE,CACF,MAAM,CAAC,IAAI,CACT,CAAC,UAAU,EAAE,EAAE,CACb,IAAA,2CAAsB,EAAC,UAAU,CAAC,QAAQ,CAAC;IAC3C,IAAA,2CAAsB,EAAC,MAAM,CAAC,QAAQ,CAAC,CAC1C;IACC,CAAC,CAAC,MAAM;IACR,CAAC,CAAC,SAAS,CAAC;AAVH,QAAA,mBAAmB,uBAUhB;AAEhB,SAAS,yBAAyB,CAAC,MAAkB;IACnD,KAAK,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,IAAI,IAAA,kBAAS,EAAC;QACvC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;QAC9B,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;KAC/B,CAAC,EAAE,CAAC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CAAC;oBAClC,MAAM;gBACR,KAAK,eAAe;oBAClB,MAAM,CAAC,aAAa,GAAG,SAAS,CAAC;oBACjC,MAAM;YACV,CAAC;QACH,CAAC;IACH,CAAC;IACD,MAAM,CAAC,IAAI,GAAG;QACZ,GAAG,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,sBAAgB;KAC1C,CAAC;IAEF,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACxB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC;QACvC,IAAI,GAAG,KAAK,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC7D,IAAI,GAAG,IAAI,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnE,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,MAAM,CAAC,cAAc,GAAG,CAAC,EAAE,CAAC;QAC1E,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IAED,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAElC;QACE,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,IAAI,EAAE,CAAC;QACxC,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,IAAI,EAAE,CAAC;KACzC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACjB,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["// RTCPeerConnection configuration: the public configuration types, their\n// defaults, input normalization (W3C RTCConfiguration compatibility) and the\n// validation `setConfiguration` applies before merging.\nimport { DEFAULT_SCTP_MTU, validateSctpMtu } from \"../../../sctp/src\";\nimport { createWebRtcDomException, createWebRtcTypeError } from \"../errors\";\nimport { enumerate } from \"../helper\";\nimport type {\n Address,\n InterfaceAddresses,\n TlsConnectionOptions,\n} from \"../imports/common\";\nimport type { CandidatePair, Message, Protocol } from \"../imports/ice\";\nimport { defaultCodecs } from \"../media/codec\";\nimport { normalizeCodecMimeType } from \"../media/codecCompatibility\";\nimport type {\n RTCRtpCodecParameters,\n RTCRtpHeaderExtensionParameters,\n} from \"../media/parameters\";\nimport {\n type KeyFrameRequestRouting,\n KeyFrameRequestRoutingModes,\n} from \"../media/router\";\nimport type { RTCRtpSenderOptions } from \"../media/rtpSender\";\nimport type { BandwidthEstimatorOption } from \"../media/sender/createBandwidthEstimator\";\nimport type { BundlePolicy } from \"../sdp\";\nimport type { MLineReuse } from \"../sdpManager\";\nimport type { DtlsKeys, RTCCertificate } from \"../transport/dtls\";\nimport { DEFAULT_MAX_MESSAGE_SIZE } from \"../transport/sctp\";\nimport { deepMerge } from \"../utils\";\n\nexport type DebugConfig = Partial<{\n /**% */\n inboundPacketLoss: number;\n /**% */\n outboundPacketLoss: number;\n /**ms */\n receiverReportDelay: number;\n disableSendNack: boolean;\n disableRecvRetransmit: boolean;\n}>;\n\nexport interface PeerConfig {\n codecs: Partial<{\n /**\n * When specifying a codec with a fixed payloadType such as PCMU,\n * it is necessary to set the correct PayloadType in RTCRtpCodecParameters in advance.\n */\n audio: RTCRtpCodecParameters[];\n video: RTCRtpCodecParameters[];\n }>;\n headerExtensions: Partial<{\n audio: RTCRtpHeaderExtensionParameters[];\n video: RTCRtpHeaderExtensionParameters[];\n }>;\n iceTransportPolicy: \"all\" | \"relay\";\n /** Advertise local ICE lite and operate in the controlled role. */\n iceLite: boolean;\n iceServers: RTCIceServer[];\n /**\n * Fall back to the built-in public STUN server (`stun.l.google.com:19302`)\n * when `iceServers` contains no STUN URL (empty or TURN-only).\n * Set to false to gather server-reflexive candidates only from the STUN\n * servers given in `iceServers`. Defaults to true.\n */\n iceUseDefaultStunServer: boolean;\n /**Minimum port and Maximum port must not be the same value */\n icePortRange: [number, number] | undefined;\n /**\n * Local addresses to bind the ICE UDP host sockets to, per family\n * (`udp4` / `udp6`).\n *\n * The address given for a family is the only host address of that family:\n * its host candidate advertises the address the socket is actually bound\n * to, even when it is not an enumerated interface address (loopback, tun,\n * VPN, ...). If the bind fails, the family has no UDP host candidate.\n * A family left unspecified while the other one is set gathers no\n * enumerated addresses (only its `iceAdditionalHostAddresses`).\n */\n iceInterfaceAddresses: InterfaceAddresses | undefined;\n /** Add additional host (local) addresses to use for candidate gathering.\n * Notably, you can include hosts that are normally excluded, such as loopback, tun interfaces, etc.\n * For a family bound by `iceInterfaceAddresses`, addresses other than the bound one are ignored.\n */\n iceAdditionalHostAddresses: string[] | undefined;\n iceUseIpv4: boolean;\n iceUseIpv6: boolean;\n iceUseTcp: boolean;\n /** Gather passive (listening) TCP host candidates. Defaults to true. */\n iceTcpPassive: boolean;\n /**\n * Seconds to wait for server-reflexive candidates while gathering.\n * Defaults to 5 when undefined.\n */\n iceStunGatherTimeout: number | undefined;\n /**\n * Seconds to wait for a TURN TCP/TLS connection to be established.\n * Defaults to 8 when undefined.\n */\n iceTurnConnectTimeout: number | undefined;\n turnTransport: \"udp\" | \"tcp\" | \"tls\" | undefined;\n turnTlsOptions: TlsConnectionOptions | undefined;\n /**\n * Preferred IP family of the TURN/UDP socket, applied only when the TURN\n * server is a hostname. Ignored for an IP literal server, whose own family\n * always selects the socket. Defaults to 4 when undefined.\n */\n turnUdpFamily: 4 | 6 | undefined;\n /** @deprecated Prefer turn URL transport parameters or turnTransport. */\n forceTurnTCP: boolean;\n /** such as google cloud run */\n iceUseLinkLocalAddress: boolean | undefined;\n /** If provided, is called on each STUN request.\n * Return `true` if a STUN response should be sent, false if it should be skipped. */\n iceFilterStunResponse:\n | ((message: Message, addr: Address, protocol: Protocol) => boolean)\n | undefined;\n iceFilterCandidatePair: ((pair: CandidatePair) => boolean) | undefined;\n dtls: Partial<{\n keys: DtlsKeys;\n }>;\n icePasswordPrefix: string | undefined;\n bundlePolicy: BundlePolicy;\n rtcpMuxPolicy: \"require\";\n iceCandidatePoolSize: number;\n certificates: RTCCertificate[];\n /**\n * Which default DTLS certificate is used when neither `certificates` nor `dtls.keys` is given.\n * Cannot be changed after construction.\n * - `\"process\"` (default): one certificate shared by every RTCPeerConnection in the process\n * (legacy behavior), so their `a=fingerprint` values are identical.\n * - `\"peerConnection\"`: each RTCPeerConnection generates its own certificate (browser behavior).\n * All DTLS transports of that connection share it.\n */\n certificateScope: CertificateScope;\n debug: DebugConfig;\n midSuffix: boolean;\n /** Advertised local SCTP max-message-size in SDP. Use 0 for unlimited. */\n maxMessageSize: number;\n /**\n * When true, padding-only RTP is omitted from onReceiveRtp and later media\n * sequence numbers are compacted. Default false preserves wire RTP events.\n */\n filterProbePaddingOnReceiveRtp: boolean;\n /** Send-side estimator used by each new sender; defaults to `\"lightweight\"`. */\n bandwidthEstimator: BandwidthEstimatorOption;\n /** SCTP outbound packet MTU used for DATA chunk fragmentation. */\n sctp: { mtu: number };\n /**\n * Queue outbound RTP on each sender until DTLS is connected.\n * Disabled by default. Pass `true` or `{ enabled: true, maxLength }` to buffer.\n */\n pendingRtp: NonNullable<RTCRtpSenderOptions[\"pendingRtp\"]>;\n /**\n * How local SDP marks inactive / stopped m-lines. Cannot be changed after construction.\n * - `\"compatible\"` (default): an accepted `inactive` m-line keeps a non-zero port.\n * Only rejected (no common codec / remote port 0) or stopped m-lines use port 0,\n * and only those negotiated port 0 positions are reused by new transceivers.\n * - `\"aggressive\"`: legacy behavior. `inactive` m-lines are also written with port 0.\n */\n mLineReuse: MLineReuse;\n /**\n * Where a PLI / FIR goes when no route has its target SSRC. See {@link KeyFrameRequestRouting}.\n * - `\"compatible\"` (default): the sender whose RTX SSRC it is, else the only video sender.\n * - `\"strict\"`: not delivered, as RFC 4585 / RFC 5104 define the target.\n */\n keyFrameRequestRouting: KeyFrameRequestRouting;\n}\n\nexport type CertificateScope = \"process\" | \"peerConnection\";\nconst CertificateScopes: readonly CertificateScope[] = [\n \"process\",\n \"peerConnection\",\n];\n\nconst MLineReuseModes: readonly MLineReuse[] = [\"compatible\", \"aggressive\"];\n\nexport const findCodecByMimeType = (\n codecs: RTCRtpCodecParameters[],\n target: RTCRtpCodecParameters,\n) =>\n codecs.find(\n (localCodec) =>\n normalizeCodecMimeType(localCodec.mimeType) ===\n normalizeCodecMimeType(target.mimeType),\n )\n ? target\n : undefined;\n\nfunction assignDynamicPayloadTypes(config: PeerConfig) {\n for (const [i, codecParams] of enumerate([\n ...(config.codecs.audio || []),\n ...(config.codecs.video || []),\n ])) {\n if (codecParams.payloadType != undefined) {\n continue;\n }\n\n codecParams.payloadType = 96 + i;\n switch (codecParams.name.toLowerCase()) {\n case \"rtx\":\n {\n codecParams.parameters = `apt=${codecParams.payloadType - 1}`;\n }\n break;\n case \"red\":\n {\n if (codecParams.contentType === \"audio\") {\n const redundant = codecParams.payloadType + 1;\n codecParams.parameters = `${redundant}/${redundant}`;\n codecParams.payloadType = 63;\n }\n }\n break;\n }\n }\n}\n\nexport type RTCIceServer = {\n urls: string | string[];\n username?: string;\n credential?: string;\n};\n\nexport type RTCBundlePolicy = \"balanced\" | \"max-compat\" | \"max-bundle\";\nexport type RTCRtcpMuxPolicy = \"require\";\n\nexport interface RTCSctpConfiguration {\n /** SCTP outbound packet MTU used for DATA chunk fragmentation. Defaults to 1191. */\n mtu?: number;\n}\n\nexport interface RTCConfiguration {\n iceServers?: RTCIceServer[];\n iceTransportPolicy?: PeerConfig[\"iceTransportPolicy\"];\n bundlePolicy?: RTCBundlePolicy;\n rtcpMuxPolicy?: RTCRtcpMuxPolicy;\n iceCandidatePoolSize?: number;\n certificates?: RTCCertificate[];\n}\n\ntype RTCPeerConnectionRTCConfiguration = Omit<\n RTCConfiguration,\n \"bundlePolicy\"\n> & {\n bundlePolicy?: PeerConfig[\"bundlePolicy\"] | RTCBundlePolicy;\n};\n\nexport type RTCPeerConnectionConfig = Partial<\n Omit<\n PeerConfig,\n | \"bundlePolicy\"\n | \"rtcpMuxPolicy\"\n | \"iceCandidatePoolSize\"\n | \"certificates\"\n | \"sctp\"\n >\n> &\n RTCPeerConnectionRTCConfiguration & { sctp?: RTCSctpConfiguration };\n\nexport function generateDefaultPeerConfig(): PeerConfig {\n return {\n codecs: defaultCodecs(),\n headerExtensions: {\n audio: [],\n video: [],\n },\n iceTransportPolicy: \"all\",\n iceLite: false,\n iceServers: [{ urls: \"stun:stun.l.google.com:19302\" }],\n iceUseDefaultStunServer: true,\n icePortRange: undefined,\n iceInterfaceAddresses: undefined,\n iceAdditionalHostAddresses: undefined,\n iceUseIpv4: true,\n iceUseIpv6: true,\n iceUseTcp: false,\n iceTcpPassive: true,\n iceStunGatherTimeout: undefined,\n iceTurnConnectTimeout: undefined,\n turnTransport: undefined,\n turnTlsOptions: undefined,\n turnUdpFamily: undefined,\n iceFilterStunResponse: undefined,\n iceFilterCandidatePair: undefined,\n icePasswordPrefix: undefined,\n iceUseLinkLocalAddress: undefined,\n dtls: {},\n bundlePolicy: \"max-compat\",\n rtcpMuxPolicy: \"require\",\n iceCandidatePoolSize: 0,\n certificates: [],\n certificateScope: \"process\",\n debug: {},\n midSuffix: false,\n forceTurnTCP: false,\n maxMessageSize: DEFAULT_MAX_MESSAGE_SIZE,\n filterProbePaddingOnReceiveRtp: false,\n bandwidthEstimator: \"lightweight\",\n sctp: { mtu: DEFAULT_SCTP_MTU },\n pendingRtp: false,\n mLineReuse: \"compatible\",\n keyFrameRequestRouting: \"compatible\",\n };\n}\nexport const defaultPeerConfig: PeerConfig = generateDefaultPeerConfig();\n\nfunction normalizePeerConfiguration(\n config: RTCPeerConnectionConfig,\n): Partial<PeerConfig> & { sctp?: RTCSctpConfiguration } {\n const input = Object(config ?? {}) as RTCPeerConnectionConfig;\n const normalizedConfig = { ...input } as Partial<PeerConfig> & {\n sctp?: RTCSctpConfiguration;\n };\n\n if (input.sctp !== undefined) {\n normalizedConfig.sctp = { ...input.sctp } as PeerConfig[\"sctp\"];\n }\n\n if (input.bundlePolicy === \"balanced\") {\n normalizedConfig.bundlePolicy = \"max-compat\";\n }\n\n if (\"certificates\" in input) {\n if (input.certificates === undefined) {\n normalizedConfig.certificates = undefined;\n } else if (\n !Array.isArray(input.certificates) ||\n input.certificates.some((certificate) => certificate == null)\n ) {\n throw createWebRtcTypeError(\n \"certificates must be an array of RTCCertificate\",\n );\n } else {\n normalizedConfig.certificates = [...input.certificates];\n }\n }\n\n if (\"iceCandidatePoolSize\" in input) {\n normalizedConfig.iceCandidatePoolSize = coerceUnsignedShort(\n input.iceCandidatePoolSize,\n \"iceCandidatePoolSize\",\n );\n }\n\n return normalizedConfig;\n}\n\nfunction coerceUnsignedShort(value: unknown, name: string) {\n const coerced = Number(value);\n if (\n !Number.isFinite(coerced) ||\n !Number.isInteger(coerced) ||\n coerced < 0 ||\n coerced > 65535\n ) {\n throw createWebRtcTypeError(`${name} must be an unsigned short`);\n }\n return coerced;\n}\n\nfunction hasSameCertificates(left: RTCCertificate[], right: RTCCertificate[]) {\n return (\n left.length === right.length &&\n left.every((certificate, index) => certificate === right[index])\n );\n}\n\nexport function clonePeerConfiguration(config: PeerConfig) {\n return {\n ...config,\n codecs: {\n audio: config.codecs.audio ? [...config.codecs.audio] : undefined,\n video: config.codecs.video ? [...config.codecs.video] : undefined,\n },\n headerExtensions: {\n audio: config.headerExtensions.audio\n ? [...config.headerExtensions.audio]\n : undefined,\n video: config.headerExtensions.video\n ? [...config.headerExtensions.video]\n : undefined,\n },\n iceServers: config.iceServers.map((server) => ({\n ...server,\n urls: Array.isArray(server.urls) ? [...server.urls] : server.urls,\n })),\n icePortRange: config.icePortRange\n ? ([...config.icePortRange] as [number, number])\n : undefined,\n iceAdditionalHostAddresses: config.iceAdditionalHostAddresses\n ? [...config.iceAdditionalHostAddresses]\n : undefined,\n dtls: { ...config.dtls },\n certificates: [...config.certificates],\n debug: { ...config.debug },\n sctp: { ...config.sctp },\n pendingRtp:\n typeof config.pendingRtp === \"object\" && config.pendingRtp != undefined\n ? { ...config.pendingRtp }\n : config.pendingRtp,\n };\n}\n\n/**\n * `setConfiguration`: validate `input` against the current `config`, then\n * merge it in place. Returns the normalized input; side effects on live\n * transports (SCTP limits, ICE servers) stay with the caller.\n */\nconst CLEARABLE_TURN_KEYS = [\n \"turnTransport\",\n \"turnTlsOptions\",\n \"turnUdpFamily\",\n] as const;\n\nexport function mergePeerConfiguration(\n config: PeerConfig,\n input: RTCPeerConnectionConfig,\n {\n isReconfiguration,\n hasLocalDescription,\n hasSctpTransport,\n }: {\n isReconfiguration: boolean;\n hasLocalDescription: boolean;\n hasSctpTransport: boolean;\n },\n) {\n const normalizedConfig = normalizePeerConfiguration(input);\n\n if (\n normalizedConfig.rtcpMuxPolicy &&\n normalizedConfig.rtcpMuxPolicy !== \"require\"\n ) {\n throw new Error(\"rtcpMuxPolicy must be require\");\n }\n\n if (\n normalizedConfig.iceCandidatePoolSize !== undefined &&\n (!Number.isInteger(normalizedConfig.iceCandidatePoolSize) ||\n normalizedConfig.iceCandidatePoolSize < 0)\n ) {\n throw new Error(\"iceCandidatePoolSize must be a non-negative integer\");\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.bundlePolicy !== undefined &&\n normalizedConfig.bundlePolicy !== config.bundlePolicy\n ) {\n throw new Error(\"bundlePolicy cannot be changed\");\n }\n\n if (\n normalizedConfig.certificateScope !== undefined &&\n !CertificateScopes.includes(normalizedConfig.certificateScope)\n ) {\n throw createWebRtcTypeError(\n `certificateScope must be one of ${CertificateScopes.join(\", \")}`,\n );\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.certificateScope !== undefined &&\n normalizedConfig.certificateScope !== config.certificateScope\n ) {\n throw createWebRtcDomException(\n \"InvalidModificationError\",\n \"certificateScope cannot be changed\",\n );\n }\n\n if (\n normalizedConfig.mLineReuse !== undefined &&\n !MLineReuseModes.includes(normalizedConfig.mLineReuse)\n ) {\n throw createWebRtcTypeError(\n `mLineReuse must be one of ${MLineReuseModes.join(\", \")}`,\n );\n }\n\n if (\n normalizedConfig.keyFrameRequestRouting !== undefined &&\n !KeyFrameRequestRoutingModes.includes(\n normalizedConfig.keyFrameRequestRouting,\n )\n ) {\n throw createWebRtcTypeError(\n `keyFrameRequestRouting must be one of ${KeyFrameRequestRoutingModes.join(\", \")}`,\n );\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.mLineReuse !== undefined &&\n normalizedConfig.mLineReuse !== config.mLineReuse\n ) {\n throw createWebRtcDomException(\n \"InvalidModificationError\",\n \"mLineReuse cannot be changed\",\n );\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.rtcpMuxPolicy !== undefined &&\n normalizedConfig.rtcpMuxPolicy !== config.rtcpMuxPolicy\n ) {\n throw new Error(\"rtcpMuxPolicy cannot be changed\");\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.certificates !== undefined &&\n !hasSameCertificates(normalizedConfig.certificates, config.certificates)\n ) {\n throw new Error(\"certificates cannot be changed\");\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.iceCandidatePoolSize !== undefined &&\n hasLocalDescription &&\n normalizedConfig.iceCandidatePoolSize !== config.iceCandidatePoolSize\n ) {\n throw new Error(\n \"iceCandidatePoolSize cannot be changed after setLocalDescription\",\n );\n }\n\n if ((normalizedConfig.iceCandidatePoolSize ?? 0) > 0) {\n throw new Error(\"iceCandidatePoolSize > 0 is not supported\");\n }\n\n if (normalizedConfig.sctp !== undefined) {\n const requestedSctpMtu = normalizedConfig.sctp.mtu ?? DEFAULT_SCTP_MTU;\n validateSctpMtu(requestedSctpMtu);\n if (hasSctpTransport && requestedSctpMtu !== config.sctp.mtu) {\n throw new Error(\n \"sctp.mtu cannot be changed after SCTP transport creation\",\n );\n }\n }\n\n deepMerge(config, normalizedConfig as Partial<PeerConfig>);\n // Omitted keys keep their value, but an explicit `undefined` unsets these\n // optional TURN settings (deepMerge skips undefined).\n for (const key of CLEARABLE_TURN_KEYS) {\n if (Object.hasOwn(normalizedConfig, key) && normalizedConfig[key] == null) {\n // Union-key writes require the intersection of all indexed property\n // types. Narrow the key so each optional setting can be cleared safely.\n switch (key) {\n case \"turnTransport\":\n config.turnTransport = undefined;\n break;\n case \"turnTlsOptions\":\n config.turnTlsOptions = undefined;\n break;\n case \"turnUdpFamily\":\n config.turnUdpFamily = undefined;\n break;\n }\n }\n }\n config.sctp = {\n mtu: config.sctp?.mtu ?? DEFAULT_SCTP_MTU,\n };\n\n if (config.icePortRange) {\n const [min, max] = config.icePortRange;\n if (min === max) throw new Error(\"should not be same value\");\n if (min >= max) throw new Error(\"The min must be less than max\");\n }\n\n if (!Number.isInteger(config.maxMessageSize) || config.maxMessageSize < 0) {\n throw new Error(\"maxMessageSize must be a non-negative integer\");\n }\n\n assignDynamicPayloadTypes(config);\n\n [\n ...(config.headerExtensions.audio || []),\n ...(config.headerExtensions.video || []),\n ].forEach((v, i) => {\n v.id = 1 + i;\n });\n\n return normalizedConfig;\n}\n"]}
|
|
@@ -2,6 +2,15 @@ import { EventTarget } from "./helper";
|
|
|
2
2
|
import { Event } from "./imports/common";
|
|
3
3
|
import type { RTCSctpTransport } from "./transport/sctp";
|
|
4
4
|
import type { Callback, CallbackWithValue } from "./types/util";
|
|
5
|
+
/**
|
|
6
|
+
* Label / Protocol Length are 16-bit byte counts of the UTF-8 fields
|
|
7
|
+
* (RFC 8832 5.1); W3C createDataChannel rejects longer values for both
|
|
8
|
+
* negotiated and in-band channels. Call before any state is touched.
|
|
9
|
+
*/
|
|
10
|
+
export declare function assertDataChannelFieldLengths(fields: {
|
|
11
|
+
label: string;
|
|
12
|
+
protocol?: string;
|
|
13
|
+
}): void;
|
|
5
14
|
export interface DataChannelStats {
|
|
6
15
|
messagesSent: number;
|
|
7
16
|
bytesSent: number;
|
|
@@ -51,6 +60,7 @@ export declare class RTCDataChannel extends EventTarget implements DataChannelSt
|
|
|
51
60
|
export type DCState = "open" | "closed" | "connecting" | "closing";
|
|
52
61
|
export declare class RTCDataChannelParameters {
|
|
53
62
|
label: string;
|
|
63
|
+
/** Lifetime in milliseconds (RFC 8832 / WebRTC). */
|
|
54
64
|
maxPacketLifeTime?: number;
|
|
55
65
|
maxRetransmits?: number;
|
|
56
66
|
ordered: boolean;
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RTCDataChannelParameters = exports.RTCDataChannel = void 0;
|
|
4
|
+
exports.assertDataChannelFieldLengths = assertDataChannelFieldLengths;
|
|
4
5
|
exports.getDataChannelMessageSize = getDataChannelMessageSize;
|
|
5
6
|
const crypto_1 = require("crypto");
|
|
7
|
+
const errors_1 = require("./errors");
|
|
6
8
|
const helper_1 = require("./helper");
|
|
7
9
|
const common_1 = require("./imports/common");
|
|
10
|
+
/**
|
|
11
|
+
* Label / Protocol Length are 16-bit byte counts of the UTF-8 fields
|
|
12
|
+
* (RFC 8832 5.1); W3C createDataChannel rejects longer values for both
|
|
13
|
+
* negotiated and in-band channels. Call before any state is touched.
|
|
14
|
+
*/
|
|
15
|
+
function assertDataChannelFieldLengths(fields) {
|
|
16
|
+
for (const name of ["label", "protocol"]) {
|
|
17
|
+
const bytes = Buffer.byteLength(fields[name] ?? "", "utf8");
|
|
18
|
+
if (bytes > 0xffff) {
|
|
19
|
+
throw (0, errors_1.createWebRtcTypeError)(`Data channel ${name} is ${bytes} bytes in UTF-8; the maximum is 65535`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
8
23
|
const log = (0, common_1.debug)("werift:packages/webrtc/src/dataChannel.ts");
|
|
9
24
|
function getDataChannelMessageSize(data) {
|
|
10
25
|
return Buffer.isBuffer(data) ? data.length : Buffer.byteLength(data);
|
|
@@ -16,19 +31,19 @@ class RTCDataChannel extends helper_1.EventTarget {
|
|
|
16
31
|
enumerable: true,
|
|
17
32
|
configurable: true,
|
|
18
33
|
writable: true,
|
|
19
|
-
value:
|
|
34
|
+
value: void 0
|
|
20
35
|
});
|
|
21
36
|
Object.defineProperty(this, "parameters", {
|
|
22
37
|
enumerable: true,
|
|
23
38
|
configurable: true,
|
|
24
39
|
writable: true,
|
|
25
|
-
value:
|
|
40
|
+
value: void 0
|
|
26
41
|
});
|
|
27
42
|
Object.defineProperty(this, "sendOpen", {
|
|
28
43
|
enumerable: true,
|
|
29
44
|
configurable: true,
|
|
30
45
|
writable: true,
|
|
31
|
-
value:
|
|
46
|
+
value: void 0
|
|
32
47
|
});
|
|
33
48
|
Object.defineProperty(this, "statsId", {
|
|
34
49
|
enumerable: true,
|
|
@@ -153,6 +168,10 @@ class RTCDataChannel extends helper_1.EventTarget {
|
|
|
153
168
|
writable: true,
|
|
154
169
|
value: 0
|
|
155
170
|
});
|
|
171
|
+
this.sctp = sctp;
|
|
172
|
+
this.parameters = parameters;
|
|
173
|
+
this.sendOpen = sendOpen;
|
|
174
|
+
assertDataChannelFieldLengths(this.parameters);
|
|
156
175
|
this.id = this.parameters.id;
|
|
157
176
|
if (parameters.negotiated) {
|
|
158
177
|
if (this.id == undefined || this.id < 0 || this.id > 65534) {
|
|
@@ -248,12 +267,13 @@ class RTCDataChannelParameters {
|
|
|
248
267
|
writable: true,
|
|
249
268
|
value: ""
|
|
250
269
|
});
|
|
270
|
+
/** Lifetime in milliseconds (RFC 8832 / WebRTC). */
|
|
251
271
|
Object.defineProperty(this, "maxPacketLifeTime", {
|
|
252
272
|
enumerable: true,
|
|
253
273
|
configurable: true,
|
|
254
274
|
writable: true,
|
|
255
275
|
value: void 0
|
|
256
|
-
});
|
|
276
|
+
});
|
|
257
277
|
Object.defineProperty(this, "maxRetransmits", {
|
|
258
278
|
enumerable: true,
|
|
259
279
|
configurable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataChannel.js","sourceRoot":"","sources":["../../../src/dataChannel.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"dataChannel.js","sourceRoot":"","sources":["../../../src/dataChannel.ts"],"names":[],"mappings":";;;AAYA,sEA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from \"./errors\";\nimport { EventTarget } from \"./helper\";\nimport { debug, Event } from \"./imports/common\";\nimport type { RTCSctpTransport } from \"./transport/sctp\";\nimport type { Callback, CallbackWithValue } from \"./types/util\";\n\n/**\n * Label / Protocol Length are 16-bit byte counts of the UTF-8 fields\n * (RFC 8832 5.1); W3C createDataChannel rejects longer values for both\n * negotiated and in-band channels. Call before any state is touched.\n */\nexport function assertDataChannelFieldLengths(fields: {\n label: string;\n protocol?: string;\n}) {\n for (const name of [\"label\", \"protocol\"] as const) {\n const bytes = Buffer.byteLength(fields[name] ?? \"\", \"utf8\");\n if (bytes > 0xffff) {\n throw createWebRtcTypeError(\n `Data channel ${name} is ${bytes} bytes in UTF-8; the maximum is 65535`,\n );\n }\n }\n}\n\nconst log = debug(\"werift:packages/webrtc/src/dataChannel.ts\");\n\nexport interface DataChannelStats {\n messagesSent: number;\n bytesSent: number;\n messagesReceived: number;\n bytesReceived: number;\n}\n\nexport function getDataChannelMessageSize(data: Buffer | string) {\n return Buffer.isBuffer(data) ? data.length : Buffer.byteLength(data);\n}\n\nexport class RTCDataChannel extends EventTarget implements DataChannelStats {\n readonly sctp: RTCSctpTransport;\n private readonly parameters: RTCDataChannelParameters;\n public readonly sendOpen: boolean;\n\n readonly statsId = randomUUID().toString();\n readonly stateChange = new Event<[DCState]>();\n readonly stateChanged = new Event<[DCState]>();\n readonly onMessage = new Event<[string | Buffer]>();\n // todo impl\n readonly error = new Event<[Error]>();\n readonly bufferedAmountLow = new Event();\n onopen?: Callback;\n onclose?: Callback;\n onclosing?: Callback;\n onmessage?: CallbackWithValue<MessageEvent>;\n // todo impl\n onerror?: CallbackWithValue<RTCErrorEvent>;\n isCreatedByRemote = false;\n id: number;\n readyState: DCState = \"connecting\";\n\n bufferedAmount = 0;\n private _bufferedAmountLowThreshold = 0;\n\n // Statistics\n messagesSent = 0;\n bytesSent = 0;\n messagesReceived = 0;\n bytesReceived = 0;\n\n constructor(\n sctp: RTCSctpTransport,\n parameters: RTCDataChannelParameters,\n sendOpen = true,\n ) {\n super();\n this.sctp = sctp;\n this.parameters = parameters;\n this.sendOpen = sendOpen;\n\n assertDataChannelFieldLengths(this.parameters);\n\n this.id = this.parameters.id;\n\n if (parameters.negotiated) {\n if (this.id == undefined || this.id < 0 || this.id > 65534) {\n throw new Error(\n \"ID must be in range 0-65534 if data channel is negotiated out-of-band\",\n );\n }\n this.sctp.dataChannelAddNegotiated(this);\n } else {\n if (sendOpen) {\n this.sendOpen = false;\n this.sctp.dataChannelOpen(this);\n }\n }\n }\n\n get ordered() {\n return this.parameters.ordered;\n }\n\n get maxRetransmits() {\n return this.parameters.maxRetransmits ?? null;\n }\n\n get maxPacketLifeTime() {\n return this.parameters.maxPacketLifeTime ?? null;\n }\n\n get label() {\n return this.parameters.label;\n }\n\n get protocol() {\n return this.parameters.protocol;\n }\n\n get negotiated() {\n return this.parameters.negotiated;\n }\n\n get bufferedAmountLowThreshold() {\n return this._bufferedAmountLowThreshold;\n }\n\n set bufferedAmountLowThreshold(value: number) {\n if (value < 0 || value > 4294967295) {\n throw new Error(\n \"bufferedAmountLowThreshold must be in range 0 - 4294967295\",\n );\n }\n this._bufferedAmountLowThreshold = value;\n }\n\n setId(id: number) {\n this.id = id;\n }\n\n setReadyState(state: DCState) {\n if (state !== this.readyState) {\n this.readyState = state;\n this.stateChange.execute(state);\n this.stateChanged.execute(state);\n\n switch (state) {\n case \"open\":\n if (this.onopen) this.onopen();\n this.emit(\"open\");\n break;\n case \"closed\":\n if (this.onclose) this.onclose();\n this.emit(\"close\");\n break;\n case \"closing\":\n if (this.onclosing) this.onclosing();\n break;\n }\n log(\"change state\", state);\n }\n }\n\n addBufferedAmount(amount: number) {\n const crossesThreshold =\n this.bufferedAmount > this.bufferedAmountLowThreshold &&\n this.bufferedAmount + amount <= this.bufferedAmountLowThreshold;\n this.bufferedAmount += amount;\n if (crossesThreshold) {\n this.bufferedAmountLow.execute();\n this.emit(\"bufferedamountlow\");\n }\n }\n\n send(data: Buffer | string) {\n const size = this.sctp.datachannelSend(this, data);\n this.messagesSent++;\n this.bytesSent += size;\n }\n\n close() {\n this.sctp.dataChannelClose(this);\n }\n}\n\nexport type DCState = \"open\" | \"closed\" | \"connecting\" | \"closing\";\n\nexport class RTCDataChannelParameters {\n label = \"\";\n /** Lifetime in milliseconds (RFC 8832 / WebRTC). */\n maxPacketLifeTime?: number;\n maxRetransmits?: number;\n ordered = true;\n protocol = \"\";\n negotiated = false;\n id!: number;\n constructor(props: Partial<RTCDataChannelParameters> = {}) {\n Object.assign(this, props);\n }\n}\n\nexport interface MessageEvent {\n data: string | Buffer;\n}\n\nexport interface RTCErrorEvent {\n error: any;\n}\n"]}
|
|
@@ -8,5 +8,15 @@ export * from "./router";
|
|
|
8
8
|
export * from "./rtpReceiver";
|
|
9
9
|
export * from "./rtpSender";
|
|
10
10
|
export * from "./rtpTransceiver";
|
|
11
|
+
export type { BandwidthEstimator, BandwidthEstimatorProcessor, CongestionEventsCompatibility, NetworkAvailabilityConsumer, ProbeClusterConfig, ProbePacingController, ProbeReservation, RoundTripTimeConsumer, SentInfo, } from "./sender/bandwidthEstimator";
|
|
12
|
+
export { BandwidthEstimatorNoopHooks, isBandwidthEstimatorProcessor, isNetworkAvailabilityConsumer, isProbePacingController, isRoundTripTimeConsumer, setAvailableBitrateIfChanged, } from "./sender/bandwidthEstimator";
|
|
13
|
+
export type { BandwidthEstimatorOption, BandwidthEstimatorPreset, } from "./sender/createBandwidthEstimator";
|
|
14
|
+
export { createBandwidthEstimator } from "./sender/createBandwidthEstimator";
|
|
15
|
+
export { DisabledBandwidthEstimator } from "./sender/estimators/disabledBwe";
|
|
16
|
+
export type { AckedPacketSample, BandwidthLimitedCause, BandwidthUsage, GccBandwidthEstimatorOptions, GccClock, LossBasedResult, LossBasedState, ProbeState, } from "./sender/estimators/gcc";
|
|
17
|
+
export { AcknowledgedBitrateEstimator, AimdRateControl, AlrDetector, BitrateEstimator, computeFeedbackRttStats, GCC_KNOWN_DIFFERENCES, GccBandwidthEstimator, getBandwidthLimitedCause, InterArrivalDelta, IntervalBudget, isProbeInitiationAllowed, isRttAboveLimit, kAlrProbeScale, kAlrProbingIntervalMs, kBeta, kDefaultMaxProbingBitrateBps, kDefaultPaceMultiplier, kDefaultPaceMultiplierWithSendSideBwe, kDefaultStartBitrateBps, kGoogCcProcessIntervalMs, kInitialMinProbeDeltaMs, kLossBasedIncreaseFactor, kLossBasedMedianSendingRateFactor, kLossBasedNotUseAckedRateInAlr, kLossBasedPaddingDurationMs, kLossDecreaseThreshold, kLossIncreaseFactor, kLossIncreaseThreshold, kLossLimitedProbeScale, kMaxBitrateBps, kMaxProbeDelayMs, kMinBitrateBps, kMinProbeDeltaMs, kProbeFractionAfterDrop, kProbePaddingPacketBytes, kRttBasedBackOffBandwidthFloorBps, kRttBasedBackOffDropFraction, kRttBasedBackOffDropIntervalMs, kRttBasedBackOffHighRttMs, kSendTimeHistoryWindowMs, kStartPhaseLossReportMinPackets, kStartPhaseMs, kTrendlineWindowSize, LinkCapacityEstimator, LossBasedBwe, maxProbeBitrateBps, ProbeController, RttBasedBackoff, TrendlineEstimator, } from "./sender/estimators/gcc";
|
|
18
|
+
export { isLightweightBandwidthEstimator, LightweightBandwidthEstimator, SenderBandwidthEstimator, } from "./sender/estimators/lightweightBwe";
|
|
19
|
+
export type { TwccPacketFeedback } from "./sender/estimators/twccFeedbackAdapter";
|
|
20
|
+
export { kTwccFeedbackHistoryMaxSeqSpan, TwccFeedbackAdapter, } from "./sender/estimators/twccFeedbackAdapter";
|
|
11
21
|
export * from "./stats";
|
|
12
22
|
export * from "./track";
|
|
@@ -14,6 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.kStartPhaseMs = exports.kStartPhaseLossReportMinPackets = exports.kSendTimeHistoryWindowMs = exports.kRttBasedBackOffHighRttMs = exports.kRttBasedBackOffDropIntervalMs = exports.kRttBasedBackOffDropFraction = exports.kRttBasedBackOffBandwidthFloorBps = exports.kProbePaddingPacketBytes = exports.kProbeFractionAfterDrop = exports.kMinProbeDeltaMs = exports.kMinBitrateBps = exports.kMaxProbeDelayMs = exports.kMaxBitrateBps = exports.kLossLimitedProbeScale = exports.kLossIncreaseThreshold = exports.kLossIncreaseFactor = exports.kLossDecreaseThreshold = exports.kLossBasedPaddingDurationMs = exports.kLossBasedNotUseAckedRateInAlr = exports.kLossBasedMedianSendingRateFactor = exports.kLossBasedIncreaseFactor = exports.kInitialMinProbeDeltaMs = exports.kGoogCcProcessIntervalMs = exports.kDefaultStartBitrateBps = exports.kDefaultPaceMultiplierWithSendSideBwe = exports.kDefaultPaceMultiplier = exports.kDefaultMaxProbingBitrateBps = exports.kBeta = exports.kAlrProbingIntervalMs = exports.kAlrProbeScale = exports.isRttAboveLimit = exports.isProbeInitiationAllowed = exports.IntervalBudget = exports.InterArrivalDelta = exports.getBandwidthLimitedCause = exports.GccBandwidthEstimator = exports.GCC_KNOWN_DIFFERENCES = exports.computeFeedbackRttStats = exports.BitrateEstimator = exports.AlrDetector = exports.AimdRateControl = exports.AcknowledgedBitrateEstimator = exports.DisabledBandwidthEstimator = exports.createBandwidthEstimator = exports.setAvailableBitrateIfChanged = exports.isRoundTripTimeConsumer = exports.isProbePacingController = exports.isNetworkAvailabilityConsumer = exports.isBandwidthEstimatorProcessor = exports.BandwidthEstimatorNoopHooks = void 0;
|
|
18
|
+
exports.TwccFeedbackAdapter = exports.kTwccFeedbackHistoryMaxSeqSpan = exports.SenderBandwidthEstimator = exports.LightweightBandwidthEstimator = exports.isLightweightBandwidthEstimator = exports.TrendlineEstimator = exports.RttBasedBackoff = exports.ProbeController = exports.maxProbeBitrateBps = exports.LossBasedBwe = exports.LinkCapacityEstimator = exports.kTrendlineWindowSize = void 0;
|
|
17
19
|
__exportStar(require("../transceiverManager"), exports);
|
|
18
20
|
__exportStar(require("./codec"), exports);
|
|
19
21
|
__exportStar(require("./codecCompatibility"), exports);
|
|
@@ -24,6 +26,74 @@ __exportStar(require("./router"), exports);
|
|
|
24
26
|
__exportStar(require("./rtpReceiver"), exports);
|
|
25
27
|
__exportStar(require("./rtpSender"), exports);
|
|
26
28
|
__exportStar(require("./rtpTransceiver"), exports);
|
|
29
|
+
var bandwidthEstimator_1 = require("./sender/bandwidthEstimator");
|
|
30
|
+
Object.defineProperty(exports, "BandwidthEstimatorNoopHooks", { enumerable: true, get: function () { return bandwidthEstimator_1.BandwidthEstimatorNoopHooks; } });
|
|
31
|
+
Object.defineProperty(exports, "isBandwidthEstimatorProcessor", { enumerable: true, get: function () { return bandwidthEstimator_1.isBandwidthEstimatorProcessor; } });
|
|
32
|
+
Object.defineProperty(exports, "isNetworkAvailabilityConsumer", { enumerable: true, get: function () { return bandwidthEstimator_1.isNetworkAvailabilityConsumer; } });
|
|
33
|
+
Object.defineProperty(exports, "isProbePacingController", { enumerable: true, get: function () { return bandwidthEstimator_1.isProbePacingController; } });
|
|
34
|
+
Object.defineProperty(exports, "isRoundTripTimeConsumer", { enumerable: true, get: function () { return bandwidthEstimator_1.isRoundTripTimeConsumer; } });
|
|
35
|
+
Object.defineProperty(exports, "setAvailableBitrateIfChanged", { enumerable: true, get: function () { return bandwidthEstimator_1.setAvailableBitrateIfChanged; } });
|
|
36
|
+
var createBandwidthEstimator_1 = require("./sender/createBandwidthEstimator");
|
|
37
|
+
Object.defineProperty(exports, "createBandwidthEstimator", { enumerable: true, get: function () { return createBandwidthEstimator_1.createBandwidthEstimator; } });
|
|
38
|
+
var disabledBwe_1 = require("./sender/estimators/disabledBwe");
|
|
39
|
+
Object.defineProperty(exports, "DisabledBandwidthEstimator", { enumerable: true, get: function () { return disabledBwe_1.DisabledBandwidthEstimator; } });
|
|
40
|
+
var gcc_1 = require("./sender/estimators/gcc");
|
|
41
|
+
Object.defineProperty(exports, "AcknowledgedBitrateEstimator", { enumerable: true, get: function () { return gcc_1.AcknowledgedBitrateEstimator; } });
|
|
42
|
+
Object.defineProperty(exports, "AimdRateControl", { enumerable: true, get: function () { return gcc_1.AimdRateControl; } });
|
|
43
|
+
Object.defineProperty(exports, "AlrDetector", { enumerable: true, get: function () { return gcc_1.AlrDetector; } });
|
|
44
|
+
Object.defineProperty(exports, "BitrateEstimator", { enumerable: true, get: function () { return gcc_1.BitrateEstimator; } });
|
|
45
|
+
Object.defineProperty(exports, "computeFeedbackRttStats", { enumerable: true, get: function () { return gcc_1.computeFeedbackRttStats; } });
|
|
46
|
+
Object.defineProperty(exports, "GCC_KNOWN_DIFFERENCES", { enumerable: true, get: function () { return gcc_1.GCC_KNOWN_DIFFERENCES; } });
|
|
47
|
+
Object.defineProperty(exports, "GccBandwidthEstimator", { enumerable: true, get: function () { return gcc_1.GccBandwidthEstimator; } });
|
|
48
|
+
Object.defineProperty(exports, "getBandwidthLimitedCause", { enumerable: true, get: function () { return gcc_1.getBandwidthLimitedCause; } });
|
|
49
|
+
Object.defineProperty(exports, "InterArrivalDelta", { enumerable: true, get: function () { return gcc_1.InterArrivalDelta; } });
|
|
50
|
+
Object.defineProperty(exports, "IntervalBudget", { enumerable: true, get: function () { return gcc_1.IntervalBudget; } });
|
|
51
|
+
Object.defineProperty(exports, "isProbeInitiationAllowed", { enumerable: true, get: function () { return gcc_1.isProbeInitiationAllowed; } });
|
|
52
|
+
Object.defineProperty(exports, "isRttAboveLimit", { enumerable: true, get: function () { return gcc_1.isRttAboveLimit; } });
|
|
53
|
+
Object.defineProperty(exports, "kAlrProbeScale", { enumerable: true, get: function () { return gcc_1.kAlrProbeScale; } });
|
|
54
|
+
Object.defineProperty(exports, "kAlrProbingIntervalMs", { enumerable: true, get: function () { return gcc_1.kAlrProbingIntervalMs; } });
|
|
55
|
+
Object.defineProperty(exports, "kBeta", { enumerable: true, get: function () { return gcc_1.kBeta; } });
|
|
56
|
+
Object.defineProperty(exports, "kDefaultMaxProbingBitrateBps", { enumerable: true, get: function () { return gcc_1.kDefaultMaxProbingBitrateBps; } });
|
|
57
|
+
Object.defineProperty(exports, "kDefaultPaceMultiplier", { enumerable: true, get: function () { return gcc_1.kDefaultPaceMultiplier; } });
|
|
58
|
+
Object.defineProperty(exports, "kDefaultPaceMultiplierWithSendSideBwe", { enumerable: true, get: function () { return gcc_1.kDefaultPaceMultiplierWithSendSideBwe; } });
|
|
59
|
+
Object.defineProperty(exports, "kDefaultStartBitrateBps", { enumerable: true, get: function () { return gcc_1.kDefaultStartBitrateBps; } });
|
|
60
|
+
Object.defineProperty(exports, "kGoogCcProcessIntervalMs", { enumerable: true, get: function () { return gcc_1.kGoogCcProcessIntervalMs; } });
|
|
61
|
+
Object.defineProperty(exports, "kInitialMinProbeDeltaMs", { enumerable: true, get: function () { return gcc_1.kInitialMinProbeDeltaMs; } });
|
|
62
|
+
Object.defineProperty(exports, "kLossBasedIncreaseFactor", { enumerable: true, get: function () { return gcc_1.kLossBasedIncreaseFactor; } });
|
|
63
|
+
Object.defineProperty(exports, "kLossBasedMedianSendingRateFactor", { enumerable: true, get: function () { return gcc_1.kLossBasedMedianSendingRateFactor; } });
|
|
64
|
+
Object.defineProperty(exports, "kLossBasedNotUseAckedRateInAlr", { enumerable: true, get: function () { return gcc_1.kLossBasedNotUseAckedRateInAlr; } });
|
|
65
|
+
Object.defineProperty(exports, "kLossBasedPaddingDurationMs", { enumerable: true, get: function () { return gcc_1.kLossBasedPaddingDurationMs; } });
|
|
66
|
+
Object.defineProperty(exports, "kLossDecreaseThreshold", { enumerable: true, get: function () { return gcc_1.kLossDecreaseThreshold; } });
|
|
67
|
+
Object.defineProperty(exports, "kLossIncreaseFactor", { enumerable: true, get: function () { return gcc_1.kLossIncreaseFactor; } });
|
|
68
|
+
Object.defineProperty(exports, "kLossIncreaseThreshold", { enumerable: true, get: function () { return gcc_1.kLossIncreaseThreshold; } });
|
|
69
|
+
Object.defineProperty(exports, "kLossLimitedProbeScale", { enumerable: true, get: function () { return gcc_1.kLossLimitedProbeScale; } });
|
|
70
|
+
Object.defineProperty(exports, "kMaxBitrateBps", { enumerable: true, get: function () { return gcc_1.kMaxBitrateBps; } });
|
|
71
|
+
Object.defineProperty(exports, "kMaxProbeDelayMs", { enumerable: true, get: function () { return gcc_1.kMaxProbeDelayMs; } });
|
|
72
|
+
Object.defineProperty(exports, "kMinBitrateBps", { enumerable: true, get: function () { return gcc_1.kMinBitrateBps; } });
|
|
73
|
+
Object.defineProperty(exports, "kMinProbeDeltaMs", { enumerable: true, get: function () { return gcc_1.kMinProbeDeltaMs; } });
|
|
74
|
+
Object.defineProperty(exports, "kProbeFractionAfterDrop", { enumerable: true, get: function () { return gcc_1.kProbeFractionAfterDrop; } });
|
|
75
|
+
Object.defineProperty(exports, "kProbePaddingPacketBytes", { enumerable: true, get: function () { return gcc_1.kProbePaddingPacketBytes; } });
|
|
76
|
+
Object.defineProperty(exports, "kRttBasedBackOffBandwidthFloorBps", { enumerable: true, get: function () { return gcc_1.kRttBasedBackOffBandwidthFloorBps; } });
|
|
77
|
+
Object.defineProperty(exports, "kRttBasedBackOffDropFraction", { enumerable: true, get: function () { return gcc_1.kRttBasedBackOffDropFraction; } });
|
|
78
|
+
Object.defineProperty(exports, "kRttBasedBackOffDropIntervalMs", { enumerable: true, get: function () { return gcc_1.kRttBasedBackOffDropIntervalMs; } });
|
|
79
|
+
Object.defineProperty(exports, "kRttBasedBackOffHighRttMs", { enumerable: true, get: function () { return gcc_1.kRttBasedBackOffHighRttMs; } });
|
|
80
|
+
Object.defineProperty(exports, "kSendTimeHistoryWindowMs", { enumerable: true, get: function () { return gcc_1.kSendTimeHistoryWindowMs; } });
|
|
81
|
+
Object.defineProperty(exports, "kStartPhaseLossReportMinPackets", { enumerable: true, get: function () { return gcc_1.kStartPhaseLossReportMinPackets; } });
|
|
82
|
+
Object.defineProperty(exports, "kStartPhaseMs", { enumerable: true, get: function () { return gcc_1.kStartPhaseMs; } });
|
|
83
|
+
Object.defineProperty(exports, "kTrendlineWindowSize", { enumerable: true, get: function () { return gcc_1.kTrendlineWindowSize; } });
|
|
84
|
+
Object.defineProperty(exports, "LinkCapacityEstimator", { enumerable: true, get: function () { return gcc_1.LinkCapacityEstimator; } });
|
|
85
|
+
Object.defineProperty(exports, "LossBasedBwe", { enumerable: true, get: function () { return gcc_1.LossBasedBwe; } });
|
|
86
|
+
Object.defineProperty(exports, "maxProbeBitrateBps", { enumerable: true, get: function () { return gcc_1.maxProbeBitrateBps; } });
|
|
87
|
+
Object.defineProperty(exports, "ProbeController", { enumerable: true, get: function () { return gcc_1.ProbeController; } });
|
|
88
|
+
Object.defineProperty(exports, "RttBasedBackoff", { enumerable: true, get: function () { return gcc_1.RttBasedBackoff; } });
|
|
89
|
+
Object.defineProperty(exports, "TrendlineEstimator", { enumerable: true, get: function () { return gcc_1.TrendlineEstimator; } });
|
|
90
|
+
var lightweightBwe_1 = require("./sender/estimators/lightweightBwe");
|
|
91
|
+
Object.defineProperty(exports, "isLightweightBandwidthEstimator", { enumerable: true, get: function () { return lightweightBwe_1.isLightweightBandwidthEstimator; } });
|
|
92
|
+
Object.defineProperty(exports, "LightweightBandwidthEstimator", { enumerable: true, get: function () { return lightweightBwe_1.LightweightBandwidthEstimator; } });
|
|
93
|
+
Object.defineProperty(exports, "SenderBandwidthEstimator", { enumerable: true, get: function () { return lightweightBwe_1.SenderBandwidthEstimator; } });
|
|
94
|
+
var twccFeedbackAdapter_1 = require("./sender/estimators/twccFeedbackAdapter");
|
|
95
|
+
Object.defineProperty(exports, "kTwccFeedbackHistoryMaxSeqSpan", { enumerable: true, get: function () { return twccFeedbackAdapter_1.kTwccFeedbackHistoryMaxSeqSpan; } });
|
|
96
|
+
Object.defineProperty(exports, "TwccFeedbackAdapter", { enumerable: true, get: function () { return twccFeedbackAdapter_1.TwccFeedbackAdapter; } });
|
|
27
97
|
__exportStar(require("./stats"), exports);
|
|
28
98
|
__exportStar(require("./track"), exports);
|
|
29
99
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/media/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/media/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,0CAAwB;AACxB,uDAAqC;AACrC,2DAAyC;AACzC,2DAAyC;AACzC,+CAA6B;AAC7B,2CAAyB;AACzB,gDAA8B;AAC9B,8CAA4B;AAC5B,mDAAiC;AAYjC,kEAOqC;AANnC,iIAAA,2BAA2B,OAAA;AAC3B,mIAAA,6BAA6B,OAAA;AAC7B,mIAAA,6BAA6B,OAAA;AAC7B,6HAAA,uBAAuB,OAAA;AACvB,6HAAA,uBAAuB,OAAA;AACvB,kIAAA,4BAA4B,OAAA;AAM9B,8EAA6E;AAApE,oIAAA,wBAAwB,OAAA;AACjC,+DAA6E;AAApE,yHAAA,0BAA0B,OAAA;AAWnC,+CAkDiC;AAjD/B,mHAAA,4BAA4B,OAAA;AAC5B,sGAAA,eAAe,OAAA;AACf,kGAAA,WAAW,OAAA;AACX,uGAAA,gBAAgB,OAAA;AAChB,8GAAA,uBAAuB,OAAA;AACvB,4GAAA,qBAAqB,OAAA;AACrB,4GAAA,qBAAqB,OAAA;AACrB,+GAAA,wBAAwB,OAAA;AACxB,wGAAA,iBAAiB,OAAA;AACjB,qGAAA,cAAc,OAAA;AACd,+GAAA,wBAAwB,OAAA;AACxB,sGAAA,eAAe,OAAA;AACf,qGAAA,cAAc,OAAA;AACd,4GAAA,qBAAqB,OAAA;AACrB,4FAAA,KAAK,OAAA;AACL,mHAAA,4BAA4B,OAAA;AAC5B,6GAAA,sBAAsB,OAAA;AACtB,4HAAA,qCAAqC,OAAA;AACrC,8GAAA,uBAAuB,OAAA;AACvB,+GAAA,wBAAwB,OAAA;AACxB,8GAAA,uBAAuB,OAAA;AACvB,+GAAA,wBAAwB,OAAA;AACxB,wHAAA,iCAAiC,OAAA;AACjC,qHAAA,8BAA8B,OAAA;AAC9B,kHAAA,2BAA2B,OAAA;AAC3B,6GAAA,sBAAsB,OAAA;AACtB,0GAAA,mBAAmB,OAAA;AACnB,6GAAA,sBAAsB,OAAA;AACtB,6GAAA,sBAAsB,OAAA;AACtB,qGAAA,cAAc,OAAA;AACd,uGAAA,gBAAgB,OAAA;AAChB,qGAAA,cAAc,OAAA;AACd,uGAAA,gBAAgB,OAAA;AAChB,8GAAA,uBAAuB,OAAA;AACvB,+GAAA,wBAAwB,OAAA;AACxB,wHAAA,iCAAiC,OAAA;AACjC,mHAAA,4BAA4B,OAAA;AAC5B,qHAAA,8BAA8B,OAAA;AAC9B,gHAAA,yBAAyB,OAAA;AACzB,+GAAA,wBAAwB,OAAA;AACxB,sHAAA,+BAA+B,OAAA;AAC/B,oGAAA,aAAa,OAAA;AACb,2GAAA,oBAAoB,OAAA;AACpB,4GAAA,qBAAqB,OAAA;AACrB,mGAAA,YAAY,OAAA;AACZ,yGAAA,kBAAkB,OAAA;AAClB,sGAAA,eAAe,OAAA;AACf,sGAAA,eAAe,OAAA;AACf,yGAAA,kBAAkB,OAAA;AAEpB,qEAI4C;AAH1C,iIAAA,+BAA+B,OAAA;AAC/B,+HAAA,6BAA6B,OAAA;AAC7B,0HAAA,wBAAwB,OAAA;AAG1B,+EAGiD;AAF/C,qIAAA,8BAA8B,OAAA;AAC9B,0HAAA,mBAAmB,OAAA;AAErB,0CAAwB;AACxB,0CAAwB","sourcesContent":["export * from \"../transceiverManager\";\nexport * from \"./codec\";\nexport * from \"./codecCompatibility\";\nexport * from \"./extension/rtcpFeedback\";\nexport * from \"./extension/rtpExtension\";\nexport * from \"./parameters\";\nexport * from \"./router\";\nexport * from \"./rtpReceiver\";\nexport * from \"./rtpSender\";\nexport * from \"./rtpTransceiver\";\nexport type {\n BandwidthEstimator,\n BandwidthEstimatorProcessor,\n CongestionEventsCompatibility,\n NetworkAvailabilityConsumer,\n ProbeClusterConfig,\n ProbePacingController,\n ProbeReservation,\n RoundTripTimeConsumer,\n SentInfo,\n} from \"./sender/bandwidthEstimator\";\nexport {\n BandwidthEstimatorNoopHooks,\n isBandwidthEstimatorProcessor,\n isNetworkAvailabilityConsumer,\n isProbePacingController,\n isRoundTripTimeConsumer,\n setAvailableBitrateIfChanged,\n} from \"./sender/bandwidthEstimator\";\nexport type {\n BandwidthEstimatorOption,\n BandwidthEstimatorPreset,\n} from \"./sender/createBandwidthEstimator\";\nexport { createBandwidthEstimator } from \"./sender/createBandwidthEstimator\";\nexport { DisabledBandwidthEstimator } from \"./sender/estimators/disabledBwe\";\nexport type {\n AckedPacketSample,\n BandwidthLimitedCause,\n BandwidthUsage,\n GccBandwidthEstimatorOptions,\n GccClock,\n LossBasedResult,\n LossBasedState,\n ProbeState,\n} from \"./sender/estimators/gcc\";\nexport {\n AcknowledgedBitrateEstimator,\n AimdRateControl,\n AlrDetector,\n BitrateEstimator,\n computeFeedbackRttStats,\n GCC_KNOWN_DIFFERENCES,\n GccBandwidthEstimator,\n getBandwidthLimitedCause,\n InterArrivalDelta,\n IntervalBudget,\n isProbeInitiationAllowed,\n isRttAboveLimit,\n kAlrProbeScale,\n kAlrProbingIntervalMs,\n kBeta,\n kDefaultMaxProbingBitrateBps,\n kDefaultPaceMultiplier,\n kDefaultPaceMultiplierWithSendSideBwe,\n kDefaultStartBitrateBps,\n kGoogCcProcessIntervalMs,\n kInitialMinProbeDeltaMs,\n kLossBasedIncreaseFactor,\n kLossBasedMedianSendingRateFactor,\n kLossBasedNotUseAckedRateInAlr,\n kLossBasedPaddingDurationMs,\n kLossDecreaseThreshold,\n kLossIncreaseFactor,\n kLossIncreaseThreshold,\n kLossLimitedProbeScale,\n kMaxBitrateBps,\n kMaxProbeDelayMs,\n kMinBitrateBps,\n kMinProbeDeltaMs,\n kProbeFractionAfterDrop,\n kProbePaddingPacketBytes,\n kRttBasedBackOffBandwidthFloorBps,\n kRttBasedBackOffDropFraction,\n kRttBasedBackOffDropIntervalMs,\n kRttBasedBackOffHighRttMs,\n kSendTimeHistoryWindowMs,\n kStartPhaseLossReportMinPackets,\n kStartPhaseMs,\n kTrendlineWindowSize,\n LinkCapacityEstimator,\n LossBasedBwe,\n maxProbeBitrateBps,\n ProbeController,\n RttBasedBackoff,\n TrendlineEstimator,\n} from \"./sender/estimators/gcc\";\nexport {\n isLightweightBandwidthEstimator,\n LightweightBandwidthEstimator,\n SenderBandwidthEstimator,\n} from \"./sender/estimators/lightweightBwe\";\nexport type { TwccPacketFeedback } from \"./sender/estimators/twccFeedbackAdapter\";\nexport {\n kTwccFeedbackHistoryMaxSeqSpan,\n TwccFeedbackAdapter,\n} from \"./sender/estimators/twccFeedbackAdapter\";\nexport * from \"./stats\";\nexport * from \"./track\";\n"]}
|
|
@@ -11,7 +11,7 @@ class NackHandler {
|
|
|
11
11
|
enumerable: true,
|
|
12
12
|
configurable: true,
|
|
13
13
|
writable: true,
|
|
14
|
-
value:
|
|
14
|
+
value: void 0
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(this, "newEstSeqNum", {
|
|
17
17
|
enumerable: true,
|
|
@@ -75,6 +75,7 @@ class NackHandler {
|
|
|
75
75
|
}
|
|
76
76
|
})
|
|
77
77
|
});
|
|
78
|
+
this.receiver = receiver;
|
|
78
79
|
}
|
|
79
80
|
get lostSeqNumbers() {
|
|
80
81
|
return Object.keys(this._lost).map(Number).sort();
|