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,183 @@
|
|
|
1
|
+
#ifndef MS_MOCKS_RTC_SCTP_MOCK_TRANSMISSION_CONTROL_BLOCK_HPP
|
|
2
|
+
#define MS_MOCKS_RTC_SCTP_MOCK_TRANSMISSION_CONTROL_BLOCK_HPP
|
|
3
|
+
|
|
4
|
+
#include "common.hpp"
|
|
5
|
+
#include "RTC/SCTP/association/TransmissionControlBlockContextInterface.hpp"
|
|
6
|
+
#include "RTC/SCTP/packet/Packet.hpp"
|
|
7
|
+
#include "RTC/SCTP/public/AssociationListenerInterface.hpp"
|
|
8
|
+
#include "RTC/SCTP/public/SctpOptions.hpp"
|
|
9
|
+
#include "mocks/include/mockTypes.hpp"
|
|
10
|
+
#include <queue>
|
|
11
|
+
#include <stdexcept>
|
|
12
|
+
#include <string>
|
|
13
|
+
|
|
14
|
+
namespace mocks
|
|
15
|
+
{
|
|
16
|
+
namespace RTC
|
|
17
|
+
{
|
|
18
|
+
namespace SCTP
|
|
19
|
+
{
|
|
20
|
+
class MockTransmissionControlBlockContext
|
|
21
|
+
: public ::RTC::SCTP::TransmissionControlBlockContextInterface
|
|
22
|
+
{
|
|
23
|
+
public:
|
|
24
|
+
using GetCurrentRtoMsAction = std::function<uint64_t()>;
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
explicit MockTransmissionControlBlockContext(
|
|
28
|
+
::RTC::SCTP::AssociationListenerInterface& associationListener,
|
|
29
|
+
const ::RTC::SCTP::SctpOptions& sctpOptions)
|
|
30
|
+
: associationListener(associationListener), sctpOptions(sctpOptions)
|
|
31
|
+
{
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public:
|
|
35
|
+
bool IsAssociationEstablished() const override
|
|
36
|
+
{
|
|
37
|
+
return this->associationEstablished;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
uint32_t GetLocalInitialTsn() const override
|
|
41
|
+
{
|
|
42
|
+
// TODO: Implement this.
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
uint32_t GetRemoteInitialTsn() const override
|
|
47
|
+
{
|
|
48
|
+
// TODO: Implement this.
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
void ObserveRttMs(uint64_t rttMs) override
|
|
53
|
+
{
|
|
54
|
+
this->observeRttMsCallCount++;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
uint64_t GetCurrentRtoMs() const override
|
|
58
|
+
{
|
|
59
|
+
if (!this->getCurrentRtoMsOnceActions.empty())
|
|
60
|
+
{
|
|
61
|
+
auto action = std::move(this->getCurrentRtoMsOnceActions.front());
|
|
62
|
+
|
|
63
|
+
this->getCurrentRtoMsOnceActions.pop();
|
|
64
|
+
|
|
65
|
+
return action();
|
|
66
|
+
}
|
|
67
|
+
else
|
|
68
|
+
{
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
bool IncrementTxErrorCounter(std::string_view /*reason*/) override
|
|
74
|
+
{
|
|
75
|
+
this->incrementTxErrorCounterCallCount++;
|
|
76
|
+
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
void ClearTxErrorCounter() override
|
|
81
|
+
{
|
|
82
|
+
this->incrementTxErrorCounterCallCount = 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
bool HasTooManyTxErrors() const override
|
|
86
|
+
{
|
|
87
|
+
// TODO: Implement this.
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
std::unique_ptr<::RTC::SCTP::Packet> CreatePacket() const override;
|
|
92
|
+
|
|
93
|
+
bool SendPacket(::RTC::SCTP::Packet* packet) override;
|
|
94
|
+
|
|
95
|
+
// Methods for testing.
|
|
96
|
+
public:
|
|
97
|
+
void SetAssociationEstablished(bool associationEstablished)
|
|
98
|
+
{
|
|
99
|
+
this->associationEstablished = associationEstablished;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @remarks
|
|
104
|
+
* - Must be called before expecting calls to `ObserveRttMs()`.
|
|
105
|
+
*/
|
|
106
|
+
MockTransmissionControlBlockContext& ExpectObserveRttMsCalledTimes(size_t times)
|
|
107
|
+
{
|
|
108
|
+
this->observeRttMsCallCount = 0;
|
|
109
|
+
this->expectedObserveRttMsCallCount = times;
|
|
110
|
+
|
|
111
|
+
return *this;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @remarks
|
|
116
|
+
* - Must be called before expecting calls to `IncrementTxErrorCounter()`.
|
|
117
|
+
*/
|
|
118
|
+
MockTransmissionControlBlockContext& ExpectIncrementTxErrorCounterCalledTimes(size_t times)
|
|
119
|
+
{
|
|
120
|
+
this->incrementTxErrorCounterCallCount = 0;
|
|
121
|
+
this->expectedIncrementTxErrorCounterCallCount = times;
|
|
122
|
+
|
|
123
|
+
return *this;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
MockTransmissionControlBlockContext& WillGetCurrentRtoMsOnce(GetCurrentRtoMsAction action)
|
|
127
|
+
{
|
|
128
|
+
this->getCurrentRtoMsOnceActions.push(std::move(action));
|
|
129
|
+
|
|
130
|
+
return *this;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
mocks::VerificationResult VerifyExpectations() const
|
|
134
|
+
{
|
|
135
|
+
if (
|
|
136
|
+
this->expectedObserveRttMsCallCount.has_value() &&
|
|
137
|
+
this->observeRttMsCallCount != this->expectedObserveRttMsCallCount.value())
|
|
138
|
+
{
|
|
139
|
+
return { .ok = false,
|
|
140
|
+
.errorMessage = "ObserveRttMs() call count mismatch [expected:" +
|
|
141
|
+
std::to_string(this->expectedObserveRttMsCallCount.value()) +
|
|
142
|
+
", got:" + std::to_string(this->observeRttMsCallCount) + "]" };
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (
|
|
146
|
+
this->expectedIncrementTxErrorCounterCallCount.has_value() &&
|
|
147
|
+
this->incrementTxErrorCounterCallCount !=
|
|
148
|
+
this->expectedIncrementTxErrorCounterCallCount.value())
|
|
149
|
+
{
|
|
150
|
+
return { .ok = false,
|
|
151
|
+
.errorMessage =
|
|
152
|
+
"IncrementTxErrorCounter() call count mismatch [expected:" +
|
|
153
|
+
std::to_string(this->expectedIncrementTxErrorCounterCallCount.value()) +
|
|
154
|
+
", got:" + std::to_string(this->incrementTxErrorCounterCallCount) + "]" };
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return { .ok = true, .errorMessage = "" };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
private:
|
|
161
|
+
// Passed by argument.
|
|
162
|
+
::RTC::SCTP::AssociationListenerInterface& associationListener;
|
|
163
|
+
const ::RTC::SCTP::SctpOptions sctpOptions;
|
|
164
|
+
|
|
165
|
+
// ObserveRttMs().
|
|
166
|
+
size_t observeRttMsCallCount{ 0 };
|
|
167
|
+
std::optional<size_t> expectedObserveRttMsCallCount;
|
|
168
|
+
|
|
169
|
+
// GetCurrentRtoMs().
|
|
170
|
+
mutable std::queue<GetCurrentRtoMsAction> getCurrentRtoMsOnceActions;
|
|
171
|
+
|
|
172
|
+
// IncrementTxErrorCounter().
|
|
173
|
+
size_t incrementTxErrorCounterCallCount{ 0 };
|
|
174
|
+
std::optional<size_t> expectedIncrementTxErrorCounterCallCount;
|
|
175
|
+
|
|
176
|
+
// Others.
|
|
177
|
+
bool associationEstablished{ false };
|
|
178
|
+
};
|
|
179
|
+
} // namespace SCTP
|
|
180
|
+
} // namespace RTC
|
|
181
|
+
} // namespace mocks
|
|
182
|
+
|
|
183
|
+
#endif
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
#ifndef MS_MOCKS_RTC_SCTP_MOCK_SEND_QUEUE_HPP
|
|
2
|
+
#define MS_MOCKS_RTC_SCTP_MOCK_SEND_QUEUE_HPP
|
|
3
|
+
|
|
4
|
+
#include "common.hpp"
|
|
5
|
+
#include "RTC/SCTP/tx/SendQueueInterface.hpp"
|
|
6
|
+
#include "mocks/include/mockTypes.hpp"
|
|
7
|
+
#include <queue>
|
|
8
|
+
#include <stdexcept>
|
|
9
|
+
#include <string>
|
|
10
|
+
|
|
11
|
+
namespace mocks
|
|
12
|
+
{
|
|
13
|
+
namespace RTC
|
|
14
|
+
{
|
|
15
|
+
namespace SCTP
|
|
16
|
+
{
|
|
17
|
+
class MockSendQueue : public ::RTC::SCTP::SendQueueInterface
|
|
18
|
+
{
|
|
19
|
+
public:
|
|
20
|
+
using ProduceAction =
|
|
21
|
+
std::function<std::optional<DataToSend>(uint64_t /*nowMs*/, size_t /*maxLength*/)>;
|
|
22
|
+
|
|
23
|
+
struct DiscardExpectation
|
|
24
|
+
{
|
|
25
|
+
// If std::nullopt, don't check it.
|
|
26
|
+
std::optional<uint16_t> streamId;
|
|
27
|
+
// If std::nullopt, don't check it.
|
|
28
|
+
std::optional<uint32_t> outgoingMessageId;
|
|
29
|
+
bool returnValue{ false };
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
public:
|
|
33
|
+
MockSendQueue() = default;
|
|
34
|
+
|
|
35
|
+
~MockSendQueue() override = default;
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
void EnableMessageInterleaving(bool enabled) override
|
|
39
|
+
{
|
|
40
|
+
this->messageInterleavingCalledWith = enabled;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
std::optional<DataToSend> Produce(uint64_t nowMs, size_t maxLength) override
|
|
44
|
+
{
|
|
45
|
+
this->produceCallCount++;
|
|
46
|
+
|
|
47
|
+
if (!this->produceOnceActions.empty())
|
|
48
|
+
{
|
|
49
|
+
auto action = std::move(this->produceOnceActions.front());
|
|
50
|
+
|
|
51
|
+
this->produceOnceActions.pop();
|
|
52
|
+
|
|
53
|
+
return action(nowMs, maxLength);
|
|
54
|
+
}
|
|
55
|
+
else if (this->produceRepeatedlyAction)
|
|
56
|
+
{
|
|
57
|
+
return this->produceRepeatedlyAction(nowMs, maxLength);
|
|
58
|
+
}
|
|
59
|
+
else
|
|
60
|
+
{
|
|
61
|
+
return std::nullopt;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
bool Discard(uint16_t streamId, uint32_t outgoingMessageId) override
|
|
66
|
+
{
|
|
67
|
+
this->discardCallCount++;
|
|
68
|
+
|
|
69
|
+
if (this->discardExpectations.empty())
|
|
70
|
+
{
|
|
71
|
+
throw std::logic_error("Discard() called but no expectation was set");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
auto discardExpectation = this->discardExpectations.front();
|
|
75
|
+
|
|
76
|
+
this->discardExpectations.pop();
|
|
77
|
+
|
|
78
|
+
if (discardExpectation.streamId.has_value() && discardExpectation.streamId.value() != streamId)
|
|
79
|
+
{
|
|
80
|
+
throw std::logic_error(
|
|
81
|
+
"Discard() called with unexpected streamId [expected:" +
|
|
82
|
+
std::to_string(discardExpectation.streamId.value()) +
|
|
83
|
+
", got:" + std::to_string(streamId) + "]");
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (
|
|
87
|
+
discardExpectation.outgoingMessageId.has_value() &&
|
|
88
|
+
discardExpectation.outgoingMessageId.value() != outgoingMessageId)
|
|
89
|
+
{
|
|
90
|
+
throw std::logic_error(
|
|
91
|
+
"Discard() called with unexpected outgoingMessageId [expected:" +
|
|
92
|
+
std::to_string(discardExpectation.outgoingMessageId.value()) +
|
|
93
|
+
", got:" + std::to_string(outgoingMessageId) + "]");
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return discardExpectation.returnValue;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
void PrepareResetStream(uint16_t /*streamId*/) override
|
|
100
|
+
{
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
bool HasStreamsReadyToBeReset() const override
|
|
104
|
+
{
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
std::vector<uint16_t> GetStreamsReadyToBeReset() override
|
|
109
|
+
{
|
|
110
|
+
return {};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
void CommitResetStreams() override
|
|
114
|
+
{
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
void RollbackResetStreams() override
|
|
118
|
+
{
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
void Reset() override
|
|
122
|
+
{
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
size_t GetStreamBufferedAmount(uint16_t /*streamId*/) const override
|
|
126
|
+
{
|
|
127
|
+
return 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
size_t GetTotalBufferedAmount() const override
|
|
131
|
+
{
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
size_t GetStreamBufferedAmountLowThreshold(uint16_t /*streamId*/) const override
|
|
136
|
+
{
|
|
137
|
+
return 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
void SetStreamBufferedAmountLowThreshold(uint16_t /*streamId*/, size_t /*bytes*/) override
|
|
141
|
+
{
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Methods for testing.
|
|
145
|
+
public:
|
|
146
|
+
MockSendQueue& ExpectEnableMessageInterleavingCalledWith(bool enabled)
|
|
147
|
+
{
|
|
148
|
+
this->expectedMessageInterleavingCalledWith = enabled;
|
|
149
|
+
|
|
150
|
+
return *this;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
MockSendQueue& WillProduceOnce(ProduceAction action)
|
|
154
|
+
{
|
|
155
|
+
this->produceOnceActions.push(std::move(action));
|
|
156
|
+
|
|
157
|
+
return *this;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
MockSendQueue& WillProduceRepeatedly(ProduceAction action)
|
|
161
|
+
{
|
|
162
|
+
this->produceRepeatedlyAction = std::move(action);
|
|
163
|
+
|
|
164
|
+
return *this;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* @remarks
|
|
169
|
+
* - Must be called before expecting calls to `Produce()`.
|
|
170
|
+
*/
|
|
171
|
+
MockSendQueue& ExpectProduceCalledTimes(size_t times)
|
|
172
|
+
{
|
|
173
|
+
this->produceCallCount = 0;
|
|
174
|
+
this->expectedProduceCallCount = times;
|
|
175
|
+
|
|
176
|
+
return *this;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
MockSendQueue& WillDiscardOnce(uint16_t streamId, uint32_t outgoingMessageId, bool returnValue)
|
|
180
|
+
{
|
|
181
|
+
this->discardExpectations.push({ streamId, outgoingMessageId, returnValue });
|
|
182
|
+
|
|
183
|
+
return *this;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* @remarks
|
|
188
|
+
* - Must be called before expecting calls to `Discard()`.
|
|
189
|
+
*/
|
|
190
|
+
MockSendQueue& ExpectDiscardCalledTimes(size_t times)
|
|
191
|
+
{
|
|
192
|
+
this->discardCallCount = 0;
|
|
193
|
+
this->expectedDiscardCallCount = times;
|
|
194
|
+
|
|
195
|
+
return *this;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
mocks::VerificationResult VerifyExpectations() const
|
|
199
|
+
{
|
|
200
|
+
if (
|
|
201
|
+
this->expectedMessageInterleavingCalledWith.has_value() &&
|
|
202
|
+
this->messageInterleavingCalledWith != this->expectedMessageInterleavingCalledWith.value())
|
|
203
|
+
{
|
|
204
|
+
return { .ok = false,
|
|
205
|
+
.errorMessage =
|
|
206
|
+
std::string("EnableMessageInterleaving() call mismatch [expected:") +
|
|
207
|
+
(this->expectedMessageInterleavingCalledWith.value() ? "true" : "false") +
|
|
208
|
+
", got:" + (this->messageInterleavingCalledWith ? "true" : "false") + "]" };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (
|
|
212
|
+
this->expectedProduceCallCount.has_value() &&
|
|
213
|
+
this->produceCallCount != this->expectedProduceCallCount.value())
|
|
214
|
+
{
|
|
215
|
+
return { .ok = false,
|
|
216
|
+
.errorMessage = "Produce() call count mismatch [expected:" +
|
|
217
|
+
std::to_string(this->expectedProduceCallCount.value()) +
|
|
218
|
+
", got:" + std::to_string(this->produceCallCount) + "]" };
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (
|
|
222
|
+
this->expectedDiscardCallCount.has_value() &&
|
|
223
|
+
this->discardCallCount != this->expectedDiscardCallCount.value())
|
|
224
|
+
{
|
|
225
|
+
return { .ok = false,
|
|
226
|
+
.errorMessage = "Discard() call count mismatch [expected:" +
|
|
227
|
+
std::to_string(this->expectedDiscardCallCount.value()) +
|
|
228
|
+
", got:" + std::to_string(this->discardCallCount) + "]" };
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (!this->discardExpectations.empty())
|
|
232
|
+
{
|
|
233
|
+
return { .ok = false,
|
|
234
|
+
.errorMessage = "Discard() has " +
|
|
235
|
+
std::to_string(this->discardExpectations.size()) +
|
|
236
|
+
" unconsumed expectation(s)" };
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return { .ok = true, .errorMessage = "" };
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
private:
|
|
243
|
+
// EnableMessageInterleaving().
|
|
244
|
+
bool messageInterleavingCalledWith{ false };
|
|
245
|
+
std::optional<bool> expectedMessageInterleavingCalledWith;
|
|
246
|
+
|
|
247
|
+
// Produce().
|
|
248
|
+
std::queue<ProduceAction> produceOnceActions;
|
|
249
|
+
ProduceAction produceRepeatedlyAction;
|
|
250
|
+
size_t produceCallCount{ 0 };
|
|
251
|
+
std::optional<size_t> expectedProduceCallCount;
|
|
252
|
+
|
|
253
|
+
// Discard().
|
|
254
|
+
std::queue<DiscardExpectation> discardExpectations;
|
|
255
|
+
size_t discardCallCount{ 0 };
|
|
256
|
+
std::optional<size_t> expectedDiscardCallCount;
|
|
257
|
+
};
|
|
258
|
+
} // namespace SCTP
|
|
259
|
+
} // namespace RTC
|
|
260
|
+
} // namespace mocks
|
|
261
|
+
|
|
262
|
+
#endif
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
#ifndef MS_MOCKS_MOCK_BACKOFF_TIMER_HANDLE_HPP
|
|
2
|
+
#define MS_MOCKS_MOCK_BACKOFF_TIMER_HANDLE_HPP
|
|
3
|
+
|
|
4
|
+
#include "common.hpp"
|
|
5
|
+
#include "handles/BackoffTimerHandleInterface.hpp"
|
|
6
|
+
#include <limits>
|
|
7
|
+
|
|
8
|
+
namespace mocks
|
|
9
|
+
{
|
|
10
|
+
// Forward declaration.
|
|
11
|
+
class MockShared;
|
|
12
|
+
|
|
13
|
+
class MockBackoffTimerHandle : public BackoffTimerHandleInterface
|
|
14
|
+
{
|
|
15
|
+
// Only MockShared class can invoke the constructor.
|
|
16
|
+
friend class mocks::MockShared;
|
|
17
|
+
|
|
18
|
+
private:
|
|
19
|
+
explicit MockBackoffTimerHandle(
|
|
20
|
+
BackoffTimerHandleOptions options,
|
|
21
|
+
std::function<uint64_t()> getTimeMs,
|
|
22
|
+
std::function<void()> onDelete);
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
MockBackoffTimerHandle& operator=(const MockBackoffTimerHandle&) = delete;
|
|
26
|
+
|
|
27
|
+
MockBackoffTimerHandle(const MockBackoffTimerHandle&) = delete;
|
|
28
|
+
|
|
29
|
+
~MockBackoffTimerHandle() override
|
|
30
|
+
{
|
|
31
|
+
this->onDelete();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public:
|
|
35
|
+
void Dump(int indentation = 0) const;
|
|
36
|
+
|
|
37
|
+
void Start() override
|
|
38
|
+
{
|
|
39
|
+
this->running = true;
|
|
40
|
+
this->expiresAtMs = this->getTimeMs() + ComputeNextTimeoutMs();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
void Stop() override
|
|
44
|
+
{
|
|
45
|
+
this->running = false;
|
|
46
|
+
this->expiresAtMs = std::numeric_limits<uint64_t>::max();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @remarks
|
|
51
|
+
* - This method must be defined in the .cpp since it's called by the
|
|
52
|
+
* constructor. Otherwise clang-tidy complains:
|
|
53
|
+
* "warning: Call to virtual method 'BackoffTimerHandle::SetBaseTimeoutMs'
|
|
54
|
+
* during construction bypasses virtual dispatch
|
|
55
|
+
* [clang-analyzer-optin.cplusplus.VirtualCall]"
|
|
56
|
+
*/
|
|
57
|
+
void SetBaseTimeoutMs(uint64_t baseTimeoutMs) override;
|
|
58
|
+
|
|
59
|
+
bool IsRunning() const override
|
|
60
|
+
{
|
|
61
|
+
return this->running;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const std::string GetLabel() const override
|
|
65
|
+
{
|
|
66
|
+
return this->label;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
std::optional<size_t> GetMaxRestarts() const override
|
|
70
|
+
{
|
|
71
|
+
return this->maxRestarts;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
size_t GetExpirationCount() const override
|
|
75
|
+
{
|
|
76
|
+
return this->expirationCount;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Methods for testing.
|
|
80
|
+
public:
|
|
81
|
+
uint64_t GetExpiresAtMs() const
|
|
82
|
+
{
|
|
83
|
+
return this->expiresAtMs;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
bool EvaluateHasExpired()
|
|
87
|
+
{
|
|
88
|
+
if (this->getTimeMs() >= this->expiresAtMs)
|
|
89
|
+
{
|
|
90
|
+
TriggerExpire();
|
|
91
|
+
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
else
|
|
95
|
+
{
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private:
|
|
101
|
+
uint64_t ComputeNextTimeoutMs() const
|
|
102
|
+
{
|
|
103
|
+
auto expirationCount = this->expirationCount;
|
|
104
|
+
|
|
105
|
+
switch (this->backoffAlgorithm)
|
|
106
|
+
{
|
|
107
|
+
case BackoffAlgorithm::FIXED:
|
|
108
|
+
{
|
|
109
|
+
return this->baseTimeoutMs;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
case BackoffAlgorithm::EXPONENTIAL:
|
|
113
|
+
{
|
|
114
|
+
auto timeoutMs = this->baseTimeoutMs;
|
|
115
|
+
|
|
116
|
+
while (expirationCount > 0 && timeoutMs < BackoffTimerHandleInterface::MaxTimeoutMs)
|
|
117
|
+
{
|
|
118
|
+
timeoutMs *= 2;
|
|
119
|
+
--expirationCount;
|
|
120
|
+
|
|
121
|
+
if (this->maxBackoffTimeoutMs.has_value() && timeoutMs > this->maxBackoffTimeoutMs.value())
|
|
122
|
+
{
|
|
123
|
+
return this->maxBackoffTimeoutMs.value();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return std::min<uint64_t>(timeoutMs, BackoffTimerHandleInterface::MaxTimeoutMs);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
NO_DEFAULT_GCC();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
void TriggerExpire();
|
|
135
|
+
|
|
136
|
+
private:
|
|
137
|
+
// Passed by argument.
|
|
138
|
+
BackoffTimerHandleInterface::Listener* listener{ nullptr };
|
|
139
|
+
const std::string label;
|
|
140
|
+
uint64_t baseTimeoutMs;
|
|
141
|
+
BackoffAlgorithm backoffAlgorithm;
|
|
142
|
+
std::optional<uint64_t> maxBackoffTimeoutMs;
|
|
143
|
+
std::optional<size_t> maxRestarts;
|
|
144
|
+
std::function<uint64_t()> getTimeMs;
|
|
145
|
+
const std::function<void()> onDelete;
|
|
146
|
+
// Others.
|
|
147
|
+
bool running{ false };
|
|
148
|
+
size_t expirationCount{ 0 };
|
|
149
|
+
uint64_t expiresAtMs{ std::numeric_limits<uint64_t>::max() };
|
|
150
|
+
};
|
|
151
|
+
} // namespace mocks
|
|
152
|
+
|
|
153
|
+
#endif
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#ifndef MS_MOCKS_MOCK_TIMER_HANDLE_HPP
|
|
2
|
+
#define MS_MOCKS_MOCK_TIMER_HANDLE_HPP
|
|
3
|
+
|
|
4
|
+
#include "common.hpp"
|
|
5
|
+
#include "handles/TimerHandleInterface.hpp"
|
|
6
|
+
|
|
7
|
+
namespace mocks
|
|
8
|
+
{
|
|
9
|
+
// Forward declaration.
|
|
10
|
+
class MockShared;
|
|
11
|
+
|
|
12
|
+
class MockTimerHandle : public TimerHandleInterface
|
|
13
|
+
{
|
|
14
|
+
// Only MockShared class can invoke the constructor.
|
|
15
|
+
friend class mocks::MockShared;
|
|
16
|
+
|
|
17
|
+
private:
|
|
18
|
+
explicit MockTimerHandle() = default;
|
|
19
|
+
|
|
20
|
+
public:
|
|
21
|
+
MockTimerHandle& operator=(const MockTimerHandle&) = delete;
|
|
22
|
+
|
|
23
|
+
MockTimerHandle(const MockTimerHandle&) = delete;
|
|
24
|
+
|
|
25
|
+
~MockTimerHandle() override = default;
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
void Start(uint64_t timeout, uint64_t repeat = 0) override
|
|
29
|
+
{
|
|
30
|
+
this->running = true;
|
|
31
|
+
this->timeout = timeout;
|
|
32
|
+
this->repeat = repeat;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
void Stop() override
|
|
36
|
+
{
|
|
37
|
+
this->running = false;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
void Restart() override
|
|
41
|
+
{
|
|
42
|
+
this->running = true;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
void Restart(uint64_t timeout, uint64_t repeat = 0) override
|
|
46
|
+
{
|
|
47
|
+
this->running = true;
|
|
48
|
+
this->timeout = timeout;
|
|
49
|
+
this->repeat = repeat;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
uint64_t GetTimeout() const override
|
|
53
|
+
{
|
|
54
|
+
return this->timeout;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
uint64_t GetRepeat() const override
|
|
58
|
+
{
|
|
59
|
+
return this->repeat;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
bool IsActive() const override
|
|
63
|
+
{
|
|
64
|
+
return this->running;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private:
|
|
68
|
+
bool running{ false };
|
|
69
|
+
uint64_t timeout{ 0u };
|
|
70
|
+
uint64_t repeat{ 0u };
|
|
71
|
+
};
|
|
72
|
+
} // namespace mocks
|
|
73
|
+
|
|
74
|
+
#endif
|