mediasoup 3.26.0 → 3.27.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/CHANGELOG.md +11 -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/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/RobustThroughputEstimator.hpp +94 -0
- package/worker/include/RTC/BWE/SendPacketHistory.hpp +137 -0
- package/worker/include/RTC/BWE/TrendlineEstimator.hpp +101 -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 +2 -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 +1 -1
- 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 +81 -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/RobustThroughputEstimator.cpp +245 -0
- package/worker/src/RTC/BWE/SendPacketHistory.cpp +184 -0
- package/worker/src/RTC/BWE/TrendlineEstimator.cpp +233 -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 +131 -102
- 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 +16 -13
- 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 +1 -1
- 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 +242 -302
- 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 +171 -44
- 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/TestRobustThroughputEstimator.cpp +433 -0
- package/worker/test/src/RTC/BWE/TestSendPacketHistory.cpp +259 -0
- package/worker/test/src/RTC/BWE/TestTrendlineEstimator.cpp +137 -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 +17 -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
|
@@ -139,12 +139,12 @@ namespace RTC
|
|
|
139
139
|
// Fixed length of our generated State Cookies when authentication is
|
|
140
140
|
// enabled.
|
|
141
141
|
static constexpr size_t AuthenticatedStateCookieLength{ StateCookie::MacOffset +
|
|
142
|
-
|
|
143
|
-
// State Cookie lifespan (Valid.Cookie.Life) in
|
|
142
|
+
StateCookie::MacLength };
|
|
143
|
+
// State Cookie lifespan (Valid.Cookie.Life) in microseconds. Used to
|
|
144
144
|
// reject stale authenticated cookies.
|
|
145
145
|
//
|
|
146
146
|
// @see RFC 9260 section 16.
|
|
147
|
-
static constexpr
|
|
147
|
+
static constexpr int64_t ValidCookieLifeUs{ 60000 * 1000 };
|
|
148
148
|
|
|
149
149
|
public:
|
|
150
150
|
/**
|
|
@@ -163,7 +163,7 @@ namespace RTC
|
|
|
163
163
|
* cookie.
|
|
164
164
|
* - If `macKey` is not nullptr, an authenticated cookie (with creation
|
|
165
165
|
* timestamp and MAC) is generated. Otherwise a plain cookie is
|
|
166
|
-
* generated and `
|
|
166
|
+
* generated and `creationTimestampUs`/`macKey` are ignored.
|
|
167
167
|
*/
|
|
168
168
|
static StateCookie* Factory(
|
|
169
169
|
uint8_t* buffer,
|
|
@@ -175,9 +175,9 @@ namespace RTC
|
|
|
175
175
|
uint32_t remoteAdvertisedReceiverWindowCredit,
|
|
176
176
|
uint64_t tieTag,
|
|
177
177
|
const Capabilities& remoteCapabilities,
|
|
178
|
-
|
|
179
|
-
const uint8_t* macKey
|
|
180
|
-
size_t macKeyLength
|
|
178
|
+
int64_t creationTimestampUs = 0,
|
|
179
|
+
const uint8_t* macKey = nullptr,
|
|
180
|
+
size_t macKeyLength = 0);
|
|
181
181
|
|
|
182
182
|
/**
|
|
183
183
|
* Serialize a StateCookie (based on given arguments) in the given buffer.
|
|
@@ -185,7 +185,7 @@ namespace RTC
|
|
|
185
185
|
* @remarks
|
|
186
186
|
* - If `macKey` is not nullptr, an authenticated cookie (with creation
|
|
187
187
|
* timestamp and MAC) is generated. Otherwise a plain cookie is
|
|
188
|
-
* generated and `
|
|
188
|
+
* generated and `creationTimestampUs`/`macKey` are ignored.
|
|
189
189
|
*/
|
|
190
190
|
static void Write(
|
|
191
191
|
uint8_t* buffer,
|
|
@@ -197,9 +197,9 @@ namespace RTC
|
|
|
197
197
|
uint32_t remoteAdvertisedReceiverWindowCredit,
|
|
198
198
|
uint64_t tieTag,
|
|
199
199
|
const Capabilities& remoteCapabilities,
|
|
200
|
-
|
|
201
|
-
const uint8_t* macKey
|
|
202
|
-
size_t macKeyLength
|
|
200
|
+
int64_t creationTimestampUs = 0,
|
|
201
|
+
const uint8_t* macKey = nullptr,
|
|
202
|
+
size_t macKeyLength = 0);
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
205
|
* Whether the given buffer is a StateCookie generated by mediasoup.
|
|
@@ -311,14 +311,14 @@ namespace RTC
|
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
/**
|
|
314
|
-
* The time (in
|
|
314
|
+
* The time (in microseconds) at which this StateCookie was created.
|
|
315
315
|
*
|
|
316
316
|
* @remarks
|
|
317
317
|
* - Only meaningful in authenticated cookies (see `IsAuthenticated()`).
|
|
318
318
|
*/
|
|
319
|
-
|
|
319
|
+
int64_t GetCreationTimestampUs() const
|
|
320
320
|
{
|
|
321
|
-
return Utils::Byte::Get8Bytes(GetBuffer(), StateCookie::TimestampOffset);
|
|
321
|
+
return static_cast<int64_t>(Utils::Byte::Get8Bytes(GetBuffer(), StateCookie::TimestampOffset));
|
|
322
322
|
}
|
|
323
323
|
|
|
324
324
|
private:
|
|
@@ -255,12 +255,12 @@ namespace RTC
|
|
|
255
255
|
void HandleReceivedReconfigurationResponseParameter(
|
|
256
256
|
const ReconfigurationResponseParameter* receivedReconfigurationResponseParameter);
|
|
257
257
|
|
|
258
|
-
void OnReConfigTimer(
|
|
258
|
+
void OnReConfigTimer(int64_t& baseTimeoutMs, bool& stop);
|
|
259
259
|
|
|
260
260
|
/* Pure virtual methods inherited from BackoffTimerHandleInterface::Listener. */
|
|
261
261
|
public:
|
|
262
262
|
void OnBackoffTimer(
|
|
263
|
-
BackoffTimerHandleInterface* backoffTimer,
|
|
263
|
+
BackoffTimerHandleInterface* backoffTimer, int64_t& baseTimeoutMs, bool& stop) override;
|
|
264
264
|
|
|
265
265
|
private:
|
|
266
266
|
AssociationListenerDeferrer& associationListenerDeferrer;
|
|
@@ -140,7 +140,7 @@ namespace RTC
|
|
|
140
140
|
* @remarks
|
|
141
141
|
* - Implements TransmissionControlBlockContextInterface.
|
|
142
142
|
*/
|
|
143
|
-
void
|
|
143
|
+
void ObserveRttUs(int64_t rttUs) override;
|
|
144
144
|
|
|
145
145
|
size_t GetCwnd() const
|
|
146
146
|
{
|
|
@@ -151,14 +151,14 @@ namespace RTC
|
|
|
151
151
|
* @remarks
|
|
152
152
|
* - Implements TransmissionControlBlockContextInterface.
|
|
153
153
|
*/
|
|
154
|
-
|
|
154
|
+
int64_t GetCurrentRtoUs() const override
|
|
155
155
|
{
|
|
156
|
-
return this->rto.
|
|
156
|
+
return this->rto.GetRtoUs();
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
int64_t GetCurrentSrttUs() const
|
|
160
160
|
{
|
|
161
|
-
return this->rto.
|
|
161
|
+
return this->rto.GetSrttUs();
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
/**
|
|
@@ -229,7 +229,7 @@ namespace RTC
|
|
|
229
229
|
* May add a FORWARD-TSN or I-FORWARD-TSN chunk to the given packet if it
|
|
230
230
|
* is needed and allowed (rate-limited).
|
|
231
231
|
*/
|
|
232
|
-
void MayAddForwardTsnChunk(Packet* packet,
|
|
232
|
+
void MayAddForwardTsnChunk(Packet* packet, int64_t nowUs);
|
|
233
233
|
|
|
234
234
|
void MaySendFastRetransmit();
|
|
235
235
|
|
|
@@ -243,7 +243,7 @@ namespace RTC
|
|
|
243
243
|
* - Cannot pass `addCookieAckChunk=true` if `this->remoteStateCookie` is
|
|
244
244
|
* present (will throw).
|
|
245
245
|
*/
|
|
246
|
-
void SendBufferedPackets(
|
|
246
|
+
void SendBufferedPackets(int64_t nowUs, bool addCookieAckChunk = false);
|
|
247
247
|
|
|
248
248
|
/**
|
|
249
249
|
* @remarks
|
|
@@ -286,20 +286,20 @@ namespace RTC
|
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
private:
|
|
289
|
-
void OnT3RtxTimer(
|
|
289
|
+
void OnT3RtxTimer(int64_t& baseTimeoutMs, bool& stop);
|
|
290
290
|
|
|
291
|
-
void OnDelayedAckTimer(
|
|
291
|
+
void OnDelayedAckTimer(int64_t& baseTimeoutMs, bool& stop);
|
|
292
292
|
|
|
293
293
|
/* Pure virtual methods inherited from RetransmissionQueue::Listener. */
|
|
294
294
|
public:
|
|
295
|
-
void
|
|
295
|
+
void OnRetransmissionQueueNewRttUs(int64_t newRttUs) override;
|
|
296
296
|
void OnRetransmissionQueueClearRetransmissionCounter() override;
|
|
297
297
|
;
|
|
298
298
|
|
|
299
299
|
/* Pure virtual methods inherited from BackoffTimerHandleInterface::Listener. */
|
|
300
300
|
public:
|
|
301
301
|
void OnBackoffTimer(
|
|
302
|
-
BackoffTimerHandleInterface* backoffTimer,
|
|
302
|
+
BackoffTimerHandleInterface* backoffTimer, int64_t& baseTimeoutMs, bool& stop) override;
|
|
303
303
|
|
|
304
304
|
private:
|
|
305
305
|
TransmissionControlBlockContextInterface::Listener* listener;
|
|
@@ -332,7 +332,7 @@ namespace RTC
|
|
|
332
332
|
HeartbeatHandler heartbeatHandler;
|
|
333
333
|
// Rate limiting of FORWARD-TSN. Next can be sent at or after this
|
|
334
334
|
// timestamp.
|
|
335
|
-
|
|
335
|
+
int64_t limitForwardTsnUntilUs{ 0 };
|
|
336
336
|
// Only valid when state is State::COOKIE_ECHOED. In this state, the
|
|
337
337
|
// association must wait for COOKIE-ACK to continue sending any packets (not
|
|
338
338
|
// including a COOKIE-ECHO). So if this state cookie is present, the
|
|
@@ -49,15 +49,15 @@ namespace RTC
|
|
|
49
49
|
virtual uint32_t GetRemoteInitialTsn() const = 0;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
* To be called when a RTT (
|
|
52
|
+
* To be called when a RTT (us) has been measured, to update the RTO
|
|
53
53
|
* value.
|
|
54
54
|
*/
|
|
55
|
-
virtual void
|
|
55
|
+
virtual void ObserveRttUs(int64_t rttUs) = 0;
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* Returns the Retransmission Timeout (RTO) value.
|
|
58
|
+
* Returns the Retransmission Timeout (RTO) value (us).
|
|
59
59
|
*/
|
|
60
|
-
virtual
|
|
60
|
+
virtual int64_t GetCurrentRtoUs() const = 0;
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* Increments the transmission error counter, given a human readable
|
|
@@ -105,9 +105,9 @@ namespace RTC
|
|
|
105
105
|
uint32_t remoteAdvertisedReceiverWindowCredit,
|
|
106
106
|
uint64_t tieTag,
|
|
107
107
|
const Capabilities& remoteCapabilities,
|
|
108
|
-
|
|
109
|
-
const uint8_t* macKey
|
|
110
|
-
size_t macKeyLength
|
|
108
|
+
int64_t creationTimestampUs = 0,
|
|
109
|
+
const uint8_t* macKey = nullptr,
|
|
110
|
+
size_t macKeyLength = 0);
|
|
111
111
|
|
|
112
112
|
protected:
|
|
113
113
|
StateCookieParameter* SoftClone(const uint8_t* buffer) const final;
|
|
@@ -175,8 +175,11 @@ namespace RTC
|
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
177
|
* Receives SCTP data (hopefully an SCTP packet) from the remote peer.
|
|
178
|
+
*
|
|
179
|
+
* @param receivedAtUs - Time at which the data arrived from the network,
|
|
180
|
+
* taken as close to the socket read as possible.
|
|
178
181
|
*/
|
|
179
|
-
virtual void ReceiveSctpData(const uint8_t* data, size_t len) = 0;
|
|
182
|
+
virtual void ReceiveSctpData(const uint8_t* data, size_t len, int64_t receivedAtUs) = 0;
|
|
180
183
|
|
|
181
184
|
/**
|
|
182
185
|
* Get negotiated max outbound streams. Returns 0 if the association is
|
|
@@ -109,55 +109,55 @@ namespace RTC
|
|
|
109
109
|
* RTO calculation. The default value is an extreme maximum but can be
|
|
110
110
|
* adapted to better match the environment.
|
|
111
111
|
*/
|
|
112
|
-
|
|
112
|
+
int64_t maxRttMs{ 60000 };
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
115
|
* Initial RTO value.
|
|
116
116
|
*/
|
|
117
|
-
|
|
117
|
+
int64_t initialRtoMs{ 500 };
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
120
|
* Minimum RTO value.
|
|
121
121
|
*/
|
|
122
|
-
|
|
122
|
+
int64_t minRtoMs{ 400 };
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* Minimum RTO value.
|
|
126
126
|
*/
|
|
127
|
-
|
|
127
|
+
int64_t maxRtoMs{ 60000 };
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
130
|
* T1-init timeout (ms).
|
|
131
131
|
*/
|
|
132
|
-
|
|
132
|
+
int64_t t1InitTimeoutMs{ 1000 };
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
135
|
* T1-cookie timeout (ms).
|
|
136
136
|
*/
|
|
137
|
-
|
|
137
|
+
int64_t t1CookieTimeoutMs{ 1000 };
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
140
|
* T2-shutdown timeout (ms).
|
|
141
141
|
*/
|
|
142
|
-
|
|
142
|
+
int64_t t2ShutdownTimeoutMs{ 1000 };
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
145
|
* Maximum duration of the backoff timeout. If no value is given, no
|
|
146
146
|
* limit is set.
|
|
147
147
|
*/
|
|
148
|
-
std::optional<
|
|
148
|
+
std::optional<int64_t> timerMaxBackoffTimeoutMs{ std::nullopt };
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
151
|
* Hearbeat interval (on idle connections only). Set to zero to disable.
|
|
152
152
|
*/
|
|
153
|
-
|
|
153
|
+
int64_t heartbeatIntervalMs{ 30000 };
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
156
|
* The maximum time when a SACK will be sent from the arrival of an
|
|
157
157
|
* unacknowledged packet. Whatever is smallest of RTO/2 and this will be
|
|
158
158
|
* used.
|
|
159
159
|
*/
|
|
160
|
-
|
|
160
|
+
int64_t delayedAckMaxTimeoutMs{ 200 };
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
163
|
* The minimum limit for the measured RTT variance.
|
|
@@ -174,7 +174,7 @@ namespace RTC
|
|
|
174
174
|
* This is defined as "G" in the algorithm for TCP in
|
|
175
175
|
* https://datatracker.ietf.org/doc/html/rfc6298#section-4.
|
|
176
176
|
*/
|
|
177
|
-
|
|
177
|
+
int64_t minRttVarianceMs{ 220 };
|
|
178
178
|
|
|
179
179
|
/**
|
|
180
180
|
* The initial congestion window size, in number of MTUs.
|
|
@@ -302,7 +302,7 @@ namespace RTC
|
|
|
302
302
|
* received before the lifetime has expired. This is only available if
|
|
303
303
|
* the peer supports Partial Reliability Extension (RFC 3758).
|
|
304
304
|
*/
|
|
305
|
-
std::optional<
|
|
305
|
+
std::optional<int64_t> lifetimeMs{ std::nullopt };
|
|
306
306
|
|
|
307
307
|
/**
|
|
308
308
|
* If set, limits the number of retransmissions. This is only available
|
|
@@ -338,7 +338,7 @@ namespace RTC
|
|
|
338
338
|
|
|
339
339
|
constexpr uint16_t MaxRetransmitsNoLimit{ std::numeric_limits<uint16_t>::max() };
|
|
340
340
|
|
|
341
|
-
constexpr
|
|
341
|
+
constexpr int64_t ExpiresAtUsInfinite{ std::numeric_limits<int64_t>::max() };
|
|
342
342
|
|
|
343
343
|
/**
|
|
344
344
|
* Unwrapped Transmission Sequence Numbers (TSN).
|
|
@@ -162,9 +162,9 @@ namespace RTC
|
|
|
162
162
|
Item(
|
|
163
163
|
uint32_t outgoingMessageId,
|
|
164
164
|
UserData data,
|
|
165
|
-
|
|
165
|
+
int64_t timeSentUs,
|
|
166
166
|
uint16_t maxRetransmissions,
|
|
167
|
-
|
|
167
|
+
int64_t expiresAtUs,
|
|
168
168
|
std::optional<uint64_t> lifecycleId);
|
|
169
169
|
|
|
170
170
|
Item(const Item&) = delete;
|
|
@@ -177,9 +177,9 @@ namespace RTC
|
|
|
177
177
|
return this->outgoingMessageId;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
|
|
180
|
+
int64_t GetTimeSentUs() const
|
|
181
181
|
{
|
|
182
|
-
return this->
|
|
182
|
+
return this->timeSentUs;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
const UserData& GetData() const
|
|
@@ -251,9 +251,9 @@ namespace RTC
|
|
|
251
251
|
* Given the current time, and the current state of this DATA chunk, it
|
|
252
252
|
* will indicate if it has expired (SCTP Partial Reliability Extension).
|
|
253
253
|
*/
|
|
254
|
-
bool HasExpired(
|
|
254
|
+
bool HasExpired(int64_t nowUs) const
|
|
255
255
|
{
|
|
256
|
-
return (this->
|
|
256
|
+
return (this->expiresAtUs != Types::ExpiresAtUsInfinite && this->expiresAtUs <= nowUs);
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
std::optional<uint64_t> GetLifecycleId() const
|
|
@@ -265,15 +265,14 @@ namespace RTC
|
|
|
265
265
|
// The actual data to send/retransmit.
|
|
266
266
|
const UserData data;
|
|
267
267
|
// When the packet was sent, and placed in this queue.
|
|
268
|
-
const
|
|
268
|
+
const int64_t timeSentUs;
|
|
269
269
|
// If the message was sent with a maximum number of retransmissions,
|
|
270
270
|
// this is set to that number. The value zero (0) means that it will
|
|
271
271
|
// never be retransmitted.
|
|
272
272
|
const uint16_t maxRetransmissions;
|
|
273
|
-
// At this exact
|
|
274
|
-
// message is not to be expired, this is set to
|
|
275
|
-
|
|
276
|
-
const uint64_t expiresAtMs;
|
|
273
|
+
// At this exact microsecond, the item is considered expired. If the
|
|
274
|
+
// message is not to be expired, this is set to `ExpiresAtUsInfinite`.
|
|
275
|
+
const int64_t expiresAtUs;
|
|
277
276
|
// An optional lifecycle id, which may only be set for the last
|
|
278
277
|
// fragment.
|
|
279
278
|
const std::optional<uint64_t> lifecycleId;
|
|
@@ -342,10 +341,10 @@ namespace RTC
|
|
|
342
341
|
}
|
|
343
342
|
|
|
344
343
|
/**
|
|
345
|
-
* Given the current time `
|
|
344
|
+
* Given the current time `nowUs`, expire and abandon outstanding (sent
|
|
346
345
|
* at least once) chunks that have a limited lifetime.
|
|
347
346
|
*/
|
|
348
|
-
void ExpireOutstandingChunks(
|
|
347
|
+
void ExpireOutstandingChunks(int64_t nowUs);
|
|
349
348
|
|
|
350
349
|
bool IsEmpty() const
|
|
351
350
|
{
|
|
@@ -382,9 +381,9 @@ namespace RTC
|
|
|
382
381
|
std::optional<Types::UnwrappedTsn> Insert(
|
|
383
382
|
uint32_t outgoingMessageId,
|
|
384
383
|
const UserData& data,
|
|
385
|
-
|
|
384
|
+
int64_t timeSentUs,
|
|
386
385
|
uint16_t maxRetransmissions = Types::MaxRetransmitsNoLimit,
|
|
387
|
-
|
|
386
|
+
int64_t expiresAtUs = Types::ExpiresAtUsInfinite,
|
|
388
387
|
std::optional<uint64_t> lifecycleId = std::nullopt);
|
|
389
388
|
|
|
390
389
|
/**
|
|
@@ -408,7 +407,7 @@ namespace RTC
|
|
|
408
407
|
* algorithm, so if the chunk has ever been retransmitted, it will return
|
|
409
408
|
* `std::nullopt`.
|
|
410
409
|
*/
|
|
411
|
-
std::optional<
|
|
410
|
+
std::optional<int64_t> MeasureRttUs(int64_t nowUs, Types::UnwrappedTsn tsn) const;
|
|
412
411
|
|
|
413
412
|
/**
|
|
414
413
|
* Returns true if the next chunk that is not acked by the peer has been
|
|
@@ -37,7 +37,7 @@ namespace RTC
|
|
|
37
37
|
virtual ~Listener() = default;
|
|
38
38
|
|
|
39
39
|
public:
|
|
40
|
-
virtual void
|
|
40
|
+
virtual void OnRetransmissionQueueNewRttUs(int64_t newRttUs) = 0;
|
|
41
41
|
virtual void OnRetransmissionQueueClearRetransmissionCounter() = 0;
|
|
42
42
|
};
|
|
43
43
|
|
|
@@ -53,7 +53,7 @@ namespace RTC
|
|
|
53
53
|
* Creates a RetransmissionQueue which will send data using
|
|
54
54
|
* `localInitialTsn` as the first TSN to use for sent fragments. It will
|
|
55
55
|
* poll data from `sendQueue`. When SACKs are received, it will estimate
|
|
56
|
-
* the RTT and call `listener->
|
|
56
|
+
* the RTT and call `listener->OnRetransmissionQueueNewRttUs()`. When an
|
|
57
57
|
* outstanding chunk has been acked, it will call
|
|
58
58
|
* `listener->OnRetransmissionQueueClearRetransmissionCounter() and will
|
|
59
59
|
* also use `t3RtxTimer`, which is the SCTP retransmission timer to manage
|
|
@@ -77,7 +77,7 @@ namespace RTC
|
|
|
77
77
|
* Handles a received SACK. Returns true if the SACK was processed and
|
|
78
78
|
* false if it was discarded due to received out-of-order and not relevant.
|
|
79
79
|
*/
|
|
80
|
-
bool HandleReceivedSackChunk(
|
|
80
|
+
bool HandleReceivedSackChunk(int64_t nowUs, const SackChunk* receivedSackChunk);
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* Handles an expired retransmission timer.
|
|
@@ -101,8 +101,7 @@ namespace RTC
|
|
|
101
101
|
* Note that `ShouldSendForwardTsn()` must be called prior to this method,
|
|
102
102
|
* to abandon expired chunks, as this method will not expire any chunks.
|
|
103
103
|
*/
|
|
104
|
-
std::vector<std::pair<uint32_t /*tsn*/, UserData>> GetChunksToSend(
|
|
105
|
-
uint64_t nowMs, size_t maxLength);
|
|
104
|
+
std::vector<std::pair<uint32_t /*tsn*/, UserData>> GetChunksToSend(int64_t nowUs, size_t maxLength);
|
|
106
105
|
|
|
107
106
|
#ifdef MS_TEST
|
|
108
107
|
/**
|
|
@@ -182,11 +181,11 @@ namespace RTC
|
|
|
182
181
|
}
|
|
183
182
|
|
|
184
183
|
/**
|
|
185
|
-
* Given the current time `
|
|
184
|
+
* Given the current time `nowUs`, it will evaluate if there are chunks
|
|
186
185
|
* that have expired and that need to be discarded. It returns true if a
|
|
187
186
|
* FORWARD-TSN should be sent.
|
|
188
187
|
*/
|
|
189
|
-
bool ShouldSendForwardTsn(
|
|
188
|
+
bool ShouldSendForwardTsn(int64_t nowUs);
|
|
190
189
|
|
|
191
190
|
/**
|
|
192
191
|
* Adds a FORWARD-TSN chunk to the given packet and returns it.
|
|
@@ -240,7 +239,7 @@ namespace RTC
|
|
|
240
239
|
* When a SACK chunk is received, this method will be called which may
|
|
241
240
|
* call into the `RetransmissionTimeout` to update the RTO.
|
|
242
241
|
*/
|
|
243
|
-
void
|
|
242
|
+
void UpdateRttUs(int64_t nowUs, Types::UnwrappedTsn cumulativeTsnAck);
|
|
244
243
|
|
|
245
244
|
/**
|
|
246
245
|
* If the congestion control is in "fast recovery mode", this may be
|
|
@@ -14,7 +14,7 @@ namespace RTC
|
|
|
14
14
|
* as delayed ack.
|
|
15
15
|
*
|
|
16
16
|
* When a round-trip-time (RTT) is calculated (outside this class), the
|
|
17
|
-
* `
|
|
17
|
+
* `ObserveRttUs()` method is called, which calculates the retransmission
|
|
18
18
|
* timeout (RTO) value. The RTO value will become larger if the RTT is high
|
|
19
19
|
* and/or the RTT values are varying a lot, which is an indicator of a bad
|
|
20
20
|
* connection.
|
|
@@ -30,35 +30,39 @@ namespace RTC
|
|
|
30
30
|
void Dump(int indentation = 0) const;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* To be called when a RTT (
|
|
33
|
+
* To be called when a RTT (us) has been measured, to update the RTO
|
|
34
34
|
* value.
|
|
35
35
|
*/
|
|
36
|
-
void
|
|
36
|
+
void ObserveRttUs(int64_t rttUs);
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* Returns the Retransmission Timeout (RTO) value.
|
|
39
|
+
* Returns the Retransmission Timeout (RTO) value (us).
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
int64_t GetRtoUs() const
|
|
42
42
|
{
|
|
43
|
-
return this->
|
|
43
|
+
return static_cast<int64_t>(this->rtoUs);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* Returns the smoothed RTT value (
|
|
47
|
+
* Returns the smoothed RTT value (us).
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* - The smoothed RTT is not rounded, so the sub-microsecond part is
|
|
51
|
+
* truncated here.
|
|
48
52
|
*/
|
|
49
|
-
|
|
53
|
+
int64_t GetSrttUs() const
|
|
50
54
|
{
|
|
51
|
-
return this->
|
|
55
|
+
return static_cast<int64_t>(this->srttUs);
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
private:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
double
|
|
60
|
-
double
|
|
61
|
-
double
|
|
59
|
+
int64_t minRtoUs;
|
|
60
|
+
int64_t maxRtoUs;
|
|
61
|
+
int64_t maxRttUs;
|
|
62
|
+
int64_t minRttVarianceUs;
|
|
63
|
+
double srttUs;
|
|
64
|
+
double rtoUs;
|
|
65
|
+
double rttVarUs{ 0 };
|
|
62
66
|
bool firstMeasurement{ false };
|
|
63
67
|
};
|
|
64
68
|
} // namespace SCTP
|
|
@@ -47,7 +47,7 @@ namespace RTC
|
|
|
47
47
|
{
|
|
48
48
|
bool isUnordered;
|
|
49
49
|
uint16_t maxRetransmissions;
|
|
50
|
-
|
|
50
|
+
int64_t expiresAtUs;
|
|
51
51
|
std::optional<uint64_t> lifecycleId;
|
|
52
52
|
};
|
|
53
53
|
|
|
@@ -128,7 +128,7 @@ namespace RTC
|
|
|
128
128
|
|
|
129
129
|
// Implementing `StreamScheduler::StreamProducer`.
|
|
130
130
|
|
|
131
|
-
std::optional<SendQueueInterface::DataToSend> Produce(
|
|
131
|
+
std::optional<SendQueueInterface::DataToSend> Produce(int64_t nowUs, size_t maxLength) override;
|
|
132
132
|
|
|
133
133
|
size_t GetBytesToSendInNextMessage() const override;
|
|
134
134
|
|
|
@@ -291,12 +291,11 @@ namespace RTC
|
|
|
291
291
|
|
|
292
292
|
/**
|
|
293
293
|
* Adds the message to be sent using the `sendMessageOptions` provided.
|
|
294
|
-
* The current time should be in `
|
|
294
|
+
* The current time should be in `nowUs`. Note that it's the responsibility
|
|
295
295
|
* of the caller to ensure that the buffer is not full (by calling
|
|
296
296
|
* `IsFull()`) before adding messages to it.
|
|
297
297
|
*/
|
|
298
|
-
void AddMessage(
|
|
299
|
-
uint64_t nowMs, Message message, const SendMessageOptions& sendMessageOptions = {});
|
|
298
|
+
void AddMessage(int64_t nowUs, Message message, const SendMessageOptions& sendMessageOptions = {});
|
|
300
299
|
|
|
301
300
|
uint16_t GetStreamPriority(uint16_t streamId) const;
|
|
302
301
|
|
|
@@ -309,7 +308,7 @@ namespace RTC
|
|
|
309
308
|
this->scheduler.EnableMessageInterleaving(enabled);
|
|
310
309
|
}
|
|
311
310
|
|
|
312
|
-
std::optional<SendQueueInterface::DataToSend> Produce(
|
|
311
|
+
std::optional<SendQueueInterface::DataToSend> Produce(int64_t nowUs, size_t maxLength) override;
|
|
313
312
|
|
|
314
313
|
bool Discard(uint16_t streamId, uint32_t outgoingMessageId) override;
|
|
315
314
|
|
|
@@ -38,7 +38,7 @@ namespace RTC
|
|
|
38
38
|
/**
|
|
39
39
|
* Time when it expires.
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
int64_t expiresAtUs{ Types::ExpiresAtUsInfinite };
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* Lifecycle. Set for the last fragment and `std::nullopt` for all
|
|
@@ -69,7 +69,7 @@ namespace RTC
|
|
|
69
69
|
* model message prioritization, which is important for any advanced
|
|
70
70
|
* stream scheduler, is further clarified.
|
|
71
71
|
*/
|
|
72
|
-
virtual std::optional<DataToSend> Produce(
|
|
72
|
+
virtual std::optional<DataToSend> Produce(int64_t nowUs, size_t maxLength) = 0;
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* Discards a partially sent message identified by the parameters `streamId`
|
|
@@ -49,13 +49,13 @@ namespace RTC
|
|
|
49
49
|
public:
|
|
50
50
|
/**
|
|
51
51
|
* Produces a fragment of data to send. The current wall time is specified
|
|
52
|
-
* as `
|
|
52
|
+
* as `nowUs` and should be used to skip chunks with expired limited
|
|
53
53
|
* lifetime. The parameter `maxLength` specifies the maximum amount of
|
|
54
54
|
* actual payload that may be returned. If these constraints prevents the
|
|
55
55
|
* stream from sending some data, `std::nullopt` should be returned.
|
|
56
56
|
*/
|
|
57
57
|
virtual std::optional<SendQueueInterface::DataToSend> Produce(
|
|
58
|
-
|
|
58
|
+
int64_t nowUs, size_t maxLength) = 0;
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Returns the number of payload bytes that is scheduled to be sent in the
|
|
@@ -123,7 +123,7 @@ namespace RTC
|
|
|
123
123
|
* Produces a message from this stream. This will only be called on
|
|
124
124
|
* streams that have data.
|
|
125
125
|
*/
|
|
126
|
-
std::optional<SendQueueInterface::DataToSend> Produce(
|
|
126
|
+
std::optional<SendQueueInterface::DataToSend> Produce(int64_t nowUs, size_t maxLength);
|
|
127
127
|
|
|
128
128
|
void MakeActive(size_t bytesToSendNext);
|
|
129
129
|
|
|
@@ -203,12 +203,12 @@ namespace RTC
|
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
205
|
* Produces a fragment of data to send. The current wall time is specified
|
|
206
|
-
* as `
|
|
206
|
+
* as `nowUs` and will be used to skip chunks with expired limited
|
|
207
207
|
* lifetime. The parameter `maxLength` specifies the maximum amount of
|
|
208
208
|
* actual payload that may be returned. If no data can be produced,
|
|
209
209
|
* `std::nullopt` is returned.
|
|
210
210
|
*/
|
|
211
|
-
std::optional<SendQueueInterface::DataToSend> Produce(
|
|
211
|
+
std::optional<SendQueueInterface::DataToSend> Produce(int64_t nowUs, size_t maxLength);
|
|
212
212
|
|
|
213
213
|
std::set<uint16_t> GetActiveStreamsForTesting() const;
|
|
214
214
|
|
|
@@ -16,10 +16,10 @@ namespace RTC
|
|
|
16
16
|
flatbuffers::FlatBufferBuilder& builder) const;
|
|
17
17
|
|
|
18
18
|
public:
|
|
19
|
-
uint16_t streamId{
|
|
19
|
+
uint16_t streamId{ 0 };
|
|
20
20
|
bool ordered{ true };
|
|
21
|
-
uint16_t maxPacketLifeTime{
|
|
22
|
-
uint16_t maxRetransmits{
|
|
21
|
+
uint16_t maxPacketLifeTime{ 0 };
|
|
22
|
+
uint16_t maxRetransmits{ 0 };
|
|
23
23
|
};
|
|
24
24
|
} // namespace RTC
|
|
25
25
|
|