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
|
@@ -0,0 +1,752 @@
|
|
|
1
|
+
#define MS_CLASS "RTC::SCTP::RoundRobinSendQueue"
|
|
2
|
+
// #define MS_LOG_DEV_LEVEL 3
|
|
3
|
+
|
|
4
|
+
#include "RTC/SCTP/tx/RoundRobinSendQueue.hpp"
|
|
5
|
+
#include "Logger.hpp"
|
|
6
|
+
#include "RTC/SCTP/packet/UserData.hpp"
|
|
7
|
+
#include "RTC/SCTP/public/SctpTypes.hpp"
|
|
8
|
+
#include <set>
|
|
9
|
+
#include <span>
|
|
10
|
+
#include <string>
|
|
11
|
+
#include <tuple> // std::forward_as_tuple()
|
|
12
|
+
|
|
13
|
+
namespace RTC
|
|
14
|
+
{
|
|
15
|
+
namespace SCTP
|
|
16
|
+
{
|
|
17
|
+
/* Instance methods. */
|
|
18
|
+
|
|
19
|
+
RoundRobinSendQueue::RoundRobinSendQueue(
|
|
20
|
+
AssociationListenerInterface& associationListener,
|
|
21
|
+
size_t mtu,
|
|
22
|
+
uint16_t defaultPriority,
|
|
23
|
+
size_t totalBufferedAmountLowThreshold)
|
|
24
|
+
: associationListener(associationListener),
|
|
25
|
+
defaultPriority(defaultPriority),
|
|
26
|
+
scheduler(mtu),
|
|
27
|
+
totalBufferedAmountThresholdWatcher(
|
|
28
|
+
[this]()
|
|
29
|
+
{
|
|
30
|
+
this->associationListener.OnAssociationTotalBufferedAmountLow();
|
|
31
|
+
})
|
|
32
|
+
{
|
|
33
|
+
MS_TRACE();
|
|
34
|
+
|
|
35
|
+
this->totalBufferedAmountThresholdWatcher.SetLowThreshold(totalBufferedAmountLowThreshold);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
RoundRobinSendQueue::~RoundRobinSendQueue()
|
|
39
|
+
{
|
|
40
|
+
MS_TRACE();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
void RoundRobinSendQueue::AddMessage(
|
|
44
|
+
uint64_t nowMs, Message message, const SendMessageOptions& sendMessageOptions)
|
|
45
|
+
{
|
|
46
|
+
MS_TRACE();
|
|
47
|
+
|
|
48
|
+
MS_ASSERT(message.GetPayloadLength(), "message payload cannot be empty");
|
|
49
|
+
|
|
50
|
+
// Any limited lifetime should start counting from now - when the message
|
|
51
|
+
// has been added to the queue.
|
|
52
|
+
// `expiresAtMs` is the time when it expires. Which is slightly larger
|
|
53
|
+
// than the message's lifetime, as the message is alive during its entire
|
|
54
|
+
// lifetime (which may be zero).
|
|
55
|
+
const MessageAttributes attributes = {
|
|
56
|
+
.isUnordered = sendMessageOptions.unordered,
|
|
57
|
+
.maxRetransmissions = sendMessageOptions.maxRetransmissions.has_value()
|
|
58
|
+
? sendMessageOptions.maxRetransmissions.value()
|
|
59
|
+
: Types::MaxRetransmitsNoLimit,
|
|
60
|
+
.expiresAtMs = sendMessageOptions.lifetimeMs.has_value()
|
|
61
|
+
? nowMs + sendMessageOptions.lifetimeMs.value() + 1
|
|
62
|
+
: Types::ExpiresAtMsInfinite,
|
|
63
|
+
.lifecycleId = sendMessageOptions.lifecycleId,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const uint16_t streamId = message.GetStreamId();
|
|
67
|
+
|
|
68
|
+
GetOrCreateStreamInfo(streamId).AddMessage(std::move(message), attributes);
|
|
69
|
+
|
|
70
|
+
AssertIsConsistent();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
uint16_t RoundRobinSendQueue::GetStreamPriority(uint16_t streamId) const
|
|
74
|
+
{
|
|
75
|
+
MS_TRACE();
|
|
76
|
+
|
|
77
|
+
const auto it = this->streams.find(streamId);
|
|
78
|
+
|
|
79
|
+
if (it == this->streams.end())
|
|
80
|
+
{
|
|
81
|
+
return this->defaultPriority;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return it->second.GetPriority();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
void RoundRobinSendQueue::SetStreamPriority(uint16_t streamId, uint16_t priority)
|
|
88
|
+
{
|
|
89
|
+
MS_TRACE();
|
|
90
|
+
|
|
91
|
+
OutgoingStream& stream = GetOrCreateStreamInfo(streamId);
|
|
92
|
+
|
|
93
|
+
stream.SetPriority(priority);
|
|
94
|
+
|
|
95
|
+
AssertIsConsistent();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
std::optional<SendQueueInterface::DataToSend> RoundRobinSendQueue::Produce(
|
|
99
|
+
uint64_t nowMs, size_t maxLength)
|
|
100
|
+
{
|
|
101
|
+
MS_TRACE();
|
|
102
|
+
|
|
103
|
+
return this->scheduler.Produce(nowMs, maxLength);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
bool RoundRobinSendQueue::Discard(uint16_t streamId, uint32_t outgoingMessageId)
|
|
107
|
+
{
|
|
108
|
+
MS_TRACE();
|
|
109
|
+
|
|
110
|
+
const bool hasDiscarded = GetOrCreateStreamInfo(streamId).Discard(outgoingMessageId);
|
|
111
|
+
|
|
112
|
+
AssertIsConsistent();
|
|
113
|
+
|
|
114
|
+
return hasDiscarded;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
void RoundRobinSendQueue::PrepareResetStream(uint16_t streamId)
|
|
118
|
+
{
|
|
119
|
+
MS_TRACE();
|
|
120
|
+
|
|
121
|
+
GetOrCreateStreamInfo(streamId).Pause();
|
|
122
|
+
|
|
123
|
+
AssertIsConsistent();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
bool RoundRobinSendQueue::HasStreamsReadyToBeReset() const
|
|
127
|
+
{
|
|
128
|
+
MS_TRACE();
|
|
129
|
+
|
|
130
|
+
return std::ranges::any_of(
|
|
131
|
+
this->streams,
|
|
132
|
+
[](const auto& entry)
|
|
133
|
+
{
|
|
134
|
+
const auto& stream = entry.second;
|
|
135
|
+
|
|
136
|
+
return stream.IsReadyToBeReset();
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
std::vector<uint16_t> RoundRobinSendQueue::GetStreamsReadyToBeReset()
|
|
141
|
+
{
|
|
142
|
+
MS_TRACE();
|
|
143
|
+
|
|
144
|
+
MS_ASSERT(
|
|
145
|
+
std::ranges::count_if(
|
|
146
|
+
this->streams,
|
|
147
|
+
[](const auto& s)
|
|
148
|
+
{
|
|
149
|
+
const auto& stream = s.second;
|
|
150
|
+
|
|
151
|
+
return stream.IsResetting();
|
|
152
|
+
}) == 0,
|
|
153
|
+
"none of the streams can be resetting");
|
|
154
|
+
|
|
155
|
+
std::vector<uint16_t /*streamId*/> readyStreams;
|
|
156
|
+
|
|
157
|
+
for (auto& [streamId, stream] : this->streams)
|
|
158
|
+
{
|
|
159
|
+
if (stream.IsReadyToBeReset())
|
|
160
|
+
{
|
|
161
|
+
stream.SetAsResetting();
|
|
162
|
+
readyStreams.push_back(streamId);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return readyStreams;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
void RoundRobinSendQueue::CommitResetStreams()
|
|
170
|
+
{
|
|
171
|
+
MS_TRACE();
|
|
172
|
+
|
|
173
|
+
MS_ASSERT(
|
|
174
|
+
std::ranges::count_if(
|
|
175
|
+
this->streams,
|
|
176
|
+
[](const auto& s)
|
|
177
|
+
{
|
|
178
|
+
const auto& stream = s.second;
|
|
179
|
+
|
|
180
|
+
return stream.IsResetting();
|
|
181
|
+
}) > 0,
|
|
182
|
+
"at least one stream must be resetting");
|
|
183
|
+
|
|
184
|
+
for (auto& [unused, stream] : this->streams)
|
|
185
|
+
{
|
|
186
|
+
if (stream.IsResetting())
|
|
187
|
+
{
|
|
188
|
+
stream.Reset();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
AssertIsConsistent();
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
void RoundRobinSendQueue::RollbackResetStreams()
|
|
196
|
+
{
|
|
197
|
+
MS_TRACE();
|
|
198
|
+
|
|
199
|
+
MS_ASSERT(
|
|
200
|
+
std::ranges::count_if(
|
|
201
|
+
this->streams,
|
|
202
|
+
[](const auto& s)
|
|
203
|
+
{
|
|
204
|
+
const auto& stream = s.second;
|
|
205
|
+
|
|
206
|
+
return stream.IsResetting();
|
|
207
|
+
}) > 0,
|
|
208
|
+
"at least one stream must be resetting");
|
|
209
|
+
|
|
210
|
+
for (auto& [unused, stream] : this->streams)
|
|
211
|
+
{
|
|
212
|
+
if (stream.IsResetting())
|
|
213
|
+
{
|
|
214
|
+
stream.Resume();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
AssertIsConsistent();
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
void RoundRobinSendQueue::Reset()
|
|
222
|
+
{
|
|
223
|
+
MS_TRACE();
|
|
224
|
+
|
|
225
|
+
// Recalculate buffered amount, as partially sent messages may have been
|
|
226
|
+
// put fully back in the queue.
|
|
227
|
+
for (auto& [unused, stream] : this->streams)
|
|
228
|
+
{
|
|
229
|
+
stream.Reset();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
this->scheduler.ForceReschedule();
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
size_t RoundRobinSendQueue::GetStreamBufferedAmount(uint16_t streamId) const
|
|
236
|
+
{
|
|
237
|
+
MS_TRACE();
|
|
238
|
+
|
|
239
|
+
const auto it = this->streams.find(streamId);
|
|
240
|
+
|
|
241
|
+
if (it == this->streams.end())
|
|
242
|
+
{
|
|
243
|
+
return 0;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const auto& stream = it->second;
|
|
247
|
+
|
|
248
|
+
return stream.GetBufferedAmount().GetValue();
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
size_t RoundRobinSendQueue::GetStreamBufferedAmountLowThreshold(uint16_t streamId) const
|
|
252
|
+
{
|
|
253
|
+
MS_TRACE();
|
|
254
|
+
|
|
255
|
+
const auto it = this->streams.find(streamId);
|
|
256
|
+
|
|
257
|
+
if (it == this->streams.end())
|
|
258
|
+
{
|
|
259
|
+
return 0;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const auto& stream = it->second;
|
|
263
|
+
|
|
264
|
+
return stream.GetBufferedAmount().GetLowThreshold();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
void RoundRobinSendQueue::SetStreamBufferedAmountLowThreshold(uint16_t streamId, size_t bytes)
|
|
268
|
+
{
|
|
269
|
+
MS_TRACE();
|
|
270
|
+
|
|
271
|
+
GetOrCreateStreamInfo(streamId).GetBufferedAmount().SetLowThreshold(bytes);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
RoundRobinSendQueue::OutgoingStream& RoundRobinSendQueue::GetOrCreateStreamInfo(uint16_t streamId)
|
|
275
|
+
{
|
|
276
|
+
MS_TRACE();
|
|
277
|
+
|
|
278
|
+
const auto it = this->streams.find(streamId);
|
|
279
|
+
|
|
280
|
+
if (it != this->streams.end())
|
|
281
|
+
{
|
|
282
|
+
auto& stream = it->second;
|
|
283
|
+
|
|
284
|
+
return stream;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const auto [it2, inserted] = this->streams.emplace(
|
|
288
|
+
std::piecewise_construct,
|
|
289
|
+
std::forward_as_tuple(streamId),
|
|
290
|
+
std::forward_as_tuple(
|
|
291
|
+
this,
|
|
292
|
+
std::addressof(this->scheduler),
|
|
293
|
+
streamId,
|
|
294
|
+
this->defaultPriority,
|
|
295
|
+
[this, streamId]()
|
|
296
|
+
{
|
|
297
|
+
this->associationListener.OnAssociationStreamBufferedAmountLow(streamId);
|
|
298
|
+
}));
|
|
299
|
+
|
|
300
|
+
return it2->second;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
void RoundRobinSendQueue::AssertIsConsistent() const
|
|
304
|
+
{
|
|
305
|
+
MS_TRACE();
|
|
306
|
+
|
|
307
|
+
std::set<uint16_t> expectedActiveStreamIds;
|
|
308
|
+
const std::set<uint16_t> actualActiveStreamIds = this->scheduler.GetActiveStreamsForTesting();
|
|
309
|
+
|
|
310
|
+
size_t totalBufferedAmount{ 0 };
|
|
311
|
+
|
|
312
|
+
for (const auto& [streamId, stream] : this->streams)
|
|
313
|
+
{
|
|
314
|
+
totalBufferedAmount += stream.GetBufferedAmount().GetValue();
|
|
315
|
+
|
|
316
|
+
if (stream.GetBytesToSendInNextMessage() > 0)
|
|
317
|
+
{
|
|
318
|
+
expectedActiveStreamIds.emplace(streamId);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (expectedActiveStreamIds != actualActiveStreamIds)
|
|
323
|
+
{
|
|
324
|
+
const auto join = [](const auto& set)
|
|
325
|
+
{
|
|
326
|
+
std::string out;
|
|
327
|
+
|
|
328
|
+
size_t i{ 0 };
|
|
329
|
+
for (const auto& v : set)
|
|
330
|
+
{
|
|
331
|
+
if (i++ != 0)
|
|
332
|
+
{
|
|
333
|
+
out += ",";
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
out += std::to_string(v);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return out;
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
MS_ASSERT(
|
|
343
|
+
expectedActiveStreamIds == actualActiveStreamIds,
|
|
344
|
+
"active streams mismatch [actual=[%s], expected=[%s]]",
|
|
345
|
+
join(actualActiveStreamIds).c_str(),
|
|
346
|
+
join(expectedActiveStreamIds).c_str());
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
MS_ASSERT(
|
|
350
|
+
totalBufferedAmount == this->totalBufferedAmountThresholdWatcher.GetValue(),
|
|
351
|
+
"total buffered amount mismatch [actual=[%zu], expected=[%zu]]",
|
|
352
|
+
totalBufferedAmount,
|
|
353
|
+
this->totalBufferedAmountThresholdWatcher.GetValue());
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
void RoundRobinSendQueue::ThresholdWatcher::Decrease(size_t bytes)
|
|
357
|
+
{
|
|
358
|
+
MS_TRACE();
|
|
359
|
+
|
|
360
|
+
MS_ASSERT(
|
|
361
|
+
bytes <= this->value,
|
|
362
|
+
"bytes (%zu) must be smaller or equal than this->value (%zu)",
|
|
363
|
+
bytes,
|
|
364
|
+
this->value);
|
|
365
|
+
|
|
366
|
+
const size_t oldValue = this->value;
|
|
367
|
+
|
|
368
|
+
this->value -= bytes;
|
|
369
|
+
|
|
370
|
+
if (oldValue > this->lowThreshold && this->value <= this->lowThreshold)
|
|
371
|
+
{
|
|
372
|
+
this->onThresholdReached();
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
void RoundRobinSendQueue::ThresholdWatcher::SetLowThreshold(size_t lowThreshold)
|
|
377
|
+
{
|
|
378
|
+
MS_TRACE();
|
|
379
|
+
|
|
380
|
+
// Betting on https://github.com/w3c/webrtc-pc/issues/2654 being accepted.
|
|
381
|
+
if (this->lowThreshold < this->value && lowThreshold >= this->value)
|
|
382
|
+
{
|
|
383
|
+
this->onThresholdReached();
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
this->lowThreshold = lowThreshold;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
void RoundRobinSendQueue::OutgoingStream::AddMessage(Message message, MessageAttributes attributes)
|
|
390
|
+
{
|
|
391
|
+
MS_TRACE();
|
|
392
|
+
|
|
393
|
+
const bool wasActive = GetBytesToSendInNextMessage() > 0;
|
|
394
|
+
|
|
395
|
+
this->bufferedAmountThresholdWatcher.Increase(message.GetPayloadLength());
|
|
396
|
+
this->parent.totalBufferedAmountThresholdWatcher.Increase(message.GetPayloadLength());
|
|
397
|
+
|
|
398
|
+
const uint32_t outgoingMessageId = this->parent.currentOutgoingMessageId;
|
|
399
|
+
|
|
400
|
+
this->parent.currentOutgoingMessageId = this->parent.currentOutgoingMessageId + 1;
|
|
401
|
+
|
|
402
|
+
this->items.emplace_back(outgoingMessageId, std::move(message), attributes);
|
|
403
|
+
|
|
404
|
+
if (!wasActive)
|
|
405
|
+
{
|
|
406
|
+
this->schedulerStream->MayMakeActive();
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
AssertIsConsistent();
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
std::optional<SendQueueInterface::DataToSend> RoundRobinSendQueue::OutgoingStream::Produce(
|
|
413
|
+
uint64_t nowMs, size_t maxLength)
|
|
414
|
+
{
|
|
415
|
+
MS_TRACE();
|
|
416
|
+
|
|
417
|
+
MS_ASSERT(
|
|
418
|
+
this->pauseState != PauseState::PAUSED && this->pauseState != PauseState::RESETTING,
|
|
419
|
+
"pause state must not be PAUSED or RESETTING");
|
|
420
|
+
|
|
421
|
+
while (!this->items.empty())
|
|
422
|
+
{
|
|
423
|
+
Item& item = this->items.front();
|
|
424
|
+
Message& message = item.message;
|
|
425
|
+
|
|
426
|
+
// Allocate Message ID and SSN when the first fragment is sent.
|
|
427
|
+
if (!item.mid.has_value())
|
|
428
|
+
{
|
|
429
|
+
// This entire message has already expired. Try the next one.
|
|
430
|
+
if (item.attributes.expiresAtMs != Types::ExpiresAtMsInfinite && item.attributes.expiresAtMs <= nowMs)
|
|
431
|
+
{
|
|
432
|
+
HandleMessageExpired(item);
|
|
433
|
+
|
|
434
|
+
this->items.pop_front();
|
|
435
|
+
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
uint32_t& mid = item.attributes.isUnordered ? this->nextUnorderedMid : this->nextOrderedMid;
|
|
440
|
+
|
|
441
|
+
item.mid = mid;
|
|
442
|
+
mid += 1;
|
|
443
|
+
}
|
|
444
|
+
if (!item.attributes.isUnordered && !item.ssn.has_value())
|
|
445
|
+
{
|
|
446
|
+
item.ssn = this->nextSsn;
|
|
447
|
+
|
|
448
|
+
this->nextSsn += 1;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// Grab the next `maxLength` fragment from this message and calculate
|
|
452
|
+
// flags.
|
|
453
|
+
const std::span<const uint8_t> messagePayload = message.GetPayload();
|
|
454
|
+
const std::span<const uint8_t> chunkPayload = messagePayload.subspan(
|
|
455
|
+
item.remainingOffset, std::min(messagePayload.size() - item.remainingOffset, maxLength));
|
|
456
|
+
|
|
457
|
+
const bool isBeginning = chunkPayload.data() == messagePayload.data();
|
|
458
|
+
const bool isEnd = (chunkPayload.data() + chunkPayload.size()) ==
|
|
459
|
+
(messagePayload.data() + messagePayload.size());
|
|
460
|
+
|
|
461
|
+
const uint16_t streamId = message.GetStreamId();
|
|
462
|
+
const uint32_t ppid = message.GetPayloadProtocolId();
|
|
463
|
+
|
|
464
|
+
// Zero-copy the payload if the message fits in a single chunk.
|
|
465
|
+
std::vector<uint8_t> payload =
|
|
466
|
+
isBeginning && isEnd ? std::move(message).ReleasePayload()
|
|
467
|
+
: std::vector<uint8_t>(chunkPayload.begin(), chunkPayload.end());
|
|
468
|
+
|
|
469
|
+
const uint32_t fsn = item.currentFsn;
|
|
470
|
+
|
|
471
|
+
item.currentFsn += 1;
|
|
472
|
+
|
|
473
|
+
this->bufferedAmountThresholdWatcher.Decrease(payload.size());
|
|
474
|
+
this->parent.totalBufferedAmountThresholdWatcher.Decrease(payload.size());
|
|
475
|
+
|
|
476
|
+
SendQueueInterface::DataToSend dataToSend(
|
|
477
|
+
item.outgoingMessageId,
|
|
478
|
+
UserData(
|
|
479
|
+
streamId,
|
|
480
|
+
item.ssn.value_or(0),
|
|
481
|
+
*item.mid,
|
|
482
|
+
fsn,
|
|
483
|
+
ppid,
|
|
484
|
+
std::move(payload),
|
|
485
|
+
isBeginning,
|
|
486
|
+
isEnd,
|
|
487
|
+
item.attributes.isUnordered));
|
|
488
|
+
|
|
489
|
+
dataToSend.maxRetransmissions = item.attributes.maxRetransmissions;
|
|
490
|
+
dataToSend.expiresAtMs = item.attributes.expiresAtMs;
|
|
491
|
+
dataToSend.lifecycleId = isEnd ? item.attributes.lifecycleId : std::nullopt;
|
|
492
|
+
|
|
493
|
+
if (isEnd)
|
|
494
|
+
{
|
|
495
|
+
// The entire message has been sent, and its last data copied to
|
|
496
|
+
// `dataToSend`, so it can safely be discarded.
|
|
497
|
+
this->items.pop_front();
|
|
498
|
+
|
|
499
|
+
if (this->pauseState == PauseState::PENDING)
|
|
500
|
+
{
|
|
501
|
+
MS_DEBUG_DEV(
|
|
502
|
+
"pause state on stream %" PRIu16 " is moving from PENDING to PAUSED", streamId);
|
|
503
|
+
|
|
504
|
+
this->pauseState = PauseState::PAUSED;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
else
|
|
508
|
+
{
|
|
509
|
+
item.remainingOffset += chunkPayload.size();
|
|
510
|
+
item.remainingLength -= chunkPayload.size();
|
|
511
|
+
|
|
512
|
+
MS_ASSERT(
|
|
513
|
+
item.remainingOffset + item.remainingLength == item.message.GetPayloadLength(),
|
|
514
|
+
"item.remainingOffset + item.remainingLength != item.message.GetPayloadLength()");
|
|
515
|
+
MS_ASSERT(item.remainingLength > 0, "item.remainingLength <= 0");
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
AssertIsConsistent();
|
|
519
|
+
|
|
520
|
+
return dataToSend;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
AssertIsConsistent();
|
|
524
|
+
|
|
525
|
+
return std::nullopt;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
size_t RoundRobinSendQueue::OutgoingStream::GetBytesToSendInNextMessage() const
|
|
529
|
+
{
|
|
530
|
+
MS_TRACE();
|
|
531
|
+
|
|
532
|
+
if (this->pauseState == PauseState::PAUSED || this->pauseState == PauseState::RESETTING)
|
|
533
|
+
{
|
|
534
|
+
// The stream has paused (and there is no partially sent message).
|
|
535
|
+
return 0;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
if (this->items.empty())
|
|
539
|
+
{
|
|
540
|
+
return 0;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
return this->items.front().remainingLength;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
bool RoundRobinSendQueue::OutgoingStream::Discard(uint32_t outgoingMessageId)
|
|
547
|
+
{
|
|
548
|
+
MS_TRACE();
|
|
549
|
+
|
|
550
|
+
bool result = false;
|
|
551
|
+
|
|
552
|
+
if (!this->items.empty())
|
|
553
|
+
{
|
|
554
|
+
Item& item = this->items.front();
|
|
555
|
+
|
|
556
|
+
if (item.outgoingMessageId == outgoingMessageId)
|
|
557
|
+
{
|
|
558
|
+
HandleMessageExpired(item);
|
|
559
|
+
|
|
560
|
+
this->items.pop_front();
|
|
561
|
+
|
|
562
|
+
// Only partially sent messages are discarded, so if a message was
|
|
563
|
+
// discarded, then it was the currently sent message.
|
|
564
|
+
this->schedulerStream->ForceReschedule();
|
|
565
|
+
|
|
566
|
+
if (this->pauseState == PauseState::PENDING)
|
|
567
|
+
{
|
|
568
|
+
this->pauseState = PauseState::PAUSED;
|
|
569
|
+
this->schedulerStream->MakeInactive();
|
|
570
|
+
}
|
|
571
|
+
else if (GetBytesToSendInNextMessage() == 0)
|
|
572
|
+
{
|
|
573
|
+
this->schedulerStream->MakeInactive();
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
// As the item still existed, it had unsent data.
|
|
577
|
+
result = true;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
AssertIsConsistent();
|
|
582
|
+
|
|
583
|
+
return result;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
void RoundRobinSendQueue::OutgoingStream::Pause()
|
|
587
|
+
{
|
|
588
|
+
MS_TRACE();
|
|
589
|
+
|
|
590
|
+
if (this->pauseState != PauseState::NOT_PAUSED)
|
|
591
|
+
{
|
|
592
|
+
// Already in progress.
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
const bool hadPendingItems = !this->items.empty();
|
|
597
|
+
|
|
598
|
+
// https://datatracker.ietf.org/doc/html/rfc8831#section-6.7
|
|
599
|
+
//
|
|
600
|
+
// "Closing of a data channel MUST be signaled by resetting the corresponding
|
|
601
|
+
// outgoing streams [RFC6525]. This means that if one side decides to close
|
|
602
|
+
// the data channel, it resets the corresponding outgoing stream."
|
|
603
|
+
// ... "[RFC6525] also guarantees that all the messages are delivered (or
|
|
604
|
+
// abandoned) before the stream is reset."
|
|
605
|
+
|
|
606
|
+
// A stream is paused when it's about to be reset. In this implementation,
|
|
607
|
+
// it will throw away all non-partially send messages - they will be
|
|
608
|
+
// abandoned as noted above. This is subject to change. It will however
|
|
609
|
+
// not discard any partially sent messages - only whole messages. Partially
|
|
610
|
+
// delivered messages (at the time of receiving a Stream Reset command) will
|
|
611
|
+
// always deliver all the fragments before actually resetting the stream.
|
|
612
|
+
for (auto it = this->items.begin(); it != this->items.end();)
|
|
613
|
+
{
|
|
614
|
+
if (it->remainingOffset == 0)
|
|
615
|
+
{
|
|
616
|
+
auto& item = *it;
|
|
617
|
+
|
|
618
|
+
HandleMessageExpired(item);
|
|
619
|
+
|
|
620
|
+
it = this->items.erase(it);
|
|
621
|
+
}
|
|
622
|
+
else
|
|
623
|
+
{
|
|
624
|
+
++it;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
this->pauseState = (this->items.empty() || this->items.front().remainingOffset == 0)
|
|
629
|
+
? PauseState::PAUSED
|
|
630
|
+
: PauseState::PENDING;
|
|
631
|
+
|
|
632
|
+
if (hadPendingItems && this->pauseState == PauseState::PAUSED)
|
|
633
|
+
{
|
|
634
|
+
MS_DEBUG_DEV("stream %" PRIu16 " was previously active, but is now paused", GetStreamId());
|
|
635
|
+
|
|
636
|
+
this->schedulerStream->MakeInactive();
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
AssertIsConsistent();
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
void RoundRobinSendQueue::OutgoingStream::Resume()
|
|
643
|
+
{
|
|
644
|
+
MS_TRACE();
|
|
645
|
+
|
|
646
|
+
MS_ASSERT(this->pauseState == PauseState::RESETTING, "pause state must be RESETTING");
|
|
647
|
+
|
|
648
|
+
this->pauseState = PauseState::NOT_PAUSED;
|
|
649
|
+
this->schedulerStream->MayMakeActive();
|
|
650
|
+
|
|
651
|
+
AssertIsConsistent();
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
void RoundRobinSendQueue::OutgoingStream::SetAsResetting()
|
|
655
|
+
{
|
|
656
|
+
MS_TRACE();
|
|
657
|
+
|
|
658
|
+
MS_ASSERT(this->pauseState == PauseState::PAUSED, "pause state must be PAUSED");
|
|
659
|
+
|
|
660
|
+
this->pauseState = PauseState::RESETTING;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
void RoundRobinSendQueue::OutgoingStream::Reset()
|
|
664
|
+
{
|
|
665
|
+
MS_TRACE();
|
|
666
|
+
|
|
667
|
+
// This can be called both when an outgoing stream reset has been responded
|
|
668
|
+
// to, or when the entire SendQueue is reset due to detecting the peer having
|
|
669
|
+
// restarted. The stream may be in any state at this time.
|
|
670
|
+
const PauseState oldPauseState = this->pauseState;
|
|
671
|
+
|
|
672
|
+
this->pauseState = PauseState::NOT_PAUSED;
|
|
673
|
+
this->nextOrderedMid = 0;
|
|
674
|
+
this->nextUnorderedMid = 0;
|
|
675
|
+
this->nextSsn = 0;
|
|
676
|
+
|
|
677
|
+
if (!this->items.empty())
|
|
678
|
+
{
|
|
679
|
+
// If this message has been partially sent, reset it so that it will be
|
|
680
|
+
// re-sent.
|
|
681
|
+
auto& item = this->items.front();
|
|
682
|
+
|
|
683
|
+
this->bufferedAmountThresholdWatcher.Increase(
|
|
684
|
+
item.message.GetPayloadLength() - item.remainingLength);
|
|
685
|
+
this->parent.totalBufferedAmountThresholdWatcher.Increase(
|
|
686
|
+
item.message.GetPayloadLength() - item.remainingLength);
|
|
687
|
+
item.remainingOffset = 0;
|
|
688
|
+
item.remainingLength = item.message.GetPayloadLength();
|
|
689
|
+
item.mid = std::nullopt;
|
|
690
|
+
item.ssn = std::nullopt;
|
|
691
|
+
item.currentFsn = 0;
|
|
692
|
+
|
|
693
|
+
if (oldPauseState == PauseState::PAUSED || oldPauseState == PauseState::RESETTING)
|
|
694
|
+
{
|
|
695
|
+
this->schedulerStream->MayMakeActive();
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
AssertIsConsistent();
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
bool RoundRobinSendQueue::OutgoingStream::HasPartiallySentMessage() const
|
|
703
|
+
{
|
|
704
|
+
MS_TRACE();
|
|
705
|
+
|
|
706
|
+
if (this->items.empty())
|
|
707
|
+
{
|
|
708
|
+
return false;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
return this->items.front().mid.has_value();
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
void RoundRobinSendQueue::OutgoingStream::HandleMessageExpired(
|
|
715
|
+
RoundRobinSendQueue::OutgoingStream::Item& item)
|
|
716
|
+
{
|
|
717
|
+
MS_TRACE();
|
|
718
|
+
|
|
719
|
+
this->bufferedAmountThresholdWatcher.Decrease(item.remainingLength);
|
|
720
|
+
|
|
721
|
+
this->parent.totalBufferedAmountThresholdWatcher.Decrease(item.remainingLength);
|
|
722
|
+
|
|
723
|
+
if (item.attributes.lifecycleId.has_value())
|
|
724
|
+
{
|
|
725
|
+
MS_DEBUG_DEV(
|
|
726
|
+
"triggering OnAssociationLifecycleMessageExpired(%" PRIu64 "), /*maybeDelivered*/ false)",
|
|
727
|
+
item.attributes.lifecycleId.value());
|
|
728
|
+
|
|
729
|
+
this->parent.associationListener.OnAssociationLifecycleMessageExpired(
|
|
730
|
+
item.attributes.lifecycleId.value(), /*maybeDelivered*/ false);
|
|
731
|
+
this->parent.associationListener.OnAssociationLifecycleMessageEnd(
|
|
732
|
+
item.attributes.lifecycleId.value());
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
void RoundRobinSendQueue::OutgoingStream::AssertIsConsistent() const
|
|
737
|
+
{
|
|
738
|
+
MS_TRACE();
|
|
739
|
+
|
|
740
|
+
size_t bytes{ 0 };
|
|
741
|
+
|
|
742
|
+
for (const auto& item : this->items)
|
|
743
|
+
{
|
|
744
|
+
bytes += item.remainingLength;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
MS_ASSERT(
|
|
748
|
+
bytes == this->bufferedAmountThresholdWatcher.GetValue(),
|
|
749
|
+
"bytes != this->bufferedAmountThresholdWatcher.GetValue()");
|
|
750
|
+
}
|
|
751
|
+
} // namespace SCTP
|
|
752
|
+
} // namespace RTC
|