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
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { Event } from "../../imports/common";
|
|
2
|
+
import type { TransportWideCC } from "../../imports/rtp";
|
|
3
|
+
/**
|
|
4
|
+
* Sent RTP packet observation used as input to send-side BWE algorithms.
|
|
5
|
+
* Transport-wide sequence numbers come from the shared DTLS transport clock.
|
|
6
|
+
*/
|
|
7
|
+
export interface SentInfo {
|
|
8
|
+
/**
|
|
9
|
+
* Transport-wide sequence: monotonic extended value from
|
|
10
|
+
* {@link RTCDtlsTransport.transportSequenceNumberExtended} (wire is low 16 bits).
|
|
11
|
+
*/
|
|
12
|
+
wideSeq: number;
|
|
13
|
+
/** Packet size in bytes (on-wire after SRTP when measured by the sender). */
|
|
14
|
+
size: number;
|
|
15
|
+
/** Optional flag for probe / probation packets used by some estimators (e.g. GCC). */
|
|
16
|
+
isProbation?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* pin `PacedPacketInfo.probe_cluster_id` reserved **before** send.
|
|
19
|
+
* ProbeController must attribute this packet to this cluster, not
|
|
20
|
+
* whatever is current when the async send completes.
|
|
21
|
+
*/
|
|
22
|
+
probeClusterId?: number;
|
|
23
|
+
/**
|
|
24
|
+
* pin `SentPacket.prior_unacked_data` — untracked bytes attributed to
|
|
25
|
+
* the next TWCC-tracked packet (RobustThroughputEstimator).
|
|
26
|
+
*/
|
|
27
|
+
priorUnackedBytes?: number;
|
|
28
|
+
/** True when this packet is an RTX / retransmission. */
|
|
29
|
+
isRetransmission?: boolean;
|
|
30
|
+
/** Wall-clock send time in milliseconds. */
|
|
31
|
+
sendingAtMs: number;
|
|
32
|
+
/** Wall-clock time when the send completed in milliseconds. */
|
|
33
|
+
sentAtMs: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Probe cluster the sender should temporarily aim for (padding / encoder ramp).
|
|
37
|
+
* GCC fires {@link BandwidthEstimator.onProbeClusterConfig} with this payload;
|
|
38
|
+
* lightweight / disabled estimators never emit it.
|
|
39
|
+
*/
|
|
40
|
+
export interface ProbeClusterConfig {
|
|
41
|
+
id: number;
|
|
42
|
+
/** Target bitrate the pacer / sender should temporarily aim for (bps). */
|
|
43
|
+
targetBps: number;
|
|
44
|
+
minPackets: number;
|
|
45
|
+
minDurationMs: number;
|
|
46
|
+
/** Minimum bytes expected for the cluster (for receive-ratio checks). */
|
|
47
|
+
minBytes: number;
|
|
48
|
+
/**
|
|
49
|
+
* pin `ProbeClusterConfig.min_probe_delta` (ms). Used for
|
|
50
|
+
* RecommendedMinProbeSize and stored on the BitrateProber cluster.
|
|
51
|
+
*/
|
|
52
|
+
minProbeDeltaMs: number;
|
|
53
|
+
/** pin `requested_at` — queue age for the 5s queued-cluster timeout. */
|
|
54
|
+
requestedAtMs: number;
|
|
55
|
+
}
|
|
56
|
+
/** Reservation taken **before** the async send (pin `CurrentCluster`). */
|
|
57
|
+
export interface ProbeReservation {
|
|
58
|
+
clusterId: number;
|
|
59
|
+
/** Next allowed send time (MinusInfinity → send immediately). */
|
|
60
|
+
nextSendTimeMs: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Common contract for send-side bandwidth estimators driven by TWCC feedback.
|
|
64
|
+
*
|
|
65
|
+
* TWCC I/O and recommended bitrate (`rtpPacketSent` / `receiveTWCC` /
|
|
66
|
+
* `availableBitrate` / `onAvailableBitrate`) are required. GCC also needs
|
|
67
|
+
* probe / pacing / RTT / process-interval hooks; those live on this same
|
|
68
|
+
* interface so {@link RTCRtpSender} does not import GCC. Lightweight and disabled
|
|
69
|
+
* estimators implement them as no-ops (`processIntervalMs === 0`, padding
|
|
70
|
+
* sizes 0, methods return false / 0 / undefined).
|
|
71
|
+
*/
|
|
72
|
+
export interface BandwidthEstimator {
|
|
73
|
+
/**
|
|
74
|
+
* Recommended / estimated available send bitrate in **bps**.
|
|
75
|
+
* May remain `0` until TWCC is negotiated and enough samples are collected.
|
|
76
|
+
*/
|
|
77
|
+
readonly availableBitrate: number;
|
|
78
|
+
/**
|
|
79
|
+
* Fires when the recommended send bitrate (**bps**) **changes**.
|
|
80
|
+
* Unit is always bits per second (bps). Change-only (not every recompute).
|
|
81
|
+
*/
|
|
82
|
+
readonly onAvailableBitrate: Event<[number]>;
|
|
83
|
+
/**
|
|
84
|
+
* Fires when a probe cluster is activated. Lightweight / disabled never fire.
|
|
85
|
+
*/
|
|
86
|
+
readonly onProbeClusterConfig: Event<[ProbeClusterConfig]>;
|
|
87
|
+
/** Record an outgoing RTP packet for later matching against TWCC feedback. */
|
|
88
|
+
rtpPacketSent(info: SentInfo): void;
|
|
89
|
+
/** Process a Transport-Wide CC RTCP feedback packet and update the estimate. */
|
|
90
|
+
receiveTWCC(feedback: TransportWideCC): void;
|
|
91
|
+
/** Clear internal history / estimates. */
|
|
92
|
+
reset?(): void;
|
|
93
|
+
/**
|
|
94
|
+
* The sender moved to another network route (DTLS transport): clear the
|
|
95
|
+
* path-dependent state (send history, TSN origin, estimates, probing) but
|
|
96
|
+
* keep application configuration such as bitrate constraints
|
|
97
|
+
* (pin `OnNetworkRouteChange`). {@link RTCRtpSender} falls back to
|
|
98
|
+
* {@link reset} when an estimator does not implement this.
|
|
99
|
+
*/
|
|
100
|
+
resetNetworkRoute?(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Release listeners / timers when the sender replaces the estimator.
|
|
103
|
+
* {@link RTCRtpSender} rebinds its stable `onAvailableBitrate` bridge after dispose.
|
|
104
|
+
*/
|
|
105
|
+
dispose?(): void;
|
|
106
|
+
/**
|
|
107
|
+
* Sender-clock process interval in milliseconds (pin GoogCc 25ms).
|
|
108
|
+
* `0` — do not run a process timer (lightweight / disabled).
|
|
109
|
+
*/
|
|
110
|
+
readonly processIntervalMs: number;
|
|
111
|
+
/**
|
|
112
|
+
* RTP padding size used when the sender injects probe / loss padding.
|
|
113
|
+
* `0` — do not inject padding (lightweight / disabled).
|
|
114
|
+
*/
|
|
115
|
+
readonly probePaddingPacketBytes: number;
|
|
116
|
+
/**
|
|
117
|
+
* Max padding packets per inner send burst. `0` when padding is disabled.
|
|
118
|
+
*/
|
|
119
|
+
readonly probePaddingMaxBurst: number;
|
|
120
|
+
/** Tag the next outgoing packet as a probe (`SentInfo.isProbation`). */
|
|
121
|
+
shouldTagProbePacket(): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Pacing target (bps) for the send engine.
|
|
124
|
+
* pin GetPacingRates: estimate × 2.5 before first TWCC, × 1.1 after,
|
|
125
|
+
* raised to the active probe target while probing.
|
|
126
|
+
* `0` — do not token-bucket pace (lightweight / disabled).
|
|
127
|
+
*/
|
|
128
|
+
getPacingBitrateBps(): number;
|
|
129
|
+
/**
|
|
130
|
+
* pin `BitrateProber::CurrentCluster` — reserve the active probe cluster
|
|
131
|
+
* **before** the packet is sent (not at send-complete callback).
|
|
132
|
+
*/
|
|
133
|
+
reserveOutgoingProbe(nowMs: number): ProbeReservation | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Number of padding packets the sender should inject to fill the active
|
|
136
|
+
* probe cluster when media alone is insufficient.
|
|
137
|
+
*/
|
|
138
|
+
pendingProbePaddingPackets(packetBytes?: number): number;
|
|
139
|
+
/**
|
|
140
|
+
* pin `GetPacingRates` padding_rate while loss-limited
|
|
141
|
+
* `kIncreaseUsingPadding`. 0 when not in that state.
|
|
142
|
+
*/
|
|
143
|
+
getPaddingBitrateBps(): number;
|
|
144
|
+
/**
|
|
145
|
+
* Padding packets to send to approach {@link getPaddingBitrateBps} when
|
|
146
|
+
* media is sparse. Not probe/probation packets.
|
|
147
|
+
*/
|
|
148
|
+
pendingLossPaddingPackets(packetBytes?: number): number;
|
|
149
|
+
/**
|
|
150
|
+
* Raw round-trip time in **milliseconds** (not TWCC propagation RTT).
|
|
151
|
+
* Pin GoogCc ignores smoothed RTT and only applies unsmoothed updates.
|
|
152
|
+
*/
|
|
153
|
+
setRoundTripTime(rttMs: number): void;
|
|
154
|
+
/** True when ICE/DTLS (or equivalent) can emit RTP. */
|
|
155
|
+
setNetworkAvailable(available: boolean): void;
|
|
156
|
+
/**
|
|
157
|
+
* Advance sender-clock estimator state at `nowMs` (milliseconds).
|
|
158
|
+
* Does not count as a sent packet — CorrectedRtt timeout only grows on
|
|
159
|
+
* `rtpPacketSent`.
|
|
160
|
+
*/
|
|
161
|
+
process(nowMs: number): void;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* GCC-oriented probe / pacing subset of {@link BandwidthEstimator}.
|
|
165
|
+
* Lightweight implements these as no-ops; use {@link isProbePacingController} to
|
|
166
|
+
* detect an estimator that actually injects probe padding.
|
|
167
|
+
*/
|
|
168
|
+
export type ProbePacingController = Pick<BandwidthEstimator, "shouldTagProbePacket" | "getPacingBitrateBps" | "reserveOutgoingProbe" | "pendingProbePaddingPackets" | "getPaddingBitrateBps" | "pendingLossPaddingPackets">;
|
|
169
|
+
/**
|
|
170
|
+
* True when the estimator actually drives probe padding (non-zero padding size).
|
|
171
|
+
* Lightweight / disabled no-ops return false.
|
|
172
|
+
*/
|
|
173
|
+
export declare function isProbePacingController(e: BandwidthEstimator): e is BandwidthEstimator & ProbePacingController;
|
|
174
|
+
/**
|
|
175
|
+
* True when the estimator needs the sender's paced send FIFO: a process
|
|
176
|
+
* timer (GCC) or probe padding. Lightweight / disabled return false, and
|
|
177
|
+
* {@link RTCRtpSender} then writes RTP straight through without consulting the
|
|
178
|
+
* pacing / probe hooks (same send path as before the BWE abstraction).
|
|
179
|
+
*/
|
|
180
|
+
export declare function needsPacedSendPath(e: BandwidthEstimator): boolean;
|
|
181
|
+
/** RTCP / network RTT consumer (pin OnRoundTripTimeUpdate). */
|
|
182
|
+
export type RoundTripTimeConsumer = Pick<BandwidthEstimator, "setRoundTripTime">;
|
|
183
|
+
/**
|
|
184
|
+
* True when the estimator consumes RTCP RTT for AIMD (non-zero process interval).
|
|
185
|
+
* Lightweight / disabled `setRoundTripTime` is a no-op.
|
|
186
|
+
*/
|
|
187
|
+
export declare function isRoundTripTimeConsumer(e: BandwidthEstimator): e is BandwidthEstimator & RoundTripTimeConsumer;
|
|
188
|
+
/** pin `OnNetworkAvailability` consumer. */
|
|
189
|
+
export type NetworkAvailabilityConsumer = Pick<BandwidthEstimator, "setNetworkAvailable">;
|
|
190
|
+
export declare function isNetworkAvailabilityConsumer(e: BandwidthEstimator): e is BandwidthEstimator & NetworkAvailabilityConsumer;
|
|
191
|
+
/** pin GoogCc `OnProcessInterval` surface. */
|
|
192
|
+
export type BandwidthEstimatorProcessor = Pick<BandwidthEstimator, "process">;
|
|
193
|
+
/** True when the sender should run a process timer (`processIntervalMs > 0`). */
|
|
194
|
+
export declare function isBandwidthEstimatorProcessor(e: BandwidthEstimator): e is BandwidthEstimator & BandwidthEstimatorProcessor;
|
|
195
|
+
/**
|
|
196
|
+
* Congestion events kept on every estimator instance so
|
|
197
|
+
* `sender.senderBWE.onCongestion` still type-checks after the BWE abstraction.
|
|
198
|
+
* Only {@link LightweightBandwidthEstimator} fires them; GCC / disabled are no-ops.
|
|
199
|
+
*
|
|
200
|
+
* Not part of {@link BandwidthEstimator}. Prefer a `LightweightBandwidthEstimator`
|
|
201
|
+
* assertion for new code. This surface may be removed in a future major.
|
|
202
|
+
*/
|
|
203
|
+
export type CongestionEventsCompatibility = {
|
|
204
|
+
/** @deprecated Lightweight-only. No-op on GCC / disabled. */
|
|
205
|
+
readonly onCongestion: Event<[boolean]>;
|
|
206
|
+
/** @deprecated Lightweight-only. No-op on GCC / disabled. */
|
|
207
|
+
readonly onCongestionScore: Event<[number]>;
|
|
208
|
+
/** @deprecated Lightweight-only. Always false on GCC / disabled. */
|
|
209
|
+
congestion: boolean;
|
|
210
|
+
/** @deprecated Lightweight-only. Always 1 on GCC / disabled. */
|
|
211
|
+
congestionScore: number;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Shared no-op implementations of GCC send-path hooks.
|
|
215
|
+
* {@link LightweightBandwidthEstimator} and {@link DisabledBandwidthEstimator} extend this.
|
|
216
|
+
*/
|
|
217
|
+
export declare abstract class BandwidthEstimatorNoopHooks {
|
|
218
|
+
readonly processIntervalMs = 0;
|
|
219
|
+
readonly probePaddingPacketBytes = 0;
|
|
220
|
+
readonly probePaddingMaxBurst = 0;
|
|
221
|
+
readonly onProbeClusterConfig: Event<[ProbeClusterConfig]>;
|
|
222
|
+
/** @deprecated No-op except on {@link LightweightBandwidthEstimator}. */
|
|
223
|
+
readonly onCongestion: Event<[boolean]>;
|
|
224
|
+
/** @deprecated No-op except on {@link LightweightBandwidthEstimator}. */
|
|
225
|
+
readonly onCongestionScore: Event<[number]>;
|
|
226
|
+
/** @deprecated Always false except on {@link LightweightBandwidthEstimator}. */
|
|
227
|
+
congestion: boolean;
|
|
228
|
+
protected _compatCongestionScore: number;
|
|
229
|
+
/** @deprecated Always 1 except on {@link LightweightBandwidthEstimator}. */
|
|
230
|
+
get congestionScore(): number;
|
|
231
|
+
shouldTagProbePacket(): boolean;
|
|
232
|
+
getPacingBitrateBps(): number;
|
|
233
|
+
reserveOutgoingProbe(_nowMs: number): ProbeReservation | undefined;
|
|
234
|
+
pendingProbePaddingPackets(_packetBytes?: number): number;
|
|
235
|
+
getPaddingBitrateBps(): number;
|
|
236
|
+
pendingLossPaddingPackets(_packetBytes?: number): number;
|
|
237
|
+
setRoundTripTime(_rttMs: number): void;
|
|
238
|
+
setNetworkAvailable(_available: boolean): void;
|
|
239
|
+
process(_nowMs: number): void;
|
|
240
|
+
protected disposeNoopHooks(): void;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Helper for concrete estimators: assign `availableBitrate` only when it changes
|
|
244
|
+
* and notify `onAvailableBitrate` with the new value in bps.
|
|
245
|
+
*/
|
|
246
|
+
export declare function setAvailableBitrateIfChanged(target: {
|
|
247
|
+
_availableBitrate: number;
|
|
248
|
+
onAvailableBitrate: Event<[number]>;
|
|
249
|
+
}, nextBps: number): boolean;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BandwidthEstimatorNoopHooks = void 0;
|
|
4
|
+
exports.isProbePacingController = isProbePacingController;
|
|
5
|
+
exports.needsPacedSendPath = needsPacedSendPath;
|
|
6
|
+
exports.isRoundTripTimeConsumer = isRoundTripTimeConsumer;
|
|
7
|
+
exports.isNetworkAvailabilityConsumer = isNetworkAvailabilityConsumer;
|
|
8
|
+
exports.isBandwidthEstimatorProcessor = isBandwidthEstimatorProcessor;
|
|
9
|
+
exports.setAvailableBitrateIfChanged = setAvailableBitrateIfChanged;
|
|
10
|
+
const common_1 = require("../../imports/common");
|
|
11
|
+
/**
|
|
12
|
+
* True when the estimator actually drives probe padding (non-zero padding size).
|
|
13
|
+
* Lightweight / disabled no-ops return false.
|
|
14
|
+
*/
|
|
15
|
+
function isProbePacingController(e) {
|
|
16
|
+
return e.probePaddingPacketBytes > 0;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* True when the estimator needs the sender's paced send FIFO: a process
|
|
20
|
+
* timer (GCC) or probe padding. Lightweight / disabled return false, and
|
|
21
|
+
* {@link RTCRtpSender} then writes RTP straight through without consulting the
|
|
22
|
+
* pacing / probe hooks (same send path as before the BWE abstraction).
|
|
23
|
+
*/
|
|
24
|
+
function needsPacedSendPath(e) {
|
|
25
|
+
return e.processIntervalMs > 0 || e.probePaddingPacketBytes > 0;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* True when the estimator consumes RTCP RTT for AIMD (non-zero process interval).
|
|
29
|
+
* Lightweight / disabled `setRoundTripTime` is a no-op.
|
|
30
|
+
*/
|
|
31
|
+
function isRoundTripTimeConsumer(e) {
|
|
32
|
+
return e.processIntervalMs > 0;
|
|
33
|
+
}
|
|
34
|
+
function isNetworkAvailabilityConsumer(e) {
|
|
35
|
+
return e.processIntervalMs > 0;
|
|
36
|
+
}
|
|
37
|
+
/** True when the sender should run a process timer (`processIntervalMs > 0`). */
|
|
38
|
+
function isBandwidthEstimatorProcessor(e) {
|
|
39
|
+
return e.processIntervalMs > 0;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Shared no-op implementations of GCC send-path hooks.
|
|
43
|
+
* {@link LightweightBandwidthEstimator} and {@link DisabledBandwidthEstimator} extend this.
|
|
44
|
+
*/
|
|
45
|
+
class BandwidthEstimatorNoopHooks {
|
|
46
|
+
constructor() {
|
|
47
|
+
Object.defineProperty(this, "processIntervalMs", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
configurable: true,
|
|
50
|
+
writable: true,
|
|
51
|
+
value: 0
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(this, "probePaddingPacketBytes", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
configurable: true,
|
|
56
|
+
writable: true,
|
|
57
|
+
value: 0
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(this, "probePaddingMaxBurst", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true,
|
|
62
|
+
writable: true,
|
|
63
|
+
value: 0
|
|
64
|
+
});
|
|
65
|
+
Object.defineProperty(this, "onProbeClusterConfig", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
configurable: true,
|
|
68
|
+
writable: true,
|
|
69
|
+
value: new common_1.Event()
|
|
70
|
+
});
|
|
71
|
+
/** @deprecated No-op except on {@link LightweightBandwidthEstimator}. */
|
|
72
|
+
Object.defineProperty(this, "onCongestion", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
configurable: true,
|
|
75
|
+
writable: true,
|
|
76
|
+
value: new common_1.Event()
|
|
77
|
+
});
|
|
78
|
+
/** @deprecated No-op except on {@link LightweightBandwidthEstimator}. */
|
|
79
|
+
Object.defineProperty(this, "onCongestionScore", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
configurable: true,
|
|
82
|
+
writable: true,
|
|
83
|
+
value: new common_1.Event()
|
|
84
|
+
});
|
|
85
|
+
/** @deprecated Always false except on {@link LightweightBandwidthEstimator}. */
|
|
86
|
+
Object.defineProperty(this, "congestion", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
configurable: true,
|
|
89
|
+
writable: true,
|
|
90
|
+
value: false
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(this, "_compatCongestionScore", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
configurable: true,
|
|
95
|
+
writable: true,
|
|
96
|
+
value: 1
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/** @deprecated Always 1 except on {@link LightweightBandwidthEstimator}. */
|
|
100
|
+
get congestionScore() {
|
|
101
|
+
return this._compatCongestionScore;
|
|
102
|
+
}
|
|
103
|
+
shouldTagProbePacket() {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
getPacingBitrateBps() {
|
|
107
|
+
return 0;
|
|
108
|
+
}
|
|
109
|
+
reserveOutgoingProbe(_nowMs) {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
pendingProbePaddingPackets(_packetBytes) {
|
|
113
|
+
return 0;
|
|
114
|
+
}
|
|
115
|
+
getPaddingBitrateBps() {
|
|
116
|
+
return 0;
|
|
117
|
+
}
|
|
118
|
+
pendingLossPaddingPackets(_packetBytes) {
|
|
119
|
+
return 0;
|
|
120
|
+
}
|
|
121
|
+
setRoundTripTime(_rttMs) { }
|
|
122
|
+
setNetworkAvailable(_available) { }
|
|
123
|
+
process(_nowMs) { }
|
|
124
|
+
disposeNoopHooks() {
|
|
125
|
+
this.onProbeClusterConfig.allUnsubscribe();
|
|
126
|
+
this.onCongestion.allUnsubscribe();
|
|
127
|
+
this.onCongestionScore.allUnsubscribe();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.BandwidthEstimatorNoopHooks = BandwidthEstimatorNoopHooks;
|
|
131
|
+
/**
|
|
132
|
+
* Helper for concrete estimators: assign `availableBitrate` only when it changes
|
|
133
|
+
* and notify `onAvailableBitrate` with the new value in bps.
|
|
134
|
+
*/
|
|
135
|
+
function setAvailableBitrateIfChanged(target, nextBps) {
|
|
136
|
+
const v = Math.max(0, Math.round(nextBps));
|
|
137
|
+
if (v === target._availableBitrate) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
target._availableBitrate = v;
|
|
141
|
+
target.onAvailableBitrate.execute(v);
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=bandwidthEstimator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bandwidthEstimator.js","sourceRoot":"","sources":["../../../../../src/media/sender/bandwidthEstimator.ts"],"names":[],"mappings":";;;AA6MA,0DAIC;AAQD,gDAEC;AAYD,0DAIC;AAQD,sEAIC;AAMD,sEAIC;AAmFD,oEAcC;AAlWD,iDAA6C;AAyM7C;;;GAGG;AACH,SAAgB,uBAAuB,CACrC,CAAqB;IAErB,OAAO,CAAC,CAAC,uBAAuB,GAAG,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,CAAqB;IACtD,OAAO,CAAC,CAAC,iBAAiB,GAAG,CAAC,IAAI,CAAC,CAAC,uBAAuB,GAAG,CAAC,CAAC;AAClE,CAAC;AAQD;;;GAGG;AACH,SAAgB,uBAAuB,CACrC,CAAqB;IAErB,OAAO,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC;AACjC,CAAC;AAQD,SAAgB,6BAA6B,CAC3C,CAAqB;IAErB,OAAO,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC;AACjC,CAAC;AAKD,iFAAiF;AACjF,SAAgB,6BAA6B,CAC3C,CAAqB;IAErB,OAAO,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC;AACjC,CAAC;AAqBD;;;GAGG;AACH,MAAsB,2BAA2B;IAAjD;QACW;;;;mBAAoB,CAAC;WAAC;QACtB;;;;mBAA0B,CAAC;WAAC;QAC5B;;;;mBAAuB,CAAC;WAAC;QACzB;;;;mBAAuB,IAAI,cAAK,EAAwB;WAAC;QAClE,yEAAyE;QAChE;;;;mBAAe,IAAI,cAAK,EAAa;WAAC;QAC/C,yEAAyE;QAChE;;;;mBAAoB,IAAI,cAAK,EAAY;WAAC;QACnD,gFAAgF;QAChF;;;;mBAAa,KAAK;WAAC;QACT;;;;mBAAyB,CAAC;WAAC;IAyCvC,CAAC;IAxCC,4EAA4E;IAC5E,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACrC,CAAC;IAED,oBAAoB;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,mBAAmB;QACjB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,oBAAoB,CAAC,MAAc;QACjC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,0BAA0B,CAAC,YAAqB;QAC9C,OAAO,CAAC,CAAC;IACX,CAAC;IAED,oBAAoB;QAClB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,yBAAyB,CAAC,YAAqB;QAC7C,OAAO,CAAC,CAAC;IACX,CAAC;IAED,gBAAgB,CAAC,MAAc,IAAS,CAAC;IAEzC,mBAAmB,CAAC,UAAmB,IAAS,CAAC;IAEjD,OAAO,CAAC,MAAc,IAAS,CAAC;IAEtB,gBAAgB;QACxB,IAAI,CAAC,oBAAoB,CAAC,cAAc,EAAE,CAAC;QAC3C,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC;QACnC,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,CAAC;IAC1C,CAAC;CACF;AApDD,kEAoDC;AAED;;;GAGG;AACH,SAAgB,4BAA4B,CAC1C,MAGC,EACD,OAAe;IAEf,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,CAAC,iBAAiB,GAAG,CAAC,CAAC;IAC7B,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACrC,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { Event } from \"../../imports/common\";\nimport type { TransportWideCC } from \"../../imports/rtp\";\n\n/**\n * Sent RTP packet observation used as input to send-side BWE algorithms.\n * Transport-wide sequence numbers come from the shared DTLS transport clock.\n */\nexport interface SentInfo {\n /**\n * Transport-wide sequence: monotonic extended value from\n * {@link RTCDtlsTransport.transportSequenceNumberExtended} (wire is low 16 bits).\n */\n wideSeq: number;\n /** Packet size in bytes (on-wire after SRTP when measured by the sender). */\n size: number;\n /** Optional flag for probe / probation packets used by some estimators (e.g. GCC). */\n isProbation?: boolean;\n /**\n * pin `PacedPacketInfo.probe_cluster_id` reserved **before** send.\n * ProbeController must attribute this packet to this cluster, not\n * whatever is current when the async send completes.\n */\n probeClusterId?: number;\n /**\n * pin `SentPacket.prior_unacked_data` — untracked bytes attributed to\n * the next TWCC-tracked packet (RobustThroughputEstimator).\n */\n priorUnackedBytes?: number;\n /** True when this packet is an RTX / retransmission. */\n isRetransmission?: boolean;\n /** Wall-clock send time in milliseconds. */\n sendingAtMs: number;\n /** Wall-clock time when the send completed in milliseconds. */\n sentAtMs: number;\n}\n\n/**\n * Probe cluster the sender should temporarily aim for (padding / encoder ramp).\n * GCC fires {@link BandwidthEstimator.onProbeClusterConfig} with this payload;\n * lightweight / disabled estimators never emit it.\n */\nexport interface ProbeClusterConfig {\n id: number;\n /** Target bitrate the pacer / sender should temporarily aim for (bps). */\n targetBps: number;\n minPackets: number;\n minDurationMs: number;\n /** Minimum bytes expected for the cluster (for receive-ratio checks). */\n minBytes: number;\n /**\n * pin `ProbeClusterConfig.min_probe_delta` (ms). Used for\n * RecommendedMinProbeSize and stored on the BitrateProber cluster.\n */\n minProbeDeltaMs: number;\n /** pin `requested_at` — queue age for the 5s queued-cluster timeout. */\n requestedAtMs: number;\n}\n\n/** Reservation taken **before** the async send (pin `CurrentCluster`). */\nexport interface ProbeReservation {\n clusterId: number;\n /** Next allowed send time (MinusInfinity → send immediately). */\n nextSendTimeMs: number;\n}\n\n/**\n * Common contract for send-side bandwidth estimators driven by TWCC feedback.\n *\n * TWCC I/O and recommended bitrate (`rtpPacketSent` / `receiveTWCC` /\n * `availableBitrate` / `onAvailableBitrate`) are required. GCC also needs\n * probe / pacing / RTT / process-interval hooks; those live on this same\n * interface so {@link RTCRtpSender} does not import GCC. Lightweight and disabled\n * estimators implement them as no-ops (`processIntervalMs === 0`, padding\n * sizes 0, methods return false / 0 / undefined).\n */\nexport interface BandwidthEstimator {\n /**\n * Recommended / estimated available send bitrate in **bps**.\n * May remain `0` until TWCC is negotiated and enough samples are collected.\n */\n readonly availableBitrate: number;\n\n /**\n * Fires when the recommended send bitrate (**bps**) **changes**.\n * Unit is always bits per second (bps). Change-only (not every recompute).\n */\n readonly onAvailableBitrate: Event<[number]>;\n\n /**\n * Fires when a probe cluster is activated. Lightweight / disabled never fire.\n */\n readonly onProbeClusterConfig: Event<[ProbeClusterConfig]>;\n\n /** Record an outgoing RTP packet for later matching against TWCC feedback. */\n rtpPacketSent(info: SentInfo): void;\n\n /** Process a Transport-Wide CC RTCP feedback packet and update the estimate. */\n receiveTWCC(feedback: TransportWideCC): void;\n\n /** Clear internal history / estimates. */\n reset?(): void;\n\n /**\n * The sender moved to another network route (DTLS transport): clear the\n * path-dependent state (send history, TSN origin, estimates, probing) but\n * keep application configuration such as bitrate constraints\n * (pin `OnNetworkRouteChange`). {@link RTCRtpSender} falls back to\n * {@link reset} when an estimator does not implement this.\n */\n resetNetworkRoute?(): void;\n\n /**\n * Release listeners / timers when the sender replaces the estimator.\n * {@link RTCRtpSender} rebinds its stable `onAvailableBitrate` bridge after dispose.\n */\n dispose?(): void;\n\n /**\n * Sender-clock process interval in milliseconds (pin GoogCc 25ms).\n * `0` — do not run a process timer (lightweight / disabled).\n */\n readonly processIntervalMs: number;\n\n /**\n * RTP padding size used when the sender injects probe / loss padding.\n * `0` — do not inject padding (lightweight / disabled).\n */\n readonly probePaddingPacketBytes: number;\n\n /**\n * Max padding packets per inner send burst. `0` when padding is disabled.\n */\n readonly probePaddingMaxBurst: number;\n\n /** Tag the next outgoing packet as a probe (`SentInfo.isProbation`). */\n shouldTagProbePacket(): boolean;\n\n /**\n * Pacing target (bps) for the send engine.\n * pin GetPacingRates: estimate × 2.5 before first TWCC, × 1.1 after,\n * raised to the active probe target while probing.\n * `0` — do not token-bucket pace (lightweight / disabled).\n */\n getPacingBitrateBps(): number;\n\n /**\n * pin `BitrateProber::CurrentCluster` — reserve the active probe cluster\n * **before** the packet is sent (not at send-complete callback).\n */\n reserveOutgoingProbe(nowMs: number): ProbeReservation | undefined;\n\n /**\n * Number of padding packets the sender should inject to fill the active\n * probe cluster when media alone is insufficient.\n */\n pendingProbePaddingPackets(packetBytes?: number): number;\n\n /**\n * pin `GetPacingRates` padding_rate while loss-limited\n * `kIncreaseUsingPadding`. 0 when not in that state.\n */\n getPaddingBitrateBps(): number;\n\n /**\n * Padding packets to send to approach {@link getPaddingBitrateBps} when\n * media is sparse. Not probe/probation packets.\n */\n pendingLossPaddingPackets(packetBytes?: number): number;\n\n /**\n * Raw round-trip time in **milliseconds** (not TWCC propagation RTT).\n * Pin GoogCc ignores smoothed RTT and only applies unsmoothed updates.\n */\n setRoundTripTime(rttMs: number): void;\n\n /** True when ICE/DTLS (or equivalent) can emit RTP. */\n setNetworkAvailable(available: boolean): void;\n\n /**\n * Advance sender-clock estimator state at `nowMs` (milliseconds).\n * Does not count as a sent packet — CorrectedRtt timeout only grows on\n * `rtpPacketSent`.\n */\n process(nowMs: number): void;\n}\n\n/**\n * GCC-oriented probe / pacing subset of {@link BandwidthEstimator}.\n * Lightweight implements these as no-ops; use {@link isProbePacingController} to\n * detect an estimator that actually injects probe padding.\n */\nexport type ProbePacingController = Pick<\n BandwidthEstimator,\n | \"shouldTagProbePacket\"\n | \"getPacingBitrateBps\"\n | \"reserveOutgoingProbe\"\n | \"pendingProbePaddingPackets\"\n | \"getPaddingBitrateBps\"\n | \"pendingLossPaddingPackets\"\n>;\n\n/**\n * True when the estimator actually drives probe padding (non-zero padding size).\n * Lightweight / disabled no-ops return false.\n */\nexport function isProbePacingController(\n e: BandwidthEstimator,\n): e is BandwidthEstimator & ProbePacingController {\n return e.probePaddingPacketBytes > 0;\n}\n\n/**\n * True when the estimator needs the sender's paced send FIFO: a process\n * timer (GCC) or probe padding. Lightweight / disabled return false, and\n * {@link RTCRtpSender} then writes RTP straight through without consulting the\n * pacing / probe hooks (same send path as before the BWE abstraction).\n */\nexport function needsPacedSendPath(e: BandwidthEstimator): boolean {\n return e.processIntervalMs > 0 || e.probePaddingPacketBytes > 0;\n}\n\n/** RTCP / network RTT consumer (pin OnRoundTripTimeUpdate). */\nexport type RoundTripTimeConsumer = Pick<\n BandwidthEstimator,\n \"setRoundTripTime\"\n>;\n\n/**\n * True when the estimator consumes RTCP RTT for AIMD (non-zero process interval).\n * Lightweight / disabled `setRoundTripTime` is a no-op.\n */\nexport function isRoundTripTimeConsumer(\n e: BandwidthEstimator,\n): e is BandwidthEstimator & RoundTripTimeConsumer {\n return e.processIntervalMs > 0;\n}\n\n/** pin `OnNetworkAvailability` consumer. */\nexport type NetworkAvailabilityConsumer = Pick<\n BandwidthEstimator,\n \"setNetworkAvailable\"\n>;\n\nexport function isNetworkAvailabilityConsumer(\n e: BandwidthEstimator,\n): e is BandwidthEstimator & NetworkAvailabilityConsumer {\n return e.processIntervalMs > 0;\n}\n\n/** pin GoogCc `OnProcessInterval` surface. */\nexport type BandwidthEstimatorProcessor = Pick<BandwidthEstimator, \"process\">;\n\n/** True when the sender should run a process timer (`processIntervalMs > 0`). */\nexport function isBandwidthEstimatorProcessor(\n e: BandwidthEstimator,\n): e is BandwidthEstimator & BandwidthEstimatorProcessor {\n return e.processIntervalMs > 0;\n}\n\n/**\n * Congestion events kept on every estimator instance so\n * `sender.senderBWE.onCongestion` still type-checks after the BWE abstraction.\n * Only {@link LightweightBandwidthEstimator} fires them; GCC / disabled are no-ops.\n *\n * Not part of {@link BandwidthEstimator}. Prefer a `LightweightBandwidthEstimator`\n * assertion for new code. This surface may be removed in a future major.\n */\nexport type CongestionEventsCompatibility = {\n /** @deprecated Lightweight-only. No-op on GCC / disabled. */\n readonly onCongestion: Event<[boolean]>;\n /** @deprecated Lightweight-only. No-op on GCC / disabled. */\n readonly onCongestionScore: Event<[number]>;\n /** @deprecated Lightweight-only. Always false on GCC / disabled. */\n congestion: boolean;\n /** @deprecated Lightweight-only. Always 1 on GCC / disabled. */\n congestionScore: number;\n};\n\n/**\n * Shared no-op implementations of GCC send-path hooks.\n * {@link LightweightBandwidthEstimator} and {@link DisabledBandwidthEstimator} extend this.\n */\nexport abstract class BandwidthEstimatorNoopHooks {\n readonly processIntervalMs = 0;\n readonly probePaddingPacketBytes = 0;\n readonly probePaddingMaxBurst = 0;\n readonly onProbeClusterConfig = new Event<[ProbeClusterConfig]>();\n /** @deprecated No-op except on {@link LightweightBandwidthEstimator}. */\n readonly onCongestion = new Event<[boolean]>();\n /** @deprecated No-op except on {@link LightweightBandwidthEstimator}. */\n readonly onCongestionScore = new Event<[number]>();\n /** @deprecated Always false except on {@link LightweightBandwidthEstimator}. */\n congestion = false;\n protected _compatCongestionScore = 1;\n /** @deprecated Always 1 except on {@link LightweightBandwidthEstimator}. */\n get congestionScore() {\n return this._compatCongestionScore;\n }\n\n shouldTagProbePacket(): boolean {\n return false;\n }\n\n getPacingBitrateBps(): number {\n return 0;\n }\n\n reserveOutgoingProbe(_nowMs: number): ProbeReservation | undefined {\n return undefined;\n }\n\n pendingProbePaddingPackets(_packetBytes?: number): number {\n return 0;\n }\n\n getPaddingBitrateBps(): number {\n return 0;\n }\n\n pendingLossPaddingPackets(_packetBytes?: number): number {\n return 0;\n }\n\n setRoundTripTime(_rttMs: number): void {}\n\n setNetworkAvailable(_available: boolean): void {}\n\n process(_nowMs: number): void {}\n\n protected disposeNoopHooks(): void {\n this.onProbeClusterConfig.allUnsubscribe();\n this.onCongestion.allUnsubscribe();\n this.onCongestionScore.allUnsubscribe();\n }\n}\n\n/**\n * Helper for concrete estimators: assign `availableBitrate` only when it changes\n * and notify `onAvailableBitrate` with the new value in bps.\n */\nexport function setAvailableBitrateIfChanged(\n target: {\n _availableBitrate: number;\n onAvailableBitrate: Event<[number]>;\n },\n nextBps: number,\n): boolean {\n const v = Math.max(0, Math.round(nextBps));\n if (v === target._availableBitrate) {\n return false;\n }\n target._availableBitrate = v;\n target.onAvailableBitrate.execute(v);\n return true;\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { BandwidthEstimator } from "./bandwidthEstimator";
|
|
2
|
+
/**
|
|
3
|
+
* Named presets for {@link PeerConfig.bandwidthEstimator}.
|
|
4
|
+
* `"lightweight"` is the default (the existing estimator, backward compatible).
|
|
5
|
+
*/
|
|
6
|
+
export type BandwidthEstimatorPreset = "lightweight" | "gcc" | "none";
|
|
7
|
+
/**
|
|
8
|
+
* How a new {@link RTCRtpSender} obtains its {@link BandwidthEstimator}.
|
|
9
|
+
*
|
|
10
|
+
* - `"lightweight"` (default): {@link LightweightBandwidthEstimator}
|
|
11
|
+
* - `"gcc"`: {@link GccBandwidthEstimator}
|
|
12
|
+
* - `false` / `"none"`: {@link DisabledBandwidthEstimator}
|
|
13
|
+
* - factory: called **once per sender** (do not share one instance)
|
|
14
|
+
*/
|
|
15
|
+
export type BandwidthEstimatorOption = BandwidthEstimatorPreset | false | (() => BandwidthEstimator);
|
|
16
|
+
/**
|
|
17
|
+
* Construct a send-side estimator from a {@link BandwidthEstimatorOption}.
|
|
18
|
+
* Each {@link RTCRtpSender} must get its own instance.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createBandwidthEstimator(option?: BandwidthEstimatorOption | undefined): BandwidthEstimator;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBandwidthEstimator = createBandwidthEstimator;
|
|
4
|
+
const disabledBwe_1 = require("./estimators/disabledBwe");
|
|
5
|
+
const gccBwe_1 = require("./estimators/gcc/gccBwe");
|
|
6
|
+
const lightweightBwe_1 = require("./estimators/lightweightBwe");
|
|
7
|
+
/**
|
|
8
|
+
* Construct a send-side estimator from a {@link BandwidthEstimatorOption}.
|
|
9
|
+
* Each {@link RTCRtpSender} must get its own instance.
|
|
10
|
+
*/
|
|
11
|
+
function createBandwidthEstimator(option = "lightweight") {
|
|
12
|
+
if (option === undefined || option === "lightweight") {
|
|
13
|
+
return new lightweightBwe_1.LightweightBandwidthEstimator();
|
|
14
|
+
}
|
|
15
|
+
if (option === false || option === "none") {
|
|
16
|
+
return new disabledBwe_1.DisabledBandwidthEstimator();
|
|
17
|
+
}
|
|
18
|
+
if (option === "gcc") {
|
|
19
|
+
return new gccBwe_1.GccBandwidthEstimator();
|
|
20
|
+
}
|
|
21
|
+
if (typeof option === "function") {
|
|
22
|
+
return option();
|
|
23
|
+
}
|
|
24
|
+
throw new TypeError(`unsupported bandwidthEstimator option: ${String(option)}`);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=createBandwidthEstimator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createBandwidthEstimator.js","sourceRoot":"","sources":["../../../../../src/media/sender/createBandwidthEstimator.ts"],"names":[],"mappings":";;AA4BA,4DAkBC;AA7CD,0DAAsE;AACtE,oDAAgE;AAChE,gEAA4E;AAqB5E;;;GAGG;AACH,SAAgB,wBAAwB,CACtC,SAA+C,aAAa;IAE5D,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,aAAa,EAAE,CAAC;QACrD,OAAO,IAAI,8CAA6B,EAAE,CAAC;IAC7C,CAAC;IACD,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QAC1C,OAAO,IAAI,wCAA0B,EAAE,CAAC;IAC1C,CAAC;IACD,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,IAAI,8BAAqB,EAAE,CAAC;IACrC,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,OAAO,MAAM,EAAE,CAAC;IAClB,CAAC;IACD,MAAM,IAAI,SAAS,CACjB,0CAA0C,MAAM,CAAC,MAAM,CAAC,EAAE,CAC3D,CAAC;AACJ,CAAC","sourcesContent":["import type { BandwidthEstimator } from \"./bandwidthEstimator\";\nimport { DisabledBandwidthEstimator } from \"./estimators/disabledBwe\";\nimport { GccBandwidthEstimator } from \"./estimators/gcc/gccBwe\";\nimport { LightweightBandwidthEstimator } from \"./estimators/lightweightBwe\";\n\n/**\n * Named presets for {@link PeerConfig.bandwidthEstimator}.\n * `\"lightweight\"` is the default (the existing estimator, backward compatible).\n */\nexport type BandwidthEstimatorPreset = \"lightweight\" | \"gcc\" | \"none\";\n\n/**\n * How a new {@link RTCRtpSender} obtains its {@link BandwidthEstimator}.\n *\n * - `\"lightweight\"` (default): {@link LightweightBandwidthEstimator}\n * - `\"gcc\"`: {@link GccBandwidthEstimator}\n * - `false` / `\"none\"`: {@link DisabledBandwidthEstimator}\n * - factory: called **once per sender** (do not share one instance)\n */\nexport type BandwidthEstimatorOption =\n | BandwidthEstimatorPreset\n | false\n | (() => BandwidthEstimator);\n\n/**\n * Construct a send-side estimator from a {@link BandwidthEstimatorOption}.\n * Each {@link RTCRtpSender} must get its own instance.\n */\nexport function createBandwidthEstimator(\n option: BandwidthEstimatorOption | undefined = \"lightweight\",\n): BandwidthEstimator {\n if (option === undefined || option === \"lightweight\") {\n return new LightweightBandwidthEstimator();\n }\n if (option === false || option === \"none\") {\n return new DisabledBandwidthEstimator();\n }\n if (option === \"gcc\") {\n return new GccBandwidthEstimator();\n }\n if (typeof option === \"function\") {\n return option();\n }\n throw new TypeError(\n `unsupported bandwidthEstimator option: ${String(option)}`,\n );\n}\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { BandwidthEstimator, ProbeClusterConfig } from "./bandwidthEstimator";
|
|
2
|
+
/** What the binding reports back to its {@link RTCRtpSender}. */
|
|
3
|
+
export type EstimatorBindingHooks = {
|
|
4
|
+
/** The active estimator changed its recommended bitrate (bps). */
|
|
5
|
+
onAvailableBitrate: (bps: number) => void;
|
|
6
|
+
/** The active estimator activated a probe cluster. */
|
|
7
|
+
onProbeClusterConfig: (cfg: ProbeClusterConfig) => void;
|
|
8
|
+
/** After each process tick (pin GetPacingRates padding_rate). */
|
|
9
|
+
onProcessTick: () => void;
|
|
10
|
+
/** The sender is stopped: the process timer neither starts nor ticks. */
|
|
11
|
+
isStopped: () => boolean;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The send-side bandwidth estimator of one {@link RTCRtpSender} and
|
|
15
|
+
* everything tied to its lifetime: the event bridges to the sender, the
|
|
16
|
+
* process timer, and the **generation**.
|
|
17
|
+
*
|
|
18
|
+
* The generation is bumped whenever the estimator is replaced, reset for a
|
|
19
|
+
* new transport, or the sender stops. A send or padding drain captures it at
|
|
20
|
+
* start and drops its estimator delivery when it no longer matches, so a
|
|
21
|
+
* packet planned under the old estimator cannot pollute the new clean one or
|
|
22
|
+
* revive a disposed probe controller. {@link generationSignal} aborts at the
|
|
23
|
+
* same moment to release waits running at the old estimator's rate.
|
|
24
|
+
*/
|
|
25
|
+
export declare class EstimatorBinding {
|
|
26
|
+
private readonly hooks;
|
|
27
|
+
private current;
|
|
28
|
+
private _generation;
|
|
29
|
+
private generationCancel;
|
|
30
|
+
private unsubscribeAvailableBitrate?;
|
|
31
|
+
private unsubscribeProbeClusterConfig?;
|
|
32
|
+
/** Interval from {@link BandwidthEstimator.processIntervalMs} (0 = none). */
|
|
33
|
+
private processTimer?;
|
|
34
|
+
constructor(initial: BandwidthEstimator, hooks: EstimatorBindingHooks);
|
|
35
|
+
get estimator(): BandwidthEstimator;
|
|
36
|
+
get generation(): number;
|
|
37
|
+
/** Aborted on the next generation bump. */
|
|
38
|
+
get generationSignal(): AbortSignal;
|
|
39
|
+
/** Invalidate sends planned under the current estimator and release their waits. */
|
|
40
|
+
bumpGeneration(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Make `impl` the active estimator with a clean state: bump the
|
|
43
|
+
* generation, release the previous instance (`dispose()`, else `reset()`)
|
|
44
|
+
* and always `reset()` `impl`, so a previously used instance does not merge
|
|
45
|
+
* old state. The same instance is only reset.
|
|
46
|
+
*/
|
|
47
|
+
replace(impl: BandwidthEstimator): void;
|
|
48
|
+
/**
|
|
49
|
+
* A new DTLS transport has its own transport-wide sequence space and path
|
|
50
|
+
* (pin `OnNetworkRouteChanged` resets the controller): drop the path state
|
|
51
|
+
* and keep app-configured constraints
|
|
52
|
+
* ({@link BandwidthEstimator.resetNetworkRoute}, else `reset()`).
|
|
53
|
+
*/
|
|
54
|
+
resetForNewRoute(): void;
|
|
55
|
+
/**
|
|
56
|
+
* pin `OnNetworkAvailability` — initial probes wait until DTLS can send.
|
|
57
|
+
* Lightweight / disabled no-op `setNetworkAvailable`.
|
|
58
|
+
*/
|
|
59
|
+
syncNetworkAvailability(connected: boolean): void;
|
|
60
|
+
/**
|
|
61
|
+
* (Re)start the process timer for the active estimator (pin
|
|
62
|
+
* `GoogCcNetworkControllerFactory::GetProcessInterval`).
|
|
63
|
+
*/
|
|
64
|
+
syncProcessTimer(): void;
|
|
65
|
+
/** Sender stop: no timer, no bridges, estimator released. */
|
|
66
|
+
close(): void;
|
|
67
|
+
private stopProcessTimer;
|
|
68
|
+
private bind;
|
|
69
|
+
private unbind;
|
|
70
|
+
}
|