mediasoup 3.19.21 → 3.20.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/node/lib/ActiveSpeakerObserver.js +34 -1
- package/node/lib/AudioLevelObserver.js +35 -2
- package/node/lib/Channel.d.ts.map +1 -1
- package/node/lib/Channel.js +37 -5
- package/node/lib/Consumer.js +39 -6
- package/node/lib/DataConsumer.d.ts.map +1 -1
- package/node/lib/DataConsumer.js +39 -5
- package/node/lib/DataConsumerTypes.d.ts +1 -0
- package/node/lib/DataConsumerTypes.d.ts.map +1 -1
- package/node/lib/DataProducer.js +37 -4
- package/node/lib/DirectTransport.js +37 -4
- package/node/lib/DirectTransportTypes.d.ts +7 -2
- package/node/lib/DirectTransportTypes.d.ts.map +1 -1
- package/node/lib/Logger.js +4 -1
- package/node/lib/PipeTransport.d.ts +3 -1
- package/node/lib/PipeTransport.d.ts.map +1 -1
- package/node/lib/PipeTransport.js +56 -5
- package/node/lib/PipeTransportTypes.d.ts +28 -8
- package/node/lib/PipeTransportTypes.d.ts.map +1 -1
- package/node/lib/PlainTransport.d.ts +3 -1
- package/node/lib/PlainTransport.d.ts.map +1 -1
- package/node/lib/PlainTransport.js +54 -3
- package/node/lib/PlainTransportTypes.d.ts +27 -7
- package/node/lib/PlainTransportTypes.d.ts.map +1 -1
- package/node/lib/Producer.js +40 -7
- package/node/lib/Router.d.ts +5 -5
- package/node/lib/Router.d.ts.map +1 -1
- package/node/lib/Router.js +81 -36
- package/node/lib/RouterTypes.d.ts +25 -3
- package/node/lib/RouterTypes.d.ts.map +1 -1
- package/node/lib/RtpObserver.js +36 -3
- package/node/lib/Transport.d.ts +3 -1
- package/node/lib/Transport.d.ts.map +1 -1
- package/node/lib/Transport.js +74 -22
- package/node/lib/TransportTypes.d.ts +2 -1
- package/node/lib/TransportTypes.d.ts.map +1 -1
- package/node/lib/WebRtcServer.js +36 -3
- package/node/lib/WebRtcTransport.d.ts +3 -1
- package/node/lib/WebRtcTransport.d.ts.map +1 -1
- package/node/lib/WebRtcTransport.js +55 -4
- package/node/lib/WebRtcTransportTypes.d.ts +27 -7
- package/node/lib/WebRtcTransportTypes.d.ts.map +1 -1
- package/node/lib/Worker.d.ts +2 -1
- package/node/lib/Worker.d.ts.map +1 -1
- package/node/lib/Worker.js +71 -25
- package/node/lib/WorkerTypes.d.ts +0 -4
- package/node/lib/WorkerTypes.d.ts.map +1 -1
- package/node/lib/enhancedEvents.d.ts +2 -2
- package/node/lib/enhancedEvents.d.ts.map +1 -1
- package/node/lib/enhancedEvents.js +0 -2
- package/node/lib/fbs/active-speaker-observer/active-speaker-observer-options.js +34 -1
- package/node/lib/fbs/active-speaker-observer/dominant-speaker-notification.js +34 -1
- package/node/lib/fbs/audio-level-observer/audio-level-observer-options.js +34 -1
- package/node/lib/fbs/audio-level-observer/volume.js +34 -1
- package/node/lib/fbs/audio-level-observer/volumes-notification.js +34 -1
- package/node/lib/fbs/common/string-string-array.js +34 -1
- package/node/lib/fbs/common/string-string.js +34 -1
- package/node/lib/fbs/common/string-uint8.js +34 -1
- package/node/lib/fbs/common/uint16-string.js +34 -1
- package/node/lib/fbs/common/uint32-string.js +34 -1
- package/node/lib/fbs/consumer/base-consumer-dump.js +34 -1
- package/node/lib/fbs/consumer/consumer-dump.js +34 -1
- package/node/lib/fbs/consumer/consumer-layers.js +34 -1
- package/node/lib/fbs/consumer/consumer-score.js +34 -1
- package/node/lib/fbs/consumer/dump-response.js +34 -1
- package/node/lib/fbs/consumer/enable-trace-event-request.js +34 -1
- package/node/lib/fbs/consumer/fir-trace-info.js +34 -1
- package/node/lib/fbs/consumer/get-stats-response.js +34 -1
- package/node/lib/fbs/consumer/key-frame-trace-info.js +34 -1
- package/node/lib/fbs/consumer/layers-change-notification.js +34 -1
- package/node/lib/fbs/consumer/pli-trace-info.js +34 -1
- package/node/lib/fbs/consumer/rtp-notification.js +34 -1
- package/node/lib/fbs/consumer/rtp-trace-info.js +34 -1
- package/node/lib/fbs/consumer/score-notification.js +34 -1
- package/node/lib/fbs/consumer/set-preferred-layers-request.js +34 -1
- package/node/lib/fbs/consumer/set-preferred-layers-response.js +34 -1
- package/node/lib/fbs/consumer/set-priority-request.js +34 -1
- package/node/lib/fbs/consumer/set-priority-response.js +34 -1
- package/node/lib/fbs/consumer/trace-notification.js +34 -1
- package/node/lib/fbs/data-consumer/add-subchannel-request.js +34 -1
- package/node/lib/fbs/data-consumer/add-subchannel-response.js +34 -1
- package/node/lib/fbs/data-consumer/buffered-amount-low-notification.js +34 -1
- package/node/lib/fbs/data-consumer/dump-response.d.ts +5 -2
- package/node/lib/fbs/data-consumer/dump-response.d.ts.map +1 -1
- package/node/lib/fbs/data-consumer/dump-response.js +60 -16
- package/node/lib/fbs/data-consumer/get-buffered-amount-response.js +34 -1
- package/node/lib/fbs/data-consumer/get-stats-response.js +34 -1
- package/node/lib/fbs/data-consumer/message-notification.js +34 -1
- package/node/lib/fbs/data-consumer/remove-subchannel-request.js +34 -1
- package/node/lib/fbs/data-consumer/remove-subchannel-response.js +34 -1
- package/node/lib/fbs/data-consumer/send-request.js +34 -1
- package/node/lib/fbs/data-consumer/set-buffered-amount-low-threshold-request.js +34 -1
- package/node/lib/fbs/data-consumer/set-subchannels-request.js +34 -1
- package/node/lib/fbs/data-consumer/set-subchannels-response.js +34 -1
- package/node/lib/fbs/data-consumer/type.d.ts +5 -0
- package/node/lib/fbs/data-consumer/type.d.ts.map +1 -0
- package/node/lib/fbs/data-consumer/type.js +10 -0
- package/node/lib/fbs/data-consumer.d.ts +1 -0
- package/node/lib/fbs/data-consumer.d.ts.map +1 -1
- package/node/lib/fbs/data-consumer.js +3 -1
- package/node/lib/fbs/data-producer/dump-response.js +34 -1
- package/node/lib/fbs/data-producer/get-stats-response.js +34 -1
- package/node/lib/fbs/data-producer/send-notification.js +34 -1
- package/node/lib/fbs/direct-transport/direct-transport-options.js +34 -1
- package/node/lib/fbs/direct-transport/dump-response.js +34 -1
- package/node/lib/fbs/direct-transport/get-stats-response.js +34 -1
- package/node/lib/fbs/direct-transport/rtcp-notification.js +34 -1
- package/node/lib/fbs/lib-uring/dump.js +34 -1
- package/node/lib/fbs/log/log.js +34 -1
- package/node/lib/fbs/message/message.js +34 -1
- package/node/lib/fbs/notification/body.d.ts +24 -22
- package/node/lib/fbs/notification/body.d.ts.map +1 -1
- package/node/lib/fbs/notification/body.js +24 -20
- package/node/lib/fbs/notification/event.d.ts +27 -26
- package/node/lib/fbs/notification/event.d.ts.map +1 -1
- package/node/lib/fbs/notification/event.js +27 -26
- package/node/lib/fbs/notification/notification.d.ts +3 -2
- package/node/lib/fbs/notification/notification.d.ts.map +1 -1
- package/node/lib/fbs/notification/notification.js +34 -1
- package/node/lib/fbs/pipe-transport/connect-request.js +34 -1
- package/node/lib/fbs/pipe-transport/connect-response.js +34 -1
- package/node/lib/fbs/pipe-transport/dump-response.js +34 -1
- package/node/lib/fbs/pipe-transport/get-stats-response.js +34 -1
- package/node/lib/fbs/pipe-transport/pipe-transport-options.js +34 -1
- package/node/lib/fbs/plain-transport/connect-request.js +34 -1
- package/node/lib/fbs/plain-transport/connect-response.js +34 -1
- package/node/lib/fbs/plain-transport/dump-response.js +34 -1
- package/node/lib/fbs/plain-transport/get-stats-response.js +34 -1
- package/node/lib/fbs/plain-transport/plain-transport-options.js +34 -1
- package/node/lib/fbs/plain-transport/rtcp-tuple-notification.js +34 -1
- package/node/lib/fbs/plain-transport/tuple-notification.js +34 -1
- package/node/lib/fbs/producer/dump-response.js +34 -1
- package/node/lib/fbs/producer/enable-trace-event-request.js +34 -1
- package/node/lib/fbs/producer/fir-trace-info.js +34 -1
- package/node/lib/fbs/producer/get-stats-response.js +34 -1
- package/node/lib/fbs/producer/key-frame-trace-info.js +34 -1
- package/node/lib/fbs/producer/pli-trace-info.js +34 -1
- package/node/lib/fbs/producer/rtp-trace-info.js +34 -1
- package/node/lib/fbs/producer/score-notification.js +34 -1
- package/node/lib/fbs/producer/score.js +34 -1
- package/node/lib/fbs/producer/send-notification.js +34 -1
- package/node/lib/fbs/producer/sr-trace-info.js +34 -1
- package/node/lib/fbs/producer/trace-notification.js +34 -1
- package/node/lib/fbs/producer/video-orientation-change-notification.js +34 -1
- package/node/lib/fbs/request/request.js +34 -1
- package/node/lib/fbs/response/response.js +34 -1
- package/node/lib/fbs/router/close-rtp-observer-request.js +34 -1
- package/node/lib/fbs/router/close-transport-request.js +34 -1
- package/node/lib/fbs/router/create-active-speaker-observer-request.js +34 -1
- package/node/lib/fbs/router/create-audio-level-observer-request.js +34 -1
- package/node/lib/fbs/router/create-direct-transport-request.js +34 -1
- package/node/lib/fbs/router/create-pipe-transport-request.js +34 -1
- package/node/lib/fbs/router/create-plain-transport-request.js +34 -1
- package/node/lib/fbs/router/create-web-rtc-transport-request.js +34 -1
- package/node/lib/fbs/router/dump-response.js +34 -1
- package/node/lib/fbs/rtp-observer/add-producer-request.js +34 -1
- package/node/lib/fbs/rtp-observer/remove-producer-request.js +34 -1
- package/node/lib/fbs/rtp-packet/dump.js +34 -1
- package/node/lib/fbs/rtp-parameters/boolean.js +34 -1
- package/node/lib/fbs/rtp-parameters/codec-mapping.js +34 -1
- package/node/lib/fbs/rtp-parameters/double.js +34 -1
- package/node/lib/fbs/rtp-parameters/encoding-mapping.js +34 -1
- package/node/lib/fbs/rtp-parameters/integer32-array.js +34 -1
- package/node/lib/fbs/rtp-parameters/integer32.js +34 -1
- package/node/lib/fbs/rtp-parameters/parameter.js +34 -1
- package/node/lib/fbs/rtp-parameters/rtcp-feedback.js +34 -1
- package/node/lib/fbs/rtp-parameters/rtcp-parameters.js +34 -1
- package/node/lib/fbs/rtp-parameters/rtp-codec-parameters.js +34 -1
- package/node/lib/fbs/rtp-parameters/rtp-encoding-parameters.js +34 -1
- package/node/lib/fbs/rtp-parameters/rtp-header-extension-parameters.js +34 -1
- package/node/lib/fbs/rtp-parameters/rtp-mapping.js +34 -1
- package/node/lib/fbs/rtp-parameters/rtp-parameters.js +34 -1
- package/node/lib/fbs/rtp-parameters/rtx.js +34 -1
- package/node/lib/fbs/rtp-parameters/string.js +34 -1
- package/node/lib/fbs/rtp-stream/base-stats.js +34 -1
- package/node/lib/fbs/rtp-stream/bitrate-by-layer.js +34 -1
- package/node/lib/fbs/rtp-stream/dump.js +34 -1
- package/node/lib/fbs/rtp-stream/params.js +34 -1
- package/node/lib/fbs/rtp-stream/recv-stats.js +34 -1
- package/node/lib/fbs/rtp-stream/send-stats.js +34 -1
- package/node/lib/fbs/rtp-stream/stats.js +34 -1
- package/node/lib/fbs/rtx-stream/params.js +34 -1
- package/node/lib/fbs/rtx-stream/rtx-dump.js +34 -1
- package/node/lib/fbs/sctp-association/sctp-negotiated-capabilities.d.ts +24 -0
- package/node/lib/fbs/sctp-association/sctp-negotiated-capabilities.d.ts.map +1 -0
- package/node/lib/fbs/sctp-association/sctp-negotiated-capabilities.js +102 -0
- package/node/lib/fbs/sctp-association.d.ts +1 -0
- package/node/lib/fbs/sctp-association.d.ts.map +1 -1
- package/node/lib/fbs/sctp-association.js +4 -1
- package/node/lib/fbs/sctp-parameters/num-sctp-streams.js +34 -1
- package/node/lib/fbs/sctp-parameters/sctp-parameters.d.ts +14 -14
- package/node/lib/fbs/sctp-parameters/sctp-parameters.d.ts.map +1 -1
- package/node/lib/fbs/sctp-parameters/sctp-parameters.js +73 -40
- package/node/lib/fbs/sctp-parameters/sctp-stream-parameters.js +34 -1
- package/node/lib/fbs/sctp-parameters.d.ts +0 -1
- package/node/lib/fbs/sctp-parameters.d.ts.map +1 -1
- package/node/lib/fbs/sctp-parameters.js +1 -4
- package/node/lib/fbs/srtp-parameters/srtp-parameters.js +34 -1
- package/node/lib/fbs/transport/bwe-trace-info.js +34 -1
- package/node/lib/fbs/transport/close-consumer-request.js +34 -1
- package/node/lib/fbs/transport/close-data-consumer-request.js +34 -1
- package/node/lib/fbs/transport/close-data-producer-request.js +34 -1
- package/node/lib/fbs/transport/close-producer-request.js +34 -1
- package/node/lib/fbs/transport/consume-data-request.d.ts +1 -1
- package/node/lib/fbs/transport/consume-data-request.js +35 -2
- package/node/lib/fbs/transport/consume-request.js +34 -1
- package/node/lib/fbs/transport/consume-response.js +34 -1
- package/node/lib/fbs/transport/dump.d.ts +7 -4
- package/node/lib/fbs/transport/dump.d.ts.map +1 -1
- package/node/lib/fbs/transport/dump.js +66 -22
- package/node/lib/fbs/transport/enable-trace-event-request.js +34 -1
- package/node/lib/fbs/transport/listen-info.js +34 -1
- package/node/lib/fbs/transport/options.d.ts +14 -14
- package/node/lib/fbs/transport/options.d.ts.map +1 -1
- package/node/lib/fbs/transport/options.js +92 -51
- package/node/lib/fbs/transport/port-range.js +34 -1
- package/node/lib/fbs/transport/produce-data-request.js +34 -1
- package/node/lib/fbs/transport/produce-request.js +34 -1
- package/node/lib/fbs/transport/produce-response.js +34 -1
- package/node/lib/fbs/transport/recv-rtp-header-extensions.js +34 -1
- package/node/lib/fbs/transport/restart-ice-response.js +34 -1
- package/node/lib/fbs/transport/rtp-listener.js +34 -1
- package/node/lib/fbs/transport/sctp-listener.js +34 -1
- package/node/lib/fbs/transport/sctp-negotiated-capabilities-notification.d.ts +22 -0
- package/node/lib/fbs/transport/sctp-negotiated-capabilities-notification.d.ts.map +1 -0
- package/node/lib/fbs/transport/sctp-negotiated-capabilities-notification.js +93 -0
- package/node/lib/fbs/transport/sctp-state-change-notification.js +34 -1
- package/node/lib/fbs/transport/send-rtcp-notification.js +34 -1
- package/node/lib/fbs/transport/set-max-incoming-bitrate-request.js +34 -1
- package/node/lib/fbs/transport/set-max-outgoing-bitrate-request.js +34 -1
- package/node/lib/fbs/transport/set-min-outgoing-bitrate-request.js +34 -1
- package/node/lib/fbs/transport/socket-flags.js +34 -1
- package/node/lib/fbs/transport/stats.js +34 -1
- package/node/lib/fbs/transport/trace-notification.js +34 -1
- package/node/lib/fbs/transport/tuple.js +34 -1
- package/node/lib/fbs/transport.d.ts +1 -0
- package/node/lib/fbs/transport.d.ts.map +1 -1
- package/node/lib/fbs/transport.js +5 -2
- package/node/lib/fbs/web-rtc-server/dump-response.js +34 -1
- package/node/lib/fbs/web-rtc-server/ice-user-name-fragment.js +34 -1
- package/node/lib/fbs/web-rtc-server/ip-port.js +34 -1
- package/node/lib/fbs/web-rtc-server/tuple-hash.js +34 -1
- package/node/lib/fbs/web-rtc-transport/connect-request.js +34 -1
- package/node/lib/fbs/web-rtc-transport/connect-response.js +34 -1
- package/node/lib/fbs/web-rtc-transport/dtls-parameters.js +34 -1
- package/node/lib/fbs/web-rtc-transport/dtls-state-change-notification.js +34 -1
- package/node/lib/fbs/web-rtc-transport/dump-response.js +34 -1
- package/node/lib/fbs/web-rtc-transport/fingerprint.js +34 -1
- package/node/lib/fbs/web-rtc-transport/get-stats-response.js +34 -1
- package/node/lib/fbs/web-rtc-transport/ice-candidate.js +34 -1
- package/node/lib/fbs/web-rtc-transport/ice-parameters.js +34 -1
- package/node/lib/fbs/web-rtc-transport/ice-selected-tuple-change-notification.js +34 -1
- package/node/lib/fbs/web-rtc-transport/ice-state-change-notification.js +34 -1
- package/node/lib/fbs/web-rtc-transport/listen-individual.js +34 -1
- package/node/lib/fbs/web-rtc-transport/listen-server.js +34 -1
- package/node/lib/fbs/web-rtc-transport/web-rtc-transport-options.js +34 -1
- package/node/lib/fbs/worker/channel-message-handlers.js +34 -1
- package/node/lib/fbs/worker/close-router-request.js +34 -1
- package/node/lib/fbs/worker/close-web-rtc-server-request.js +34 -1
- package/node/lib/fbs/worker/create-router-request.js +34 -1
- package/node/lib/fbs/worker/create-web-rtc-server-request.js +34 -1
- package/node/lib/fbs/worker/dump-response.js +34 -1
- package/node/lib/fbs/worker/resource-usage-response.js +34 -1
- package/node/lib/fbs/worker/update-settings-request.js +34 -1
- package/node/lib/index.d.ts +1 -1
- package/node/lib/index.d.ts.map +1 -1
- package/node/lib/index.js +37 -5
- package/node/lib/ortc.js +36 -3
- package/node/lib/rtpParametersFbsUtils.js +34 -1
- package/node/lib/rtpStreamStatsFbsUtils.js +35 -2
- package/node/lib/sctpParametersFbsUtils.d.ts +2 -2
- package/node/lib/sctpParametersFbsUtils.d.ts.map +1 -1
- package/node/lib/sctpParametersFbsUtils.js +44 -7
- package/node/lib/sctpParametersTypes.d.ts +10 -46
- package/node/lib/sctpParametersTypes.d.ts.map +1 -1
- package/node/lib/srtpParametersFbsUtils.js +34 -1
- package/node/lib/test/test-ActiveSpeakerObserver.js +35 -2
- package/node/lib/test/test-AudioLevelObserver.js +35 -2
- package/node/lib/test/test-Consumer.js +37 -4
- package/node/lib/test/test-DataConsumer.js +35 -2
- package/node/lib/test/test-DataProducer.js +35 -2
- package/node/lib/test/test-DirectTransport.js +36 -8
- package/node/lib/test/test-PipeTransport.js +35 -2
- package/node/lib/test/test-PlainTransport.js +45 -12
- package/node/lib/test/test-Producer.js +37 -4
- package/node/lib/test/test-Router.js +35 -2
- package/node/lib/test/test-WebRtcServer.js +34 -1
- package/node/lib/test/test-WebRtcTransport.js +51 -22
- package/node/lib/test/test-Worker.js +37 -4
- package/node/lib/test/test-mediasoup.js +36 -3
- package/node/lib/test/test-multiopus.js +35 -2
- package/node/lib/test/test-ortc.js +34 -1
- package/node/lib/test/test-werift-sctp.js +39 -5
- package/npm-scripts.mjs +2 -2
- package/package.json +13 -11
- package/worker/deps/libwebrtc/LICENSE +5 -0
- package/worker/deps/libwebrtc/README.md +3 -3
- package/worker/deps/libwebrtc/libwebrtc/mediasoup_helpers.h +13 -10
- package/worker/fbs/dataConsumer.fbs +7 -2
- package/worker/fbs/dataProducer.fbs +1 -0
- package/worker/fbs/notification.fbs +2 -0
- package/worker/fbs/sctpAssociation.fbs +4 -0
- package/worker/fbs/sctpParameters.fbs +5 -12
- package/worker/fbs/transport.fbs +12 -8
- package/worker/fuzzer/src/RTC/FuzzerDtlsTransport.cpp +13 -3
- package/worker/fuzzer/src/RTC/FuzzerRateCalculator.cpp +2 -2
- package/worker/fuzzer/src/RTC/FuzzerSeqManager.cpp +1 -1
- package/worker/fuzzer/src/RTC/FuzzerTrendCalculator.cpp +5 -5
- package/worker/fuzzer/src/RTC/ICE/FuzzerStunPacket.cpp +9 -6
- package/worker/fuzzer/src/RTC/RTP/FuzzerRetransmissionBuffer.cpp +1 -1
- package/worker/fuzzer/src/RTC/RTP/FuzzerRtpStreamSend.cpp +14 -2
- package/worker/fuzzer/src/RTC/SCTP/association/FuzzerStateCookie.cpp +1 -1
- package/worker/fuzzer/src/RTC/SCTP/packet/FuzzerPacket.cpp +5 -2
- package/worker/fuzzer/src/fuzzer.cpp +3 -10
- package/worker/include/Channel/ChannelMessageRegistrator.hpp +39 -0
- package/worker/include/Channel/ChannelMessageRegistratorInterface.hpp +32 -0
- package/worker/include/Channel/ChannelRequest.hpp +1 -1
- package/worker/include/Channel/ChannelSocket.hpp +1 -1
- package/worker/include/DepLibUV.hpp +1 -1
- package/worker/include/DepLibUring.hpp +3 -3
- package/worker/include/Logger.hpp +4 -4
- package/worker/include/MediaSoupErrors.hpp +1 -1
- package/worker/include/RTC/ActiveSpeakerObserver.hpp +11 -9
- package/worker/include/RTC/AudioLevelObserver.hpp +7 -7
- package/worker/include/RTC/Consumer.hpp +3 -3
- package/worker/include/RTC/DataConsumer.hpp +13 -17
- package/worker/include/RTC/DataProducer.hpp +6 -9
- package/worker/include/RTC/DirectTransport.hpp +4 -6
- package/worker/include/RTC/DtlsTransport.hpp +13 -11
- package/worker/include/RTC/ICE/IceServer.hpp +8 -5
- package/worker/include/RTC/ICE/StunPacket.hpp +1 -1
- package/worker/include/RTC/KeyFrameRequestManager.hpp +15 -12
- package/worker/include/RTC/NackGenerator.hpp +8 -6
- package/worker/include/RTC/PipeConsumer.hpp +1 -2
- package/worker/include/RTC/PipeTransport.hpp +4 -6
- package/worker/include/RTC/PlainTransport.hpp +4 -6
- package/worker/include/RTC/PortManager.hpp +1 -1
- package/worker/include/RTC/Producer.hpp +3 -3
- package/worker/include/RTC/RTCP/FeedbackPs.hpp +1 -1
- package/worker/include/RTC/RTCP/FeedbackRtp.hpp +1 -1
- package/worker/include/RTC/RTCP/FeedbackRtpNack.hpp +1 -1
- package/worker/include/RTC/RTCP/ReceiverReport.hpp +1 -1
- package/worker/include/RTC/RTP/Packet.hpp +2 -2
- package/worker/include/RTC/RTP/RtpStream.hpp +17 -12
- package/worker/include/RTC/RTP/RtpStreamRecv.hpp +8 -6
- package/worker/include/RTC/RTP/RtpStreamSend.hpp +4 -1
- package/worker/include/RTC/RTP/RtxStream.hpp +3 -1
- package/worker/include/RTC/RTP/SharedPacket.hpp +1 -1
- package/worker/include/RTC/RateCalculator.hpp +5 -2
- package/worker/include/RTC/Router.hpp +7 -8
- package/worker/include/RTC/RtpObserver.hpp +3 -3
- package/worker/include/RTC/SCTP/association/Association.hpp +53 -19
- package/worker/include/RTC/SCTP/association/AssociationListenerDeferrer.hpp +14 -6
- package/worker/include/RTC/SCTP/association/HeartbeatHandler.hpp +18 -14
- package/worker/include/RTC/SCTP/association/PacketSender.hpp +3 -3
- package/worker/include/RTC/SCTP/association/StateCookie.hpp +1 -1
- package/worker/include/RTC/SCTP/association/StreamResetHandler.hpp +49 -35
- package/worker/include/RTC/SCTP/association/TransmissionControlBlock.hpp +114 -31
- package/worker/include/RTC/SCTP/association/{TCBContext.hpp → TransmissionControlBlockContextInterface.hpp} +14 -8
- package/worker/include/RTC/SCTP/packet/Chunk.hpp +3 -3
- package/worker/include/RTC/SCTP/packet/TLV.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/UserData.hpp +61 -17
- package/worker/include/RTC/SCTP/packet/chunks/AnyDataChunk.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/chunks/AnyForwardTsnChunk.hpp +9 -9
- package/worker/include/RTC/SCTP/packet/chunks/AnyInitChunk.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/chunks/DataChunk.hpp +4 -2
- package/worker/include/RTC/SCTP/packet/chunks/ForwardTsnChunk.hpp +3 -3
- package/worker/include/RTC/SCTP/packet/chunks/IDataChunk.hpp +4 -2
- package/worker/include/RTC/SCTP/packet/chunks/IForwardTsnChunk.hpp +3 -3
- package/worker/include/RTC/SCTP/packet/chunks/InitAckChunk.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/chunks/InitChunk.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/chunks/SackChunk.hpp +10 -3
- package/worker/include/RTC/SCTP/packet/chunks/ShutdownChunk.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/errorCauses/InvalidStreamIdentifierErrorCause.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/errorCauses/MissingMandatoryParameterErrorCause.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/errorCauses/NoUserDataErrorCause.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/errorCauses/StaleCookieErrorCause.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/AddIncomingStreamsRequestParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/AddOutgoingStreamsRequestParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/CookiePreservativeParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/IncomingSsnResetRequestParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/OutgoingSsnResetRequestParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/ReconfigurationResponseParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/SsnTsnResetRequestParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/SupportedAddressTypesParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/SupportedExtensionsParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/ZeroChecksumAcceptableParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/public/AssociationInterface.hpp +22 -2
- package/worker/include/RTC/SCTP/public/{AssociationListener.hpp → AssociationListenerInterface.hpp} +5 -5
- package/worker/include/RTC/SCTP/public/Message.hpp +26 -10
- package/worker/include/RTC/SCTP/public/SctpOptions.hpp +28 -19
- package/worker/include/RTC/SCTP/public/SctpTypes.hpp +21 -0
- package/worker/include/RTC/SCTP/rx/DataTracker.hpp +277 -0
- package/worker/include/RTC/SCTP/rx/InterleavedReassemblyStreams.hpp +116 -0
- package/worker/include/RTC/SCTP/rx/ReassemblyQueue.hpp +202 -0
- package/worker/include/RTC/SCTP/rx/ReassemblyStreamsInterface.hpp +83 -0
- package/worker/include/RTC/SCTP/rx/TraditionalReassemblyStreams.hpp +183 -0
- package/worker/include/RTC/SCTP/tx/OutstandingData.hpp +595 -0
- package/worker/include/RTC/SCTP/tx/RetransmissionErrorCounter.hpp +3 -3
- package/worker/include/RTC/SCTP/tx/RetransmissionQueue.hpp +329 -0
- package/worker/include/RTC/SCTP/tx/RetransmissionTimeout.hpp +11 -10
- package/worker/include/RTC/SCTP/tx/RoundRobinSendQueue.hpp +356 -0
- package/worker/include/RTC/SCTP/tx/SendQueueInterface.hpp +180 -0
- package/worker/include/RTC/SCTP/tx/StreamScheduler.hpp +235 -0
- package/worker/include/RTC/SenderBandwidthEstimator.hpp +5 -1
- package/worker/include/RTC/Serializable.hpp +11 -3
- package/worker/include/RTC/SimpleConsumer.hpp +1 -2
- package/worker/include/RTC/SimulcastConsumer.hpp +1 -2
- package/worker/include/RTC/SvcConsumer.hpp +1 -2
- package/worker/include/RTC/TcpServer.hpp +2 -2
- package/worker/include/RTC/Transport.hpp +65 -86
- package/worker/include/RTC/TransportCongestionControlClient.hpp +8 -5
- package/worker/include/RTC/TransportCongestionControlServer.hpp +8 -5
- package/worker/include/RTC/TransportTuple.hpp +1 -1
- package/worker/include/RTC/UdpSocket.hpp +1 -1
- package/worker/include/RTC/WebRtcServer.hpp +3 -3
- package/worker/include/RTC/WebRtcTransport.hpp +5 -7
- package/worker/include/Settings.hpp +2 -3
- package/worker/include/Shared.hpp +64 -0
- package/worker/include/SharedInterface.hpp +77 -0
- package/worker/include/Utils/UnwrappedSequenceNumber.hpp +270 -0
- package/worker/include/Utils.hpp +10 -4
- package/worker/include/Worker.hpp +6 -6
- package/worker/include/common.hpp +12 -12
- package/worker/include/handles/BackoffTimerHandle.hpp +28 -67
- package/worker/include/handles/BackoffTimerHandleInterface.hpp +123 -0
- package/worker/include/handles/TimerHandle.hpp +29 -20
- package/worker/include/handles/TimerHandleInterface.hpp +43 -0
- package/worker/meson.build +45 -29
- package/worker/meson_options.txt +2 -1
- package/worker/mocks/include/Channel/MockChannelMessageRegistrator.hpp +45 -0
- package/worker/mocks/include/MockShared.hpp +90 -0
- package/worker/mocks/include/RTC/SCTP/association/MockAssociationListener.hpp +308 -0
- package/worker/mocks/include/RTC/SCTP/association/MockTransmissionControlBlockContext.hpp +183 -0
- package/worker/mocks/include/RTC/SCTP/tx/MockSendQueue.hpp +262 -0
- package/worker/mocks/include/handles/MockBackoffTimerHandle.hpp +153 -0
- package/worker/mocks/include/handles/MockTimerHandle.hpp +74 -0
- package/worker/mocks/include/mockTypes.hpp +15 -0
- package/worker/mocks/src/Channel/MockChannelMessageRegistrator.cpp +128 -0
- package/worker/mocks/src/MockShared.cpp +46 -0
- package/worker/mocks/src/RTC/SCTP/association/MockTransmissionControlBlockContext.cpp +39 -0
- package/worker/mocks/src/handles/MockBackoffTimerHandle.cpp +127 -0
- package/worker/scripts/clang-scripts.mjs +5 -1
- package/worker/scripts/package-lock.json +6 -7
- package/worker/src/Channel/ChannelMessageRegistrator.cpp +125 -0
- package/worker/src/Channel/ChannelSocket.cpp +3 -4
- package/worker/src/DepLibUV.cpp +1 -1
- package/worker/src/DepLibUring.cpp +3 -1
- package/worker/src/Logger.cpp +1 -1
- package/worker/src/MediaSoupErrors.cpp +2 -0
- package/worker/src/RTC/ActiveSpeakerObserver.cpp +14 -14
- package/worker/src/RTC/AudioLevelObserver.cpp +12 -10
- package/worker/src/RTC/Consumer.cpp +28 -26
- package/worker/src/RTC/DataConsumer.cpp +61 -71
- package/worker/src/RTC/DataProducer.cpp +16 -11
- package/worker/src/RTC/DirectTransport.cpp +21 -20
- package/worker/src/RTC/DtlsTransport.cpp +4 -4
- package/worker/src/RTC/ICE/IceServer.cpp +6 -5
- package/worker/src/RTC/ICE/StunPacket.cpp +1 -1
- package/worker/src/RTC/KeyFrameRequestManager.cpp +15 -15
- package/worker/src/RTC/NackGenerator.cpp +6 -6
- package/worker/src/RTC/PipeConsumer.cpp +6 -5
- package/worker/src/RTC/PipeTransport.cpp +9 -22
- package/worker/src/RTC/PlainTransport.cpp +16 -28
- package/worker/src/RTC/Producer.cpp +40 -39
- package/worker/src/RTC/RTCP/FeedbackPsAfb.cpp +1 -1
- package/worker/src/RTC/RTCP/FeedbackPsRpsi.cpp +1 -2
- package/worker/src/RTC/RTCP/FeedbackRtpTransport.cpp +1 -1
- package/worker/src/RTC/RTCP/XR.cpp +1 -1
- package/worker/src/RTC/RTP/Packet.cpp +3 -1
- package/worker/src/RTC/RTP/ProbationGenerator.cpp +4 -4
- package/worker/src/RTC/RTP/RetransmissionBuffer.cpp +1 -1
- package/worker/src/RTC/RTP/RtpStream.cpp +17 -10
- package/worker/src/RTC/RTP/RtpStreamRecv.cpp +16 -14
- package/worker/src/RTC/RTP/RtpStreamSend.cpp +12 -9
- package/worker/src/RTC/RTP/RtxStream.cpp +7 -7
- package/worker/src/RTC/RTP/SharedPacket.cpp +3 -3
- package/worker/src/RTC/RateCalculator.cpp +1 -2
- package/worker/src/RTC/Router.cpp +61 -38
- package/worker/src/RTC/RtpDictionaries/RtpCodecMimeType.cpp +1 -1
- package/worker/src/RTC/RtpObserver.cpp +2 -1
- package/worker/src/RTC/SCTP/LICENSE +44 -0
- package/worker/src/RTC/SCTP/association/Association.cpp +417 -411
- package/worker/src/RTC/SCTP/association/AssociationListenerDeferrer.cpp +46 -13
- package/worker/src/RTC/SCTP/association/HeartbeatHandler.cpp +47 -43
- package/worker/src/RTC/SCTP/association/PacketSender.cpp +8 -8
- package/worker/src/RTC/SCTP/association/StreamResetHandler.cpp +113 -101
- package/worker/src/RTC/SCTP/association/TransmissionControlBlock.cpp +291 -62
- package/worker/src/RTC/SCTP/packet/Chunk.cpp +5 -1
- package/worker/src/RTC/SCTP/packet/Packet.cpp +8 -1
- package/worker/src/RTC/SCTP/packet/chunks/DataChunk.cpp +17 -0
- package/worker/src/RTC/SCTP/packet/chunks/ForwardTsnChunk.cpp +4 -4
- package/worker/src/RTC/SCTP/packet/chunks/IDataChunk.cpp +25 -0
- package/worker/src/RTC/SCTP/packet/chunks/IForwardTsnChunk.cpp +10 -7
- package/worker/src/RTC/SCTP/packet/chunks/SackChunk.cpp +21 -4
- package/worker/src/RTC/SCTP/packet/chunks/ShutdownCompleteChunk.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/errorCauses/NoUserDataErrorCause.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/errorCauses/ProtocolViolationErrorCause.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/errorCauses/UserInitiatedAbortErrorCause.cpp +1 -1
- package/worker/src/RTC/SCTP/public/Message.cpp +8 -0
- package/worker/src/RTC/SCTP/public/SctpOptions.cpp +90 -0
- package/worker/src/RTC/SCTP/rx/DataTracker.cpp +471 -0
- package/worker/src/RTC/SCTP/rx/InterleavedReassemblyStreams.cpp +327 -0
- package/worker/src/RTC/SCTP/rx/ReassemblyQueue.cpp +288 -0
- package/worker/src/RTC/SCTP/rx/TraditionalReassemblyStreams.cpp +453 -0
- package/worker/src/RTC/SCTP/tx/OutstandingData.cpp +912 -0
- package/worker/src/RTC/SCTP/tx/RetransmissionQueue.cpp +786 -0
- package/worker/src/RTC/SCTP/tx/RetransmissionTimeout.cpp +2 -2
- package/worker/src/RTC/SCTP/tx/RoundRobinSendQueue.cpp +752 -0
- package/worker/src/RTC/SCTP/tx/StreamScheduler.cpp +257 -0
- package/worker/src/RTC/SenderBandwidthEstimator.cpp +7 -5
- package/worker/src/RTC/SimpleConsumer.cpp +11 -11
- package/worker/src/RTC/SimulcastConsumer.cpp +16 -16
- package/worker/src/RTC/SrtpSession.cpp +1 -1
- package/worker/src/RTC/SvcConsumer.cpp +16 -16
- package/worker/src/RTC/TcpConnection.cpp +1 -1
- package/worker/src/RTC/Transport.cpp +497 -563
- package/worker/src/RTC/TransportCongestionControlClient.cpp +9 -8
- package/worker/src/RTC/TransportCongestionControlServer.cpp +5 -5
- package/worker/src/RTC/WebRtcServer.cpp +5 -4
- package/worker/src/RTC/WebRtcTransport.cpp +44 -39
- package/worker/src/Settings.cpp +9 -28
- package/worker/src/Shared.cpp +35 -0
- package/worker/src/Utils/Crypto.cpp +1 -1
- package/worker/src/Utils/String.cpp +1 -1
- package/worker/src/Worker.cpp +19 -48
- package/worker/src/handles/BackoffTimerHandle.cpp +34 -21
- package/worker/src/handles/TimerHandle.cpp +5 -4
- package/worker/src/handles/UdpSocketHandle.cpp +1 -1
- package/worker/src/lib.cpp +17 -16
- package/worker/subprojects/catch2.wrap +6 -6
- package/worker/tasks.py +1 -1
- package/worker/test/include/RTC/ICE/iceCommon.hpp +8 -7
- package/worker/test/include/RTC/RTP/rtpCommon.hpp +7 -6
- package/worker/test/include/RTC/SCTP/sctpCommon.hpp +16 -10
- package/worker/test/include/catch2Macros.hpp +31 -0
- package/worker/test/src/RTC/ICE/TestStunPacket.cpp +3 -3
- package/worker/test/src/RTC/ICE/iceCommon.cpp +2 -2
- package/worker/test/src/RTC/RTP/Codecs/TestVP8.cpp +1 -1
- package/worker/test/src/RTC/RTP/Codecs/TestVP9.cpp +1 -1
- package/worker/test/src/RTC/RTP/TestPacket.cpp +3 -3
- package/worker/test/src/RTC/RTP/TestRtpStreamRecv.cpp +16 -9
- package/worker/test/src/RTC/RTP/TestRtpStreamSend.cpp +38 -23
- package/worker/test/src/RTC/RTP/TestSharedPacket.cpp +1 -1
- package/worker/test/src/RTC/RTP/rtpCommon.cpp +2 -2
- package/worker/test/src/RTC/SCTP/association/TestHeartbeatHandler.cpp +292 -0
- package/worker/test/src/RTC/SCTP/association/TestNegotiatedCapabilities.cpp +1 -1
- package/worker/test/src/RTC/SCTP/association/TestStateCookie.cpp +1 -1
- package/worker/test/src/RTC/SCTP/association/TestTransmissionControlBlock.cpp +99 -0
- package/worker/test/src/RTC/SCTP/packet/TestChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/TestPacket.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestAbortAssociationChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestCookieAckChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestCookieEchoChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestDataChunk.cpp +77 -7
- package/worker/test/src/RTC/SCTP/packet/chunks/TestForwardTsnChunk.cpp +35 -26
- package/worker/test/src/RTC/SCTP/packet/chunks/TestHeartbeatAckChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestHeartbeatRequestChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestIDataChunk.cpp +77 -7
- package/worker/test/src/RTC/SCTP/packet/chunks/TestIForwardTsnChunk.cpp +59 -27
- package/worker/test/src/RTC/SCTP/packet/chunks/TestInitAckChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestInitChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestOperationErrorChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestReConfigChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestSackChunk.cpp +73 -35
- package/worker/test/src/RTC/SCTP/packet/chunks/TestShutdownAckChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestShutdownChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestShutdownCompleteChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestUnknownChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestCookieReceivedWhileShuttingDownErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestInvalidMandatoryParameterErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestInvalidStreamIdentifierErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestMissingMandatoryParameterErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestNoUserDataErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestOutOfResourceErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestProtocolViolationErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestRestartOfAnAssociationWithNewAddressesErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestStaleCookieErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestUnknownErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestUnrecognizedChunkTypeErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestUnrecognizedParametersErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestUnresolvableAddressErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestUserInitiatedAbortErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestAddIncomingStreamsRequestParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestAddOutgoingStreamsRequestParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestCookiePreservativeParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestForwardTsnSupportedParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestHeartbeatInfoParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestIPv4AddressParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestIPv6AddressParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestIncomingSsnResetRequestParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestOutgoingSsnResetRequestParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestReconfigurationResponseParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestSsnTsnResetRequestParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestStateCookieParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestSupportedAddressTypesParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestSupportedExtensionsParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestUnknownParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestUnrecognizedParameterParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestZeroChecksumAcceptableParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/rx/TestDataTracker.cpp +1117 -0
- package/worker/test/src/RTC/SCTP/rx/TestInterleavedReassemblyStreams.cpp +565 -0
- package/worker/test/src/RTC/SCTP/rx/TestReassemblyQueue.cpp +557 -0
- package/worker/test/src/RTC/SCTP/rx/TestTraditionalReassemblyStreams.cpp +555 -0
- package/worker/test/src/RTC/SCTP/sctpCommon.cpp +2 -2
- package/worker/test/src/RTC/SCTP/tx/TestOutstandingData.cpp +1248 -0
- package/worker/test/src/RTC/SCTP/tx/TestRetransmissionErrorCounter.cpp +4 -0
- package/worker/test/src/RTC/SCTP/tx/TestRetransmissionQueue.cpp +2218 -0
- package/worker/test/src/RTC/SCTP/tx/TestRetransmissionTimeout.cpp +33 -33
- package/worker/test/src/RTC/SCTP/tx/TestRoundRobinSendQueue.cpp +1130 -0
- package/worker/test/src/RTC/SCTP/tx/TestStreamScheduler.cpp +721 -0
- package/worker/test/src/RTC/TestKeyFrameRequestManager.cpp +20 -30
- package/worker/test/src/RTC/TestNackGenerator.cpp +11 -8
- package/worker/test/src/RTC/TestRateCalculator.cpp +6 -7
- package/worker/test/src/RTC/TestSimpleConsumer.cpp +11 -11
- package/worker/test/src/RTC/TestTransportCongestionControlServer.cpp +15 -3
- package/worker/test/src/Utils/TestByte.cpp +98 -0
- package/worker/test/src/{RTC/SCTP/common → Utils}/TestUnwrappedSequenceNumber.cpp +2 -2
- package/worker/test/src/testHelpers.cpp +1 -1
- package/worker/test/src/tests.cpp +0 -12
- package/node/lib/fbs/consumer/degrade-request.d.ts +0 -30
- package/node/lib/fbs/consumer/degrade-request.d.ts.map +0 -1
- package/node/lib/fbs/consumer/degrade-request.js +0 -91
- package/node/lib/fbs/consumer/enable-delay-and-loss-request.d.ts +0 -24
- package/node/lib/fbs/consumer/enable-delay-and-loss-request.d.ts.map +0 -1
- package/node/lib/fbs/consumer/enable-delay-and-loss-request.js +0 -69
- package/node/lib/fbs/producer/degrade-request.d.ts +0 -30
- package/node/lib/fbs/producer/degrade-request.d.ts.map +0 -1
- package/node/lib/fbs/producer/degrade-request.js +0 -91
- package/node/lib/fbs/worker/close-notification.d.ts +0 -18
- package/node/lib/fbs/worker/close-notification.d.ts.map +0 -1
- package/node/lib/fbs/worker/close-notification.js +0 -45
- package/node/lib/fbs/worker/close-request.d.ts +0 -18
- package/node/lib/fbs/worker/close-request.d.ts.map +0 -1
- package/node/lib/fbs/worker/close-request.js +0 -45
- package/node/lib/fbs/worker/close-worker-notification.d.ts +0 -18
- package/node/lib/fbs/worker/close-worker-notification.d.ts.map +0 -1
- package/node/lib/fbs/worker/close-worker-notification.js +0 -45
- package/worker/include/ChannelMessageRegistrator.hpp +0 -30
- package/worker/include/DepUsrSCTP.hpp +0 -48
- package/worker/include/RTC/SCTP/TODO_SCTP.md +0 -43
- package/worker/include/RTC/SCTP/common/UnwrappedSequenceNumber.hpp +0 -274
- package/worker/include/RTC/SctpAssociation.hpp +0 -147
- package/worker/include/RTC/Shared.hpp +0 -23
- package/worker/src/ChannelMessageRegistrator.cpp +0 -119
- package/worker/src/DepUsrSCTP.cpp +0 -277
- package/worker/src/RTC/SctpAssociation.cpp +0 -1175
- package/worker/src/RTC/Shared.cpp +0 -23
- package/worker/subprojects/usrsctp.wrap +0 -8
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
#define MS_RTC_SCTP_TYPES_HPP
|
|
3
3
|
|
|
4
4
|
#include "common.hpp"
|
|
5
|
+
#include "Utils/UnwrappedSequenceNumber.hpp"
|
|
6
|
+
#include <limits>
|
|
5
7
|
#include <string_view>
|
|
6
8
|
|
|
7
9
|
namespace RTC
|
|
@@ -331,6 +333,25 @@ namespace RTC
|
|
|
331
333
|
}
|
|
332
334
|
}
|
|
333
335
|
}
|
|
336
|
+
|
|
337
|
+
constexpr uint16_t MaxRetransmitsNoLimit{ std::numeric_limits<uint16_t>::max() };
|
|
338
|
+
|
|
339
|
+
constexpr uint64_t ExpiresAtMsInfinite{ std::numeric_limits<uint64_t>::max() };
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Unwrapped Transmission Sequence Numbers (TSN).
|
|
343
|
+
*/
|
|
344
|
+
using UnwrappedTsn = Utils::UnwrappedSequenceNumber<uint32_t>;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Unwrapped Stream Sequence Numbers (SSN).
|
|
348
|
+
*/
|
|
349
|
+
using UnwrappedSsn = Utils::UnwrappedSequenceNumber<uint16_t>;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Unwrapped Message Identifier (MID).
|
|
353
|
+
*/
|
|
354
|
+
using UnwrappedMid = Utils::UnwrappedSequenceNumber<uint32_t>;
|
|
334
355
|
} // namespace Types
|
|
335
356
|
} // namespace SCTP
|
|
336
357
|
} // namespace RTC
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
#ifndef MS_RTC_SCTP_DATA_TRACKER_HPP
|
|
2
|
+
#define MS_RTC_SCTP_DATA_TRACKER_HPP
|
|
3
|
+
|
|
4
|
+
#include "common.hpp"
|
|
5
|
+
#include "Utils/UnwrappedSequenceNumber.hpp"
|
|
6
|
+
#include "handles/BackoffTimerHandleInterface.hpp"
|
|
7
|
+
#include "RTC/SCTP/packet/Packet.hpp"
|
|
8
|
+
#include "RTC/SCTP/packet/UserData.hpp"
|
|
9
|
+
#include "RTC/SCTP/packet/chunks/SackChunk.hpp"
|
|
10
|
+
#include "RTC/SCTP/public/SctpTypes.hpp"
|
|
11
|
+
#include <set>
|
|
12
|
+
#include <string_view>
|
|
13
|
+
#include <vector>
|
|
14
|
+
|
|
15
|
+
namespace RTC
|
|
16
|
+
{
|
|
17
|
+
namespace SCTP
|
|
18
|
+
{
|
|
19
|
+
/**
|
|
20
|
+
* Keeps track of received DATA and I-DATA chunks and handles all logic for
|
|
21
|
+
* when_to create SACKs and also how_to generate them.
|
|
22
|
+
*
|
|
23
|
+
* It only uses TSNs to track delivery and doesn't need to be aware of
|
|
24
|
+
* streams.
|
|
25
|
+
*
|
|
26
|
+
* SACKs are optimally sent every second packet on association with no packet
|
|
27
|
+
* loss. When packet loss is detected, it's sent for every packet. When SACKs
|
|
28
|
+
* are not sent directly, a timer is used to send a SACK delayed (by RTO/2,
|
|
29
|
+
* or 200ms, whatever is smallest).
|
|
30
|
+
*/
|
|
31
|
+
class DataTracker
|
|
32
|
+
{
|
|
33
|
+
public:
|
|
34
|
+
/**
|
|
35
|
+
* The maximum number of duplicate TSNs that will be reported in a SACK.
|
|
36
|
+
*/
|
|
37
|
+
static constexpr size_t MaxDuplicateTsnReported{ 20 };
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The maximum number of gap-ack-blocks that will be reported in a SACK.
|
|
41
|
+
*/
|
|
42
|
+
static constexpr size_t MaxGapAckBlocksReported{ 20 };
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The maximum number of accepted in-flight DATA / I-DATA chunks. This
|
|
46
|
+
* indicates the maximum difference from this buffer's last cumulative ack
|
|
47
|
+
* TSN, and any received data. Data received beyond this limit will be
|
|
48
|
+
* dropped, which will force the transmitter to send data that actually
|
|
49
|
+
* increases the last cumulative acked TSN.
|
|
50
|
+
*/
|
|
51
|
+
static constexpr uint32_t MaxAcceptedOutstandingFragments{ 100000 };
|
|
52
|
+
|
|
53
|
+
private:
|
|
54
|
+
enum class AckState : uint8_t
|
|
55
|
+
{
|
|
56
|
+
/**
|
|
57
|
+
* No need to send an ACK.
|
|
58
|
+
*/
|
|
59
|
+
IDLE,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Has received data chunks (but not yet end of packet).
|
|
63
|
+
*/
|
|
64
|
+
BECOMING_DELAYED,
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Has received data chunks and the end of a packet. Delayed ack timer is
|
|
68
|
+
* running and a SACK will be sent on expiry, or if DATA / I-DATA is sent,
|
|
69
|
+
* or after next packet with data.
|
|
70
|
+
*/
|
|
71
|
+
DELAYED,
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Send a SACK immediately after handling this packet.
|
|
75
|
+
*/
|
|
76
|
+
IMMEDIATE,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
private:
|
|
80
|
+
static constexpr std::string_view AckStateToString(AckState ackState)
|
|
81
|
+
{
|
|
82
|
+
// NOTE: We cannot use MS_TRACE() here because clang in Linux will
|
|
83
|
+
// complain about "read of non-constexpr variable 'configuration' is not
|
|
84
|
+
// allowed in a constant expression".
|
|
85
|
+
|
|
86
|
+
switch (ackState)
|
|
87
|
+
{
|
|
88
|
+
case AckState::IDLE:
|
|
89
|
+
{
|
|
90
|
+
return "IDLE";
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
case AckState::BECOMING_DELAYED:
|
|
94
|
+
{
|
|
95
|
+
return "BECOMING_DELAYED";
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
case AckState::DELAYED:
|
|
99
|
+
{
|
|
100
|
+
return "DELAYED";
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
case AckState::IMMEDIATE:
|
|
104
|
+
{
|
|
105
|
+
return "IMMEDIATE";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
NO_DEFAULT_GCC();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
private:
|
|
113
|
+
/**
|
|
114
|
+
* Represents ranges of TSNs that have been received that are not directly
|
|
115
|
+
* following the last cumulative acked TSN. This information is returned
|
|
116
|
+
* to the sender in the "gap-ack-blocks" in the SACK chunk. The blocks are
|
|
117
|
+
* always non-overlapping and non-adjacent.
|
|
118
|
+
*/
|
|
119
|
+
class AdditionalTsnBlocks
|
|
120
|
+
{
|
|
121
|
+
public:
|
|
122
|
+
/**
|
|
123
|
+
* Represents an inclusive range of received TSNs, i.e. [firstTsn, lastTsn].
|
|
124
|
+
*/
|
|
125
|
+
struct TsnRange
|
|
126
|
+
{
|
|
127
|
+
TsnRange(Types::UnwrappedTsn firstTsn, Types::UnwrappedTsn lastTsn)
|
|
128
|
+
: firstTsn(firstTsn), lastTsn(lastTsn)
|
|
129
|
+
{
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
Types::UnwrappedTsn firstTsn;
|
|
133
|
+
Types::UnwrappedTsn lastTsn;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Adds a TSN to the set. This will try to expand any existing block and
|
|
138
|
+
* might merge blocks to ensure that all blocks are non-adjacent. If a
|
|
139
|
+
* current block can't be expanded, a new block is created.
|
|
140
|
+
*
|
|
141
|
+
* The return value indicates if `tsn` was added. If false is returned,
|
|
142
|
+
* the `tsn` was already represented in one of the blocks.
|
|
143
|
+
*/
|
|
144
|
+
bool Add(Types::UnwrappedTsn tsn);
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Erases all TSNs up to, and including `tsn`. This will remove all
|
|
148
|
+
* blocks that are completely below `tsn` and may truncate a block where
|
|
149
|
+
* `tsn` is within that block. In that case, the frontmost block's start
|
|
150
|
+
* TSN will be the next following tsn after `tsn`.
|
|
151
|
+
*/
|
|
152
|
+
void EraseTo(Types::UnwrappedTsn tsn);
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Removes the first block. Must not be called on an empty set.
|
|
156
|
+
*/
|
|
157
|
+
void PopFront();
|
|
158
|
+
|
|
159
|
+
const std::vector<TsnRange>& GetBlocks() const
|
|
160
|
+
{
|
|
161
|
+
return this->blocks;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
bool IsEmpty() const
|
|
165
|
+
{
|
|
166
|
+
return this->blocks.empty();
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const TsnRange& Front() const
|
|
170
|
+
{
|
|
171
|
+
return this->blocks.front();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
private:
|
|
175
|
+
// A sorted vector of non-overlapping and non-adjacent blocks.
|
|
176
|
+
std::vector<TsnRange> blocks;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
public:
|
|
180
|
+
DataTracker(BackoffTimerHandleInterface* delayedAckTimer, uint32_t remoteInitialTsn);
|
|
181
|
+
|
|
182
|
+
public:
|
|
183
|
+
/**
|
|
184
|
+
* Indicates if the provided TSN is valid. If this return false, the data
|
|
185
|
+
* should be dropped and not added to any other buffers, which essentially
|
|
186
|
+
* means that there is intentional packet loss.
|
|
187
|
+
*/
|
|
188
|
+
bool IsTsnValid(uint32_t tsn) const;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Called for every incoming data chunk. Returns `true` if `tsn` was seen
|
|
192
|
+
* for the first time, and `false` if it has been seen before (a duplicate
|
|
193
|
+
* `tsn`).
|
|
194
|
+
*
|
|
195
|
+
* @remarks
|
|
196
|
+
* - `IsTsnValid()` must be called prior to calling this method.
|
|
197
|
+
*/
|
|
198
|
+
bool Observe(uint32_t tsn, bool immediateAck = false);
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Called at the end of processing an SCTP packet.
|
|
202
|
+
*/
|
|
203
|
+
void ObservePacketEnd();
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Called for incoming FORWARD-TSN/I-FORWARD-TSN chunks. Indicates if the
|
|
207
|
+
* chunk had any effect.
|
|
208
|
+
*/
|
|
209
|
+
bool HandleForwardTsn(uint32_t newCumulativeTsn);
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Indicates if a SACK should be sent. There may be other reasons to send
|
|
213
|
+
* a SACK, but if this function indicates so, it should be sent as soon as
|
|
214
|
+
* possible. Calling this function will make it clear a flag so that if
|
|
215
|
+
* it's called again, it will probably return `false`.
|
|
216
|
+
*
|
|
217
|
+
* If the delayed ack timer is running, this method will return `false`
|
|
218
|
+
* unless `alsoIfDelayed` is set to `true`. Then it will return true as
|
|
219
|
+
* well.
|
|
220
|
+
*/
|
|
221
|
+
bool ShouldSendAck(bool alsoIfDelayed = false);
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Forces `ShouldSendSack()` to return `true`.
|
|
225
|
+
*/
|
|
226
|
+
void ForceImmediateSack();
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Returns the last cumulative ack TSN - the last seen data chunk's TSN
|
|
230
|
+
* value before any packet loss was detected.
|
|
231
|
+
*/
|
|
232
|
+
uint32_t GetLastCumulativeAckedTsn() const
|
|
233
|
+
{
|
|
234
|
+
return this->lastCumulativeAckedTsn.Wrap();
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
bool IsLaterThanCumulativeAckedTsn(uint32_t tsn) const
|
|
238
|
+
{
|
|
239
|
+
return this->tsnUnwrapper.PeekUnwrap(tsn) > this->lastCumulativeAckedTsn;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Returns `true` if the received `tsn` would increase the cumulative ack
|
|
244
|
+
* TSN.
|
|
245
|
+
*/
|
|
246
|
+
bool WillIncreaseCumAckTsn(uint32_t tsn) const;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Adds a SACK chunk with selective ack to the given Packet.
|
|
250
|
+
*
|
|
251
|
+
* @remarks
|
|
252
|
+
* - It will clear `this->duplicates`, so every SACK chunk that is
|
|
253
|
+
* consumed must be sent.
|
|
254
|
+
*/
|
|
255
|
+
void AddSackSelectiveAck(Packet* packet, size_t aRwnd);
|
|
256
|
+
|
|
257
|
+
void HandleDelayedAckTimerExpiry();
|
|
258
|
+
|
|
259
|
+
private:
|
|
260
|
+
void UpdateAckState(AckState newAckState, std::string_view reason);
|
|
261
|
+
|
|
262
|
+
private:
|
|
263
|
+
// If a packet has ever been seen.
|
|
264
|
+
BackoffTimerHandleInterface* delayedAckTimer;
|
|
265
|
+
bool packetSeen{ false };
|
|
266
|
+
AckState ackState{ AckState::IDLE };
|
|
267
|
+
Types::UnwrappedTsn::Unwrapper tsnUnwrapper;
|
|
268
|
+
// All TSNs up until (and including) this value have been seen.
|
|
269
|
+
Types::UnwrappedTsn lastCumulativeAckedTsn;
|
|
270
|
+
// Received TSNs that are not directly following `lastCumulativeAckedTsn`.
|
|
271
|
+
AdditionalTsnBlocks additionalTsnBlocks;
|
|
272
|
+
std::set<uint32_t> duplicateTsns;
|
|
273
|
+
};
|
|
274
|
+
} // namespace SCTP
|
|
275
|
+
} // namespace RTC
|
|
276
|
+
|
|
277
|
+
#endif
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#ifndef MS_RTC_SCTP_INTERLEAVED_REASSEMBLY_STREAMS_HPP
|
|
2
|
+
#define MS_RTC_SCTP_INTERLEAVED_REASSEMBLY_STREAMS_HPP
|
|
3
|
+
|
|
4
|
+
#include "common.hpp"
|
|
5
|
+
#include "RTC/SCTP/rx/ReassemblyStreamsInterface.hpp"
|
|
6
|
+
#include <map>
|
|
7
|
+
#include <span>
|
|
8
|
+
#include <tuple> // std::tie()
|
|
9
|
+
|
|
10
|
+
namespace RTC
|
|
11
|
+
{
|
|
12
|
+
namespace SCTP
|
|
13
|
+
{
|
|
14
|
+
/**
|
|
15
|
+
* Handles reassembly of incoming data when interleaved message sending is
|
|
16
|
+
* enabled on the association, i.e. when RFC 8260 is in use.
|
|
17
|
+
*
|
|
18
|
+
* In other words, this class handles data received via I-DATA chunks.
|
|
19
|
+
*/
|
|
20
|
+
class InterleavedReassemblyStreams : public ReassemblyStreamsInterface
|
|
21
|
+
{
|
|
22
|
+
private:
|
|
23
|
+
struct FullStreamId
|
|
24
|
+
{
|
|
25
|
+
FullStreamId(bool unordered, uint16_t streamId) : unordered(unordered), streamId(streamId)
|
|
26
|
+
{
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
friend bool operator<(FullStreamId a, FullStreamId b)
|
|
30
|
+
{
|
|
31
|
+
return std::tie(a.unordered, a.streamId) < std::tie(b.unordered, b.streamId);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const bool unordered;
|
|
35
|
+
const uint16_t streamId;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
private:
|
|
39
|
+
class Stream
|
|
40
|
+
{
|
|
41
|
+
private:
|
|
42
|
+
using ChunkMap = std::map<uint32_t /*fsn*/, std::pair<Types::UnwrappedTsn, UserData>>;
|
|
43
|
+
|
|
44
|
+
public:
|
|
45
|
+
Stream(FullStreamId fullStreamId, InterleavedReassemblyStreams* parent, uint32_t nextMid = 0)
|
|
46
|
+
: fullStreamId(fullStreamId), parent(*parent), nextMid(midUnwrapper.Unwrap(nextMid))
|
|
47
|
+
{
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
int32_t AddData(Types::UnwrappedTsn tsn, UserData data);
|
|
52
|
+
|
|
53
|
+
size_t EraseTo(uint32_t mid);
|
|
54
|
+
|
|
55
|
+
void Reset()
|
|
56
|
+
{
|
|
57
|
+
this->midUnwrapper.Reset();
|
|
58
|
+
this->nextMid = this->midUnwrapper.Unwrap(0);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
bool HasUnassembledChunks() const
|
|
62
|
+
{
|
|
63
|
+
return !this->chunksByMid.empty();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private:
|
|
67
|
+
/**
|
|
68
|
+
* Try to assemble one message identified by `mid`. Returns the number
|
|
69
|
+
* of bytes assembled if a message was assembled.
|
|
70
|
+
*/
|
|
71
|
+
size_t TryToAssembleMessage(Types::UnwrappedMid mid);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Try to assemble several messages in order from the stream. Returns
|
|
75
|
+
* the number of bytes assembled if a message was assembled.
|
|
76
|
+
*/
|
|
77
|
+
size_t TryToAssembleMessages();
|
|
78
|
+
|
|
79
|
+
size_t AssembleMessage(ChunkMap& tsnChunks);
|
|
80
|
+
|
|
81
|
+
size_t AssembleMessage(Types::UnwrappedTsn tsn, UserData data);
|
|
82
|
+
|
|
83
|
+
private:
|
|
84
|
+
const FullStreamId fullStreamId;
|
|
85
|
+
InterleavedReassemblyStreams& parent;
|
|
86
|
+
std::map<Types::UnwrappedMid, ChunkMap> chunksByMid;
|
|
87
|
+
Types::UnwrappedMid::Unwrapper midUnwrapper;
|
|
88
|
+
Types::UnwrappedMid nextMid;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
public:
|
|
92
|
+
explicit InterleavedReassemblyStreams(
|
|
93
|
+
ReassemblyStreamsInterface::OnAssembledMessage onAssembledMessage);
|
|
94
|
+
|
|
95
|
+
public:
|
|
96
|
+
int32_t AddData(Types::UnwrappedTsn tsn, UserData data) override;
|
|
97
|
+
|
|
98
|
+
size_t HandleForwardTsn(
|
|
99
|
+
Types::UnwrappedTsn newCumulativeTsn,
|
|
100
|
+
std::span<const AnyForwardTsnChunk::SkippedStream> skippedStreams) override;
|
|
101
|
+
|
|
102
|
+
void ResetStreams(std::span<const uint16_t> streamIds) override;
|
|
103
|
+
|
|
104
|
+
private:
|
|
105
|
+
Stream& GetOrCreateStream(const FullStreamId& streamId);
|
|
106
|
+
|
|
107
|
+
private:
|
|
108
|
+
// Callback for when a message has been assembled.
|
|
109
|
+
const OnAssembledMessage onAssembledMessage;
|
|
110
|
+
// All unordered and ordered streams, managing not-yet-assembled data.
|
|
111
|
+
std::map<FullStreamId, Stream> streams;
|
|
112
|
+
};
|
|
113
|
+
} // namespace SCTP
|
|
114
|
+
} // namespace RTC
|
|
115
|
+
|
|
116
|
+
#endif
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
#ifndef MS_RTC_SCTP_REASSEMBLY_QUEUE_HPP
|
|
2
|
+
#define MS_RTC_SCTP_REASSEMBLY_QUEUE_HPP
|
|
3
|
+
|
|
4
|
+
#include "common.hpp"
|
|
5
|
+
#include "RTC/SCTP/packet/UserData.hpp"
|
|
6
|
+
#include "RTC/SCTP/packet/chunks/AnyForwardTsnChunk.hpp"
|
|
7
|
+
#include "RTC/SCTP/public/Message.hpp"
|
|
8
|
+
#include "RTC/SCTP/public/SctpTypes.hpp"
|
|
9
|
+
#include "RTC/SCTP/rx/ReassemblyStreamsInterface.hpp"
|
|
10
|
+
#include <deque>
|
|
11
|
+
#include <set>
|
|
12
|
+
#include <span>
|
|
13
|
+
#include <vector>
|
|
14
|
+
|
|
15
|
+
namespace RTC
|
|
16
|
+
{
|
|
17
|
+
namespace SCTP
|
|
18
|
+
{
|
|
19
|
+
/**
|
|
20
|
+
* Contains the received DATA / I-DATA chunks that haven't yet been
|
|
21
|
+
* reassembled, and reassembles chunks when possible.
|
|
22
|
+
*
|
|
23
|
+
* The actual assembly is handled by an implementation of the
|
|
24
|
+
* `ReassemblyStreamsInterface` interface.
|
|
25
|
+
*
|
|
26
|
+
* Except for reassembling fragmented messages, this class will also handle
|
|
27
|
+
* two less common operations. To handle the receiver-side of partial
|
|
28
|
+
* reliability (limited number of retransmissions or limited message
|
|
29
|
+
* lifetime) as well as stream resetting, which is used when a sender wishes
|
|
30
|
+
* to close SCTP streams.
|
|
31
|
+
*
|
|
32
|
+
* Partial reliability is handled when a FORWARD-TSN or I-FORWARD-TSN chunk
|
|
33
|
+
* is received, and it will simply delete any chunks matching the parameters
|
|
34
|
+
* in that chunk. This is mainly implemented in ReassemblyStreams classes.
|
|
35
|
+
*
|
|
36
|
+
* Resetting streams is handled when a RECONFIG chunks is received with an
|
|
37
|
+
* "Outgoing SSN Reset Request" parameter. That parameter will contain a list
|
|
38
|
+
* of streams to reset, and a `senderLastAssignedTsn`. If this TSN is not yet
|
|
39
|
+
* seen, the stream cannot be directly reset, and this class will respond
|
|
40
|
+
* that the reset is "deferred". But if this TSN provided is known, the
|
|
41
|
+
* stream can be immediately be reset.
|
|
42
|
+
*
|
|
43
|
+
* The reassembly queue has a maximum size, as it would otherwise be an DoS
|
|
44
|
+
* attack vector where a peer could consume all memory of the other peer by
|
|
45
|
+
* sending a lot of ordered chunks, but carefully withholding an early one.
|
|
46
|
+
* It also has a watermark limit, which the caller can query is the number
|
|
47
|
+
* of bytes is above that limit. This is used by the caller to be selective
|
|
48
|
+
* in what to add to the reassembly queue, so that it's not exhausted. The
|
|
49
|
+
* caller is expected to call `IsFull()` prior to adding data to the queue
|
|
50
|
+
* and to act accordingly if the queue is full.
|
|
51
|
+
*/
|
|
52
|
+
class ReassemblyQueue
|
|
53
|
+
{
|
|
54
|
+
public:
|
|
55
|
+
/**
|
|
56
|
+
* When the queue is filled over this fraction (of its maximum size), the
|
|
57
|
+
* SCTP association should restrict incoming data to avoid filling up the
|
|
58
|
+
* queue.
|
|
59
|
+
*/
|
|
60
|
+
static constexpr float HighWatermarkLimit{ 0.9 };
|
|
61
|
+
|
|
62
|
+
private:
|
|
63
|
+
struct DeferredResetStreams
|
|
64
|
+
{
|
|
65
|
+
DeferredResetStreams(Types::UnwrappedTsn senderLastAssignedTsn, std::set<uint16_t> streamIds)
|
|
66
|
+
: senderLastAssignedTsn(senderLastAssignedTsn), streamIds(std::move(streamIds))
|
|
67
|
+
{
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
Types::UnwrappedTsn senderLastAssignedTsn;
|
|
71
|
+
std::set<uint16_t> streamIds;
|
|
72
|
+
std::vector<std::function<void()>> deferredActions;
|
|
73
|
+
// TODO: SCTP: Once we upgrade to C++23, replace with:
|
|
74
|
+
// std::vector<std::move_only_function<void()>> deferredActions;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
public:
|
|
78
|
+
explicit ReassemblyQueue(size_t maxLengthBytes, bool useMessageInterleaving = false);
|
|
79
|
+
|
|
80
|
+
~ReassemblyQueue();
|
|
81
|
+
|
|
82
|
+
public:
|
|
83
|
+
/**
|
|
84
|
+
* Adds a data chunk to the queue, with a `tsn` and other parameters in
|
|
85
|
+
* `data`.
|
|
86
|
+
*/
|
|
87
|
+
void AddData(uint32_t tsn, UserData data);
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Indicates if the reassembly queue has any reassembled messages that can
|
|
91
|
+
* be retrieved by calling `GetNextMessage()`.
|
|
92
|
+
*/
|
|
93
|
+
bool HasMessages() const
|
|
94
|
+
{
|
|
95
|
+
return !this->reassembledMessages.empty();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Returns the number of reassembled messages that are ready to be
|
|
100
|
+
* retrieved by calling `GetNextMessage()`.
|
|
101
|
+
*/
|
|
102
|
+
size_t GetMessagesReadyCount() const
|
|
103
|
+
{
|
|
104
|
+
return this->reassembledMessages.size();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Returns the next reassembled message or `std::nullopt` if there are no
|
|
109
|
+
* messages ready.
|
|
110
|
+
*/
|
|
111
|
+
std::optional<Message> GetNextMessage();
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Handles a FORWARD-TSN/I-FORWARD-TSN chunk, when the sender has indicated
|
|
115
|
+
* that the received (this class) should forget about some chunks. This is
|
|
116
|
+
* used to implement partial reliability.
|
|
117
|
+
*/
|
|
118
|
+
void HandleForwardTsn(
|
|
119
|
+
uint32_t newCumulativeTsn, std::span<const AnyForwardTsnChunk::SkippedStream> skippedStreams);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Resets the provided streams and leaves deferred reset processing, if
|
|
123
|
+
* enabled.
|
|
124
|
+
*/
|
|
125
|
+
void ResetStreamsAndLeaveDeferredReset(std::span<const uint16_t> streamIds);
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Enters deferred reset processing.
|
|
129
|
+
*/
|
|
130
|
+
void EnterDeferredReset(uint32_t senderLastAssignedTsn, std::span<const uint16_t> streamIds);
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The number of payload bytes that have been queued. Note that the actual
|
|
134
|
+
* memory usage is higher due to additional overhead of tracking received
|
|
135
|
+
* data.
|
|
136
|
+
*/
|
|
137
|
+
size_t GetQueuedBytes() const
|
|
138
|
+
{
|
|
139
|
+
return this->queuedBytes;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The remaining bytes until the queue has reached the watermark limit.
|
|
144
|
+
*/
|
|
145
|
+
size_t GetRemainingBytes() const
|
|
146
|
+
{
|
|
147
|
+
return this->watermarkBytes - this->queuedBytes;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Indicates if the queue is full. Data should not be added to the queue
|
|
152
|
+
* when it's full.
|
|
153
|
+
*/
|
|
154
|
+
bool IsFull() const
|
|
155
|
+
{
|
|
156
|
+
return this->queuedBytes >= this->maxLengthBytes;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Indicates if the queue is above the watermark limit, which is a certain
|
|
161
|
+
* percentage of its size.
|
|
162
|
+
*/
|
|
163
|
+
bool IsAboveWatermark() const
|
|
164
|
+
{
|
|
165
|
+
return this->queuedBytes >= this->watermarkBytes;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Returns the watermark limit, in bytes.
|
|
170
|
+
*/
|
|
171
|
+
size_t GetWatermarkBytes() const
|
|
172
|
+
{
|
|
173
|
+
return this->watermarkBytes;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
private:
|
|
177
|
+
std::unique_ptr<ReassemblyStreamsInterface> CreateReassemblyStreams(
|
|
178
|
+
ReassemblyStreamsInterface::OnAssembledMessage onAssembledMessage,
|
|
179
|
+
bool useMessageInterleaving);
|
|
180
|
+
|
|
181
|
+
void AddReassembledMessage(std::span<const Types::UnwrappedTsn> tsns, Message message);
|
|
182
|
+
|
|
183
|
+
void AssertIsConsistent() const;
|
|
184
|
+
|
|
185
|
+
private:
|
|
186
|
+
const size_t maxLengthBytes;
|
|
187
|
+
const size_t watermarkBytes;
|
|
188
|
+
Types::UnwrappedTsn::Unwrapper tsnUnwrapper;
|
|
189
|
+
// Messages that have been reassembled, and will be consumed from by
|
|
190
|
+
// `GetNextMessage()`.
|
|
191
|
+
std::deque<Message> reassembledMessages;
|
|
192
|
+
// If present, "deferred reset processing" mode is active.
|
|
193
|
+
std::optional<DeferredResetStreams> deferredResetStreams;
|
|
194
|
+
// The number of "payload bytes" that are in this queue, in total.
|
|
195
|
+
size_t queuedBytes = 0;
|
|
196
|
+
// The actual implementation of ReassemblyStreams.
|
|
197
|
+
std::unique_ptr<ReassemblyStreamsInterface> reassemblyStreams;
|
|
198
|
+
};
|
|
199
|
+
} // namespace SCTP
|
|
200
|
+
} // namespace RTC
|
|
201
|
+
|
|
202
|
+
#endif
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#ifndef MS_RTC_SCTP_REASSEMBLY_STREAMS_INTERFACE_HPP
|
|
2
|
+
#define MS_RTC_SCTP_REASSEMBLY_STREAMS_INTERFACE_HPP
|
|
3
|
+
|
|
4
|
+
#include "common.hpp"
|
|
5
|
+
#include "RTC/SCTP/packet/UserData.hpp"
|
|
6
|
+
#include "RTC/SCTP/packet/chunks/AnyForwardTsnChunk.hpp"
|
|
7
|
+
#include "RTC/SCTP/public/Message.hpp"
|
|
8
|
+
#include "RTC/SCTP/public/SctpTypes.hpp"
|
|
9
|
+
#include <span>
|
|
10
|
+
|
|
11
|
+
namespace RTC
|
|
12
|
+
{
|
|
13
|
+
namespace SCTP
|
|
14
|
+
{
|
|
15
|
+
/**
|
|
16
|
+
* Implementations of this interface will be called when data is received,
|
|
17
|
+
* when data should be skipped/forgotten or when sequence number should be
|
|
18
|
+
* reset.
|
|
19
|
+
*
|
|
20
|
+
* As a result of these operations - mainly when data is received - the
|
|
21
|
+
* implementations of this interface should notify when a message has been
|
|
22
|
+
* assembled, by calling the provided callback of type `OnAssembledMessage()`.
|
|
23
|
+
* How it assembles messages will depend on e.g. if a message was sent on an
|
|
24
|
+
* ordered or unordered stream.
|
|
25
|
+
*
|
|
26
|
+
* Implementations will - for each operation - indicate how much additional
|
|
27
|
+
* memory that has been used as a result of performing the operation. This
|
|
28
|
+
* is used to limit the maximum amount of memory used, to prevent
|
|
29
|
+
* out-of-memory situations.
|
|
30
|
+
*/
|
|
31
|
+
class ReassemblyStreamsInterface
|
|
32
|
+
{
|
|
33
|
+
public:
|
|
34
|
+
/**
|
|
35
|
+
* This callback will be provided as an argument to the constructor of the
|
|
36
|
+
* concrete class implementing this interface and should be called when a
|
|
37
|
+
* message has been assembled as well as indicating from which TSNs this
|
|
38
|
+
* message was assembled from.
|
|
39
|
+
*/
|
|
40
|
+
using OnAssembledMessage =
|
|
41
|
+
std::function<void(std::span<const Types::UnwrappedTsn> tsns, Message message)>;
|
|
42
|
+
|
|
43
|
+
public:
|
|
44
|
+
virtual ~ReassemblyStreamsInterface() = default;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
/**
|
|
48
|
+
* Adds a data chunk to a stream as identified in `data`. If it was the
|
|
49
|
+
* last remaining chunk in a message, reassemble one (or several, in case
|
|
50
|
+
* of ordered chunks) messages.
|
|
51
|
+
*
|
|
52
|
+
* Returns the additional number of bytes added to the queue as a result
|
|
53
|
+
* of performing this operation. If this addition resulted in messages
|
|
54
|
+
* being assembled and delivered, this may be negative.
|
|
55
|
+
*/
|
|
56
|
+
virtual int32_t AddData(Types::UnwrappedTsn tsn, UserData data) = 0;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Called for incoming FORWARD-TSN/I-FORWARD-TSN chunks - when the sender
|
|
60
|
+
* wishes the received to skip/forget about data up until the provided
|
|
61
|
+
* TSN. This is used to implement partial reliability, such as limiting
|
|
62
|
+
* the number of retransmissions or the an expiration duration. As a
|
|
63
|
+
* result of skipping data, this may result in the implementation being
|
|
64
|
+
* able to assemble messages in ordered streams.
|
|
65
|
+
*
|
|
66
|
+
* Returns the number of bytes removed from the queue as a result of this
|
|
67
|
+
* operation.
|
|
68
|
+
*/
|
|
69
|
+
virtual size_t HandleForwardTsn(
|
|
70
|
+
Types::UnwrappedTsn newCumulativeTsn,
|
|
71
|
+
std::span<const AnyForwardTsnChunk::SkippedStream> skippedStreams) = 0;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Called for incoming (possibly deferred) RE-CONFIG chunks asking for
|
|
75
|
+
* either a few streams, or all streams (when the list is empty) to be
|
|
76
|
+
* reset - to have their next SSN or Message ID to be zero.
|
|
77
|
+
*/
|
|
78
|
+
virtual void ResetStreams(std::span<const uint16_t> streamIds) = 0;
|
|
79
|
+
};
|
|
80
|
+
} // namespace SCTP
|
|
81
|
+
} // namespace RTC
|
|
82
|
+
|
|
83
|
+
#endif
|