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,912 @@
|
|
|
1
|
+
#define MS_CLASS "RTC::SCTP::OutstandingData"
|
|
2
|
+
// #define MS_LOG_DEV_LEVEL 3
|
|
3
|
+
|
|
4
|
+
#include "RTC/SCTP/tx/OutstandingData.hpp"
|
|
5
|
+
#include "Logger.hpp"
|
|
6
|
+
#include "MediaSoupErrors.hpp"
|
|
7
|
+
#include "RTC/SCTP/packet/chunks/AnyForwardTsnChunk.hpp"
|
|
8
|
+
#include "Utils.hpp"
|
|
9
|
+
#include <map>
|
|
10
|
+
|
|
11
|
+
namespace RTC
|
|
12
|
+
{
|
|
13
|
+
namespace SCTP
|
|
14
|
+
{
|
|
15
|
+
/* Static. */
|
|
16
|
+
|
|
17
|
+
// The number of times a packet must be NACKed before it's retransmitted.
|
|
18
|
+
//
|
|
19
|
+
// @see https://datatracker.ietf.org/doc/html/rfc9260#section-7.2.4
|
|
20
|
+
constexpr uint8_t NumberOfNacksForRetransmission{ 3 };
|
|
21
|
+
|
|
22
|
+
/* Instance methods. */
|
|
23
|
+
|
|
24
|
+
OutstandingData::Item::Item(
|
|
25
|
+
uint32_t outgoingMessageId,
|
|
26
|
+
UserData data,
|
|
27
|
+
uint64_t timeSentMs,
|
|
28
|
+
uint16_t maxRetransmissions,
|
|
29
|
+
uint64_t expiresAtMs,
|
|
30
|
+
std::optional<uint64_t> lifecycleId)
|
|
31
|
+
: outgoingMessageId(outgoingMessageId),
|
|
32
|
+
data(std::move(data)),
|
|
33
|
+
timeSentMs(timeSentMs),
|
|
34
|
+
maxRetransmissions(maxRetransmissions),
|
|
35
|
+
expiresAtMs(expiresAtMs),
|
|
36
|
+
lifecycleId(lifecycleId)
|
|
37
|
+
{
|
|
38
|
+
MS_TRACE();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
void OutstandingData::Item::Ack()
|
|
42
|
+
{
|
|
43
|
+
MS_TRACE();
|
|
44
|
+
|
|
45
|
+
if (this->lifecycle != Lifecycle::ABANDONED)
|
|
46
|
+
{
|
|
47
|
+
this->lifecycle = Lifecycle::ACTIVE;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
this->ackState = AckState::ACKED;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
OutstandingData::Item::NackAction OutstandingData::Item::Nack(bool retransmitNow)
|
|
54
|
+
{
|
|
55
|
+
MS_TRACE();
|
|
56
|
+
|
|
57
|
+
this->ackState = AckState::NACKED;
|
|
58
|
+
++this->nackCount;
|
|
59
|
+
|
|
60
|
+
if (!ShouldBeRetransmitted() && !IsAbandoned() && (retransmitNow || this->nackCount >= NumberOfNacksForRetransmission))
|
|
61
|
+
{
|
|
62
|
+
// Nacked enough times, it's considered lost.
|
|
63
|
+
if (this->numRetransmissions < this->maxRetransmissions)
|
|
64
|
+
{
|
|
65
|
+
this->lifecycle = Lifecycle::TO_BE_RETRANSMITTED;
|
|
66
|
+
|
|
67
|
+
return NackAction::RETRANSMIT;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
Abandon();
|
|
71
|
+
|
|
72
|
+
return NackAction::ABANDON;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return NackAction::NOTHING;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
void OutstandingData::Item::MarkAsRetransmitted()
|
|
79
|
+
{
|
|
80
|
+
MS_TRACE();
|
|
81
|
+
|
|
82
|
+
this->lifecycle = Lifecycle::ACTIVE;
|
|
83
|
+
this->ackState = AckState::UNACKED;
|
|
84
|
+
this->nackCount = 0;
|
|
85
|
+
++this->numRetransmissions;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
void OutstandingData::Item::Abandon()
|
|
89
|
+
{
|
|
90
|
+
MS_TRACE();
|
|
91
|
+
|
|
92
|
+
MS_ASSERT(
|
|
93
|
+
this->expiresAtMs != Types::ExpiresAtMsInfinite ||
|
|
94
|
+
this->maxRetransmissions != Types::MaxRetransmitsNoLimit,
|
|
95
|
+
"item should not have infinite expiration time or its retransmission times shouldn't be the maximum");
|
|
96
|
+
|
|
97
|
+
this->lifecycle = Lifecycle::ABANDONED;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
OutstandingData::OutstandingData(
|
|
101
|
+
size_t dataChunkHeaderLength,
|
|
102
|
+
Types::UnwrappedTsn lastCumulativeTsnAck,
|
|
103
|
+
std::function<bool(uint16_t /*streamId*/, uint32_t /*outgoingMessageId*/)> discardFromSendQueue)
|
|
104
|
+
: dataChunkHeaderLength(dataChunkHeaderLength),
|
|
105
|
+
lastCumulativeTsnAck(lastCumulativeTsnAck),
|
|
106
|
+
discardFromSendQueue(std::move(discardFromSendQueue))
|
|
107
|
+
{
|
|
108
|
+
MS_TRACE();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
OutstandingData::AckInfo OutstandingData::HandleSack(
|
|
112
|
+
Types::UnwrappedTsn cumulativeTsnAck,
|
|
113
|
+
std::span<const SackChunk::GapAckBlock> gapAckBlocks,
|
|
114
|
+
bool isInFastRecovery)
|
|
115
|
+
{
|
|
116
|
+
MS_TRACE();
|
|
117
|
+
|
|
118
|
+
const bool cumulativeTsnAckAdvanced = cumulativeTsnAck > this->lastCumulativeTsnAck;
|
|
119
|
+
|
|
120
|
+
OutstandingData::AckInfo ackInfo(cumulativeTsnAck);
|
|
121
|
+
|
|
122
|
+
// Erase all items up to cumulativeTsnAck.
|
|
123
|
+
RemoveAcked(cumulativeTsnAck, ackInfo);
|
|
124
|
+
|
|
125
|
+
// ACK packets reported in the gap ack blocks.
|
|
126
|
+
AckGapBlocks(cumulativeTsnAck, gapAckBlocks, ackInfo);
|
|
127
|
+
|
|
128
|
+
// NACK and possibly mark for retransmit Chunks that weren't acked.
|
|
129
|
+
NackBetweenAckBlocks(
|
|
130
|
+
cumulativeTsnAck, gapAckBlocks, isInFastRecovery, cumulativeTsnAckAdvanced, ackInfo);
|
|
131
|
+
|
|
132
|
+
AssertIsConsistent();
|
|
133
|
+
|
|
134
|
+
return ackInfo;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
std::vector<std::pair<uint32_t /*tsn*/, UserData>> OutstandingData::GetChunksToBeFastRetransmitted(
|
|
138
|
+
size_t maxLength)
|
|
139
|
+
{
|
|
140
|
+
MS_TRACE();
|
|
141
|
+
|
|
142
|
+
std::vector<std::pair<uint32_t /*tsn*/, UserData>> result =
|
|
143
|
+
ExtractChunksThatCanFit(this->toBeFastRetransmitted, maxLength);
|
|
144
|
+
|
|
145
|
+
// https://datatracker.ietf.org/doc/html/rfc9260#section-7.2.4
|
|
146
|
+
//
|
|
147
|
+
// "Those TSNs marked for retransmission due to the Fast-Retransmit
|
|
148
|
+
// algorithm that did not fit in the sent datagram carrying K other TSNs
|
|
149
|
+
// are also marked as ineligible for a subsequent Fast Retransmit.
|
|
150
|
+
// However, as they are marked for retransmission they will be
|
|
151
|
+
// retransmitted later on as soon as cwnd allows."
|
|
152
|
+
if (!this->toBeFastRetransmitted.empty())
|
|
153
|
+
{
|
|
154
|
+
this->toBeRetransmitted.insert(
|
|
155
|
+
this->toBeFastRetransmitted.begin(), this->toBeFastRetransmitted.end());
|
|
156
|
+
|
|
157
|
+
this->toBeFastRetransmitted.clear();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
AssertIsConsistent();
|
|
161
|
+
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
std::vector<std::pair<uint32_t /*tsn*/, UserData>> OutstandingData::GetChunksToBeRetransmitted(
|
|
166
|
+
size_t maxLength)
|
|
167
|
+
{
|
|
168
|
+
MS_TRACE();
|
|
169
|
+
|
|
170
|
+
// Chunks scheduled for fast retransmission must be sent first.
|
|
171
|
+
MS_ASSERT(this->toBeFastRetransmitted.empty(), "this->toBeFastRetransmitted is not empty");
|
|
172
|
+
|
|
173
|
+
return ExtractChunksThatCanFit(this->toBeRetransmitted, maxLength);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
void OutstandingData::ExpireOutstandingChunks(uint64_t nowMs)
|
|
177
|
+
{
|
|
178
|
+
MS_TRACE();
|
|
179
|
+
|
|
180
|
+
std::vector<Types::UnwrappedTsn> tsnsToExpire;
|
|
181
|
+
Types::UnwrappedTsn tsn = this->lastCumulativeTsnAck;
|
|
182
|
+
|
|
183
|
+
for (const Item& item : this->outstandingData)
|
|
184
|
+
{
|
|
185
|
+
tsn.Increment();
|
|
186
|
+
|
|
187
|
+
// Chunks that are nacked can be expired. Care should be taken not to
|
|
188
|
+
// expire unacked (in-flight) Chunks as they might have been received,
|
|
189
|
+
// but the SACK is either delayed or in-flight and may be received
|
|
190
|
+
// later.
|
|
191
|
+
if (item.IsAbandoned())
|
|
192
|
+
{
|
|
193
|
+
// Already abandoned.
|
|
194
|
+
}
|
|
195
|
+
else if (item.IsNacked() && item.HasExpired(nowMs))
|
|
196
|
+
{
|
|
197
|
+
tsnsToExpire.push_back(tsn);
|
|
198
|
+
}
|
|
199
|
+
else
|
|
200
|
+
{
|
|
201
|
+
// A non-expired Chunk. No need to iterate any further.
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
for (const Types::UnwrappedTsn tsnToExpire : tsnsToExpire)
|
|
207
|
+
{
|
|
208
|
+
// The item is retrieved by TSN, as AbandonAllFor() may have modified
|
|
209
|
+
// `this->outstandingData` and invalidated iterators from the first
|
|
210
|
+
// loop.
|
|
211
|
+
const Item& item = GetItem(tsnToExpire);
|
|
212
|
+
|
|
213
|
+
MS_WARN_TAG(
|
|
214
|
+
sctp,
|
|
215
|
+
"marking nacked Chunk %" PRIu32 " and message %" PRIu32 " as expired",
|
|
216
|
+
tsnToExpire.Wrap(),
|
|
217
|
+
item.GetData().GetMessageId());
|
|
218
|
+
|
|
219
|
+
AbandonAllFor(item);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
AssertIsConsistent();
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
Types::UnwrappedTsn OutstandingData::GetHighestOutstandingTsn() const
|
|
226
|
+
{
|
|
227
|
+
MS_TRACE();
|
|
228
|
+
|
|
229
|
+
return Types::UnwrappedTsn::AddTo(this->lastCumulativeTsnAck, this->outstandingData.size());
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
std::optional<Types::UnwrappedTsn> OutstandingData::Insert(
|
|
233
|
+
uint32_t outgoingMessageId,
|
|
234
|
+
const UserData& data,
|
|
235
|
+
uint64_t timeSentMs,
|
|
236
|
+
uint16_t maxRetransmissions,
|
|
237
|
+
uint64_t expiresAtMs,
|
|
238
|
+
std::optional<uint64_t> lifecycleId)
|
|
239
|
+
{
|
|
240
|
+
MS_TRACE();
|
|
241
|
+
|
|
242
|
+
// All Chunks are always padded to be even divisible by 4.
|
|
243
|
+
const size_t chunkLength = GetSerializedChunkLength(data);
|
|
244
|
+
|
|
245
|
+
this->unackedPayloadBytes += data.GetPayloadLength();
|
|
246
|
+
this->unackedPacketBytes += chunkLength;
|
|
247
|
+
++this->unackedItems;
|
|
248
|
+
|
|
249
|
+
const Types::UnwrappedTsn tsn = GetNextTsn();
|
|
250
|
+
const Item& item = this->outstandingData.emplace_back(
|
|
251
|
+
outgoingMessageId, data.Clone(), timeSentMs, maxRetransmissions, expiresAtMs, lifecycleId);
|
|
252
|
+
|
|
253
|
+
if (item.HasExpired(timeSentMs))
|
|
254
|
+
{
|
|
255
|
+
// No need to send it, it was expired when it was in the send queue.
|
|
256
|
+
MS_WARN_TAG(
|
|
257
|
+
sctp,
|
|
258
|
+
"marking freshly produced Chunk %" PRIu32 " and message %" PRIu32 " as expired",
|
|
259
|
+
tsn.Wrap(),
|
|
260
|
+
item.GetData().GetMessageId());
|
|
261
|
+
|
|
262
|
+
AbandonAllFor(item);
|
|
263
|
+
|
|
264
|
+
AssertIsConsistent();
|
|
265
|
+
|
|
266
|
+
return std::nullopt;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
AssertIsConsistent();
|
|
270
|
+
|
|
271
|
+
return tsn;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
void OutstandingData::NackAll()
|
|
275
|
+
{
|
|
276
|
+
MS_TRACE();
|
|
277
|
+
|
|
278
|
+
Types::UnwrappedTsn tsn = this->lastCumulativeTsnAck;
|
|
279
|
+
|
|
280
|
+
// A two-pass algorithm is needed, as NackItem will invalidate iterators.
|
|
281
|
+
std::vector<Types::UnwrappedTsn> tsnsToNack;
|
|
282
|
+
|
|
283
|
+
for (const Item& item : this->outstandingData)
|
|
284
|
+
{
|
|
285
|
+
tsn.Increment();
|
|
286
|
+
|
|
287
|
+
if (!item.IsAcked())
|
|
288
|
+
{
|
|
289
|
+
tsnsToNack.push_back(tsn);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
for (const Types::UnwrappedTsn tsnToNack : tsnsToNack)
|
|
294
|
+
{
|
|
295
|
+
NackItem(
|
|
296
|
+
tsnToNack,
|
|
297
|
+
/*retransmitNow*/ true,
|
|
298
|
+
/*doFastRetransmit*/ false);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
AssertIsConsistent();
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const ForwardTsnChunk* OutstandingData::AddForwardTsn(Packet* packet) const
|
|
305
|
+
{
|
|
306
|
+
MS_TRACE();
|
|
307
|
+
|
|
308
|
+
std::map<uint16_t /*streamId*/, uint16_t /*ssn*/> skippedPerOrderedStream;
|
|
309
|
+
Types::UnwrappedTsn newCumulativeAck = this->lastCumulativeTsnAck;
|
|
310
|
+
Types::UnwrappedTsn tsn = this->lastCumulativeTsnAck;
|
|
311
|
+
|
|
312
|
+
for (const Item& item : this->outstandingData)
|
|
313
|
+
{
|
|
314
|
+
tsn.Increment();
|
|
315
|
+
|
|
316
|
+
if (
|
|
317
|
+
this->streamResetBreakpointTsns.contains(tsn) ||
|
|
318
|
+
(tsn != newCumulativeAck.GetNextValue()) || !item.IsAbandoned())
|
|
319
|
+
{
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
newCumulativeAck = tsn;
|
|
324
|
+
|
|
325
|
+
if (
|
|
326
|
+
!item.GetData().IsUnordered() && item.GetData().GetStreamSequenceNumber() >
|
|
327
|
+
skippedPerOrderedStream[item.GetData().GetStreamId()])
|
|
328
|
+
{
|
|
329
|
+
skippedPerOrderedStream[item.GetData().GetStreamId()] =
|
|
330
|
+
item.GetData().GetStreamSequenceNumber();
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
auto* forwardTsnChunk = packet->BuildChunkInPlace<ForwardTsnChunk>();
|
|
335
|
+
|
|
336
|
+
forwardTsnChunk->SetNewCumulativeTsn(newCumulativeAck.Wrap());
|
|
337
|
+
|
|
338
|
+
for (const auto& [streamId, ssn] : skippedPerOrderedStream)
|
|
339
|
+
{
|
|
340
|
+
forwardTsnChunk->AddSkippedStream(AnyForwardTsnChunk::SkippedStream{ streamId, ssn });
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
forwardTsnChunk->Consolidate();
|
|
344
|
+
|
|
345
|
+
return forwardTsnChunk;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
const IForwardTsnChunk* OutstandingData::AddIForwardTsn(Packet* packet) const
|
|
349
|
+
{
|
|
350
|
+
MS_TRACE();
|
|
351
|
+
|
|
352
|
+
std::map<std::pair<bool /*unordered*/, uint16_t /*streamId*/>, uint32_t /*mid*/> skippedPerStream;
|
|
353
|
+
Types::UnwrappedTsn newCumulativeAck = this->lastCumulativeTsnAck;
|
|
354
|
+
Types::UnwrappedTsn tsn = this->lastCumulativeTsnAck;
|
|
355
|
+
|
|
356
|
+
for (const Item& item : this->outstandingData)
|
|
357
|
+
{
|
|
358
|
+
tsn.Increment();
|
|
359
|
+
|
|
360
|
+
if (
|
|
361
|
+
this->streamResetBreakpointTsns.contains(tsn) ||
|
|
362
|
+
(tsn != newCumulativeAck.GetNextValue()) || !item.IsAbandoned())
|
|
363
|
+
{
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
newCumulativeAck = tsn;
|
|
368
|
+
|
|
369
|
+
const std::pair<bool /*unordered*/, uint16_t /*streamId*/> stream =
|
|
370
|
+
std::make_pair(item.GetData().IsUnordered(), item.GetData().GetStreamId());
|
|
371
|
+
|
|
372
|
+
skippedPerStream[stream] = std::max(item.GetData().GetMessageId(), skippedPerStream[stream]);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
auto* iForwardTsnChunk = packet->BuildChunkInPlace<IForwardTsnChunk>();
|
|
376
|
+
|
|
377
|
+
iForwardTsnChunk->SetNewCumulativeTsn(newCumulativeAck.Wrap());
|
|
378
|
+
|
|
379
|
+
for (const auto& [stream, mid] : skippedPerStream)
|
|
380
|
+
{
|
|
381
|
+
const uint16_t streamId = stream.second;
|
|
382
|
+
const bool unordered = stream.first;
|
|
383
|
+
|
|
384
|
+
iForwardTsnChunk->AddSkippedStream(
|
|
385
|
+
AnyForwardTsnChunk::SkippedStream{ unordered, streamId, mid });
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
iForwardTsnChunk->Consolidate();
|
|
389
|
+
|
|
390
|
+
return iForwardTsnChunk;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
std::optional<uint64_t> OutstandingData::MeasureRtt(uint64_t nowMs, Types::UnwrappedTsn tsn) const
|
|
394
|
+
{
|
|
395
|
+
MS_TRACE();
|
|
396
|
+
|
|
397
|
+
if (tsn > this->lastCumulativeTsnAck && tsn < GetNextTsn())
|
|
398
|
+
{
|
|
399
|
+
const Item& item = GetItem(tsn);
|
|
400
|
+
|
|
401
|
+
if (!item.HasBeenRetransmitted())
|
|
402
|
+
{
|
|
403
|
+
// https://datatracker.ietf.org/doc/html/rfc9260#section-6.3.1
|
|
404
|
+
//
|
|
405
|
+
// "Karn's algorithm: RTT measurements MUST NOT be made using packets
|
|
406
|
+
// that were retransmitted (and thus for which it is ambiguous
|
|
407
|
+
// whether the reply was for the first instance of the Chunk or for a
|
|
408
|
+
// later instance)"
|
|
409
|
+
return nowMs - item.GetTimeSentMs();
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
return std::nullopt;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
bool OutstandingData::ShouldSendForwardTsn() const
|
|
417
|
+
{
|
|
418
|
+
MS_TRACE();
|
|
419
|
+
|
|
420
|
+
if (!this->outstandingData.empty())
|
|
421
|
+
{
|
|
422
|
+
return this->outstandingData.front().IsAbandoned();
|
|
423
|
+
}
|
|
424
|
+
else
|
|
425
|
+
{
|
|
426
|
+
return false;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
void OutstandingData::BeginResetStreams()
|
|
431
|
+
{
|
|
432
|
+
MS_TRACE();
|
|
433
|
+
|
|
434
|
+
this->streamResetBreakpointTsns.insert(GetNextTsn());
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
#ifdef MS_TEST
|
|
438
|
+
std::vector<
|
|
439
|
+
std::pair<uint32_t /*tsn*/, OutstandingData::State>> OutstandingData::GetChunkStatesForTesting() const
|
|
440
|
+
{
|
|
441
|
+
MS_TRACE();
|
|
442
|
+
|
|
443
|
+
std::vector<std::pair<uint32_t /*tsn*/, State>> states;
|
|
444
|
+
|
|
445
|
+
states.emplace_back(this->lastCumulativeTsnAck.Wrap(), State::ACKED);
|
|
446
|
+
|
|
447
|
+
Types::UnwrappedTsn tsn = this->lastCumulativeTsnAck;
|
|
448
|
+
|
|
449
|
+
for (const Item& item : this->outstandingData)
|
|
450
|
+
{
|
|
451
|
+
tsn.Increment();
|
|
452
|
+
|
|
453
|
+
State state;
|
|
454
|
+
|
|
455
|
+
if (item.IsAbandoned())
|
|
456
|
+
{
|
|
457
|
+
state = State::ABANDONED;
|
|
458
|
+
}
|
|
459
|
+
else if (item.ShouldBeRetransmitted())
|
|
460
|
+
{
|
|
461
|
+
state = State::TO_BE_RETRANSMITTED;
|
|
462
|
+
}
|
|
463
|
+
else if (item.IsAcked())
|
|
464
|
+
{
|
|
465
|
+
state = State::ACKED;
|
|
466
|
+
}
|
|
467
|
+
else if (item.IsNacked())
|
|
468
|
+
{
|
|
469
|
+
state = State::NACKED;
|
|
470
|
+
}
|
|
471
|
+
else if (item.IsOutstanding())
|
|
472
|
+
{
|
|
473
|
+
state = State::IN_FLIGHT;
|
|
474
|
+
}
|
|
475
|
+
else
|
|
476
|
+
{
|
|
477
|
+
MS_THROW_ERROR("should not end here");
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
states.emplace_back(tsn.Wrap(), state);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
return states;
|
|
484
|
+
}
|
|
485
|
+
#endif
|
|
486
|
+
|
|
487
|
+
size_t OutstandingData::GetSerializedChunkLength(const UserData& data) const
|
|
488
|
+
{
|
|
489
|
+
MS_TRACE();
|
|
490
|
+
|
|
491
|
+
return Utils::Byte::PadTo4Bytes<size_t>(this->dataChunkHeaderLength + data.GetPayloadLength());
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
OutstandingData::Item& OutstandingData::GetItem(Types::UnwrappedTsn tsn)
|
|
495
|
+
{
|
|
496
|
+
MS_TRACE();
|
|
497
|
+
|
|
498
|
+
MS_ASSERT(
|
|
499
|
+
tsn > this->lastCumulativeTsnAck, "tsn must be higher than this->lastCumulativeTsnAck");
|
|
500
|
+
MS_ASSERT(tsn < GetNextTsn(), "tsn must be higher than GetNextTsn()");
|
|
501
|
+
|
|
502
|
+
const size_t index = Types::UnwrappedTsn::Difference(tsn, this->lastCumulativeTsnAck) - 1;
|
|
503
|
+
|
|
504
|
+
MS_ASSERT(index >= 0, "index must be equal or higher than 0");
|
|
505
|
+
MS_ASSERT(
|
|
506
|
+
index < this->outstandingData.size(),
|
|
507
|
+
"index must be lower than this->outstandingData.size()");
|
|
508
|
+
|
|
509
|
+
return this->outstandingData[index];
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
const OutstandingData::Item& OutstandingData::GetItem(Types::UnwrappedTsn tsn) const
|
|
513
|
+
{
|
|
514
|
+
MS_TRACE();
|
|
515
|
+
|
|
516
|
+
MS_ASSERT(
|
|
517
|
+
tsn > this->lastCumulativeTsnAck, "tsn must be higher than this->lastCumulativeTsnAck");
|
|
518
|
+
MS_ASSERT(tsn < GetNextTsn(), "tsn must be higher than GetNextTsn()");
|
|
519
|
+
|
|
520
|
+
const size_t index = Types::UnwrappedTsn::Difference(tsn, this->lastCumulativeTsnAck) - 1;
|
|
521
|
+
|
|
522
|
+
MS_ASSERT(index >= 0, "index must be equal or higher than 0");
|
|
523
|
+
MS_ASSERT(
|
|
524
|
+
index < this->outstandingData.size(),
|
|
525
|
+
"index must be lower than this->outstandingData.size()");
|
|
526
|
+
|
|
527
|
+
return this->outstandingData[index];
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
void OutstandingData::RemoveAcked(Types::UnwrappedTsn cumulativeTsnAck, AckInfo& ackInfo)
|
|
531
|
+
{
|
|
532
|
+
MS_TRACE();
|
|
533
|
+
|
|
534
|
+
while (!this->outstandingData.empty() && this->lastCumulativeTsnAck < cumulativeTsnAck)
|
|
535
|
+
{
|
|
536
|
+
const Types::UnwrappedTsn tsn = this->lastCumulativeTsnAck.GetNextValue();
|
|
537
|
+
|
|
538
|
+
Item& item = this->outstandingData.front();
|
|
539
|
+
|
|
540
|
+
AckChunk(ackInfo, tsn, item);
|
|
541
|
+
|
|
542
|
+
if (item.GetLifecycleId().has_value())
|
|
543
|
+
{
|
|
544
|
+
MS_ASSERT(item.GetData().IsEnd(), "item.GetData().IsEnd() must be true");
|
|
545
|
+
|
|
546
|
+
if (item.IsAbandoned())
|
|
547
|
+
{
|
|
548
|
+
ackInfo.abandonedLifecycleIds.push_back(item.GetLifecycleId().value());
|
|
549
|
+
}
|
|
550
|
+
else
|
|
551
|
+
{
|
|
552
|
+
ackInfo.ackedLifecycleIds.push_back(item.GetLifecycleId().value());
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
this->outstandingData.pop_front();
|
|
557
|
+
this->lastCumulativeTsnAck.Increment();
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
this->streamResetBreakpointTsns.erase(
|
|
561
|
+
this->streamResetBreakpointTsns.begin(),
|
|
562
|
+
this->streamResetBreakpointTsns.upper_bound(cumulativeTsnAck.GetNextValue()));
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
void OutstandingData::AckGapBlocks(
|
|
566
|
+
Types::UnwrappedTsn cumulativeTsnAck,
|
|
567
|
+
std::span<const SackChunk::GapAckBlock> gapAckBlocks,
|
|
568
|
+
AckInfo& ackInfo)
|
|
569
|
+
{
|
|
570
|
+
MS_TRACE();
|
|
571
|
+
|
|
572
|
+
// Mark all non-gaps as ACKED (but they can't be removed) as (from RFC)
|
|
573
|
+
// "SCTP considers the information carried in the Gap Ack Blocks in the
|
|
574
|
+
// SACK Chunk as advisory". Note that when NR-SACK is supported, this can
|
|
575
|
+
// be handled differently.
|
|
576
|
+
|
|
577
|
+
for (const auto& block : gapAckBlocks)
|
|
578
|
+
{
|
|
579
|
+
const Types::UnwrappedTsn start = Types::UnwrappedTsn::AddTo(cumulativeTsnAck, block.start);
|
|
580
|
+
const Types::UnwrappedTsn end = Types::UnwrappedTsn::AddTo(cumulativeTsnAck, block.end);
|
|
581
|
+
|
|
582
|
+
for (Types::UnwrappedTsn tsn = start; tsn <= end; tsn = tsn.GetNextValue())
|
|
583
|
+
{
|
|
584
|
+
if (tsn > this->lastCumulativeTsnAck && tsn < GetNextTsn())
|
|
585
|
+
{
|
|
586
|
+
Item& item = GetItem(tsn);
|
|
587
|
+
|
|
588
|
+
AckChunk(ackInfo, tsn, item);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
void OutstandingData::NackBetweenAckBlocks(
|
|
595
|
+
Types::UnwrappedTsn cumulativeTsnAck,
|
|
596
|
+
std::span<const SackChunk::GapAckBlock> gapAckBlocks,
|
|
597
|
+
bool isInFastRecovery,
|
|
598
|
+
bool cumulativeTsnAckedAdvanced,
|
|
599
|
+
AckInfo& ackInfo)
|
|
600
|
+
{
|
|
601
|
+
MS_TRACE();
|
|
602
|
+
|
|
603
|
+
// Mark everything between the blocks as NACKED/TO_BE_RETRANSMITTED.
|
|
604
|
+
//
|
|
605
|
+
// https://datatracker.ietf.org/doc/html/rfc9260#section-7.2.4
|
|
606
|
+
//
|
|
607
|
+
// "Mark the DATA chunk(s) with three miss indications for retransmission."
|
|
608
|
+
// "For each incoming SACK, miss indications are incremented only for
|
|
609
|
+
// missing TSNs prior to the highest TSN newly acknowledged in the SACK."
|
|
610
|
+
//
|
|
611
|
+
// What this means is that only when there is a increasing stream of data
|
|
612
|
+
// received and there are new packets seen (since last time), packets that
|
|
613
|
+
// are in-flight and between gaps should be nacked. This means that SCTP
|
|
614
|
+
// relies on the T3-RTX-timer to re-send packets otherwise.
|
|
615
|
+
Types::UnwrappedTsn maxTsnToNack = ackInfo.highestTsnAcked;
|
|
616
|
+
|
|
617
|
+
if (isInFastRecovery && cumulativeTsnAckedAdvanced)
|
|
618
|
+
{
|
|
619
|
+
// https://datatracker.ietf.org/doc/html/rfc9260#section-7.2.4
|
|
620
|
+
//
|
|
621
|
+
// "If an endpoint is in Fast Recovery and a SACK arrives that advances
|
|
622
|
+
// the Cumulative TSN Ack Point, the miss indications are incremented
|
|
623
|
+
// for all TSNs reported missing in the SACK."
|
|
624
|
+
maxTsnToNack = Types::UnwrappedTsn::AddTo(
|
|
625
|
+
cumulativeTsnAck, gapAckBlocks.empty() ? 0 : gapAckBlocks.rbegin()->end);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
Types::UnwrappedTsn prevBlockLastAcked = cumulativeTsnAck;
|
|
629
|
+
|
|
630
|
+
for (const auto& block : gapAckBlocks)
|
|
631
|
+
{
|
|
632
|
+
const Types::UnwrappedTsn curBlockFirstAcked =
|
|
633
|
+
Types::UnwrappedTsn::AddTo(cumulativeTsnAck, block.start);
|
|
634
|
+
|
|
635
|
+
for (Types::UnwrappedTsn tsn = prevBlockLastAcked.GetNextValue();
|
|
636
|
+
tsn < curBlockFirstAcked && tsn <= maxTsnToNack && tsn < GetNextTsn();
|
|
637
|
+
tsn = tsn.GetNextValue())
|
|
638
|
+
{
|
|
639
|
+
ackInfo.hasPacketLoss |= NackItem(
|
|
640
|
+
tsn,
|
|
641
|
+
/*retransmitNow*/ false,
|
|
642
|
+
/*doFastRetransmit*/ !isInFastRecovery);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
prevBlockLastAcked = Types::UnwrappedTsn::AddTo(cumulativeTsnAck, block.end);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
// Note that packets are not NACKED which are above the highest
|
|
649
|
+
// gap-ack-block (or above the cumulative ack TSN if no gap-ack-blocks)
|
|
650
|
+
// as only packets up until the `highestTsnAcked` (see above) should be
|
|
651
|
+
// considered when NACKing.
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
void OutstandingData::AckChunk(AckInfo& ackInfo, Types::UnwrappedTsn tsn, Item& item)
|
|
655
|
+
{
|
|
656
|
+
MS_TRACE();
|
|
657
|
+
|
|
658
|
+
if (!item.IsAcked())
|
|
659
|
+
{
|
|
660
|
+
const size_t serializedLength = GetSerializedChunkLength(item.GetData());
|
|
661
|
+
|
|
662
|
+
ackInfo.bytesAcked += serializedLength;
|
|
663
|
+
|
|
664
|
+
if (item.IsOutstanding())
|
|
665
|
+
{
|
|
666
|
+
this->unackedPayloadBytes -= item.GetData().GetPayloadLength();
|
|
667
|
+
this->unackedPacketBytes -= serializedLength;
|
|
668
|
+
--this->unackedItems;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
if (item.ShouldBeRetransmitted())
|
|
672
|
+
{
|
|
673
|
+
MS_ASSERT(
|
|
674
|
+
!this->toBeFastRetransmitted.contains(tsn),
|
|
675
|
+
"tsn should not be present in this->toBeFastRetransmitted");
|
|
676
|
+
|
|
677
|
+
this->toBeRetransmitted.erase(tsn);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
item.Ack();
|
|
681
|
+
|
|
682
|
+
ackInfo.highestTsnAcked = std::max(ackInfo.highestTsnAcked, tsn);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
bool OutstandingData::NackItem(Types::UnwrappedTsn tsn, bool retransmitNow, bool doFastRetransmit)
|
|
687
|
+
{
|
|
688
|
+
MS_TRACE();
|
|
689
|
+
|
|
690
|
+
Item& item = GetItem(tsn);
|
|
691
|
+
|
|
692
|
+
// Ignore NACKs for chunks that have already been acknowledged.
|
|
693
|
+
if (item.IsAcked())
|
|
694
|
+
{
|
|
695
|
+
return false;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
const bool wasOutstanding = item.IsOutstanding();
|
|
699
|
+
const Item::NackAction action = item.Nack(retransmitNow);
|
|
700
|
+
|
|
701
|
+
if (wasOutstanding && !item.IsOutstanding())
|
|
702
|
+
{
|
|
703
|
+
this->unackedPayloadBytes -= item.GetData().GetPayloadLength();
|
|
704
|
+
this->unackedPacketBytes -= GetSerializedChunkLength(item.GetData());
|
|
705
|
+
--this->unackedItems;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
switch (action)
|
|
709
|
+
{
|
|
710
|
+
case Item::NackAction::NOTHING:
|
|
711
|
+
{
|
|
712
|
+
return false;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
case Item::NackAction::RETRANSMIT:
|
|
716
|
+
{
|
|
717
|
+
if (doFastRetransmit)
|
|
718
|
+
{
|
|
719
|
+
this->toBeFastRetransmitted.insert(tsn);
|
|
720
|
+
}
|
|
721
|
+
else
|
|
722
|
+
{
|
|
723
|
+
this->toBeRetransmitted.insert(tsn);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
MS_DEBUG_TAG(sctp, "tsn %" PRIu32 " marked for retransmission", tsn.Wrap());
|
|
727
|
+
|
|
728
|
+
break;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
case Item::NackAction::ABANDON:
|
|
732
|
+
{
|
|
733
|
+
MS_DEBUG_TAG(sctp, "tsn %" PRIu32 " nacked, resulted in abandoning", tsn.Wrap());
|
|
734
|
+
|
|
735
|
+
AbandonAllFor(item);
|
|
736
|
+
|
|
737
|
+
break;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
return true;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
void OutstandingData::AbandonAllFor(const OutstandingData::Item& item)
|
|
745
|
+
{
|
|
746
|
+
MS_TRACE();
|
|
747
|
+
|
|
748
|
+
// Erase all remaining chunks from the producer, if any.
|
|
749
|
+
if (this->discardFromSendQueue(item.GetData().GetStreamId(), item.GetOutgoingMessageId()))
|
|
750
|
+
{
|
|
751
|
+
// There were remaining chunks to be produced for this message. Since the
|
|
752
|
+
// receiver may have already received all chunks (up till now) for this
|
|
753
|
+
// message, we can't just FORWARD-TSN to the last fragment in this
|
|
754
|
+
// (abandoned) message and start sending a new message, as the receiver will
|
|
755
|
+
// then see a new message before the end of the previous one was seen (or
|
|
756
|
+
// skipped over). So create a new fragment, representing the end, that the
|
|
757
|
+
// received will never see as it is abandoned immediately and used as cum
|
|
758
|
+
// TSN in the sent FORWARD-TSN.
|
|
759
|
+
UserData messageEnd(
|
|
760
|
+
item.GetData().GetStreamId(),
|
|
761
|
+
item.GetData().GetStreamSequenceNumber(),
|
|
762
|
+
item.GetData().GetMessageId(),
|
|
763
|
+
item.GetData().GetFragmentSequenceNumber(),
|
|
764
|
+
item.GetData().GetPayloadProtocolId(),
|
|
765
|
+
std::vector<uint8_t>(),
|
|
766
|
+
/*isBeginning*/ false,
|
|
767
|
+
/*isEnd*/ true,
|
|
768
|
+
/*isUnordered*/ item.GetData().IsUnordered());
|
|
769
|
+
|
|
770
|
+
const Types::UnwrappedTsn tsn = GetNextTsn();
|
|
771
|
+
|
|
772
|
+
Item& addedItem = this->outstandingData.emplace_back(
|
|
773
|
+
item.GetOutgoingMessageId(),
|
|
774
|
+
std::move(messageEnd),
|
|
775
|
+
/*timeSentMs*/ 0,
|
|
776
|
+
/*maxRetransmissions*/ 0,
|
|
777
|
+
/*expiresAtMs*/ Types::ExpiresAtMsInfinite,
|
|
778
|
+
/*lifecycleId*/ std::nullopt);
|
|
779
|
+
|
|
780
|
+
// The added Chunk shouldn't be included in `this->unackedPacketBytes`,
|
|
781
|
+
// so set it as acked.
|
|
782
|
+
addedItem.Ack();
|
|
783
|
+
|
|
784
|
+
MS_DEBUG_TAG(sctp, "adding unsent end placeholder for message at TSN %" PRIu32, tsn.Wrap());
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
Types::UnwrappedTsn tsn = this->lastCumulativeTsnAck;
|
|
788
|
+
|
|
789
|
+
for (Item& other : this->outstandingData)
|
|
790
|
+
{
|
|
791
|
+
tsn.Increment();
|
|
792
|
+
|
|
793
|
+
if (
|
|
794
|
+
!other.IsAbandoned() && other.GetData().GetStreamId() == item.GetData().GetStreamId() &&
|
|
795
|
+
other.GetOutgoingMessageId() == item.GetOutgoingMessageId())
|
|
796
|
+
{
|
|
797
|
+
MS_WARN_TAG(sctp, "marking Chunk %" PRIu32 " as abandoned", tsn.Wrap());
|
|
798
|
+
|
|
799
|
+
if (other.ShouldBeRetransmitted())
|
|
800
|
+
{
|
|
801
|
+
this->toBeFastRetransmitted.erase(tsn);
|
|
802
|
+
this->toBeRetransmitted.erase(tsn);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
const bool wasOutstanding = other.IsOutstanding();
|
|
806
|
+
|
|
807
|
+
other.Abandon();
|
|
808
|
+
|
|
809
|
+
if (wasOutstanding)
|
|
810
|
+
{
|
|
811
|
+
this->unackedPayloadBytes -= other.GetData().GetPayloadLength();
|
|
812
|
+
this->unackedPacketBytes -= GetSerializedChunkLength(other.GetData());
|
|
813
|
+
--this->unackedItems;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
std::vector<std::pair<uint32_t /*tsn*/, UserData>> OutstandingData::ExtractChunksThatCanFit(
|
|
820
|
+
std::set<Types::UnwrappedTsn>& chunks, size_t maxLength)
|
|
821
|
+
{
|
|
822
|
+
MS_TRACE();
|
|
823
|
+
|
|
824
|
+
std::vector<std::pair<uint32_t /*tsn*/, UserData>> result;
|
|
825
|
+
|
|
826
|
+
for (auto it = chunks.begin(); it != chunks.end();)
|
|
827
|
+
{
|
|
828
|
+
const Types::UnwrappedTsn tsn = *it;
|
|
829
|
+
|
|
830
|
+
Item& item = GetItem(tsn);
|
|
831
|
+
|
|
832
|
+
MS_ASSERT(item.ShouldBeRetransmitted(), "item should be retransmitted");
|
|
833
|
+
MS_ASSERT(!item.IsOutstanding(), "item should not be outstanding");
|
|
834
|
+
MS_ASSERT(!item.IsAbandoned(), "item should not be abandoned");
|
|
835
|
+
MS_ASSERT(!item.IsAcked(), "item should not be acked");
|
|
836
|
+
|
|
837
|
+
const size_t serializedLength = GetSerializedChunkLength(item.GetData());
|
|
838
|
+
|
|
839
|
+
if (serializedLength <= maxLength)
|
|
840
|
+
{
|
|
841
|
+
item.MarkAsRetransmitted();
|
|
842
|
+
result.emplace_back(tsn.Wrap(), item.GetData().Clone());
|
|
843
|
+
maxLength -= serializedLength;
|
|
844
|
+
|
|
845
|
+
this->unackedPayloadBytes += item.GetData().GetPayloadLength();
|
|
846
|
+
this->unackedPacketBytes += serializedLength;
|
|
847
|
+
++this->unackedItems;
|
|
848
|
+
|
|
849
|
+
it = chunks.erase(it);
|
|
850
|
+
}
|
|
851
|
+
else
|
|
852
|
+
{
|
|
853
|
+
++it;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
// No point in continuing if the packet is full.
|
|
857
|
+
if (maxLength <= this->dataChunkHeaderLength)
|
|
858
|
+
{
|
|
859
|
+
break;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
return result;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
void OutstandingData::AssertIsConsistent() const
|
|
867
|
+
{
|
|
868
|
+
MS_TRACE();
|
|
869
|
+
|
|
870
|
+
size_t actualUnackedPayloadBytes{ 0 };
|
|
871
|
+
size_t actualUnackedPacketBytes{ 0 };
|
|
872
|
+
size_t actualUnackedItems{ 0 };
|
|
873
|
+
|
|
874
|
+
std::set<Types::UnwrappedTsn> combinedToBeRetransmitted;
|
|
875
|
+
|
|
876
|
+
combinedToBeRetransmitted.insert(this->toBeRetransmitted.begin(), this->toBeRetransmitted.end());
|
|
877
|
+
combinedToBeRetransmitted.insert(
|
|
878
|
+
this->toBeFastRetransmitted.begin(), this->toBeFastRetransmitted.end());
|
|
879
|
+
|
|
880
|
+
std::set<Types::UnwrappedTsn> actualCombinedToBeRetransmitted;
|
|
881
|
+
Types::UnwrappedTsn tsn = this->lastCumulativeTsnAck;
|
|
882
|
+
|
|
883
|
+
for (const Item& item : this->outstandingData)
|
|
884
|
+
{
|
|
885
|
+
tsn.Increment();
|
|
886
|
+
|
|
887
|
+
if (item.IsOutstanding())
|
|
888
|
+
{
|
|
889
|
+
actualUnackedPayloadBytes += item.GetData().GetPayloadLength();
|
|
890
|
+
actualUnackedPacketBytes += GetSerializedChunkLength(item.GetData());
|
|
891
|
+
++actualUnackedItems;
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
if (item.ShouldBeRetransmitted())
|
|
895
|
+
{
|
|
896
|
+
actualCombinedToBeRetransmitted.insert(tsn);
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
MS_ASSERT(
|
|
901
|
+
actualUnackedPayloadBytes == this->unackedPayloadBytes,
|
|
902
|
+
"actualUnackedPayloadBytes != this->unackedPayloadBytes");
|
|
903
|
+
MS_ASSERT(
|
|
904
|
+
actualUnackedPacketBytes == this->unackedPacketBytes,
|
|
905
|
+
"actualUnackedPacketBytes != this->unackedPacketBytes");
|
|
906
|
+
MS_ASSERT(actualUnackedItems == this->unackedItems, "actualUnackedItems != this->unackedItems");
|
|
907
|
+
MS_ASSERT(
|
|
908
|
+
actualCombinedToBeRetransmitted == combinedToBeRetransmitted,
|
|
909
|
+
"actualCombinedToBeRetransmitted != combinedToBeRetransmitted");
|
|
910
|
+
}
|
|
911
|
+
} // namespace SCTP
|
|
912
|
+
} // namespace RTC
|