mediasoup 3.26.0 → 3.27.1
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/CHANGELOG.md +16 -0
- package/node/lib/DataConsumer.js +1 -1
- package/node/lib/Router.js +1 -1
- package/node/lib/Transport.js +15 -15
- package/node/lib/fbs/rtp-parameters/encoding-mapping.d.ts +2 -6
- package/node/lib/fbs/rtp-parameters/encoding-mapping.d.ts.map +1 -1
- package/node/lib/fbs/rtp-parameters/encoding-mapping.js +7 -19
- package/node/lib/fbs/rtp-parameters/rtp-encoding-parameters.d.ts +4 -4
- package/node/lib/fbs/rtp-parameters/rtp-encoding-parameters.js +2 -2
- package/node/lib/fbs/rtp-stream/bitrate-by-layer.d.ts +5 -5
- package/node/lib/fbs/rtp-stream/bitrate-by-layer.d.ts.map +1 -1
- package/node/lib/fbs/rtp-stream/bitrate-by-layer.js +3 -3
- package/node/lib/fbs/rtp-stream/recv-stats.d.ts +5 -5
- package/node/lib/fbs/rtp-stream/recv-stats.d.ts.map +1 -1
- package/node/lib/fbs/rtp-stream/recv-stats.js +3 -3
- package/node/lib/fbs/rtp-stream/send-stats.d.ts +5 -5
- package/node/lib/fbs/rtp-stream/send-stats.d.ts.map +1 -1
- package/node/lib/fbs/rtp-stream/send-stats.js +3 -3
- package/node/lib/fbs/transport/bwe-trace-info.d.ts +23 -23
- package/node/lib/fbs/transport/bwe-trace-info.d.ts.map +1 -1
- package/node/lib/fbs/transport/bwe-trace-info.js +15 -15
- package/node/lib/fbs/transport/options.d.ts +5 -5
- package/node/lib/fbs/transport/options.js +2 -2
- package/node/lib/fbs/transport/set-max-incoming-bitrate-request.d.ts +5 -5
- package/node/lib/fbs/transport/set-max-incoming-bitrate-request.d.ts.map +1 -1
- package/node/lib/fbs/transport/set-max-incoming-bitrate-request.js +3 -3
- package/node/lib/fbs/transport/set-max-outgoing-bitrate-request.d.ts +5 -5
- package/node/lib/fbs/transport/set-max-outgoing-bitrate-request.d.ts.map +1 -1
- package/node/lib/fbs/transport/set-max-outgoing-bitrate-request.js +3 -3
- package/node/lib/fbs/transport/set-min-outgoing-bitrate-request.d.ts +5 -5
- package/node/lib/fbs/transport/set-min-outgoing-bitrate-request.d.ts.map +1 -1
- package/node/lib/fbs/transport/set-min-outgoing-bitrate-request.js +3 -3
- package/node/lib/fbs/transport/stats.d.ts +38 -38
- package/node/lib/fbs/transport/stats.d.ts.map +1 -1
- package/node/lib/fbs/transport/stats.js +25 -25
- package/node/lib/ortc.d.ts +0 -1
- package/node/lib/ortc.d.ts.map +1 -1
- package/node/lib/ortc.js +1 -2
- package/node/lib/rtpParametersFbsUtils.d.ts.map +1 -1
- package/node/lib/rtpParametersFbsUtils.js +2 -2
- package/package.json +9 -9
- package/worker/deps/libwebrtc/libwebrtc/call/rtp_transport_controller_send.cc +10 -10
- package/worker/deps/libwebrtc/libwebrtc/mediasoup_helpers.h +6 -6
- package/worker/deps/libwebrtc/libwebrtc/modules/congestion_controller/goog_cc/alr_detector.cc +1 -1
- package/worker/deps/libwebrtc/libwebrtc/modules/pacing/paced_sender.cc +7 -7
- package/worker/deps/libwebrtc/libwebrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h +1 -1
- package/worker/deps/libwebrtc/libwebrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc +1 -1
- package/worker/fbs/FBS/meson.build +25 -0
- package/worker/fbs/meson.build +15 -18
- package/worker/fbs/rtpParameters.fbs +1 -2
- package/worker/fbs/rtpStream.fbs +3 -3
- package/worker/fbs/transport.fbs +23 -23
- package/worker/fuzzer/include/RTC/FuzzerDtlsTransport.hpp +4 -1
- package/worker/fuzzer/src/FuzzerUtils.cpp +5 -3
- package/worker/fuzzer/src/RTC/FuzzerDtlsTransport.cpp +8 -5
- package/worker/fuzzer/src/RTC/FuzzerRateCalculator.cpp +3 -3
- package/worker/fuzzer/src/RTC/FuzzerTrendCalculator.cpp +6 -6
- package/worker/fuzzer/src/RTC/RTCP/FuzzerFeedbackRtpTransport.cpp +3 -3
- package/worker/fuzzer/src/RTC/RTP/FuzzerPacket.cpp +2 -2
- package/worker/fuzzer/src/RTC/RTP/FuzzerRetransmissionBuffer.cpp +5 -5
- package/worker/fuzzer/src/RTC/RTP/FuzzerRtpStreamSend.cpp +3 -3
- package/worker/fuzzer/src/fuzzer.cpp +4 -0
- package/worker/include/Channel/ChannelNotification.hpp +3 -3
- package/worker/include/Channel/ChannelRequest.hpp +1 -1
- package/worker/include/Channel/ChannelSocket.hpp +11 -0
- package/worker/include/DepLibUV.hpp +16 -33
- package/worker/include/RTC/ActiveSpeakerObserver.hpp +11 -11
- package/worker/include/RTC/AudioLevelObserver.hpp +4 -4
- package/worker/include/RTC/BWE/AcknowledgedBitrateEstimatorInterface.hpp +55 -0
- package/worker/include/RTC/BWE/AimdRateControl.hpp +190 -0
- package/worker/include/RTC/BWE/BweTypes.hpp +211 -0
- package/worker/include/RTC/BWE/DelayBasedBwe.hpp +173 -0
- package/worker/include/RTC/BWE/FeedbackAdapter.hpp +72 -0
- package/worker/include/RTC/BWE/InterArrivalDelta.hpp +106 -0
- package/worker/include/RTC/BWE/LinkCapacityEstimator.hpp +84 -0
- package/worker/include/RTC/BWE/LossBasedController.hpp +520 -0
- package/worker/include/RTC/BWE/RobustThroughputEstimator.hpp +94 -0
- package/worker/include/RTC/BWE/SendPacketHistory.hpp +137 -0
- package/worker/include/RTC/BWE/TargetRateController.hpp +306 -0
- package/worker/include/RTC/BWE/TrendlineEstimator.hpp +143 -0
- package/worker/include/RTC/BWE/Utils.hpp +39 -0
- package/worker/include/RTC/Consts.hpp +6 -6
- package/worker/include/RTC/Consumer.hpp +14 -12
- package/worker/include/RTC/DataConsumer.hpp +3 -3
- package/worker/include/RTC/DataProducer.hpp +3 -3
- package/worker/include/RTC/DtlsTransport.hpp +5 -2
- package/worker/include/RTC/ICE/IceCandidate.hpp +2 -2
- package/worker/include/RTC/ICE/IceServer.hpp +3 -3
- package/worker/include/RTC/KeyFrameRequestManager.hpp +3 -3
- package/worker/include/RTC/NEW_RTCP/packet/Packet.hpp +1 -1
- package/worker/include/RTC/NackGenerator.hpp +12 -12
- package/worker/include/RTC/PipeProducerStreamManager.hpp +3 -4
- package/worker/include/RTC/PipeTransport.hpp +18 -5
- package/worker/include/RTC/PlainTransport.hpp +18 -5
- package/worker/include/RTC/PortManager.hpp +4 -4
- package/worker/include/RTC/Producer.hpp +21 -12
- package/worker/include/RTC/ProducerStreamManager.hpp +12 -6
- package/worker/include/RTC/RTCP/Bye.hpp +2 -2
- package/worker/include/RTC/RTCP/FeedbackPsRemb.hpp +4 -4
- package/worker/include/RTC/RTCP/FeedbackRtpTmmb.hpp +3 -3
- package/worker/include/RTC/RTCP/FeedbackRtpTransport.hpp +54 -39
- package/worker/include/RTC/RTCP/Packet.hpp +3 -3
- package/worker/include/RTC/RTCP/ReceiverReport.hpp +3 -3
- package/worker/include/RTC/RTCP/Sdes.hpp +2 -2
- package/worker/include/RTC/RTCP/XR.hpp +2 -2
- package/worker/include/RTC/RTCP/XrDelaySinceLastRr.hpp +1 -1
- package/worker/include/RTC/RTP/Codecs/H264.hpp +1 -1
- package/worker/include/RTC/RTP/Codecs/Opus.hpp +2 -2
- package/worker/include/RTC/RTP/Codecs/PayloadDescriptorHandler.hpp +3 -3
- package/worker/include/RTC/RTP/Codecs/VP8.hpp +2 -2
- package/worker/include/RTC/RTP/Codecs/VP9.hpp +2 -2
- package/worker/include/RTC/RTP/HeaderExtensionIds.hpp +12 -12
- package/worker/include/RTC/RTP/Packet.hpp +13 -13
- package/worker/include/RTC/RTP/ProbationGenerator.hpp +1 -1
- package/worker/include/RTC/RTP/RetransmissionBuffer.hpp +7 -7
- package/worker/include/RTC/RTP/RtpStream.hpp +37 -51
- package/worker/include/RTC/RTP/RtpStreamRecv.hpp +59 -41
- package/worker/include/RTC/RTP/RtpStreamSend.hpp +20 -14
- package/worker/include/RTC/RTP/RtxStream.hpp +12 -13
- package/worker/include/RTC/RateCalculator.hpp +50 -44
- package/worker/include/RTC/RemoteCaptureTimeEstimator.hpp +5 -4
- package/worker/include/RTC/RemoteClockOffsetEstimator.hpp +11 -11
- package/worker/include/RTC/Router.hpp +6 -0
- package/worker/include/RTC/RtcLogger.hpp +1 -1
- package/worker/include/RTC/RtpDictionaries.hpp +10 -10
- package/worker/include/RTC/SCTP/association/Association.hpp +56 -28
- package/worker/include/RTC/SCTP/association/HeartbeatHandler.hpp +4 -4
- package/worker/include/RTC/SCTP/association/StateCookie.hpp +14 -14
- package/worker/include/RTC/SCTP/association/StreamResetHandler.hpp +38 -2
- package/worker/include/RTC/SCTP/association/TransmissionControlBlock.hpp +12 -12
- package/worker/include/RTC/SCTP/association/TransmissionControlBlockContextInterface.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/TLV.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/StateCookieParameter.hpp +3 -3
- package/worker/include/RTC/SCTP/public/AssociationInterface.hpp +4 -1
- package/worker/include/RTC/SCTP/public/AssociationMetrics.hpp +1 -1
- package/worker/include/RTC/SCTP/public/SctpOptions.hpp +12 -12
- package/worker/include/RTC/SCTP/public/SctpTypes.hpp +6 -6
- package/worker/include/RTC/SCTP/rx/ReassemblyQueue.hpp +10 -0
- package/worker/include/RTC/SCTP/tx/OutstandingData.hpp +15 -16
- package/worker/include/RTC/SCTP/tx/RetransmissionQueue.hpp +7 -8
- package/worker/include/RTC/SCTP/tx/RetransmissionTimeout.hpp +20 -16
- package/worker/include/RTC/SCTP/tx/RoundRobinSendQueue.hpp +5 -6
- package/worker/include/RTC/SCTP/tx/SendQueueInterface.hpp +2 -2
- package/worker/include/RTC/SCTP/tx/StreamScheduler.hpp +5 -5
- package/worker/include/RTC/SctpDictionaries.hpp +3 -3
- package/worker/include/RTC/Serializable.hpp +1 -1
- package/worker/include/RTC/SimpleProducerStreamManager.hpp +3 -4
- package/worker/include/RTC/SimulcastProducerStreamManager.hpp +6 -7
- package/worker/include/RTC/SvcProducerStreamManager.hpp +6 -5
- package/worker/include/RTC/TcpConnection.hpp +9 -3
- package/worker/include/RTC/TcpServer.hpp +3 -0
- package/worker/include/RTC/Transport.hpp +52 -45
- package/worker/include/RTC/TransportCongestionControlClient.hpp +30 -25
- package/worker/include/RTC/TransportCongestionControlServer.hpp +17 -17
- package/worker/include/RTC/TrendCalculator.hpp +5 -5
- package/worker/include/RTC/UdpSocket.hpp +11 -2
- package/worker/include/RTC/WebRtcServer.hpp +20 -5
- package/worker/include/RTC/WebRtcTransport.hpp +35 -10
- package/worker/include/Settings.hpp +4 -2
- package/worker/include/Shared.hpp +5 -20
- package/worker/include/SharedInterface.hpp +6 -28
- package/worker/include/Utils.hpp +40 -21
- package/worker/include/common.hpp +4 -0
- package/worker/include/handles/BackoffTimerHandle.hpp +4 -4
- package/worker/include/handles/BackoffTimerHandleInterface.hpp +5 -5
- package/worker/include/handles/TcpConnectionHandle.hpp +6 -6
- package/worker/include/handles/TcpServerHandle.hpp +1 -1
- package/worker/include/handles/TimerHandle.hpp +15 -9
- package/worker/include/handles/TimerHandleInterface.hpp +10 -4
- package/worker/include/handles/UdpSocketHandle.hpp +3 -3
- package/worker/include/handles/UnixStreamSocketHandle.hpp +2 -2
- package/worker/meson.build +87 -36
- package/worker/meson_options.txt +1 -0
- package/worker/mocks/include/MockShared.hpp +24 -23
- package/worker/mocks/include/RTC/SCTP/association/MockTransmissionControlBlockContext.hpp +51 -27
- package/worker/mocks/include/RTC/SCTP/tx/MockSendQueue.hpp +11 -11
- package/worker/mocks/include/handles/MockBackoffTimerHandle.hpp +10 -10
- package/worker/mocks/include/handles/MockTimerHandle.hpp +60 -22
- package/worker/mocks/src/MockShared.cpp +51 -5
- package/worker/mocks/src/handles/MockBackoffTimerHandle.cpp +29 -15
- package/worker/mocks/src/handles/MockTimerHandle.cpp +117 -0
- package/worker/scripts/clang-scripts.mjs +2 -2
- package/worker/src/Channel/ChannelNotification.cpp +5 -6
- package/worker/src/Channel/ChannelSocket.cpp +20 -2
- package/worker/src/DepLibUV.cpp +4 -5
- package/worker/src/RTC/ActiveSpeakerObserver.cpp +59 -47
- package/worker/src/RTC/AudioLevelObserver.cpp +7 -7
- package/worker/src/RTC/BWE/AimdRateControl.cpp +468 -0
- package/worker/src/RTC/BWE/BweTypes.cpp +61 -0
- package/worker/src/RTC/BWE/DelayBasedBwe.cpp +275 -0
- package/worker/src/RTC/BWE/FeedbackAdapter.cpp +148 -0
- package/worker/src/RTC/BWE/InterArrivalDelta.cpp +181 -0
- package/worker/src/RTC/BWE/LinkCapacityEstimator.cpp +133 -0
- package/worker/src/RTC/BWE/LossBasedController.cpp +1046 -0
- package/worker/src/RTC/BWE/RobustThroughputEstimator.cpp +245 -0
- package/worker/src/RTC/BWE/SendPacketHistory.cpp +184 -0
- package/worker/src/RTC/BWE/TargetRateController.cpp +435 -0
- package/worker/src/RTC/BWE/TrendlineEstimator.cpp +311 -0
- package/worker/src/RTC/BWE/Utils.cpp +54 -0
- package/worker/src/RTC/Consumer.cpp +48 -35
- package/worker/src/RTC/DataConsumer.cpp +4 -4
- package/worker/src/RTC/DataProducer.cpp +3 -3
- package/worker/src/RTC/DirectTransport.cpp +2 -2
- package/worker/src/RTC/DtlsTransport.cpp +14 -11
- package/worker/src/RTC/ICE/IceServer.cpp +2 -2
- package/worker/src/RTC/KeyFrameRequestManager.cpp +16 -12
- package/worker/src/RTC/NackGenerator.cpp +12 -12
- package/worker/src/RTC/PipeProducerStreamManager.cpp +6 -6
- package/worker/src/RTC/PipeTransport.cpp +16 -13
- package/worker/src/RTC/PlainTransport.cpp +25 -16
- package/worker/src/RTC/Producer.cpp +50 -36
- package/worker/src/RTC/RTCP/FeedbackPsRemb.cpp +13 -6
- package/worker/src/RTC/RTCP/FeedbackRtpTmmb.cpp +14 -5
- package/worker/src/RTC/RTCP/FeedbackRtpTransport.cpp +76 -50
- package/worker/src/RTC/RTP/Codecs/VP8.cpp +1 -1
- package/worker/src/RTC/RTP/Codecs/VP9.cpp +4 -4
- package/worker/src/RTC/RTP/Packet.cpp +9 -10
- package/worker/src/RTC/RTP/RetransmissionBuffer.cpp +6 -6
- package/worker/src/RTC/RTP/RtpStream.cpp +19 -19
- package/worker/src/RTC/RTP/RtpStreamRecv.cpp +146 -81
- package/worker/src/RTC/RTP/RtpStreamSend.cpp +49 -44
- package/worker/src/RTC/RTP/RtxStream.cpp +7 -10
- package/worker/src/RTC/RateCalculator.cpp +99 -136
- package/worker/src/RTC/RemoteCaptureTimeEstimator.cpp +13 -13
- package/worker/src/RTC/RemoteClockOffsetEstimator.cpp +18 -17
- package/worker/src/RTC/Router.cpp +18 -1
- package/worker/src/RTC/RtpDictionaries/RtpEncodingParameters.cpp +5 -2
- package/worker/src/RTC/SCTP/association/Association.cpp +146 -103
- package/worker/src/RTC/SCTP/association/AssociationListenerDeferrer.cpp +4 -4
- package/worker/src/RTC/SCTP/association/Capabilities.cpp +1 -1
- package/worker/src/RTC/SCTP/association/HeartbeatHandler.cpp +25 -18
- package/worker/src/RTC/SCTP/association/StateCookie.cpp +7 -6
- package/worker/src/RTC/SCTP/association/StreamResetHandler.cpp +122 -14
- package/worker/src/RTC/SCTP/association/TransmissionControlBlock.cpp +28 -26
- package/worker/src/RTC/SCTP/packet/chunks/SackChunk.cpp +0 -1
- package/worker/src/RTC/SCTP/packet/parameters/StateCookieParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/public/AssociationMetrics.cpp +2 -2
- package/worker/src/RTC/SCTP/public/SctpOptions.cpp +13 -13
- package/worker/src/RTC/SCTP/rx/DataTracker.cpp +1 -1
- package/worker/src/RTC/SCTP/rx/ReassemblyQueue.cpp +5 -5
- package/worker/src/RTC/SCTP/tx/OutstandingData.cpp +15 -15
- package/worker/src/RTC/SCTP/tx/RetransmissionQueue.cpp +15 -15
- package/worker/src/RTC/SCTP/tx/RetransmissionTimeout.cpp +29 -26
- package/worker/src/RTC/SCTP/tx/RoundRobinSendQueue.cpp +12 -11
- package/worker/src/RTC/SCTP/tx/StreamScheduler.cpp +4 -4
- package/worker/src/RTC/SctpDictionaries/SctpStreamParameters.cpp +2 -2
- package/worker/src/RTC/SimpleProducerStreamManager.cpp +10 -10
- package/worker/src/RTC/SimulcastProducerStreamManager.cpp +39 -37
- package/worker/src/RTC/SvcProducerStreamManager.cpp +39 -25
- package/worker/src/RTC/TcpConnection.cpp +9 -3
- package/worker/src/RTC/TcpServer.cpp +7 -2
- package/worker/src/RTC/Transport.cpp +266 -307
- package/worker/src/RTC/TransportCongestionControlClient.cpp +78 -71
- package/worker/src/RTC/TransportCongestionControlServer.cpp +38 -40
- package/worker/src/RTC/TrendCalculator.cpp +3 -3
- package/worker/src/RTC/UdpSocket.cpp +14 -3
- package/worker/src/RTC/WebRtcServer.cpp +20 -14
- package/worker/src/RTC/WebRtcTransport.cpp +35 -30
- package/worker/src/Settings.cpp +10 -0
- package/worker/src/Shared.cpp +2 -2
- package/worker/src/Utils/Crypto.cpp +2 -2
- package/worker/src/Worker.cpp +5 -1
- package/worker/src/handles/BackoffTimerHandle.cpp +24 -11
- package/worker/src/handles/TimerHandle.cpp +74 -25
- package/worker/src/lib.cpp +6 -0
- package/worker/tasks.py +197 -45
- package/worker/test/include/RTC/BWE/helpers/LinkSimulator.hpp +117 -0
- package/worker/test/src/RTC/BWE/TestAimdRateControl.cpp +400 -0
- package/worker/test/src/RTC/BWE/TestDelayBasedBwe.cpp +568 -0
- package/worker/test/src/RTC/BWE/TestFeedbackAdapter.cpp +546 -0
- package/worker/test/src/RTC/BWE/TestInterArrivalDelta.cpp +301 -0
- package/worker/test/src/RTC/BWE/TestLinkCapacityEstimator.cpp +115 -0
- package/worker/test/src/RTC/BWE/TestLossBasedController.cpp +1199 -0
- package/worker/test/src/RTC/BWE/TestRobustThroughputEstimator.cpp +433 -0
- package/worker/test/src/RTC/BWE/TestSendPacketHistory.cpp +259 -0
- package/worker/test/src/RTC/BWE/TestTargetRateController.cpp +337 -0
- package/worker/test/src/RTC/BWE/TestTrendlineEstimator.cpp +182 -0
- package/worker/test/src/RTC/BWE/TestUtils.cpp +61 -0
- package/worker/test/src/RTC/BWE/helpers/LinkSimulator.cpp +171 -0
- package/worker/test/src/RTC/RTCP/TestFeedbackPsRemb.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackRtpTmmb.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackRtpTransport.cpp +246 -208
- package/worker/test/src/RTC/RTP/TestPacket.cpp +11 -11
- package/worker/test/src/RTC/RTP/TestRetransmissionBuffer.cpp +12 -12
- package/worker/test/src/RTC/RTP/TestRtpStreamRecv.cpp +23 -16
- package/worker/test/src/RTC/RTP/TestRtpStreamSend.cpp +13 -13
- package/worker/test/src/RTC/SCTP/association/TestAssociation.cpp +27 -22
- package/worker/test/src/RTC/SCTP/association/TestHeartbeatHandler.cpp +21 -15
- package/worker/test/src/RTC/SCTP/association/TestStateCookie.cpp +6 -6
- package/worker/test/src/RTC/SCTP/association/TestStreamResetHandler.cpp +128 -13
- package/worker/test/src/RTC/SCTP/association/TestTransmissionControlBlock.cpp +3 -3
- package/worker/test/src/RTC/SCTP/packet/chunks/TestForwardTsnChunk.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/chunks/TestIForwardTsnChunk.cpp +23 -23
- package/worker/test/src/RTC/SCTP/packet/chunks/TestInitChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestSackChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestIPv6AddressParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/rx/TestDataTracker.cpp +37 -37
- package/worker/test/src/RTC/SCTP/rx/TestInterleavedReassemblyStreams.cpp +10 -10
- package/worker/test/src/RTC/SCTP/rx/TestReassemblyQueue.cpp +1 -1
- package/worker/test/src/RTC/SCTP/tx/TestOutstandingData.cpp +93 -93
- package/worker/test/src/RTC/SCTP/tx/TestRetransmissionQueue.cpp +247 -247
- package/worker/test/src/RTC/SCTP/tx/TestRetransmissionTimeout.cpp +100 -80
- package/worker/test/src/RTC/SCTP/tx/TestRoundRobinSendQueue.cpp +163 -163
- package/worker/test/src/RTC/SCTP/tx/TestStreamScheduler.cpp +76 -77
- package/worker/test/src/RTC/TestConsumer.cpp +8 -3
- package/worker/test/src/RTC/TestKeyFrameRequestManager.cpp +3 -3
- package/worker/test/src/RTC/TestNackGenerator.cpp +3 -3
- package/worker/test/src/RTC/TestPipeProducerStreamManager.cpp +5 -5
- package/worker/test/src/RTC/TestRateCalculator.cpp +110 -14
- package/worker/test/src/RTC/TestRemoteCaptureTimeEstimator.cpp +22 -17
- package/worker/test/src/RTC/TestRemoteClockOffsetEstimator.cpp +87 -85
- package/worker/test/src/RTC/TestSimpleProducerStreamManager.cpp +54 -47
- package/worker/test/src/RTC/TestSimulcastProducerStreamManager.cpp +83 -69
- package/worker/test/src/RTC/TestSvcProducerStreamManager.cpp +76 -65
- package/worker/test/src/RTC/TestTransportCongestionControlServer.cpp +72 -66
- package/worker/test/src/RTC/TestTransportTuple.cpp +19 -4
- package/worker/test/src/TestDepLibUV.cpp +19 -0
- package/worker/test/src/Utils/TestTime.cpp +57 -26
- package/worker/test/src/testHelpers.cpp +1 -1
- package/worker/test/src/tests.cpp +6 -0
- package/worker/include/RTC/SenderBandwidthEstimator.hpp +0 -118
- package/worker/src/RTC/SenderBandwidthEstimator.cpp +0 -269
|
@@ -196,7 +196,7 @@ namespace RTC
|
|
|
196
196
|
{
|
|
197
197
|
StreamReset streamReset = std::get<StreamReset>(std::move(data));
|
|
198
198
|
listener->OnAssociationStreamsResetPerformed(streamReset.streamIds);
|
|
199
|
-
|
|
199
|
+
},
|
|
200
200
|
StreamReset{ .streamIds = { outboundStreamIds.begin(), outboundStreamIds.end() } });
|
|
201
201
|
}
|
|
202
202
|
|
|
@@ -212,9 +212,9 @@ namespace RTC
|
|
|
212
212
|
{
|
|
213
213
|
StreamReset streamReset = std::get<StreamReset>(std::move(data));
|
|
214
214
|
listener->OnAssociationStreamsResetFailed(streamReset.streamIds, streamReset.errorMessage);
|
|
215
|
-
|
|
215
|
+
},
|
|
216
216
|
StreamReset{ .streamIds = { outboundStreamIds.begin(), outboundStreamIds.end() },
|
|
217
|
-
|
|
217
|
+
.errorMessage = std::string(errorMessage) });
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
void AssociationListenerDeferrer::OnAssociationInboundStreamsReset(
|
|
@@ -229,7 +229,7 @@ namespace RTC
|
|
|
229
229
|
{
|
|
230
230
|
StreamReset streamReset = std::get<StreamReset>(std::move(data));
|
|
231
231
|
listener->OnAssociationInboundStreamsReset(streamReset.streamIds);
|
|
232
|
-
|
|
232
|
+
},
|
|
233
233
|
StreamReset{ .streamIds = { inboundStreamIds.begin(), inboundStreamIds.end() } });
|
|
234
234
|
}
|
|
235
235
|
|
|
@@ -35,7 +35,7 @@ namespace RTC
|
|
|
35
35
|
capabilities.partialReliability =
|
|
36
36
|
remoteForwardTsnSupportedParameter ||
|
|
37
37
|
(remoteSupportedExtensionsParameter &&
|
|
38
|
-
|
|
38
|
+
remoteSupportedExtensionsParameter->IncludesChunkType(Chunk::ChunkType::FORWARD_TSN));
|
|
39
39
|
|
|
40
40
|
// Remote announces Message Interleaving support via Supported Extensions
|
|
41
41
|
// parameter.
|
|
@@ -71,8 +71,9 @@ namespace RTC
|
|
|
71
71
|
|
|
72
72
|
if (intervalDurationShouldIncludeRtt)
|
|
73
73
|
{
|
|
74
|
+
// NOTE: The timer takes milliseconds, so the RTO is truncated here.
|
|
74
75
|
this->intervalTimer->SetBaseTimeoutMs(
|
|
75
|
-
this->intervalDurationMs + this->tcbContext->
|
|
76
|
+
this->intervalDurationMs + (this->tcbContext->GetCurrentRtoUs() / 1000));
|
|
76
77
|
}
|
|
77
78
|
else
|
|
78
79
|
{
|
|
@@ -149,24 +150,27 @@ namespace RTC
|
|
|
149
150
|
return;
|
|
150
151
|
}
|
|
151
152
|
|
|
152
|
-
|
|
153
|
-
|
|
153
|
+
// NOTE: The peer echoes back the info we wrote, so this value cannot be
|
|
154
|
+
// trusted. The guard below rejects it unless it's a past instant, which
|
|
155
|
+
// also rejects a negative resulting from garbage above 2^63.
|
|
156
|
+
const auto createdAtUs = static_cast<int64_t>(Utils::Byte::Get8Bytes(info, 0));
|
|
157
|
+
const int64_t nowUs = this->shared->GetTimeUs();
|
|
154
158
|
|
|
155
|
-
if (
|
|
159
|
+
if (createdAtUs > 0 && createdAtUs <= nowUs)
|
|
156
160
|
{
|
|
157
|
-
const
|
|
161
|
+
const int64_t rttUs = nowUs - createdAtUs;
|
|
158
162
|
|
|
159
|
-
MS_DEBUG_DEV("valid HEARTBEAT-ACK chunk received, calling
|
|
163
|
+
MS_DEBUG_DEV("valid HEARTBEAT-ACK chunk received, calling ObserveRttUs(%" PRIi64 ")", rttUs);
|
|
160
164
|
|
|
161
|
-
this->tcbContext->
|
|
165
|
+
this->tcbContext->ObserveRttUs(rttUs);
|
|
162
166
|
}
|
|
163
167
|
else
|
|
164
168
|
{
|
|
165
169
|
MS_WARN_DEV(
|
|
166
|
-
"ignoring received HEARTBEAT-ACK chunk with invalid info content [
|
|
167
|
-
",
|
|
168
|
-
|
|
169
|
-
|
|
170
|
+
"ignoring received HEARTBEAT-ACK chunk with invalid info content [createdAtUs:%" PRIi64
|
|
171
|
+
", nowUs:%" PRIi64 "]",
|
|
172
|
+
createdAtUs,
|
|
173
|
+
nowUs);
|
|
170
174
|
}
|
|
171
175
|
|
|
172
176
|
// https://datatracker.ietf.org/doc/html/rfc9260#section-8.1
|
|
@@ -176,7 +180,7 @@ namespace RTC
|
|
|
176
180
|
this->tcbContext->ClearTxErrorCounter();
|
|
177
181
|
}
|
|
178
182
|
|
|
179
|
-
void HeartbeatHandler::OnIntervalTimer(
|
|
183
|
+
void HeartbeatHandler::OnIntervalTimer(int64_t& /*baseTimeoutMs*/, bool& /*stop*/)
|
|
180
184
|
{
|
|
181
185
|
MS_TRACE();
|
|
182
186
|
|
|
@@ -204,14 +208,17 @@ namespace RTC
|
|
|
204
208
|
return;
|
|
205
209
|
}
|
|
206
210
|
|
|
207
|
-
|
|
211
|
+
// NOTE: The timer takes milliseconds, so the RTO is truncated here.
|
|
212
|
+
this->timeoutTimer->SetBaseTimeoutMs(this->tcbContext->GetCurrentRtoUs() / 1000);
|
|
208
213
|
this->timeoutTimer->Start();
|
|
209
214
|
|
|
210
215
|
alignas(8) uint8_t info[HeartbeatInfoLength];
|
|
211
216
|
|
|
212
|
-
|
|
217
|
+
// NOTE: This is read back in HandleReceivedHeartbeatAckChunk() when the
|
|
218
|
+
// peer echoes it, so both sides of it must use the same unit.
|
|
219
|
+
const int64_t nowUs = this->shared->GetTimeUs();
|
|
213
220
|
|
|
214
|
-
Utils::Byte::Set8Bytes(info, 0,
|
|
221
|
+
Utils::Byte::Set8Bytes(info, 0, static_cast<uint64_t>(nowUs));
|
|
215
222
|
|
|
216
223
|
auto packet = this->tcbContext->CreatePacket();
|
|
217
224
|
auto* heartbeatRequestChunk = packet->BuildChunkInPlace<HeartbeatRequestChunk>();
|
|
@@ -222,12 +229,12 @@ namespace RTC
|
|
|
222
229
|
heartbeatInfoParameter->Consolidate();
|
|
223
230
|
heartbeatRequestChunk->Consolidate();
|
|
224
231
|
|
|
225
|
-
MS_DEBUG_DEV("sending HEARTBEAT-REQUEST chunk with info content [
|
|
232
|
+
MS_DEBUG_DEV("sending HEARTBEAT-REQUEST chunk with info content [nowUs:%" PRIi64 "]", nowUs);
|
|
226
233
|
|
|
227
234
|
this->tcbContext->SendPacket(packet.get());
|
|
228
235
|
}
|
|
229
236
|
|
|
230
|
-
void HeartbeatHandler::OnTimeoutTimer(
|
|
237
|
+
void HeartbeatHandler::OnTimeoutTimer(int64_t& /*baseTimeoutMs*/, bool& stop)
|
|
231
238
|
{
|
|
232
239
|
MS_TRACE();
|
|
233
240
|
|
|
@@ -261,7 +268,7 @@ namespace RTC
|
|
|
261
268
|
}
|
|
262
269
|
|
|
263
270
|
void HeartbeatHandler::OnBackoffTimer(
|
|
264
|
-
BackoffTimerHandleInterface* backoffTimer,
|
|
271
|
+
BackoffTimerHandleInterface* backoffTimer, int64_t& baseTimeoutMs, bool& stop)
|
|
265
272
|
{
|
|
266
273
|
MS_TRACE();
|
|
267
274
|
|
|
@@ -49,7 +49,7 @@ namespace RTC
|
|
|
49
49
|
uint32_t remoteAdvertisedReceiverWindowCredit,
|
|
50
50
|
uint64_t tieTag,
|
|
51
51
|
const Capabilities& remoteCapabilities,
|
|
52
|
-
|
|
52
|
+
int64_t creationTimestampUs,
|
|
53
53
|
const uint8_t* macKey,
|
|
54
54
|
size_t macKeyLength)
|
|
55
55
|
{
|
|
@@ -66,7 +66,7 @@ namespace RTC
|
|
|
66
66
|
remoteAdvertisedReceiverWindowCredit,
|
|
67
67
|
tieTag,
|
|
68
68
|
remoteCapabilities,
|
|
69
|
-
|
|
69
|
+
creationTimestampUs,
|
|
70
70
|
macKey,
|
|
71
71
|
macKeyLength);
|
|
72
72
|
|
|
@@ -86,7 +86,7 @@ namespace RTC
|
|
|
86
86
|
uint32_t remoteAdvertisedReceiverWindowCredit,
|
|
87
87
|
uint64_t tieTag,
|
|
88
88
|
const Capabilities& remoteCapabilities,
|
|
89
|
-
|
|
89
|
+
int64_t creationTimestampUs,
|
|
90
90
|
const uint8_t* macKey,
|
|
91
91
|
size_t macKeyLength)
|
|
92
92
|
{
|
|
@@ -132,7 +132,8 @@ namespace RTC
|
|
|
132
132
|
// bytes (including the timestamp).
|
|
133
133
|
//
|
|
134
134
|
// @see RFC 9260 section 5.1.3.
|
|
135
|
-
Utils::Byte::Set8Bytes(
|
|
135
|
+
Utils::Byte::Set8Bytes(
|
|
136
|
+
buffer, StateCookie::TimestampOffset, static_cast<uint64_t>(creationTimestampUs));
|
|
136
137
|
|
|
137
138
|
const uint8_t* mac = Utils::Crypto::GetHmacSha1(
|
|
138
139
|
reinterpret_cast<const char*>(macKey), macKeyLength, buffer, StateCookie::MacOffset);
|
|
@@ -228,7 +229,7 @@ namespace RTC
|
|
|
228
229
|
SetLength(
|
|
229
230
|
bufferLength == StateCookie::AuthenticatedStateCookieLength
|
|
230
231
|
? StateCookie::AuthenticatedStateCookieLength
|
|
231
|
-
|
|
232
|
+
: StateCookie::StateCookieLength);
|
|
232
233
|
}
|
|
233
234
|
|
|
234
235
|
StateCookie::~StateCookie()
|
|
@@ -258,7 +259,7 @@ namespace RTC
|
|
|
258
259
|
|
|
259
260
|
if (IsAuthenticated())
|
|
260
261
|
{
|
|
261
|
-
MS_DUMP_CLEAN(indentation, " creation timestamp (
|
|
262
|
+
MS_DUMP_CLEAN(indentation, " creation timestamp (us): %" PRIi64, GetCreationTimestampUs());
|
|
262
263
|
}
|
|
263
264
|
|
|
264
265
|
MS_DUMP_CLEAN(indentation, " remote capabilities:");
|
|
@@ -77,7 +77,8 @@ namespace RTC
|
|
|
77
77
|
this->retransmissionQueue->GetLastAssignedTsn(),
|
|
78
78
|
this->retransmissionQueue->BeginResetStreams());
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
// NOTE: The timer takes milliseconds, so the RTO is truncated here.
|
|
81
|
+
this->reConfigTimer->SetBaseTimeoutMs(this->tcbContext->GetCurrentRtoUs() / 1000);
|
|
81
82
|
this->reConfigTimer->Start();
|
|
82
83
|
|
|
83
84
|
AddReConfigChunk(packet);
|
|
@@ -142,6 +143,63 @@ namespace RTC
|
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
145
|
|
|
146
|
+
bool StreamResetHandler::MayLeaveDeferredReset()
|
|
147
|
+
{
|
|
148
|
+
MS_TRACE();
|
|
149
|
+
|
|
150
|
+
if (!this->deferredIncomingRequest.has_value())
|
|
151
|
+
{
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// https://tools.ietf.org/html/rfc6525#section-5.2.2
|
|
156
|
+
//
|
|
157
|
+
// "In this mode, any data arriving with a TSN larger than the Sender's
|
|
158
|
+
// Last Assigned TSN for the affected stream(s) MUST be queued locally and
|
|
159
|
+
// held until the cumulative acknowledgment point reaches the Sender's Last
|
|
160
|
+
// Assigned TSN."
|
|
161
|
+
//
|
|
162
|
+
// So deferred reset processing must end as soon as the cumulative ack TSN
|
|
163
|
+
// reaches the sender's last assigned TSN. Otherwise the queued data would
|
|
164
|
+
// be held (and accounted for) until the peer decides to retransmit its
|
|
165
|
+
// request, which it may never do.
|
|
166
|
+
if (this->dataTracker->IsLaterThanCumulativeAckedTsn(this->deferredIncomingRequest->senderLastAssignedTsn))
|
|
167
|
+
{
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
MS_DEBUG_DEV(
|
|
172
|
+
"leaving deferred reset processing, sender last assigned tsn %" PRIu32 " reached",
|
|
173
|
+
this->deferredIncomingRequest->senderLastAssignedTsn);
|
|
174
|
+
|
|
175
|
+
// Remember the request being performed here. The peer was told "in
|
|
176
|
+
// progress" and will retry it with a new request sequence number, and that
|
|
177
|
+
// retry must not reset the very same streams a second time.
|
|
178
|
+
this->performedDeferredRequest = std::move(this->deferredIncomingRequest);
|
|
179
|
+
|
|
180
|
+
this->deferredIncomingRequest = std::nullopt;
|
|
181
|
+
|
|
182
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
183
|
+
const auto& streamIds = this->performedDeferredRequest.value().streamIds;
|
|
184
|
+
|
|
185
|
+
// https://tools.ietf.org/html/rfc6525#section-5.2.2
|
|
186
|
+
//
|
|
187
|
+
// E3) "If no stream numbers are listed in the parameter, then all incoming
|
|
188
|
+
// streams MUST be reset to 0 as the next expected SSN. If specific stream
|
|
189
|
+
// numbers are listed, then only these specific streams MUST be reset to 0,
|
|
190
|
+
// and all other non-listed SSNs remain unchanged." E4: "Any queued TSNs
|
|
191
|
+
// (queued at step E2) MUST now be released and processed normally."
|
|
192
|
+
this->reassemblyQueue->ResetStreamsAndLeaveDeferredReset(streamIds);
|
|
193
|
+
|
|
194
|
+
this->associationListenerDeferrer.OnAssociationInboundStreamsReset(streamIds);
|
|
195
|
+
|
|
196
|
+
// The request has now been performed, so a retransmission of it must get
|
|
197
|
+
// the final response rather than "in progress" again.
|
|
198
|
+
this->lastProcessedReqResult = ReconfigurationResponseParameter::Result::SUCCESS_PERFORMED;
|
|
199
|
+
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
|
|
145
203
|
bool StreamResetHandler::ValidateReceivedReConfigChunk(const ReConfigChunk* receivedReConfigChunk)
|
|
146
204
|
{
|
|
147
205
|
MS_TRACE();
|
|
@@ -168,21 +226,21 @@ namespace RTC
|
|
|
168
226
|
|
|
169
227
|
if (
|
|
170
228
|
(firstParameter->GetType() == Parameter::ParameterType::OUTGOING_SSN_RESET_REQUEST &&
|
|
171
|
-
|
|
229
|
+
secondParameter->GetType() == Parameter::ParameterType::INCOMING_SSN_RESET_REQUEST) ||
|
|
172
230
|
(firstParameter->GetType() == Parameter::ParameterType::INCOMING_SSN_RESET_REQUEST &&
|
|
173
|
-
|
|
231
|
+
secondParameter->GetType() == Parameter::ParameterType::OUTGOING_SSN_RESET_REQUEST) ||
|
|
174
232
|
(firstParameter->GetType() == Parameter::ParameterType::ADD_OUTGOING_STREAMS_REQUEST &&
|
|
175
|
-
|
|
233
|
+
secondParameter->GetType() == Parameter::ParameterType::ADD_INCOMING_STREAMS_REQUEST) ||
|
|
176
234
|
(firstParameter->GetType() == Parameter::ParameterType::ADD_INCOMING_STREAMS_REQUEST &&
|
|
177
|
-
|
|
235
|
+
secondParameter->GetType() == Parameter::ParameterType::ADD_OUTGOING_STREAMS_REQUEST) ||
|
|
178
236
|
(firstParameter->GetType() == Parameter::ParameterType::RECONFIGURATION_RESPONSE &&
|
|
179
|
-
|
|
237
|
+
secondParameter->GetType() == Parameter::ParameterType::OUTGOING_SSN_RESET_REQUEST) ||
|
|
180
238
|
(firstParameter->GetType() == Parameter::ParameterType::OUTGOING_SSN_RESET_REQUEST &&
|
|
181
|
-
|
|
239
|
+
secondParameter->GetType() == Parameter::ParameterType::RECONFIGURATION_RESPONSE) ||
|
|
182
240
|
(firstParameter->GetType() == Parameter::ParameterType::RECONFIGURATION_RESPONSE &&
|
|
183
|
-
|
|
241
|
+
secondParameter->GetType() == Parameter::ParameterType::RECONFIGURATION_RESPONSE) ||
|
|
184
242
|
(firstParameter->GetType() == Parameter::ParameterType::RECONFIGURATION_RESPONSE &&
|
|
185
|
-
|
|
243
|
+
secondParameter->GetType() == Parameter::ParameterType::RECONFIGURATION_RESPONSE))
|
|
186
244
|
{
|
|
187
245
|
return true;
|
|
188
246
|
}
|
|
@@ -283,6 +341,11 @@ namespace RTC
|
|
|
283
341
|
validationResult == ReqSeqNbrValidationResult::RETRANSMISSION &&
|
|
284
342
|
this->lastProcessedReqResult != ReconfigurationResponseParameter::Result::IN_PROGRESS)
|
|
285
343
|
{
|
|
344
|
+
// The peer is getting the final result of this request, so there is no
|
|
345
|
+
// longer a need to remember that it may have been performed when leaving
|
|
346
|
+
// deferred reset processing.
|
|
347
|
+
this->performedDeferredRequest = std::nullopt;
|
|
348
|
+
|
|
286
349
|
auto* reconfigurationResponseParameter =
|
|
287
350
|
reConfigChunk->BuildParameterInPlace<ReconfigurationResponseParameter>();
|
|
288
351
|
|
|
@@ -300,7 +363,33 @@ namespace RTC
|
|
|
300
363
|
// "In Progress" request. In all cases, re-evaluate the state.
|
|
301
364
|
this->lastProcessedReqSeqNbr = requestSn;
|
|
302
365
|
|
|
303
|
-
|
|
366
|
+
// This very same request may have already been performed when the
|
|
367
|
+
// cumulative ack TSN reached its sender's last assigned TSN. The peer was
|
|
368
|
+
// told "in progress" and doesn't know it yet, so it retries it with a new
|
|
369
|
+
// request sequence number. Resetting those streams again would set their
|
|
370
|
+
// next expected SSN back to 0 after post reset data may have already been
|
|
371
|
+
// received, so just reply the final result.
|
|
372
|
+
const bool alreadyPerformed =
|
|
373
|
+
this->performedDeferredRequest.has_value() &&
|
|
374
|
+
this->performedDeferredRequest->senderLastAssignedTsn ==
|
|
375
|
+
receivedOutgoingSsnResetRequestParameter->GetSenderLastAssignedTsn() &&
|
|
376
|
+
this->performedDeferredRequest->streamIds ==
|
|
377
|
+
receivedOutgoingSsnResetRequestParameter->GetStreamIds();
|
|
378
|
+
|
|
379
|
+
this->performedDeferredRequest = std::nullopt;
|
|
380
|
+
|
|
381
|
+
if (alreadyPerformed)
|
|
382
|
+
{
|
|
383
|
+
// Set the result again rather than relying on the one stored when the
|
|
384
|
+
// reset was performed, since a received incoming stream reset request
|
|
385
|
+
// may have overwritten it in the meantime.
|
|
386
|
+
this->lastProcessedReqResult = ReconfigurationResponseParameter::Result::SUCCESS_PERFORMED;
|
|
387
|
+
|
|
388
|
+
MS_DEBUG_DEV(
|
|
389
|
+
"reset outgoing already performed when leaving deferred reset processing, sender last assigned tsn %" PRIu32,
|
|
390
|
+
receivedOutgoingSsnResetRequestParameter->GetSenderLastAssignedTsn());
|
|
391
|
+
}
|
|
392
|
+
else if (
|
|
304
393
|
this->dataTracker->IsLaterThanCumulativeAckedTsn(
|
|
305
394
|
receivedOutgoingSsnResetRequestParameter->GetSenderLastAssignedTsn()))
|
|
306
395
|
{
|
|
@@ -313,6 +402,21 @@ namespace RTC
|
|
|
313
402
|
receivedOutgoingSsnResetRequestParameter->GetSenderLastAssignedTsn(),
|
|
314
403
|
receivedOutgoingSsnResetRequestParameter->GetStreamIds());
|
|
315
404
|
|
|
405
|
+
// Remember the request so that deferred reset processing can end as soon
|
|
406
|
+
// as the cumulative ack TSN reaches the sender's last assigned TSN,
|
|
407
|
+
// without depending on the peer retransmitting its request.
|
|
408
|
+
//
|
|
409
|
+
// NOTE: Just like ReassemblyQueue::EnterDeferredReset() does, a new
|
|
410
|
+
// request is ignored while already in deferred reset processing.
|
|
411
|
+
if (!this->deferredIncomingRequest.has_value())
|
|
412
|
+
{
|
|
413
|
+
this->deferredIncomingRequest = DeferredIncomingRequest{
|
|
414
|
+
.senderLastAssignedTsn =
|
|
415
|
+
receivedOutgoingSsnResetRequestParameter->GetSenderLastAssignedTsn(),
|
|
416
|
+
.streamIds = receivedOutgoingSsnResetRequestParameter->GetStreamIds(),
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
|
|
316
420
|
// "If the endpoint enters 'deferred reset processing', it MUST put a
|
|
317
421
|
// Re-configuration Response Parameter into a RE-CONFIG chunk indicating
|
|
318
422
|
// 'In progress' and MUST send the RE-CONFIG chunk.
|
|
@@ -334,6 +438,8 @@ namespace RTC
|
|
|
334
438
|
this->reassemblyQueue->ResetStreamsAndLeaveDeferredReset(
|
|
335
439
|
receivedOutgoingSsnResetRequestParameter->GetStreamIds());
|
|
336
440
|
|
|
441
|
+
this->deferredIncomingRequest = std::nullopt;
|
|
442
|
+
|
|
337
443
|
this->associationListenerDeferrer.OnAssociationInboundStreamsReset(
|
|
338
444
|
receivedOutgoingSsnResetRequestParameter->GetStreamIds());
|
|
339
445
|
|
|
@@ -435,7 +541,8 @@ namespace RTC
|
|
|
435
541
|
// Force this request to be sent again, but with the same `reqSeqNbr`.
|
|
436
542
|
this->currentRequest->SetDeferred(true);
|
|
437
543
|
|
|
438
|
-
|
|
544
|
+
// NOTE: The timer takes milliseconds, so the RTO is truncated here.
|
|
545
|
+
this->reConfigTimer->SetBaseTimeoutMs(this->tcbContext->GetCurrentRtoUs() / 1000);
|
|
439
546
|
this->reConfigTimer->Start();
|
|
440
547
|
|
|
441
548
|
break;
|
|
@@ -469,7 +576,7 @@ namespace RTC
|
|
|
469
576
|
}
|
|
470
577
|
}
|
|
471
578
|
|
|
472
|
-
void StreamResetHandler::OnReConfigTimer(
|
|
579
|
+
void StreamResetHandler::OnReConfigTimer(int64_t& baseTimeoutMs, bool& stop)
|
|
473
580
|
{
|
|
474
581
|
MS_TRACE();
|
|
475
582
|
|
|
@@ -520,11 +627,12 @@ namespace RTC
|
|
|
520
627
|
|
|
521
628
|
this->tcbContext->SendPacket(packet.get());
|
|
522
629
|
|
|
523
|
-
|
|
630
|
+
// NOTE: The timer takes milliseconds, so the RTO is truncated here.
|
|
631
|
+
baseTimeoutMs = this->tcbContext->GetCurrentRtoUs() / 1000;
|
|
524
632
|
}
|
|
525
633
|
|
|
526
634
|
void StreamResetHandler::OnBackoffTimer(
|
|
527
|
-
BackoffTimerHandleInterface* backoffTimer,
|
|
635
|
+
BackoffTimerHandleInterface* backoffTimer, int64_t& baseTimeoutMs, bool& stop)
|
|
528
636
|
{
|
|
529
637
|
MS_TRACE();
|
|
530
638
|
|
|
@@ -125,27 +125,31 @@ namespace RTC
|
|
|
125
125
|
MS_DUMP_CLEAN(indentation, "</SCTP::TransmissionControlBlock>");
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
void TransmissionControlBlock::
|
|
128
|
+
void TransmissionControlBlock::ObserveRttUs(int64_t rttUs)
|
|
129
129
|
{
|
|
130
130
|
MS_TRACE();
|
|
131
131
|
|
|
132
132
|
#if MS_LOG_DEV_LEVEL == 3
|
|
133
|
-
const auto
|
|
133
|
+
const auto prevRtoUs = this->rto.GetRtoUs();
|
|
134
134
|
#endif
|
|
135
135
|
|
|
136
|
-
this->rto.
|
|
136
|
+
this->rto.ObserveRttUs(rttUs);
|
|
137
137
|
|
|
138
138
|
MS_DEBUG_DEV(
|
|
139
|
-
"new rtt:%"
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
this->rto.
|
|
139
|
+
"new rtt:%" PRIi64 " us, previous rto:%" PRIi64 " us, new rto:%" PRIi64 " us, srtt:%" PRIi64
|
|
140
|
+
" us",
|
|
141
|
+
rttUs,
|
|
142
|
+
prevRtoUs,
|
|
143
|
+
this->rto.GetRtoUs(),
|
|
144
|
+
this->rto.GetSrttUs());
|
|
144
145
|
|
|
145
|
-
|
|
146
|
+
// NOTE: The timers take milliseconds, so the RTO is truncated here. It is
|
|
147
|
+
// hundreds of milliseconds long, so the sub-millisecond part is noise.
|
|
148
|
+
this->t3RtxTimer->SetBaseTimeoutMs(this->rto.GetRtoUs() / 1000);
|
|
146
149
|
|
|
147
|
-
const
|
|
148
|
-
static_cast<
|
|
150
|
+
const int64_t delayedAckTimeoutMs = std::min(
|
|
151
|
+
static_cast<int64_t>((this->rto.GetRtoUs() * 0.5) / 1000),
|
|
152
|
+
this->sctpOptions.delayedAckMaxTimeoutMs);
|
|
149
153
|
|
|
150
154
|
this->delayedAckTimer->SetBaseTimeoutMs(delayedAckTimeoutMs);
|
|
151
155
|
}
|
|
@@ -211,11 +215,11 @@ namespace RTC
|
|
|
211
215
|
SendPacket(packet.get());
|
|
212
216
|
}
|
|
213
217
|
|
|
214
|
-
void TransmissionControlBlock::MayAddForwardTsnChunk(Packet* packet,
|
|
218
|
+
void TransmissionControlBlock::MayAddForwardTsnChunk(Packet* packet, int64_t nowUs)
|
|
215
219
|
{
|
|
216
220
|
MS_TRACE();
|
|
217
221
|
|
|
218
|
-
if (
|
|
222
|
+
if (nowUs >= this->limitForwardTsnUntilUs && this->retransmissionQueue.ShouldSendForwardTsn(nowUs))
|
|
219
223
|
{
|
|
220
224
|
if (this->negotiatedCapabilities.messageInterleaving)
|
|
221
225
|
{
|
|
@@ -233,7 +237,7 @@ namespace RTC
|
|
|
233
237
|
// before sending a duplicate FORWARD TSN."
|
|
234
238
|
// "Any delay applied to the sending of FORWARD TSN chunk SHOULD NOT
|
|
235
239
|
// exceed 200ms and MUST NOT exceed 500ms".
|
|
236
|
-
this->
|
|
240
|
+
this->limitForwardTsnUntilUs = nowUs + std::min(int64_t{ 200 * 1000 }, this->rto.GetSrttUs());
|
|
237
241
|
}
|
|
238
242
|
}
|
|
239
243
|
|
|
@@ -284,7 +288,7 @@ namespace RTC
|
|
|
284
288
|
SendPacket(packet.get());
|
|
285
289
|
}
|
|
286
290
|
|
|
287
|
-
void TransmissionControlBlock::SendBufferedPackets(
|
|
291
|
+
void TransmissionControlBlock::SendBufferedPackets(int64_t nowUs, bool addCookieAckChunk)
|
|
288
292
|
{
|
|
289
293
|
MS_TRACE();
|
|
290
294
|
|
|
@@ -338,9 +342,7 @@ namespace RTC
|
|
|
338
342
|
packet.get(), this->reassemblyQueue.GetRemainingBytes());
|
|
339
343
|
}
|
|
340
344
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
MayAddForwardTsnChunk(packet.get(), nowMs);
|
|
345
|
+
MayAddForwardTsnChunk(packet.get(), nowUs);
|
|
344
346
|
|
|
345
347
|
if (this->streamResetHandler.ShouldSendStreamResetRequest())
|
|
346
348
|
{
|
|
@@ -349,7 +351,7 @@ namespace RTC
|
|
|
349
351
|
}
|
|
350
352
|
|
|
351
353
|
auto chunksToSend =
|
|
352
|
-
this->retransmissionQueue.GetChunksToSend(
|
|
354
|
+
this->retransmissionQueue.GetChunksToSend(nowUs, packet->GetAvailableLength());
|
|
353
355
|
|
|
354
356
|
if (!chunksToSend.empty())
|
|
355
357
|
{
|
|
@@ -409,7 +411,7 @@ namespace RTC
|
|
|
409
411
|
}
|
|
410
412
|
}
|
|
411
413
|
|
|
412
|
-
void TransmissionControlBlock::OnT3RtxTimer(
|
|
414
|
+
void TransmissionControlBlock::OnT3RtxTimer(int64_t& /*baseTimeoutMs*/, bool& stop)
|
|
413
415
|
{
|
|
414
416
|
MS_TRACE();
|
|
415
417
|
|
|
@@ -439,9 +441,9 @@ namespace RTC
|
|
|
439
441
|
{
|
|
440
442
|
this->retransmissionQueue.HandleT3RtxTimerExpiry();
|
|
441
443
|
|
|
442
|
-
const
|
|
444
|
+
const int64_t nowUs = this->shared->GetTimeUs();
|
|
443
445
|
|
|
444
|
-
SendBufferedPackets(
|
|
446
|
+
SendBufferedPackets(nowUs);
|
|
445
447
|
}
|
|
446
448
|
else
|
|
447
449
|
{
|
|
@@ -455,7 +457,7 @@ namespace RTC
|
|
|
455
457
|
}
|
|
456
458
|
}
|
|
457
459
|
|
|
458
|
-
void TransmissionControlBlock::OnDelayedAckTimer(
|
|
460
|
+
void TransmissionControlBlock::OnDelayedAckTimer(int64_t& /*baseTimeoutMs*/, bool& /*stop*/)
|
|
459
461
|
{
|
|
460
462
|
MS_TRACE();
|
|
461
463
|
|
|
@@ -482,7 +484,7 @@ namespace RTC
|
|
|
482
484
|
}
|
|
483
485
|
|
|
484
486
|
void TransmissionControlBlock::OnBackoffTimer(
|
|
485
|
-
BackoffTimerHandleInterface* backoffTimer,
|
|
487
|
+
BackoffTimerHandleInterface* backoffTimer, int64_t& baseTimeoutMs, bool& stop)
|
|
486
488
|
{
|
|
487
489
|
MS_TRACE();
|
|
488
490
|
|
|
@@ -496,11 +498,11 @@ namespace RTC
|
|
|
496
498
|
}
|
|
497
499
|
}
|
|
498
500
|
|
|
499
|
-
void TransmissionControlBlock::
|
|
501
|
+
void TransmissionControlBlock::OnRetransmissionQueueNewRttUs(int64_t newRttUs)
|
|
500
502
|
{
|
|
501
503
|
MS_TRACE();
|
|
502
504
|
|
|
503
|
-
|
|
505
|
+
ObserveRttUs(newRttUs);
|
|
504
506
|
}
|
|
505
507
|
|
|
506
508
|
void TransmissionControlBlock::OnRetransmissionQueueClearRetransmissionCounter()
|
|
@@ -123,7 +123,7 @@ namespace RTC
|
|
|
123
123
|
uint32_t remoteAdvertisedReceiverWindowCredit,
|
|
124
124
|
uint64_t tieTag,
|
|
125
125
|
const Capabilities& remoteCapabilities,
|
|
126
|
-
|
|
126
|
+
int64_t creationTimestampUs,
|
|
127
127
|
const uint8_t* macKey,
|
|
128
128
|
size_t macKeyLength)
|
|
129
129
|
{
|
|
@@ -148,7 +148,7 @@ namespace RTC
|
|
|
148
148
|
remoteAdvertisedReceiverWindowCredit,
|
|
149
149
|
tieTag,
|
|
150
150
|
remoteCapabilities,
|
|
151
|
-
|
|
151
|
+
creationTimestampUs,
|
|
152
152
|
macKey,
|
|
153
153
|
macKeyLength);
|
|
154
154
|
|
|
@@ -14,7 +14,7 @@ namespace RTC
|
|
|
14
14
|
{
|
|
15
15
|
MS_TRACE();
|
|
16
16
|
|
|
17
|
-
auto peerImplementationStringView = Types::
|
|
17
|
+
auto peerImplementationStringView = Types::sctpImplementationToString(this->peerImplementation);
|
|
18
18
|
|
|
19
19
|
MS_DUMP_CLEAN(indentation, "<SCTP::AssociationMetrics>");
|
|
20
20
|
MS_DUMP_CLEAN(indentation, " tx packets count: %" PRIu64, this->txPacketsCount);
|
|
@@ -24,7 +24,7 @@ namespace RTC
|
|
|
24
24
|
MS_DUMP_CLEAN(indentation, " rtx packets count: %" PRIu64, this->rtxPacketsCount);
|
|
25
25
|
MS_DUMP_CLEAN(indentation, " rtx bytes count: %" PRIu64, this->rtxBytesCount);
|
|
26
26
|
MS_DUMP_CLEAN(indentation, " current congestion window (bytes): %zu", this->cwndBytes);
|
|
27
|
-
MS_DUMP_CLEAN(indentation, " smoothed round trip time (ms): %"
|
|
27
|
+
MS_DUMP_CLEAN(indentation, " smoothed round trip time (ms): %" PRIi64, this->srttMs);
|
|
28
28
|
MS_DUMP_CLEAN(indentation, " unacked data count: %zu", this->unackDataCount);
|
|
29
29
|
MS_DUMP_CLEAN(
|
|
30
30
|
indentation, " peer's last announced receiver window size: %" PRIu32, this->peerRwndBytes);
|
|
@@ -34,23 +34,23 @@ namespace RTC
|
|
|
34
34
|
" total buffered amount low threshold: %zu",
|
|
35
35
|
this->totalBufferedAmountLowThreshold);
|
|
36
36
|
MS_DUMP_CLEAN(indentation, " default stream priority: %" PRIu16, this->defaultStreamPriority);
|
|
37
|
-
MS_DUMP_CLEAN(indentation, " max rtt (ms): %"
|
|
38
|
-
MS_DUMP_CLEAN(indentation, " initial rto (ms): %"
|
|
39
|
-
MS_DUMP_CLEAN(indentation, " min rto (ms): %"
|
|
40
|
-
MS_DUMP_CLEAN(indentation, " max rto (ms): %"
|
|
41
|
-
MS_DUMP_CLEAN(indentation, " t1-init timeout (ms): %"
|
|
42
|
-
MS_DUMP_CLEAN(indentation, " t1-cookie timeout (ms): %"
|
|
43
|
-
MS_DUMP_CLEAN(indentation, " t2-shutdown timeout (ms): %"
|
|
37
|
+
MS_DUMP_CLEAN(indentation, " max rtt (ms): %" PRIi64, this->maxRttMs);
|
|
38
|
+
MS_DUMP_CLEAN(indentation, " initial rto (ms): %" PRIi64, this->initialRtoMs);
|
|
39
|
+
MS_DUMP_CLEAN(indentation, " min rto (ms): %" PRIi64, this->minRtoMs);
|
|
40
|
+
MS_DUMP_CLEAN(indentation, " max rto (ms): %" PRIi64, this->maxRtoMs);
|
|
41
|
+
MS_DUMP_CLEAN(indentation, " t1-init timeout (ms): %" PRIi64, this->t1InitTimeoutMs);
|
|
42
|
+
MS_DUMP_CLEAN(indentation, " t1-cookie timeout (ms): %" PRIi64, this->t1CookieTimeoutMs);
|
|
43
|
+
MS_DUMP_CLEAN(indentation, " t2-shutdown timeout (ms): %" PRIi64, this->t2ShutdownTimeoutMs);
|
|
44
44
|
MS_DUMP_CLEAN(
|
|
45
45
|
indentation,
|
|
46
46
|
" timer max backoff timeout (ms): %s",
|
|
47
47
|
this->timerMaxBackoffTimeoutMs
|
|
48
48
|
? std::to_string(this->timerMaxBackoffTimeoutMs.value()).c_str()
|
|
49
|
-
|
|
50
|
-
MS_DUMP_CLEAN(indentation, " heartbeat interval (ms): %"
|
|
49
|
+
: "Infinite");
|
|
50
|
+
MS_DUMP_CLEAN(indentation, " heartbeat interval (ms): %" PRIi64, this->heartbeatIntervalMs);
|
|
51
51
|
MS_DUMP_CLEAN(
|
|
52
|
-
indentation, " delayed ack max timeout (ms): %"
|
|
53
|
-
MS_DUMP_CLEAN(indentation, " min rtt variance (ms): %"
|
|
52
|
+
indentation, " delayed ack max timeout (ms): %" PRIi64, this->delayedAckMaxTimeoutMs);
|
|
53
|
+
MS_DUMP_CLEAN(indentation, " min rtt variance (ms): %" PRIi64, this->minRttVarianceMs);
|
|
54
54
|
MS_DUMP_CLEAN(indentation, " initial cwnd mtus: %zu", this->initialCwndMtus);
|
|
55
55
|
MS_DUMP_CLEAN(indentation, " min cwnd mtus: %zu", this->minCwndMtus);
|
|
56
56
|
MS_DUMP_CLEAN(
|
|
@@ -62,12 +62,12 @@ namespace RTC
|
|
|
62
62
|
indentation,
|
|
63
63
|
" max retransmissions: %s",
|
|
64
64
|
this->maxRetransmissions ? std::to_string(this->maxRetransmissions.value()).c_str()
|
|
65
|
-
|
|
65
|
+
: "Infinite");
|
|
66
66
|
MS_DUMP_CLEAN(
|
|
67
67
|
indentation,
|
|
68
68
|
" max init retransmissions: %s",
|
|
69
69
|
this->maxInitRetransmissions ? std::to_string(this->maxInitRetransmissions.value()).c_str()
|
|
70
|
-
|
|
70
|
+
: "Infinite");
|
|
71
71
|
MS_DUMP_CLEAN(
|
|
72
72
|
indentation, " enable partial reliability: %s", this->enablePartialReliability ? "yes" : "no");
|
|
73
73
|
MS_DUMP_CLEAN(
|
|
@@ -256,7 +256,7 @@ namespace RTC
|
|
|
256
256
|
if (
|
|
257
257
|
this->ackState == AckState::IMMEDIATE ||
|
|
258
258
|
(alsoIfDelayed &&
|
|
259
|
-
|
|
259
|
+
(this->ackState == AckState::BECOMING_DELAYED || this->ackState == AckState::DELAYED)))
|
|
260
260
|
{
|
|
261
261
|
UpdateAckState(AckState::IDLE, "should send SACK");
|
|
262
262
|
|