werift 0.25.2 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -0
- package/THIRD_PARTY_LICENSES_LIBWEBRTC.txt +58 -0
- package/lib/common/src/asn1.d.ts +42 -0
- package/lib/common/src/asn1.js +163 -0
- package/lib/common/src/asn1.js.map +1 -0
- package/lib/common/src/binary.d.ts +1 -3
- package/lib/common/src/binary.js +8 -6
- package/lib/common/src/binary.js.map +1 -1
- package/lib/common/src/binaryData.js +2 -1
- package/lib/common/src/binaryData.js.map +1 -1
- package/lib/common/src/index.d.ts +6 -5
- package/lib/common/src/index.js +6 -5
- package/lib/common/src/index.js.map +1 -1
- package/lib/common/src/log.d.ts +12 -1
- package/lib/common/src/log.js +142 -12
- package/lib/common/src/log.js.map +1 -1
- package/lib/common/src/network.js.map +1 -1
- package/lib/common/src/queue.d.ts +41 -0
- package/lib/common/src/queue.js +146 -0
- package/lib/common/src/queue.js.map +1 -0
- package/lib/common/src/transport.d.ts +15 -2
- package/lib/common/src/transport.js +108 -19
- package/lib/common/src/transport.js.map +1 -1
- package/lib/dtls/src/cipher/create.js.map +1 -1
- package/lib/dtls/src/cipher/ec.js +8 -8
- package/lib/dtls/src/cipher/ec.js.map +1 -1
- package/lib/dtls/src/cipher/namedCurve.js +6 -7
- package/lib/dtls/src/cipher/namedCurve.js.map +1 -1
- package/lib/dtls/src/cipher/prf.d.ts +2 -2
- package/lib/dtls/src/cipher/prf.js +29 -8
- package/lib/dtls/src/cipher/prf.js.map +1 -1
- package/lib/dtls/src/cipher/suites/aead.d.ts +1 -1
- package/lib/dtls/src/context/certificate.d.ts +32 -0
- package/lib/dtls/src/context/certificate.js +54 -0
- package/lib/dtls/src/context/certificate.js.map +1 -0
- package/lib/dtls/src/context/cipher.d.ts +13 -7
- package/lib/dtls/src/context/cipher.js +58 -106
- package/lib/dtls/src/context/cipher.js.map +1 -1
- package/lib/dtls/src/context/dtls.js +4 -2
- package/lib/dtls/src/context/dtls.js.map +1 -1
- package/lib/dtls/src/context/transport.d.ts +4 -0
- package/lib/dtls/src/context/transport.js +16 -1
- package/lib/dtls/src/context/transport.js.map +1 -1
- package/lib/dtls/src/flight/client/flight1.js +2 -1
- package/lib/dtls/src/flight/client/flight1.js.map +1 -1
- package/lib/dtls/src/flight/client/flight5.js +4 -2
- package/lib/dtls/src/flight/client/flight5.js.map +1 -1
- package/lib/dtls/src/flight/flight.d.ts +1 -1
- package/lib/dtls/src/flight/flight.js +16 -5
- package/lib/dtls/src/flight/flight.js.map +1 -1
- package/lib/dtls/src/flight/server/flight2.js.map +1 -1
- package/lib/dtls/src/flight/server/flight4.d.ts +2 -1
- package/lib/dtls/src/flight/server/flight4.js +12 -4
- package/lib/dtls/src/flight/server/flight4.js.map +1 -1
- package/lib/dtls/src/flight/server/flight6.js +2 -1
- package/lib/dtls/src/flight/server/flight6.js.map +1 -1
- package/lib/dtls/src/handshake/const.d.ts +17 -13
- package/lib/dtls/src/handshake/const.js +16 -14
- package/lib/dtls/src/handshake/const.js.map +1 -1
- package/lib/dtls/src/handshake/extensions/signature.d.ts +1 -1
- package/lib/dtls/src/handshake/extensions/signature.js.map +1 -1
- package/lib/dtls/src/handshake/message/alert.js +5 -3
- package/lib/dtls/src/handshake/message/alert.js.map +1 -1
- package/lib/dtls/src/handshake/message/certificate.js +3 -2
- package/lib/dtls/src/handshake/message/certificate.js.map +1 -1
- package/lib/dtls/src/handshake/message/changeCipherSpec.js +4 -4
- package/lib/dtls/src/handshake/message/changeCipherSpec.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/certificateVerify.d.ts +1 -1
- package/lib/dtls/src/handshake/message/client/certificateVerify.js +5 -3
- package/lib/dtls/src/handshake/message/client/certificateVerify.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/hello.js +15 -8
- package/lib/dtls/src/handshake/message/client/hello.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/keyExchange.js +3 -2
- package/lib/dtls/src/handshake/message/client/keyExchange.js.map +1 -1
- package/lib/dtls/src/handshake/message/finished.js +2 -1
- package/lib/dtls/src/handshake/message/finished.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/certificateRequest.d.ts +1 -1
- package/lib/dtls/src/handshake/message/server/certificateRequest.js +7 -4
- package/lib/dtls/src/handshake/message/server/certificateRequest.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/hello.d.ts +1 -1
- package/lib/dtls/src/handshake/message/server/hello.js +14 -8
- package/lib/dtls/src/handshake/message/server/hello.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/helloDone.js +1 -1
- package/lib/dtls/src/handshake/message/server/helloDone.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js +5 -3
- package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/keyExchange.d.ts +1 -1
- package/lib/dtls/src/handshake/message/server/keyExchange.js +17 -9
- package/lib/dtls/src/handshake/message/server/keyExchange.js.map +1 -1
- package/lib/dtls/src/handshake/random.d.ts +1 -1
- package/lib/dtls/src/handshake/random.js +7 -4
- package/lib/dtls/src/handshake/random.js.map +1 -1
- package/lib/dtls/src/imports/common.d.ts +1 -0
- package/lib/dtls/src/imports/common.js +1 -0
- package/lib/dtls/src/imports/common.js.map +1 -1
- package/lib/dtls/src/index.d.ts +2 -2
- package/lib/dtls/src/index.js +2 -2
- package/lib/dtls/src/index.js.map +1 -1
- package/lib/dtls/src/record/const.d.ts +43 -33
- package/lib/dtls/src/record/const.js +43 -36
- package/lib/dtls/src/record/const.js.map +1 -1
- package/lib/dtls/src/record/message/fragment.d.ts +1 -1
- package/lib/dtls/src/record/message/fragment.js +15 -9
- package/lib/dtls/src/record/message/fragment.js.map +1 -1
- package/lib/dtls/src/record/message/header.js +12 -7
- package/lib/dtls/src/record/message/header.js.map +1 -1
- package/lib/dtls/src/record/message/plaintext.js +4 -2
- package/lib/dtls/src/record/message/plaintext.js.map +1 -1
- package/lib/dtls/src/record/receive.js +2 -2
- package/lib/dtls/src/record/receive.js.map +1 -1
- package/lib/dtls/src/server.js +1 -1
- package/lib/dtls/src/server.js.map +1 -1
- package/lib/dtls/src/socket.d.ts +2 -2
- package/lib/dtls/src/socket.js +6 -4
- package/lib/dtls/src/socket.js.map +1 -1
- package/lib/ice/src/candidate.d.ts +1 -1
- package/lib/ice/src/candidate.js +24 -12
- package/lib/ice/src/candidate.js.map +1 -1
- package/lib/ice/src/dns/lookup.d.ts +10 -1
- package/lib/ice/src/dns/lookup.js +42 -7
- package/lib/ice/src/dns/lookup.js.map +1 -1
- package/lib/ice/src/exceptions.d.ts +46 -0
- package/lib/ice/src/exceptions.js +92 -5
- package/lib/ice/src/exceptions.js.map +1 -1
- package/lib/ice/src/helper.d.ts +1 -1
- package/lib/ice/src/ice.d.ts +191 -5
- package/lib/ice/src/ice.js +1048 -156
- package/lib/ice/src/ice.js.map +1 -1
- package/lib/ice/src/iceBase.d.ts +174 -10
- package/lib/ice/src/iceBase.js +165 -12
- package/lib/ice/src/iceBase.js.map +1 -1
- package/lib/ice/src/index.d.ts +5 -5
- package/lib/ice/src/index.js +5 -5
- package/lib/ice/src/index.js.map +1 -1
- package/lib/ice/src/internal/resolveHostAddresses.d.ts +26 -0
- package/lib/ice/src/internal/resolveHostAddresses.js +45 -0
- package/lib/ice/src/internal/resolveHostAddresses.js.map +1 -0
- package/lib/ice/src/stun/protocol.d.ts +3 -1
- package/lib/ice/src/stun/protocol.js +16 -0
- package/lib/ice/src/stun/protocol.js.map +1 -1
- package/lib/ice/src/stun/tcpProtocol.d.ts +2 -0
- package/lib/ice/src/stun/tcpProtocol.js +16 -1
- package/lib/ice/src/stun/tcpProtocol.js.map +1 -1
- package/lib/ice/src/stun/transaction.d.ts +35 -1
- package/lib/ice/src/stun/transaction.js +93 -18
- package/lib/ice/src/stun/transaction.js.map +1 -1
- package/lib/ice/src/turn/credential.d.ts +49 -0
- package/lib/ice/src/turn/credential.js +78 -0
- package/lib/ice/src/turn/credential.js.map +1 -0
- package/lib/ice/src/turn/protocol.d.ts +97 -7
- package/lib/ice/src/turn/protocol.js +357 -55
- package/lib/ice/src/turn/protocol.js.map +1 -1
- package/lib/ice/src/utils.js.map +1 -1
- package/lib/ice-server/src/stun/attributes.d.ts +2 -0
- package/lib/ice-server/src/stun/attributes.js +7 -1
- package/lib/ice-server/src/stun/attributes.js.map +1 -1
- package/lib/ice-server/src/stun/const.d.ts +24 -16
- package/lib/ice-server/src/stun/const.js +22 -18
- package/lib/ice-server/src/stun/const.js.map +1 -1
- package/lib/ice-server/src/stun/message.d.ts +3 -1
- package/lib/ice-server/src/stun/message.js +41 -6
- package/lib/ice-server/src/stun/message.js.map +1 -1
- package/lib/ice-server/src/turn/auth.d.ts +1 -1
- package/lib/index.mjs +25252 -12664
- package/lib/nonstandard/index.mjs +11015 -8906
- package/lib/polyfill/dom.mjs +30779 -18386
- package/lib/polyfill/index.mjs +30779 -18386
- package/lib/rtp/src/codec/assertPayload.d.ts +4 -0
- package/lib/rtp/src/codec/assertPayload.js +12 -0
- package/lib/rtp/src/codec/assertPayload.js.map +1 -0
- package/lib/rtp/src/codec/av1.js +2 -0
- package/lib/rtp/src/codec/av1.js.map +1 -1
- package/lib/rtp/src/codec/h264.d.ts +1 -1
- package/lib/rtp/src/codec/h264.js +35 -43
- package/lib/rtp/src/codec/h264.js.map +1 -1
- package/lib/rtp/src/codec/vp8.js +11 -5
- package/lib/rtp/src/codec/vp8.js.map +1 -1
- package/lib/rtp/src/codec/vp9.js +12 -0
- package/lib/rtp/src/codec/vp9.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/container.js +2 -1
- package/lib/rtp/src/extra/container/mp4/container.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/exp-golomb.js +2 -1
- package/lib/rtp/src/extra/container/mp4/exp-golomb.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/h264.d.ts +21 -17
- package/lib/rtp/src/extra/container/mp4/h264.js +26 -24
- package/lib/rtp/src/extra/container/mp4/h264.js.map +1 -1
- package/lib/rtp/src/extra/container/ogg/index.d.ts +1 -0
- package/lib/rtp/src/extra/container/ogg/index.js +1 -0
- package/lib/rtp/src/extra/container/ogg/index.js.map +1 -1
- package/lib/rtp/src/extra/container/ogg/writer.d.ts +90 -0
- package/lib/rtp/src/extra/container/ogg/writer.js +300 -0
- package/lib/rtp/src/extra/container/ogg/writer.js.map +1 -0
- package/lib/rtp/src/extra/container/webm/container.d.ts +1 -1
- package/lib/rtp/src/extra/container/webm/ebml/ebml.d.ts +6 -0
- package/lib/rtp/src/extra/container/webm/ebml/ebml.js +26 -4
- package/lib/rtp/src/extra/container/webm/ebml/ebml.js.map +1 -1
- package/lib/rtp/src/extra/processor/depacketizer.d.ts +6 -1
- package/lib/rtp/src/extra/processor/depacketizer.js +29 -3
- package/lib/rtp/src/extra/processor/depacketizer.js.map +1 -1
- package/lib/rtp/src/extra/processor/depacketizerCallback.d.ts +1 -11
- package/lib/rtp/src/extra/processor/depacketizerTransformer.d.ts +1 -1
- package/lib/rtp/src/extra/processor/dtx.js +4 -2
- package/lib/rtp/src/extra/processor/dtx.js.map +1 -1
- package/lib/rtp/src/extra/processor/dtxCallback.d.ts +1 -11
- package/lib/rtp/src/extra/processor/index.d.ts +2 -0
- package/lib/rtp/src/extra/processor/index.js +2 -0
- package/lib/rtp/src/extra/processor/index.js.map +1 -1
- package/lib/rtp/src/extra/processor/interface.d.ts +16 -11
- package/lib/rtp/src/extra/processor/interface.js.map +1 -1
- package/lib/rtp/src/extra/processor/jitterBuffer.d.ts +29 -6
- package/lib/rtp/src/extra/processor/jitterBuffer.js +101 -111
- package/lib/rtp/src/extra/processor/jitterBuffer.js.map +1 -1
- package/lib/rtp/src/extra/processor/jitterBufferCallback.d.ts +1 -11
- package/lib/rtp/src/extra/processor/jitterBufferTransformer.d.ts +1 -1
- package/lib/rtp/src/extra/processor/jitterBufferTransformer.js +2 -1
- package/lib/rtp/src/extra/processor/jitterBufferTransformer.js.map +1 -1
- package/lib/rtp/src/extra/processor/lipsync.d.ts +63 -0
- package/lib/rtp/src/extra/processor/lipsync.js +202 -51
- package/lib/rtp/src/extra/processor/lipsync.js.map +1 -1
- package/lib/rtp/src/extra/processor/mp4.d.ts +0 -6
- package/lib/rtp/src/extra/processor/mp4.js +7 -4
- package/lib/rtp/src/extra/processor/mp4.js.map +1 -1
- package/lib/rtp/src/extra/processor/mute.js +4 -2
- package/lib/rtp/src/extra/processor/mute.js.map +1 -1
- package/lib/rtp/src/extra/processor/nack.d.ts +1 -1
- package/lib/rtp/src/extra/processor/nack.js +5 -3
- package/lib/rtp/src/extra/processor/nack.js.map +1 -1
- package/lib/rtp/src/extra/processor/nackHandlerCallback.d.ts +1 -11
- package/lib/rtp/src/extra/processor/ntpTime.js +4 -6
- package/lib/rtp/src/extra/processor/ntpTime.js.map +1 -1
- package/lib/rtp/src/extra/processor/ntpTimeCallback.d.ts +1 -11
- package/lib/rtp/src/extra/processor/ogg.d.ts +72 -0
- package/lib/rtp/src/extra/processor/ogg.js +221 -0
- package/lib/rtp/src/extra/processor/ogg.js.map +1 -0
- package/lib/rtp/src/extra/processor/oggCallback.d.ts +21 -0
- package/lib/rtp/src/extra/processor/oggCallback.js +97 -0
- package/lib/rtp/src/extra/processor/oggCallback.js.map +1 -0
- package/lib/rtp/src/extra/processor/rtcpCallback.d.ts +1 -1
- package/lib/rtp/src/extra/processor/rtcpCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpCallback.d.ts +1 -1
- package/lib/rtp/src/extra/processor/rtpCallback.js +3 -2
- package/lib/rtp/src/extra/processor/rtpCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpStream.d.ts +2 -2
- package/lib/rtp/src/extra/processor/rtpStream.js +2 -1
- package/lib/rtp/src/extra/processor/rtpStream.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpTime.js +2 -1
- package/lib/rtp/src/extra/processor/rtpTime.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpTimeCallback.d.ts +1 -11
- package/lib/rtp/src/extra/processor/webm.d.ts +27 -0
- package/lib/rtp/src/extra/processor/webm.js +57 -23
- package/lib/rtp/src/extra/processor/webm.js.map +1 -1
- package/lib/rtp/src/extra/processor/webmCallback.js +6 -1
- package/lib/rtp/src/extra/processor/webmCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/webmStream.js.map +1 -1
- package/lib/rtp/src/helper.d.ts +2 -2
- package/lib/rtp/src/helper.js +2 -6
- package/lib/rtp/src/helper.js.map +1 -1
- package/lib/rtp/src/index.d.ts +10 -2
- package/lib/rtp/src/index.js +10 -2
- package/lib/rtp/src/index.js.map +1 -1
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.d.ts +4 -0
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js +6 -1
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js.map +1 -1
- package/lib/rtp/src/rtcp/rtcp.js +9 -4
- package/lib/rtp/src/rtcp/rtcp.js.map +1 -1
- package/lib/rtp/src/rtcp/rtpfb/transportWideSequence.d.ts +58 -0
- package/lib/rtp/src/rtcp/rtpfb/transportWideSequence.js +143 -0
- package/lib/rtp/src/rtcp/rtpfb/transportWideSequence.js.map +1 -0
- package/lib/rtp/src/rtcp/rtpfb/twcc.d.ts +35 -13
- package/lib/rtp/src/rtcp/rtpfb/twcc.js +132 -54
- package/lib/rtp/src/rtcp/rtpfb/twcc.js.map +1 -1
- package/lib/rtp/src/rtcp/rtpfb/twccReceiveTiming.d.ts +13 -0
- package/lib/rtp/src/rtcp/rtpfb/twccReceiveTiming.js +29 -0
- package/lib/rtp/src/rtcp/rtpfb/twccReceiveTiming.js.map +1 -0
- package/lib/rtp/src/rtcp/rtpfb/twccReferenceTime.d.ts +41 -0
- package/lib/rtp/src/rtcp/rtpfb/twccReferenceTime.js +89 -0
- package/lib/rtp/src/rtcp/rtpfb/twccReferenceTime.js.map +1 -0
- package/lib/rtp/src/rtcp/sr.d.ts +4 -3
- package/lib/rtp/src/rtcp/sr.js +4 -2
- package/lib/rtp/src/rtcp/sr.js.map +1 -1
- package/lib/rtp/src/rtp/continuity.d.ts +36 -0
- package/lib/rtp/src/rtp/continuity.js +100 -0
- package/lib/rtp/src/rtp/continuity.js.map +1 -0
- package/lib/rtp/src/rtp/headerExtension.js +41 -21
- package/lib/rtp/src/rtp/headerExtension.js.map +1 -1
- package/lib/rtp/src/rtp/padding.d.ts +17 -0
- package/lib/rtp/src/rtp/padding.js +37 -0
- package/lib/rtp/src/rtp/padding.js.map +1 -0
- package/lib/rtp/src/rtp/red/encoder.d.ts +10 -0
- package/lib/rtp/src/rtp/red/encoder.js +14 -1
- package/lib/rtp/src/rtp/red/encoder.js.map +1 -1
- package/lib/rtp/src/rtp/red/packet.js +24 -8
- package/lib/rtp/src/rtp/red/packet.js.map +1 -1
- package/lib/rtp/src/rtp/rtp.d.ts +24 -1
- package/lib/rtp/src/rtp/rtp.js +70 -29
- package/lib/rtp/src/rtp/rtp.js.map +1 -1
- package/lib/rtp/src/rtp/rtx.js +3 -0
- package/lib/rtp/src/rtp/rtx.js.map +1 -1
- package/lib/rtp/src/rtp/sendHeaderExtensions.d.ts +36 -0
- package/lib/rtp/src/rtp/sendHeaderExtensions.js +85 -0
- package/lib/rtp/src/rtp/sendHeaderExtensions.js.map +1 -0
- package/lib/rtp/src/srtp/cipher/ctr.d.ts +2 -2
- package/lib/rtp/src/srtp/cipher/ctr.js +5 -3
- package/lib/rtp/src/srtp/cipher/ctr.js.map +1 -1
- package/lib/rtp/src/srtp/cipher/gcm.d.ts +1 -1
- package/lib/rtp/src/srtp/cipher/gcm.js +1 -1
- package/lib/rtp/src/srtp/cipher/gcm.js.map +1 -1
- package/lib/rtp/src/srtp/cipher/index.js +8 -4
- package/lib/rtp/src/srtp/cipher/index.js.map +1 -1
- package/lib/rtp/src/srtp/context/context.d.ts +29 -1
- package/lib/rtp/src/srtp/context/context.js +84 -27
- package/lib/rtp/src/srtp/context/context.js.map +1 -1
- package/lib/rtp/src/srtp/context/srtcp.d.ts +1 -1
- package/lib/rtp/src/srtp/context/srtcp.js +33 -0
- package/lib/rtp/src/srtp/context/srtcp.js.map +1 -1
- package/lib/rtp/src/srtp/context/srtp.d.ts +1 -1
- package/lib/rtp/src/srtp/context/srtp.js +36 -4
- package/lib/rtp/src/srtp/context/srtp.js.map +1 -1
- package/lib/rtp/src/srtp/error.d.ts +8 -0
- package/lib/rtp/src/srtp/error.js +13 -1
- package/lib/rtp/src/srtp/error.js.map +1 -1
- package/lib/rtp/src/srtp/packet.js +4 -1
- package/lib/rtp/src/srtp/packet.js.map +1 -1
- package/lib/rtp/src/srtp/replay.d.ts +24 -0
- package/lib/rtp/src/srtp/replay.js +75 -0
- package/lib/rtp/src/srtp/replay.js.map +1 -0
- package/lib/rtp/src/srtp/session.js +2 -1
- package/lib/rtp/src/srtp/session.js.map +1 -1
- package/lib/rtp/src/srtp/srtcp.js +2 -1
- package/lib/rtp/src/srtp/srtcp.js.map +1 -1
- package/lib/rtp/src/srtp/srtp.js +2 -1
- package/lib/rtp/src/srtp/srtp.js.map +1 -1
- package/lib/rtp/src/util.js +2 -1
- package/lib/rtp/src/util.js.map +1 -1
- package/lib/sctp/src/chunk.d.ts +5 -0
- package/lib/sctp/src/chunk.js +31 -8
- package/lib/sctp/src/chunk.js.map +1 -1
- package/lib/sctp/src/const.d.ts +25 -17
- package/lib/sctp/src/const.js +23 -19
- package/lib/sctp/src/const.js.map +1 -1
- package/lib/sctp/src/index.d.ts +4 -3
- package/lib/sctp/src/index.js +10 -8
- package/lib/sctp/src/index.js.map +1 -1
- package/lib/sctp/src/param.d.ts +6 -2
- package/lib/sctp/src/param.js +22 -8
- package/lib/sctp/src/param.js.map +1 -1
- package/lib/sctp/src/sctp.d.ts +91 -2
- package/lib/sctp/src/sctp.js +700 -134
- package/lib/sctp/src/sctp.js.map +1 -1
- package/lib/sctp/src/transport.js +4 -2
- package/lib/sctp/src/transport.js.map +1 -1
- package/lib/webrtc/src/api/peerConfig.d.ts +307 -0
- package/lib/webrtc/src/api/peerConfig.js +291 -0
- package/lib/webrtc/src/api/peerConfig.js.map +1 -0
- package/lib/webrtc/src/api/peerConnectionEvents.d.ts +36 -0
- package/lib/webrtc/src/api/peerConnectionEvents.js +44 -0
- package/lib/webrtc/src/api/peerConnectionEvents.js.map +1 -0
- package/lib/webrtc/src/dataChannel.d.ts +11 -1
- package/lib/webrtc/src/dataChannel.js +25 -5
- package/lib/webrtc/src/dataChannel.js.map +1 -1
- package/lib/webrtc/src/index.d.ts +2 -2
- package/lib/webrtc/src/index.js +2 -2
- package/lib/webrtc/src/index.js.map +1 -1
- package/lib/webrtc/src/media/index.d.ts +11 -1
- package/lib/webrtc/src/media/index.js +71 -1
- package/lib/webrtc/src/media/index.js.map +1 -1
- package/lib/webrtc/src/media/receiver/nack.js +5 -5
- package/lib/webrtc/src/media/receiver/nack.js.map +1 -1
- package/lib/webrtc/src/media/receiver/receiverTwcc.d.ts +61 -1
- package/lib/webrtc/src/media/receiver/receiverTwcc.js +218 -63
- package/lib/webrtc/src/media/receiver/receiverTwcc.js.map +1 -1
- package/lib/webrtc/src/media/router.d.ts +130 -6
- package/lib/webrtc/src/media/router.js +325 -29
- package/lib/webrtc/src/media/router.js.map +1 -1
- package/lib/webrtc/src/media/rtpReceiver.d.ts +137 -14
- package/lib/webrtc/src/media/rtpReceiver.js +420 -44
- package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
- package/lib/webrtc/src/media/rtpSender.d.ts +232 -65
- package/lib/webrtc/src/media/rtpSender.js +784 -448
- package/lib/webrtc/src/media/rtpSender.js.map +1 -1
- package/lib/webrtc/src/media/rtpTransceiver.d.ts +95 -4
- package/lib/webrtc/src/media/rtpTransceiver.js +121 -9
- package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
- package/lib/webrtc/src/media/sender/bandwidthEstimator.d.ts +249 -0
- package/lib/webrtc/src/media/sender/bandwidthEstimator.js +144 -0
- package/lib/webrtc/src/media/sender/bandwidthEstimator.js.map +1 -0
- package/lib/webrtc/src/media/sender/createBandwidthEstimator.d.ts +20 -0
- package/lib/webrtc/src/media/sender/createBandwidthEstimator.js +26 -0
- package/lib/webrtc/src/media/sender/createBandwidthEstimator.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimatorBinding.d.ts +70 -0
- package/lib/webrtc/src/media/sender/estimatorBinding.js +175 -0
- package/lib/webrtc/src/media/sender/estimatorBinding.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/disabledBwe.d.ts +18 -0
- package/lib/webrtc/src/media/sender/estimators/disabledBwe.js +44 -0
- package/lib/webrtc/src/media/sender/estimators/disabledBwe.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/acknowledgedBitrateEstimator.d.ts +79 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/acknowledgedBitrateEstimator.js +289 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/acknowledgedBitrateEstimator.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/aimdRateControl.d.ts +87 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/aimdRateControl.js +429 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/aimdRateControl.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/alrDetector.d.ts +21 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/alrDetector.js +84 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/alrDetector.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/bandwidthLimitedCause.d.ts +37 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/bandwidthLimitedCause.js +74 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/bandwidthLimitedCause.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/constants.d.ts +383 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/constants.js +408 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/constants.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/gccBwe.d.ts +406 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/gccBwe.js +1391 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/gccBwe.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/index.d.ts +19 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/index.js +75 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/index.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/interArrivalDelta.d.ts +68 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/interArrivalDelta.js +201 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/interArrivalDelta.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/intervalBudget.d.ts +26 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/intervalBudget.js +72 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/intervalBudget.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/linkCapacityEstimator.d.ts +41 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/linkCapacityEstimator.js +99 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/linkCapacityEstimator.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/lossBasedBwe.d.ts +247 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/lossBasedBwe.js +1042 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/lossBasedBwe.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/overuseDetector.d.ts +26 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/overuseDetector.js +132 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/overuseDetector.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/probeController.d.ts +305 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/probeController.js +1073 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/probeController.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/rttBasedBackoff.d.ts +60 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/rttBasedBackoff.js +151 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/rttBasedBackoff.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/trendlineEstimator.d.ts +44 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/trendlineEstimator.js +246 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/trendlineEstimator.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/index.d.ts +7 -0
- package/lib/webrtc/src/media/sender/estimators/index.js +19 -0
- package/lib/webrtc/src/media/sender/estimators/index.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/lightweightBwe.d.ts +64 -0
- package/lib/webrtc/src/media/sender/estimators/lightweightBwe.js +216 -0
- package/lib/webrtc/src/media/sender/estimators/lightweightBwe.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/twccFeedbackAdapter.d.ts +117 -0
- package/lib/webrtc/src/media/sender/estimators/twccFeedbackAdapter.js +250 -0
- package/lib/webrtc/src/media/sender/estimators/twccFeedbackAdapter.js.map +1 -0
- package/lib/webrtc/src/media/sender/outgoingQueue.d.ts +40 -0
- package/lib/webrtc/src/media/sender/outgoingQueue.js +153 -0
- package/lib/webrtc/src/media/sender/outgoingQueue.js.map +1 -0
- package/lib/webrtc/src/media/sender/padding.d.ts +45 -0
- package/lib/webrtc/src/media/sender/padding.js +134 -0
- package/lib/webrtc/src/media/sender/padding.js.map +1 -0
- package/lib/webrtc/src/media/sender/pendingRtp.d.ts +35 -0
- package/lib/webrtc/src/media/sender/pendingRtp.js +120 -0
- package/lib/webrtc/src/media/sender/pendingRtp.js.map +1 -0
- package/lib/webrtc/src/media/sender/rtpWire.d.ts +13 -0
- package/lib/webrtc/src/media/sender/rtpWire.js +38 -0
- package/lib/webrtc/src/media/sender/rtpWire.js.map +1 -0
- package/lib/webrtc/src/media/sender/sendPacer.d.ts +27 -0
- package/lib/webrtc/src/media/sender/sendPacer.js +110 -0
- package/lib/webrtc/src/media/sender/sendPacer.js.map +1 -0
- package/lib/webrtc/src/media/sender/senderBWE.d.ts +8 -32
- package/lib/webrtc/src/media/sender/senderBWE.js +5 -142
- package/lib/webrtc/src/media/sender/senderBWE.js.map +1 -1
- package/lib/webrtc/src/media/sender/senderStats.d.ts +100 -0
- package/lib/webrtc/src/media/sender/senderStats.js +322 -0
- package/lib/webrtc/src/media/sender/senderStats.js.map +1 -0
- package/lib/webrtc/src/media/track.d.ts +21 -3
- package/lib/webrtc/src/media/track.js +24 -6
- package/lib/webrtc/src/media/track.js.map +1 -1
- package/lib/webrtc/src/negotiation/bundleTopology.d.ts +103 -0
- package/lib/webrtc/src/negotiation/bundleTopology.js +384 -0
- package/lib/webrtc/src/negotiation/bundleTopology.js.map +1 -0
- package/lib/webrtc/src/negotiation/descriptionValidation.d.ts +51 -0
- package/lib/webrtc/src/negotiation/descriptionValidation.js +267 -0
- package/lib/webrtc/src/negotiation/descriptionValidation.js.map +1 -0
- package/lib/webrtc/src/negotiation/iceRestartRequest.d.ts +21 -0
- package/lib/webrtc/src/negotiation/iceRestartRequest.js +61 -0
- package/lib/webrtc/src/negotiation/iceRestartRequest.js.map +1 -0
- package/lib/webrtc/src/negotiation/internalState.d.ts +34 -0
- package/lib/webrtc/src/negotiation/internalState.js +21 -0
- package/lib/webrtc/src/negotiation/internalState.js.map +1 -0
- package/lib/webrtc/src/negotiation/negotiationNeeded.d.ts +44 -0
- package/lib/webrtc/src/negotiation/negotiationNeeded.js +119 -0
- package/lib/webrtc/src/negotiation/negotiationNeeded.js.map +1 -0
- package/lib/webrtc/src/negotiation/remoteCandidates.d.ts +86 -0
- package/lib/webrtc/src/negotiation/remoteCandidates.js +349 -0
- package/lib/webrtc/src/negotiation/remoteCandidates.js.map +1 -0
- package/lib/webrtc/src/negotiation/remoteMediaApplication.d.ts +71 -0
- package/lib/webrtc/src/negotiation/remoteMediaApplication.js +414 -0
- package/lib/webrtc/src/negotiation/remoteMediaApplication.js.map +1 -0
- package/lib/webrtc/src/negotiation/transportActivation.d.ts +59 -0
- package/lib/webrtc/src/negotiation/transportActivation.js +356 -0
- package/lib/webrtc/src/negotiation/transportActivation.js.map +1 -0
- package/lib/webrtc/src/negotiationTransaction.d.ts +240 -0
- package/lib/webrtc/src/negotiationTransaction.js +604 -0
- package/lib/webrtc/src/negotiationTransaction.js.map +1 -0
- package/lib/webrtc/src/nonstandard/dummyMedia.js +2 -1
- package/lib/webrtc/src/nonstandard/dummyMedia.js.map +1 -1
- package/lib/webrtc/src/nonstandard/index.d.ts +1 -1
- package/lib/webrtc/src/nonstandard/index.js +1 -1
- package/lib/webrtc/src/nonstandard/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/navigator.js +4 -3
- package/lib/webrtc/src/nonstandard/navigator.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/index.d.ts +32 -8
- package/lib/webrtc/src/nonstandard/recorder/index.js +81 -20
- package/lib/webrtc/src/nonstandard/recorder/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/index.d.ts +10 -8
- package/lib/webrtc/src/nonstandard/recorder/writer/index.js +2 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/ogg.d.ts +32 -0
- package/lib/webrtc/src/nonstandard/recorder/writer/ogg.js +185 -0
- package/lib/webrtc/src/nonstandard/recorder/writer/ogg.js.map +1 -0
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.d.ts +2 -2
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js +10 -3
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js.map +1 -1
- package/lib/webrtc/src/nonstandard/userMedia/packetizer.d.ts +2 -2
- package/lib/webrtc/src/nonstandard/userMedia/packetizer.js.map +1 -1
- package/lib/webrtc/src/nonstandard/userMedia.d.ts +2 -2
- package/lib/webrtc/src/nonstandard/userMedia.js +4 -3
- package/lib/webrtc/src/nonstandard/userMedia.js.map +1 -1
- package/lib/webrtc/src/peerConnection.d.ts +176 -238
- package/lib/webrtc/src/peerConnection.js +1042 -913
- package/lib/webrtc/src/peerConnection.js.map +1 -1
- package/lib/webrtc/src/polyfill/api.d.ts +5 -5
- package/lib/webrtc/src/polyfill/api.js.map +1 -1
- package/lib/webrtc/src/polyfill/index.js.map +1 -1
- package/lib/webrtc/src/polyfill/install.js +1 -1
- package/lib/webrtc/src/polyfill/install.js.map +1 -1
- package/lib/webrtc/src/polyfill/mediaDevices.js +2 -1
- package/lib/webrtc/src/polyfill/mediaDevices.js.map +1 -1
- package/lib/webrtc/src/polyfill/registers/mp4Webm.js.map +1 -1
- package/lib/webrtc/src/polyfill/registers/rtpRtcp.js.map +1 -1
- package/lib/webrtc/src/polyfill/selectSettings.js.map +1 -1
- package/lib/webrtc/src/polyfill/sourceIo.js.map +1 -1
- package/lib/webrtc/src/sctpManager.d.ts +97 -1
- package/lib/webrtc/src/sctpManager.js +189 -9
- package/lib/webrtc/src/sctpManager.js.map +1 -1
- package/lib/webrtc/src/sdp.js +12 -6
- package/lib/webrtc/src/sdp.js.map +1 -1
- package/lib/webrtc/src/sdpManager.d.ts +55 -11
- package/lib/webrtc/src/sdpManager.js +364 -87
- package/lib/webrtc/src/sdpManager.js.map +1 -1
- package/lib/webrtc/src/secureTransportManager.d.ts +89 -28
- package/lib/webrtc/src/secureTransportManager.js +232 -53
- package/lib/webrtc/src/secureTransportManager.js.map +1 -1
- package/lib/webrtc/src/transceiverManager.d.ts +62 -18
- package/lib/webrtc/src/transceiverManager.js +272 -107
- package/lib/webrtc/src/transceiverManager.js.map +1 -1
- package/lib/webrtc/src/transport/dtls.d.ts +64 -3
- package/lib/webrtc/src/transport/dtls.js +166 -42
- package/lib/webrtc/src/transport/dtls.js.map +1 -1
- package/lib/webrtc/src/transport/ice.d.ts +199 -28
- package/lib/webrtc/src/transport/ice.js +666 -71
- package/lib/webrtc/src/transport/ice.js.map +1 -1
- package/lib/webrtc/src/transport/iceCandidateAttribute.d.ts +98 -0
- package/lib/webrtc/src/transport/iceCandidateAttribute.js +129 -0
- package/lib/webrtc/src/transport/iceCandidateAttribute.js.map +1 -0
- package/lib/webrtc/src/transport/sctp.d.ts +6 -1
- package/lib/webrtc/src/transport/sctp.js +149 -37
- package/lib/webrtc/src/transport/sctp.js.map +1 -1
- package/lib/webrtc/src/utils.d.ts +39 -6
- package/lib/webrtc/src/utils.js +57 -17
- package/lib/webrtc/src/utils.js.map +1 -1
- package/package.json +16 -15
|
@@ -5,13 +5,13 @@ const crypto_1 = require("crypto");
|
|
|
5
5
|
const promises_1 = require("timers/promises");
|
|
6
6
|
const common_1 = require("../imports/common");
|
|
7
7
|
const rtp_1 = require("../imports/rtp");
|
|
8
|
+
const sdp_1 = require("../sdp");
|
|
8
9
|
const utils_1 = require("../utils");
|
|
9
10
|
const codecCompatibility_1 = require("./codecCompatibility");
|
|
11
|
+
const rtcpFeedback_1 = require("./extension/rtcpFeedback");
|
|
10
12
|
const nack_1 = require("./receiver/nack");
|
|
11
13
|
const receiverTwcc_1 = require("./receiver/receiverTwcc");
|
|
12
14
|
const statistics_1 = require("./receiver/statistics");
|
|
13
|
-
const sdp_1 = require("../sdp");
|
|
14
|
-
const rtcpFeedback_1 = require("./extension/rtcpFeedback");
|
|
15
15
|
const stats_1 = require("./stats");
|
|
16
16
|
const track_1 = require("./track");
|
|
17
17
|
const log = (0, rtp_1.debug)("werift:packages/webrtc/src/media/rtpReceiver.ts");
|
|
@@ -24,19 +24,19 @@ class RTCRtpReceiver {
|
|
|
24
24
|
enumerable: true,
|
|
25
25
|
configurable: true,
|
|
26
26
|
writable: true,
|
|
27
|
-
value:
|
|
27
|
+
value: void 0
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(this, "kind", {
|
|
30
30
|
enumerable: true,
|
|
31
31
|
configurable: true,
|
|
32
32
|
writable: true,
|
|
33
|
-
value:
|
|
33
|
+
value: void 0
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(this, "rtcpSsrc", {
|
|
36
36
|
enumerable: true,
|
|
37
37
|
configurable: true,
|
|
38
38
|
writable: true,
|
|
39
|
-
value:
|
|
39
|
+
value: void 0
|
|
40
40
|
});
|
|
41
41
|
Object.defineProperty(this, "codecs", {
|
|
42
42
|
enumerable: true,
|
|
@@ -56,6 +56,25 @@ class RTCRtpReceiver {
|
|
|
56
56
|
writable: true,
|
|
57
57
|
value: {}
|
|
58
58
|
});
|
|
59
|
+
Object.defineProperty(this, "stagedCodecs", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true,
|
|
62
|
+
writable: true,
|
|
63
|
+
value: {}
|
|
64
|
+
});
|
|
65
|
+
Object.defineProperty(this, "stagedSsrcByRtx", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
configurable: true,
|
|
68
|
+
writable: true,
|
|
69
|
+
value: {}
|
|
70
|
+
});
|
|
71
|
+
/** SSRCs of `trackBySSRC` learned from RID packets rather than SDP. */
|
|
72
|
+
Object.defineProperty(this, "learnedTrackSsrcs", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
configurable: true,
|
|
75
|
+
writable: true,
|
|
76
|
+
value: new Set()
|
|
77
|
+
});
|
|
59
78
|
Object.defineProperty(this, "nack", {
|
|
60
79
|
enumerable: true,
|
|
61
80
|
configurable: true,
|
|
@@ -98,6 +117,17 @@ class RTCRtpReceiver {
|
|
|
98
117
|
writable: true,
|
|
99
118
|
value: {}
|
|
100
119
|
});
|
|
120
|
+
/**
|
|
121
|
+
* Tracks whose SSRC a later pranswer / answer of the same offer replaced.
|
|
122
|
+
* The next SSRC a description gives this receiver takes one over, so the
|
|
123
|
+
* application keeps receiving on the same track object.
|
|
124
|
+
*/
|
|
125
|
+
Object.defineProperty(this, "unboundTracks", {
|
|
126
|
+
enumerable: true,
|
|
127
|
+
configurable: true,
|
|
128
|
+
writable: true,
|
|
129
|
+
value: []
|
|
130
|
+
});
|
|
101
131
|
/**last sender Report Timestamp
|
|
102
132
|
* compactNtp
|
|
103
133
|
*/
|
|
@@ -156,6 +186,13 @@ class RTCRtpReceiver {
|
|
|
156
186
|
writable: true,
|
|
157
187
|
value: void 0
|
|
158
188
|
});
|
|
189
|
+
/** DTLS transport {@link receiverTWCC} was acquired from (release key). */
|
|
190
|
+
Object.defineProperty(this, "receiverTWCCTransport", {
|
|
191
|
+
enumerable: true,
|
|
192
|
+
configurable: true,
|
|
193
|
+
writable: true,
|
|
194
|
+
value: void 0
|
|
195
|
+
});
|
|
159
196
|
Object.defineProperty(this, "stopped", {
|
|
160
197
|
enumerable: true,
|
|
161
198
|
configurable: true,
|
|
@@ -234,6 +271,24 @@ class RTCRtpReceiver {
|
|
|
234
271
|
writable: true,
|
|
235
272
|
value: {}
|
|
236
273
|
});
|
|
274
|
+
/**
|
|
275
|
+
* Per-SSRC compaction of {@link MediaStreamTrack.onReceiveRtp} sequence
|
|
276
|
+
* numbers when probe padding is filtered. Uses extended sequence numbers so
|
|
277
|
+
* late padding cannot rewrite packets already delivered past that seq.
|
|
278
|
+
*/
|
|
279
|
+
Object.defineProperty(this, "probePaddingCompactBySsrc", {
|
|
280
|
+
enumerable: true,
|
|
281
|
+
configurable: true,
|
|
282
|
+
writable: true,
|
|
283
|
+
value: {}
|
|
284
|
+
});
|
|
285
|
+
/** Media payload type last received on each SSRC (RTX resolved to its media SSRC). */
|
|
286
|
+
Object.defineProperty(this, "payloadTypeBySsrc", {
|
|
287
|
+
enumerable: true,
|
|
288
|
+
configurable: true,
|
|
289
|
+
writable: true,
|
|
290
|
+
value: {}
|
|
291
|
+
});
|
|
237
292
|
Object.defineProperty(this, "handleRtpBySsrc", {
|
|
238
293
|
enumerable: true,
|
|
239
294
|
configurable: true,
|
|
@@ -251,10 +306,14 @@ class RTCRtpReceiver {
|
|
|
251
306
|
const track = this.trackByRID[rid];
|
|
252
307
|
if (!this.trackBySSRC[packet.header.ssrc]) {
|
|
253
308
|
this.trackBySSRC[packet.header.ssrc] = track;
|
|
309
|
+
this.learnedTrackSsrcs.add(packet.header.ssrc);
|
|
254
310
|
}
|
|
255
311
|
this.handleRTP(packet, extensions, track);
|
|
256
312
|
}
|
|
257
313
|
});
|
|
314
|
+
this.config = config;
|
|
315
|
+
this.kind = kind;
|
|
316
|
+
this.rtcpSsrc = rtcpSsrc;
|
|
258
317
|
this.defaultTrack = new track_1.MediaStreamTrack({ kind, remote: true });
|
|
259
318
|
this.onPacketLost.subscribe((nack) => {
|
|
260
319
|
this.nackCountBySsrc[nack.mediaSourceSsrc] =
|
|
@@ -265,8 +324,19 @@ class RTCRtpReceiver {
|
|
|
265
324
|
return this.dtlsTransport ?? null;
|
|
266
325
|
}
|
|
267
326
|
setDtlsTransport(dtls) {
|
|
327
|
+
if (this.receiverTWCCTransport && this.receiverTWCCTransport !== dtls) {
|
|
328
|
+
this.releaseReceiverTWCC();
|
|
329
|
+
}
|
|
268
330
|
this.dtlsTransport = dtls;
|
|
269
331
|
}
|
|
332
|
+
/** Drop this receiver's reference to the transport-shared TWCC generator. */
|
|
333
|
+
releaseReceiverTWCC() {
|
|
334
|
+
if (this.receiverTWCC && this.receiverTWCCTransport) {
|
|
335
|
+
(0, receiverTwcc_1.releaseTransportReceiverTWCC)(this.receiverTWCCTransport, this.receiverTWCC);
|
|
336
|
+
}
|
|
337
|
+
this.receiverTWCC = undefined;
|
|
338
|
+
this.receiverTWCCTransport = undefined;
|
|
339
|
+
}
|
|
270
340
|
// todo fix
|
|
271
341
|
get track() {
|
|
272
342
|
return this.tracks[0] ?? this.defaultTrack;
|
|
@@ -277,57 +347,214 @@ class RTCRtpReceiver {
|
|
|
277
347
|
get twccEnabled() {
|
|
278
348
|
return this.codecArray[0]?.rtcpFeedback.find((f) => f.type === (0, rtcpFeedback_1.useTWCC)().type);
|
|
279
349
|
}
|
|
350
|
+
/** `a=rtcp-fb:<pt> nack pli` (RFC 4585): a generic `nack` alone does not allow PLI. */
|
|
280
351
|
get pliEnabled() {
|
|
281
|
-
|
|
352
|
+
const pli = (0, rtcpFeedback_1.usePLI)();
|
|
353
|
+
return this.codecArray[0]?.rtcpFeedback.find((f) => f.type === pli.type && f.parameter === pli.parameter);
|
|
282
354
|
}
|
|
283
|
-
|
|
355
|
+
/**
|
|
356
|
+
* Receive tables are keyed by payload type and RTX SSRC. With
|
|
357
|
+
* `deferConflicts` (a pending offer or pranswer), a new key applies at once
|
|
358
|
+
* so provisional RTP decodes, but a key the current session already uses
|
|
359
|
+
* with another value is staged: current RTP keeps its codec and RTX pairing
|
|
360
|
+
* until the transaction commits, and rollback drops the staged value.
|
|
361
|
+
*/
|
|
362
|
+
prepareReceive(params, { deferConflicts = false } = {}) {
|
|
284
363
|
params.codecs.forEach((c) => {
|
|
285
|
-
this.codecs[c.payloadType]
|
|
364
|
+
const existing = this.codecs[c.payloadType];
|
|
365
|
+
if (deferConflicts && existing && !sameCodec(existing, c)) {
|
|
366
|
+
this.stagedCodecs[c.payloadType] = c;
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
// The latest description decides the key: an earlier staged value
|
|
370
|
+
// must not overwrite it at the commit.
|
|
371
|
+
delete this.stagedCodecs[c.payloadType];
|
|
372
|
+
this.codecs[c.payloadType] = c;
|
|
373
|
+
}
|
|
286
374
|
});
|
|
287
375
|
params.encodings.forEach((e) => {
|
|
288
|
-
if (e.rtx)
|
|
376
|
+
if (!e.rtx)
|
|
377
|
+
return;
|
|
378
|
+
const existing = this.ssrcByRtx[e.rtx.ssrc];
|
|
379
|
+
if (deferConflicts && existing !== undefined && existing !== e.ssrc) {
|
|
380
|
+
this.stagedSsrcByRtx[e.rtx.ssrc] = e.ssrc;
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
delete this.stagedSsrcByRtx[e.rtx.ssrc];
|
|
289
384
|
this.ssrcByRtx[e.rtx.ssrc] = e.ssrc;
|
|
290
385
|
}
|
|
291
386
|
});
|
|
292
387
|
}
|
|
293
388
|
/**
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
* metadata も新しい先頭 codec に更新する。
|
|
297
|
-
* 既存の receiverTWCC は破棄し、新しい codec が transport-cc を持ち
|
|
298
|
-
* remote SSRC が分かる場合だけ再生成する。
|
|
299
|
-
* setCodecPreferences() 後の createAnswer() 再解決や remote からの
|
|
300
|
-
* 再交渉では、除外された payload type の RTP を受け付けないようにする。
|
|
389
|
+
* Internal: drop values staged by an earlier remote pranswer. A later
|
|
390
|
+
* pranswer or the final answer replaces that proposal as a whole.
|
|
301
391
|
*/
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
392
|
+
discardStagedReceive() {
|
|
393
|
+
clearTable(this.stagedCodecs);
|
|
394
|
+
clearTable(this.stagedSsrcByRtx);
|
|
395
|
+
}
|
|
396
|
+
/** Internal: the transaction committed, staged payload types and RTX pairs apply. */
|
|
397
|
+
commitStagedReceive() {
|
|
398
|
+
Object.assign(this.codecs, this.stagedCodecs);
|
|
399
|
+
Object.assign(this.ssrcByRtx, this.stagedSsrcByRtx);
|
|
400
|
+
clearTable(this.stagedCodecs);
|
|
401
|
+
clearTable(this.stagedSsrcByRtx);
|
|
402
|
+
}
|
|
403
|
+
/** Internal: capture the decode tables for a negotiation rollback baseline. */
|
|
404
|
+
snapshotReceiveTables() {
|
|
405
|
+
return {
|
|
406
|
+
codecs: { ...this.codecs },
|
|
407
|
+
ssrcByRtx: { ...this.ssrcByRtx },
|
|
408
|
+
stagedCodecs: { ...this.stagedCodecs },
|
|
409
|
+
stagedSsrcByRtx: { ...this.stagedSsrcByRtx },
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
/** Internal: replace the decode tables with a rollback baseline. */
|
|
413
|
+
restoreReceiveTables(snapshot) {
|
|
414
|
+
for (const [table, saved] of [
|
|
415
|
+
[this.codecs, snapshot.codecs],
|
|
416
|
+
[this.ssrcByRtx, snapshot.ssrcByRtx],
|
|
417
|
+
[this.stagedCodecs, snapshot.stagedCodecs],
|
|
418
|
+
[this.stagedSsrcByRtx, snapshot.stagedSsrcByRtx],
|
|
419
|
+
]) {
|
|
420
|
+
clearTable(table);
|
|
421
|
+
Object.assign(table, saved);
|
|
305
422
|
}
|
|
306
|
-
|
|
307
|
-
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Internal: everything a negotiation may change on this receiver, for a
|
|
426
|
+
* rollback baseline. Packet-driven runtime (statistics, NACK, RTCP) is not
|
|
427
|
+
* part of it.
|
|
428
|
+
*/
|
|
429
|
+
snapshotNegotiationState() {
|
|
430
|
+
return {
|
|
431
|
+
receiverTWCC: this.receiverTWCC,
|
|
432
|
+
remoteStreamIds: [...this.remoteStreamIds],
|
|
433
|
+
remoteStreamId: this.remoteStreamId,
|
|
434
|
+
remoteTrackId: this.remoteTrackId,
|
|
435
|
+
tracks: [...this.tracks],
|
|
436
|
+
trackBySSRC: { ...this.trackBySSRC },
|
|
437
|
+
trackByRID: { ...this.trackByRID },
|
|
438
|
+
unboundTracks: [...this.unboundTracks],
|
|
439
|
+
receiveTables: this.snapshotReceiveTables(),
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
/** Internal: return to a negotiation baseline taken by `snapshotNegotiationState`. */
|
|
443
|
+
restoreNegotiationState(state) {
|
|
444
|
+
// Transport-cc feedback a pending description started for this receiver
|
|
445
|
+
// stops; the current session's feedback (if any) remains.
|
|
446
|
+
if (this.receiverTWCC !== state.receiverTWCC) {
|
|
447
|
+
if (this.receiverTWCC)
|
|
448
|
+
this.receiverTWCC.twccRunning = false;
|
|
449
|
+
this.receiverTWCC = state.receiverTWCC;
|
|
450
|
+
}
|
|
451
|
+
this.remoteStreamIds = state.remoteStreamIds;
|
|
452
|
+
this.remoteStreamId = state.remoteStreamId;
|
|
453
|
+
this.remoteTrackId = state.remoteTrackId;
|
|
454
|
+
this.tracks.splice(0, this.tracks.length, ...state.tracks);
|
|
455
|
+
// SSRCs learned from RID packets are live state, not SDP: keep those
|
|
456
|
+
// whose track survives the rollback.
|
|
457
|
+
const learnedTracks = Object.entries(this.trackBySSRC).filter(([ssrc, track]) => this.learnedTrackSsrcs.has(Number(ssrc)) &&
|
|
458
|
+
!(ssrc in state.trackBySSRC) &&
|
|
459
|
+
state.tracks.includes(track));
|
|
460
|
+
replaceTable(this.trackBySSRC, state.trackBySSRC);
|
|
461
|
+
for (const [ssrc, track] of learnedTracks) {
|
|
462
|
+
this.trackBySSRC[ssrc] = track;
|
|
308
463
|
}
|
|
464
|
+
replaceTable(this.trackByRID, state.trackByRID);
|
|
465
|
+
this.unboundTracks = [...state.unboundTracks];
|
|
466
|
+
// A track the rolled-back description rebound gets its SSRC back.
|
|
467
|
+
for (const [ssrc, track] of Object.entries(state.trackBySSRC)) {
|
|
468
|
+
if (!track.rid)
|
|
469
|
+
track.ssrc = Number(ssrc);
|
|
470
|
+
}
|
|
471
|
+
// Codec/RTX tables added or changed by a pending description are
|
|
472
|
+
// dropped; current RTP is decoded exactly as before the transaction.
|
|
473
|
+
this.restoreReceiveTables(state.receiveTables);
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Replace receiver codec state after a negotiated codec preference change.
|
|
477
|
+
* Use only when the transaction commits; pending descriptions stage through
|
|
478
|
+
* prepareReceive() so the current decode path remains available.
|
|
479
|
+
*/
|
|
480
|
+
resyncCodecs(params, mediaSourceSsrc) {
|
|
481
|
+
// The committed description replaces the tables as a whole: values a
|
|
482
|
+
// pending description staged must not come back at the commit.
|
|
483
|
+
this.discardStagedReceive();
|
|
484
|
+
clearTable(this.codecs);
|
|
485
|
+
clearTable(this.ssrcByRtx);
|
|
309
486
|
this.prepareReceive(params);
|
|
310
487
|
const codec = (0, codecCompatibility_1.deliveredTrackCodec)(this.kind, params.codecs[0], params.codecs);
|
|
311
488
|
if (codec) {
|
|
312
|
-
for (const track of this.tracks)
|
|
489
|
+
for (const track of this.tracks)
|
|
313
490
|
track.codec = codec;
|
|
314
|
-
}
|
|
315
491
|
}
|
|
492
|
+
// Re-acquire before releasing the previous reference so a still-enabled
|
|
493
|
+
// receiver keeps the same transport-wide history instead of recreating it.
|
|
494
|
+
const previous = this.receiverTWCC;
|
|
495
|
+
const previousTransport = this.receiverTWCCTransport;
|
|
316
496
|
this.receiverTWCC = undefined;
|
|
497
|
+
this.receiverTWCCTransport = undefined;
|
|
317
498
|
if (mediaSourceSsrc != undefined) {
|
|
318
499
|
this.setupTWCC(mediaSourceSsrc);
|
|
319
500
|
}
|
|
501
|
+
if (previous && previousTransport) {
|
|
502
|
+
(0, receiverTwcc_1.releaseTransportReceiverTWCC)(previousTransport, previous);
|
|
503
|
+
}
|
|
320
504
|
}
|
|
321
505
|
/**
|
|
322
|
-
*
|
|
506
|
+
* Attach this receiver to the DTLS-transport-scoped TWCC generator.
|
|
507
|
+
* BUNDLE audio/video share one {@link ReceiverTWCC} so interleaved
|
|
508
|
+
* transport-wide sequences are not reported as loss.
|
|
323
509
|
*/
|
|
324
|
-
setupTWCC(mediaSourceSsrc) {
|
|
325
|
-
if (
|
|
326
|
-
|
|
510
|
+
setupTWCC(mediaSourceSsrc, negotiated = !!this.twccEnabled) {
|
|
511
|
+
if (!negotiated || !this.dtlsTransport) {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
if (!this.receiverTWCC) {
|
|
515
|
+
this.receiverTWCC = (0, receiverTwcc_1.acquireTransportReceiverTWCC)(this.dtlsTransport, this.rtcpSsrc, mediaSourceSsrc);
|
|
516
|
+
this.receiverTWCCTransport = this.dtlsTransport;
|
|
517
|
+
return;
|
|
327
518
|
}
|
|
519
|
+
this.receiverTWCC.setMediaSourceSsrc(mediaSourceSsrc);
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Internal: tracks a replaced remote offer gave this receiver stay its
|
|
523
|
+
* tracks; the SSRCs the replacing offer gives take them over.
|
|
524
|
+
*/
|
|
525
|
+
keepUnboundTracks(tracks) {
|
|
526
|
+
for (const track of tracks) {
|
|
527
|
+
if (track.rid || this.tracks.includes(track))
|
|
528
|
+
continue;
|
|
529
|
+
this.tracks.push(track);
|
|
530
|
+
this.unboundTracks.push(track);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
/** Internal: a superseded pending description no longer routes `ssrc`. */
|
|
534
|
+
releaseProvisionalSsrc(ssrc) {
|
|
535
|
+
const track = this.trackBySSRC[ssrc];
|
|
536
|
+
if (!track || track.rid)
|
|
537
|
+
return;
|
|
538
|
+
delete this.trackBySSRC[ssrc];
|
|
539
|
+
this.unboundTracks.push(track);
|
|
328
540
|
}
|
|
329
541
|
addTrack(track) {
|
|
542
|
+
if (track.ssrc &&
|
|
543
|
+
!track.rid &&
|
|
544
|
+
!this.trackBySSRC[track.ssrc] &&
|
|
545
|
+
this.unboundTracks.length > 0) {
|
|
546
|
+
const unbound = this.unboundTracks.find((t) => t.ssrc === track.ssrc) ??
|
|
547
|
+
this.unboundTracks[0];
|
|
548
|
+
this.unboundTracks = this.unboundTracks.filter((t) => t !== unbound);
|
|
549
|
+
unbound.ssrc = track.ssrc;
|
|
550
|
+
unbound.codec = track.codec ?? unbound.codec;
|
|
551
|
+
this.trackBySSRC[track.ssrc] = unbound;
|
|
552
|
+
this.learnedTrackSsrcs.delete(track.ssrc);
|
|
553
|
+
return false;
|
|
554
|
+
}
|
|
330
555
|
const exist = this.tracks.find((t) => {
|
|
556
|
+
if (this.unboundTracks.includes(t))
|
|
557
|
+
return false;
|
|
331
558
|
if (t.rid) {
|
|
332
559
|
return t.rid === track.rid;
|
|
333
560
|
}
|
|
@@ -341,6 +568,7 @@ class RTCRtpReceiver {
|
|
|
341
568
|
this.tracks.push(track);
|
|
342
569
|
if (track.ssrc) {
|
|
343
570
|
this.trackBySSRC[track.ssrc] = track;
|
|
571
|
+
this.learnedTrackSsrcs.delete(track.ssrc);
|
|
344
572
|
}
|
|
345
573
|
if (track.rid) {
|
|
346
574
|
this.trackByRID[track.rid] = track;
|
|
@@ -351,8 +579,7 @@ class RTCRtpReceiver {
|
|
|
351
579
|
this.stopped = true;
|
|
352
580
|
this.rtcpRunning = false;
|
|
353
581
|
this.rtcpCancel.abort();
|
|
354
|
-
|
|
355
|
-
this.receiverTWCC.twccRunning = false;
|
|
582
|
+
this.releaseReceiverTWCC();
|
|
356
583
|
this.nack.close();
|
|
357
584
|
}
|
|
358
585
|
/**transceiver の停止確定時に remote track を ended にする */
|
|
@@ -506,8 +733,25 @@ class RTCRtpReceiver {
|
|
|
506
733
|
}
|
|
507
734
|
return (0, stats_1.buildStatsReport)(stats, this.getStatsRootIds());
|
|
508
735
|
}
|
|
736
|
+
/**
|
|
737
|
+
* Internal: whether PLI is negotiated for `mediaSsrc`, and the payload type
|
|
738
|
+
* that decides it. PLI follows the negotiated receive codec of this SSRC:
|
|
739
|
+
* the live codec table (current while a proposal is pending, switched at
|
|
740
|
+
* commit and restored on rollback), not the codec its track was created with.
|
|
741
|
+
*/
|
|
742
|
+
pliNegotiation(mediaSsrc) {
|
|
743
|
+
const payloadType = this.payloadTypeBySsrc[mediaSsrc] ??
|
|
744
|
+
this.trackBySSRC[mediaSsrc]?.codec?.payloadType;
|
|
745
|
+
const codec = payloadType != undefined ? this.codecs[payloadType] : undefined;
|
|
746
|
+
return {
|
|
747
|
+
payloadType: codec ? payloadType : undefined,
|
|
748
|
+
allowed: codec
|
|
749
|
+
? hasFeedback(codec, (0, rtcpFeedback_1.usePLI)().type, (0, rtcpFeedback_1.usePLI)().parameter)
|
|
750
|
+
: !!this.pliEnabled,
|
|
751
|
+
};
|
|
752
|
+
}
|
|
509
753
|
async sendRtcpPLI(mediaSsrc) {
|
|
510
|
-
if (!this.
|
|
754
|
+
if (!this.pliNegotiation(mediaSsrc).allowed) {
|
|
511
755
|
log("pli not supported", { mediaSsrc });
|
|
512
756
|
return;
|
|
513
757
|
}
|
|
@@ -564,52 +808,184 @@ class RTCRtpReceiver {
|
|
|
564
808
|
this.remoteStreams[packet.header.ssrc] ??
|
|
565
809
|
new statistics_1.StreamStatistics(codec.clockRate);
|
|
566
810
|
this.remoteStreams[packet.header.ssrc].add(packet);
|
|
811
|
+
const paddingOnly = (0, rtp_1.isPaddingOnlyRtpPacket)(packet);
|
|
812
|
+
let receiveType = paddingOnly
|
|
813
|
+
? track_1.RtpReceivePacketType.padding
|
|
814
|
+
: track_1.RtpReceivePacketType.media;
|
|
815
|
+
let mediaCodec = codec;
|
|
816
|
+
if (codec.name.toLowerCase() === "rtx") {
|
|
817
|
+
const codecParams = (0, sdp_1.codecParametersFromString)(codec.parameters ?? "");
|
|
818
|
+
mediaCodec = this.codecs[codecParams.apt] ?? codec;
|
|
819
|
+
}
|
|
820
|
+
if (hasFeedback(mediaCodec, (0, rtcpFeedback_1.useTWCC)().type)) {
|
|
821
|
+
this.setupTWCC(packet.header.ssrc, true);
|
|
822
|
+
}
|
|
567
823
|
if (this.receiverTWCC) {
|
|
568
824
|
const transportSequenceNumber = extensions[rtp_1.RTP_EXTENSION_URI.transportWideCC];
|
|
569
|
-
if (
|
|
570
|
-
|
|
825
|
+
if (transportSequenceNumber !== undefined) {
|
|
826
|
+
this.receiverTWCC.setMediaSourceSsrc?.(packet.header.ssrc);
|
|
827
|
+
this.receiverTWCC.handleTWCC(transportSequenceNumber);
|
|
571
828
|
}
|
|
572
|
-
this.receiverTWCC.handleTWCC(transportSequenceNumber);
|
|
573
|
-
}
|
|
574
|
-
else if (this.twccEnabled) {
|
|
575
|
-
this.setupTWCC(packet.header.ssrc);
|
|
576
829
|
}
|
|
830
|
+
// RTCP feedback follows the codec this packet was negotiated with, not
|
|
831
|
+
// whichever payload type happens to sort first in the receive table.
|
|
577
832
|
if (codec.name.toLowerCase() === "rtx") {
|
|
578
833
|
const originalSsrc = this.ssrcByRtx[packet.header.ssrc];
|
|
579
|
-
|
|
580
|
-
|
|
834
|
+
// Padding-only RTX (probe / bandwidth padding) carries no original
|
|
835
|
+
// packet: TWCC above already observed it, nothing is delivered.
|
|
581
836
|
if (packet.payload.length < 2)
|
|
582
837
|
return;
|
|
583
|
-
packet = (0, rtp_1.unwrapRtx)(packet,
|
|
838
|
+
packet = (0, rtp_1.unwrapRtx)(packet, mediaCodec.payloadType, originalSsrc);
|
|
584
839
|
track = this.trackBySSRC[originalSsrc];
|
|
840
|
+
receiveType = track_1.RtpReceivePacketType.retransmission;
|
|
585
841
|
}
|
|
586
842
|
let red;
|
|
587
|
-
if (codec.name.toLowerCase() === "red") {
|
|
843
|
+
if (!paddingOnly && codec.name.toLowerCase() === "red") {
|
|
588
844
|
red = rtp_1.Red.deSerialize(packet.payload);
|
|
589
845
|
if (!Object.keys(this.codecs).includes(red.header.fields[0].blockPT.toString())) {
|
|
590
846
|
return;
|
|
591
847
|
}
|
|
592
848
|
}
|
|
593
|
-
|
|
849
|
+
this.payloadTypeBySsrc[packet.header.ssrc] = mediaCodec.payloadType;
|
|
850
|
+
if (track?.kind === "video" && hasFeedback(mediaCodec, "nack")) {
|
|
594
851
|
this.nack.addPacket(packet);
|
|
595
852
|
}
|
|
596
853
|
if (track) {
|
|
854
|
+
const info = { type: receiveType };
|
|
597
855
|
if (red) {
|
|
598
856
|
if (track.kind === "audio") {
|
|
599
857
|
const payloads = this.audioRedHandler.push(red, packet);
|
|
600
|
-
for (const
|
|
601
|
-
|
|
858
|
+
for (const recovered of payloads) {
|
|
859
|
+
this.emitReceiveRtp(track, recovered, extensions, {
|
|
860
|
+
type: track_1.RtpReceivePacketType.media,
|
|
861
|
+
});
|
|
602
862
|
}
|
|
603
863
|
}
|
|
604
864
|
else {
|
|
605
865
|
}
|
|
606
866
|
}
|
|
607
867
|
else {
|
|
608
|
-
|
|
868
|
+
this.emitReceiveRtp(track, packet, extensions, info);
|
|
609
869
|
}
|
|
610
870
|
}
|
|
611
871
|
this.runRtcp();
|
|
612
872
|
}
|
|
873
|
+
/**
|
|
874
|
+
* Deliver a packet on {@link MediaStreamTrack.onReceiveRtp}.
|
|
875
|
+
* When {@link PeerConfig.filterProbePaddingOnReceiveRtp} is true (opt-in),
|
|
876
|
+
* padding-only probes are omitted and media sequence numbers are compacted
|
|
877
|
+
* by on-time padding strictly before that packet in extended seq space.
|
|
878
|
+
* Late padding (arriving after media with a higher original seq) is ignored
|
|
879
|
+
* so already-delivered mappings are not rewritten.
|
|
880
|
+
* Default is false so `onReceiveRtp` matches the wire sequence.
|
|
881
|
+
*/
|
|
882
|
+
emitReceiveRtp(track, packet, extensions, info) {
|
|
883
|
+
if (this.config.filterProbePaddingOnReceiveRtp === true) {
|
|
884
|
+
const compacted = this.compactProbePaddingSequence(packet, info);
|
|
885
|
+
if (!compacted) {
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
888
|
+
track.onReceiveRtp.execute(compacted, extensions, info);
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
track.onReceiveRtp.execute(packet.clone(), extensions, info);
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Filter padding and compact media seq using extended sequence position.
|
|
895
|
+
* Returns undefined when the packet is skipped padding.
|
|
896
|
+
*/
|
|
897
|
+
compactProbePaddingSequence(packet, info) {
|
|
898
|
+
const ssrc = packet.header.ssrc;
|
|
899
|
+
let state = this.probePaddingCompactBySsrc[ssrc];
|
|
900
|
+
if (!state) {
|
|
901
|
+
state = {
|
|
902
|
+
onTimePaddingExt: new Set(),
|
|
903
|
+
prunedOnTimeCount: 0,
|
|
904
|
+
};
|
|
905
|
+
this.probePaddingCompactBySsrc[ssrc] = state;
|
|
906
|
+
}
|
|
907
|
+
const ext = extendRtpSequence(packet.header.sequenceNumber, state.lastExt);
|
|
908
|
+
state.lastExt = ext;
|
|
909
|
+
if (info.type === track_1.RtpReceivePacketType.padding) {
|
|
910
|
+
const late = state.maxDeliveredMediaExt !== undefined &&
|
|
911
|
+
ext <= state.maxDeliveredMediaExt;
|
|
912
|
+
if (!late) {
|
|
913
|
+
state.onTimePaddingExt.add(ext);
|
|
914
|
+
}
|
|
915
|
+
this.pruneProbePaddingCompact(state);
|
|
916
|
+
return undefined;
|
|
917
|
+
}
|
|
918
|
+
let skip = state.prunedOnTimeCount;
|
|
919
|
+
for (const paddingExt of state.onTimePaddingExt) {
|
|
920
|
+
if (paddingExt < ext) {
|
|
921
|
+
skip++;
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
const delivered = packet.clone();
|
|
925
|
+
delivered.header.sequenceNumber = (ext - skip) & 0xffff;
|
|
926
|
+
state.maxDeliveredMediaExt =
|
|
927
|
+
state.maxDeliveredMediaExt === undefined
|
|
928
|
+
? ext
|
|
929
|
+
: Math.max(state.maxDeliveredMediaExt, ext);
|
|
930
|
+
this.pruneProbePaddingCompact(state);
|
|
931
|
+
return delivered;
|
|
932
|
+
}
|
|
933
|
+
pruneProbePaddingCompact(state) {
|
|
934
|
+
if (state.lastExt === undefined) {
|
|
935
|
+
return;
|
|
936
|
+
}
|
|
937
|
+
const horizon = state.lastExt - 0x10000;
|
|
938
|
+
if (horizon <= 0) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
for (const paddingExt of state.onTimePaddingExt) {
|
|
942
|
+
if (paddingExt < horizon) {
|
|
943
|
+
state.onTimePaddingExt.delete(paddingExt);
|
|
944
|
+
state.prunedOnTimeCount++;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}
|
|
613
948
|
}
|
|
614
949
|
exports.RTCRtpReceiver = RTCRtpReceiver;
|
|
950
|
+
/** RFC 3550-style 16-bit sequence extension from the previous packet. */
|
|
951
|
+
function extendRtpSequence(seq, lastExt) {
|
|
952
|
+
const seq16 = seq & 0xffff;
|
|
953
|
+
if (lastExt === undefined) {
|
|
954
|
+
return seq16;
|
|
955
|
+
}
|
|
956
|
+
const lastSeq = lastExt & 0xffff;
|
|
957
|
+
let roc = (lastExt - lastSeq) / 0x10000;
|
|
958
|
+
const delta = seq16 - lastSeq;
|
|
959
|
+
if (delta < -0x8000) {
|
|
960
|
+
roc += 1;
|
|
961
|
+
}
|
|
962
|
+
else if (delta > 0x8000) {
|
|
963
|
+
roc -= 1;
|
|
964
|
+
}
|
|
965
|
+
return roc * 0x10000 + seq16;
|
|
966
|
+
}
|
|
967
|
+
function clearTable(table) {
|
|
968
|
+
for (const key of Object.keys(table))
|
|
969
|
+
delete table[Number(key)];
|
|
970
|
+
}
|
|
971
|
+
/** Replace the entries of a string-keyed table in place (keys may be RIDs). */
|
|
972
|
+
function replaceTable(table, source) {
|
|
973
|
+
for (const key of Object.keys(table))
|
|
974
|
+
delete table[key];
|
|
975
|
+
Object.assign(table, source);
|
|
976
|
+
}
|
|
977
|
+
const feedbackKey = (codec) => codec.rtcpFeedback
|
|
978
|
+
.map((f) => `${f.type} ${f.parameter ?? ""}`)
|
|
979
|
+
.sort()
|
|
980
|
+
.join(",");
|
|
981
|
+
function sameCodec(a, b) {
|
|
982
|
+
return (a.mimeType.toLowerCase() === b.mimeType.toLowerCase() &&
|
|
983
|
+
a.clockRate === b.clockRate &&
|
|
984
|
+
(a.channels ?? 1) === (b.channels ?? 1) &&
|
|
985
|
+
(a.parameters ?? "") === (b.parameters ?? "") &&
|
|
986
|
+
feedbackKey(a) === feedbackKey(b));
|
|
987
|
+
}
|
|
988
|
+
function hasFeedback(codec, type, parameter) {
|
|
989
|
+
return !!codec?.rtcpFeedback.some((f) => f.type === type && (parameter === undefined || f.parameter === parameter));
|
|
990
|
+
}
|
|
615
991
|
//# sourceMappingURL=rtpReceiver.js.map
|