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
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
#include "common.hpp"
|
|
2
|
+
#include "RTC/BWE/InterArrivalDelta.hpp"
|
|
3
|
+
#include <catch2/catch_test_macros.hpp>
|
|
4
|
+
|
|
5
|
+
SCENARIO("BWE InterArrivalDelta", "[bwe][interarrivaldelta]")
|
|
6
|
+
{
|
|
7
|
+
constexpr size_t PacketSize{ 1000 };
|
|
8
|
+
// Length of a send time group, which is the value that the delay based
|
|
9
|
+
// estimator gives to its own instances.
|
|
10
|
+
constexpr int64_t SendTimeGroupLengthUs{ 5 * 1000 };
|
|
11
|
+
// Base network delay between send and arrival times.
|
|
12
|
+
constexpr int64_t BaseDelayMs{ 100 };
|
|
13
|
+
constexpr int64_t InitialSendTimeMs{ 1000000 };
|
|
14
|
+
|
|
15
|
+
// Feed a packet with explicit arrival and feedback times. Times are given in
|
|
16
|
+
// ms for readability and converted into us, which is what the class takes.
|
|
17
|
+
auto feedAt = [](
|
|
18
|
+
RTC::BWE::InterArrivalDelta& interArrivalDelta,
|
|
19
|
+
int64_t sendTimeMs,
|
|
20
|
+
int64_t arrivalTimeMs,
|
|
21
|
+
int64_t feedbackAtMs) -> std::optional<RTC::BWE::InterArrivalDelta::Deltas>
|
|
22
|
+
{
|
|
23
|
+
return interArrivalDelta.ComputeDeltas(
|
|
24
|
+
sendTimeMs * 1000, arrivalTimeMs * 1000, feedbackAtMs * 1000, PacketSize);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// Feed a packet whose arrival time is its send time plus the base network
|
|
28
|
+
// delay, which is the well behaved case.
|
|
29
|
+
auto feed = [&feedAt](
|
|
30
|
+
RTC::BWE::InterArrivalDelta& interArrivalDelta,
|
|
31
|
+
int64_t sendTimeMs) -> std::optional<RTC::BWE::InterArrivalDelta::Deltas>
|
|
32
|
+
{
|
|
33
|
+
const int64_t arrivalTimeMs = sendTimeMs + BaseDelayMs;
|
|
34
|
+
|
|
35
|
+
return feedAt(interArrivalDelta, sendTimeMs, arrivalTimeMs, /*feedbackAtMs*/ arrivalTimeMs);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
SECTION("first packet doesn't produce deltas")
|
|
39
|
+
{
|
|
40
|
+
RTC::BWE::InterArrivalDelta interArrivalDelta(SendTimeGroupLengthUs);
|
|
41
|
+
|
|
42
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs).has_value());
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
SECTION("packets within the same send time group don't produce deltas")
|
|
46
|
+
{
|
|
47
|
+
RTC::BWE::InterArrivalDelta interArrivalDelta(SendTimeGroupLengthUs);
|
|
48
|
+
|
|
49
|
+
// All of them are sent within 5 ms of the first one.
|
|
50
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs).has_value());
|
|
51
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs + 1).has_value());
|
|
52
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs + 3).has_value());
|
|
53
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs + 5).has_value());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
SECTION("first group transition doesn't produce deltas yet")
|
|
57
|
+
{
|
|
58
|
+
RTC::BWE::InterArrivalDelta interArrivalDelta(SendTimeGroupLengthUs);
|
|
59
|
+
|
|
60
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs).has_value());
|
|
61
|
+
|
|
62
|
+
// Sent more than 5 ms later, so this starts a second group. There is still
|
|
63
|
+
// no previous group to compare with.
|
|
64
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs + 10).has_value());
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
SECTION("third group produces deltas between the two previous ones")
|
|
68
|
+
{
|
|
69
|
+
RTC::BWE::InterArrivalDelta interArrivalDelta(SendTimeGroupLengthUs);
|
|
70
|
+
|
|
71
|
+
// Group A: three packets, the last one sent at +4.
|
|
72
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs).has_value());
|
|
73
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs + 2).has_value());
|
|
74
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs + 4).has_value());
|
|
75
|
+
|
|
76
|
+
// Group B: a single packet sent at +10.
|
|
77
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs + 10).has_value());
|
|
78
|
+
|
|
79
|
+
// Group C starts, so the deltas between B and A are ready.
|
|
80
|
+
const auto deltas = feed(interArrivalDelta, InitialSendTimeMs + 20);
|
|
81
|
+
|
|
82
|
+
REQUIRE(deltas.has_value());
|
|
83
|
+
// Send time of B (+10) minus send time of A (+4).
|
|
84
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
85
|
+
REQUIRE(deltas.value().sendDeltaUs == 6 * 1000);
|
|
86
|
+
// Same value since every packet had the very same network delay.
|
|
87
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
88
|
+
REQUIRE(deltas.value().arrivalDeltaUs == 6 * 1000);
|
|
89
|
+
// B holds a single packet while A holds three of them.
|
|
90
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
91
|
+
REQUIRE(deltas.value().sizeDelta == -2 * static_cast<int64_t>(PacketSize));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
SECTION("a longer send time group absorbs packets that would otherwise start a new one")
|
|
95
|
+
{
|
|
96
|
+
RTC::BWE::InterArrivalDelta interArrivalDelta(/*sendTimeGroupLengthUs*/ 20 * 1000);
|
|
97
|
+
|
|
98
|
+
// Group A: sent 10 ms apart, which is beyond the default group length but
|
|
99
|
+
// still within the 20 ms given to this instance. Note that their arrival
|
|
100
|
+
// delta matches their send delta, so they are not absorbed as a burst
|
|
101
|
+
// either, which leaves the group length as the only thing grouping them.
|
|
102
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs).has_value());
|
|
103
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs + 10).has_value());
|
|
104
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs + 20).has_value());
|
|
105
|
+
|
|
106
|
+
// Group B: a single packet, sent 20 ms after the first packet of A.
|
|
107
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs + 40).has_value());
|
|
108
|
+
|
|
109
|
+
// Group C starts, so the deltas between B and A are ready.
|
|
110
|
+
const auto deltas = feed(interArrivalDelta, InitialSendTimeMs + 80);
|
|
111
|
+
|
|
112
|
+
REQUIRE(deltas.has_value());
|
|
113
|
+
// Send time of B (+40) minus send time of A (+20), which is the last packet
|
|
114
|
+
// absorbed into A.
|
|
115
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
116
|
+
REQUIRE(deltas.value().sendDeltaUs == 20 * 1000);
|
|
117
|
+
// B holds a single packet while A holds three of them.
|
|
118
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
119
|
+
REQUIRE(deltas.value().sizeDelta == -2 * static_cast<int64_t>(PacketSize));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
SECTION("increasing network delay produces a bigger arrival delta")
|
|
123
|
+
{
|
|
124
|
+
RTC::BWE::InterArrivalDelta interArrivalDelta(SendTimeGroupLengthUs);
|
|
125
|
+
|
|
126
|
+
// Group A.
|
|
127
|
+
REQUIRE(!feedAt(
|
|
128
|
+
interArrivalDelta,
|
|
129
|
+
/*sendTimeMs*/ InitialSendTimeMs,
|
|
130
|
+
/*arrivalTimeMs*/ InitialSendTimeMs + BaseDelayMs,
|
|
131
|
+
/*feedbackAtMs*/ InitialSendTimeMs + BaseDelayMs)
|
|
132
|
+
.has_value());
|
|
133
|
+
|
|
134
|
+
// Group B, arriving 20 ms later than the base delay would suggest.
|
|
135
|
+
REQUIRE(!feedAt(
|
|
136
|
+
interArrivalDelta,
|
|
137
|
+
/*sendTimeMs*/ InitialSendTimeMs + 10,
|
|
138
|
+
/*arrivalTimeMs*/ InitialSendTimeMs + 10 + BaseDelayMs + 20,
|
|
139
|
+
/*feedbackAtMs*/ InitialSendTimeMs + 10 + BaseDelayMs + 20)
|
|
140
|
+
.has_value());
|
|
141
|
+
|
|
142
|
+
// Group C.
|
|
143
|
+
const auto deltas = feedAt(
|
|
144
|
+
interArrivalDelta,
|
|
145
|
+
/*sendTimeMs*/ InitialSendTimeMs + 20,
|
|
146
|
+
/*arrivalTimeMs*/ InitialSendTimeMs + 20 + BaseDelayMs + 20,
|
|
147
|
+
/*feedbackAtMs*/ InitialSendTimeMs + 20 + BaseDelayMs + 20);
|
|
148
|
+
|
|
149
|
+
REQUIRE(deltas.has_value());
|
|
150
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
151
|
+
REQUIRE(deltas.value().sendDeltaUs == 10 * 1000);
|
|
152
|
+
// 20 ms of extra queuing delay on top of the send delta.
|
|
153
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
154
|
+
REQUIRE(deltas.value().arrivalDeltaUs == 30 * 1000);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
SECTION("packet sent before the current group is discarded")
|
|
158
|
+
{
|
|
159
|
+
RTC::BWE::InterArrivalDelta interArrivalDelta(SendTimeGroupLengthUs);
|
|
160
|
+
|
|
161
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs + 100).has_value());
|
|
162
|
+
|
|
163
|
+
// Sent before the first packet of the current group.
|
|
164
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs).has_value());
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
SECTION("a packet serialized by the network is absorbed into the ongoing burst")
|
|
168
|
+
{
|
|
169
|
+
RTC::BWE::InterArrivalDelta interArrivalDelta(SendTimeGroupLengthUs);
|
|
170
|
+
|
|
171
|
+
// Group A.
|
|
172
|
+
REQUIRE(!feedAt(
|
|
173
|
+
interArrivalDelta,
|
|
174
|
+
/*sendTimeMs*/ InitialSendTimeMs,
|
|
175
|
+
/*arrivalTimeMs*/ InitialSendTimeMs + BaseDelayMs,
|
|
176
|
+
/*feedbackAtMs*/ InitialSendTimeMs + BaseDelayMs)
|
|
177
|
+
.has_value());
|
|
178
|
+
|
|
179
|
+
// Sent 10 ms later, so it would start a new group, but it arrived just 2 ms
|
|
180
|
+
// later, meaning that the network serialized it together with the previous
|
|
181
|
+
// packet. It must be absorbed into the very same burst.
|
|
182
|
+
REQUIRE(!feedAt(
|
|
183
|
+
interArrivalDelta,
|
|
184
|
+
/*sendTimeMs*/ InitialSendTimeMs + 10,
|
|
185
|
+
/*arrivalTimeMs*/ InitialSendTimeMs + BaseDelayMs + 2,
|
|
186
|
+
/*feedbackAtMs*/ InitialSendTimeMs + BaseDelayMs + 2)
|
|
187
|
+
.has_value());
|
|
188
|
+
|
|
189
|
+
// Given that both packets are still within the same group, the next group
|
|
190
|
+
// transition cannot produce deltas yet.
|
|
191
|
+
REQUIRE(!feedAt(
|
|
192
|
+
interArrivalDelta,
|
|
193
|
+
/*sendTimeMs*/ InitialSendTimeMs + 200,
|
|
194
|
+
/*arrivalTimeMs*/ InitialSendTimeMs + 200 + BaseDelayMs,
|
|
195
|
+
/*feedbackAtMs*/ InitialSendTimeMs + 200 + BaseDelayMs)
|
|
196
|
+
.has_value());
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
SECTION("a burst longer than the maximum duration ends")
|
|
200
|
+
{
|
|
201
|
+
RTC::BWE::InterArrivalDelta interArrivalDelta(SendTimeGroupLengthUs);
|
|
202
|
+
|
|
203
|
+
int64_t sendTimeMs = InitialSendTimeMs;
|
|
204
|
+
int64_t arrivalTimeMs = InitialSendTimeMs + BaseDelayMs;
|
|
205
|
+
bool gotDeltas{ false };
|
|
206
|
+
|
|
207
|
+
// Each packet is sent 10 ms after the previous one but arrives just 4 ms
|
|
208
|
+
// later, so every single one of them qualifies for the ongoing burst. The
|
|
209
|
+
// burst must end anyway once it lasts 100 ms, which takes 26 packets. Two
|
|
210
|
+
// bursts must be completed before deltas can be computed between them.
|
|
211
|
+
for (int i{ 0 }; i < 60; ++i)
|
|
212
|
+
{
|
|
213
|
+
sendTimeMs += 10;
|
|
214
|
+
arrivalTimeMs += 4;
|
|
215
|
+
|
|
216
|
+
if (feedAt(interArrivalDelta, sendTimeMs, arrivalTimeMs, /*feedbackAtMs*/ arrivalTimeMs).has_value())
|
|
217
|
+
{
|
|
218
|
+
gotDeltas = true;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// The burst was broken, so groups were created and deltas were computed.
|
|
223
|
+
REQUIRE(gotDeltas);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
SECTION("a remote clock jump resets the state")
|
|
227
|
+
{
|
|
228
|
+
RTC::BWE::InterArrivalDelta interArrivalDelta(SendTimeGroupLengthUs);
|
|
229
|
+
|
|
230
|
+
// Group A.
|
|
231
|
+
REQUIRE(!feedAt(
|
|
232
|
+
interArrivalDelta,
|
|
233
|
+
/*sendTimeMs*/ InitialSendTimeMs,
|
|
234
|
+
/*arrivalTimeMs*/ InitialSendTimeMs + BaseDelayMs,
|
|
235
|
+
/*feedbackAtMs*/ InitialSendTimeMs + BaseDelayMs)
|
|
236
|
+
.has_value());
|
|
237
|
+
|
|
238
|
+
// Group B, whose arrival time jumps 4 seconds ahead while our own clock just
|
|
239
|
+
// advances 10 ms.
|
|
240
|
+
REQUIRE(!feedAt(
|
|
241
|
+
interArrivalDelta,
|
|
242
|
+
/*sendTimeMs*/ InitialSendTimeMs + 10,
|
|
243
|
+
/*arrivalTimeMs*/ InitialSendTimeMs + BaseDelayMs + 4000,
|
|
244
|
+
/*feedbackAtMs*/ InitialSendTimeMs + BaseDelayMs + 10)
|
|
245
|
+
.has_value());
|
|
246
|
+
|
|
247
|
+
// Group C would produce the deltas between B and A, but the clock offset
|
|
248
|
+
// change is detected instead and the state is reset.
|
|
249
|
+
REQUIRE(!feedAt(
|
|
250
|
+
interArrivalDelta,
|
|
251
|
+
/*sendTimeMs*/ InitialSendTimeMs + 20,
|
|
252
|
+
/*arrivalTimeMs*/ InitialSendTimeMs + BaseDelayMs + 4010,
|
|
253
|
+
/*feedbackAtMs*/ InitialSendTimeMs + BaseDelayMs + 20)
|
|
254
|
+
.has_value());
|
|
255
|
+
|
|
256
|
+
// Given that the state was reset, three fresh groups are needed again before
|
|
257
|
+
// any deltas are produced.
|
|
258
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs + 30).has_value());
|
|
259
|
+
REQUIRE(!feed(interArrivalDelta, InitialSendTimeMs + 40).has_value());
|
|
260
|
+
REQUIRE(feed(interArrivalDelta, InitialSendTimeMs + 50).has_value());
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
SECTION("groups arriving out of order don't produce deltas")
|
|
264
|
+
{
|
|
265
|
+
RTC::BWE::InterArrivalDelta interArrivalDelta(SendTimeGroupLengthUs);
|
|
266
|
+
|
|
267
|
+
// Group A, completed at +400.
|
|
268
|
+
REQUIRE(!feedAt(
|
|
269
|
+
interArrivalDelta,
|
|
270
|
+
/*sendTimeMs*/ InitialSendTimeMs,
|
|
271
|
+
/*arrivalTimeMs*/ InitialSendTimeMs + 400,
|
|
272
|
+
/*feedbackAtMs*/ InitialSendTimeMs + 400)
|
|
273
|
+
.has_value());
|
|
274
|
+
|
|
275
|
+
// Group B starts.
|
|
276
|
+
REQUIRE(!feedAt(
|
|
277
|
+
interArrivalDelta,
|
|
278
|
+
/*sendTimeMs*/ InitialSendTimeMs + 20,
|
|
279
|
+
/*arrivalTimeMs*/ InitialSendTimeMs + 500,
|
|
280
|
+
/*feedbackAtMs*/ InitialSendTimeMs + 500)
|
|
281
|
+
.has_value());
|
|
282
|
+
|
|
283
|
+
// A packet of group B that arrives way earlier than the rest, dragging the
|
|
284
|
+
// arrival time of the whole group back to +100, hence before group A.
|
|
285
|
+
REQUIRE(!feedAt(
|
|
286
|
+
interArrivalDelta,
|
|
287
|
+
/*sendTimeMs*/ InitialSendTimeMs + 22,
|
|
288
|
+
/*arrivalTimeMs*/ InitialSendTimeMs + 100,
|
|
289
|
+
/*feedbackAtMs*/ InitialSendTimeMs + 100)
|
|
290
|
+
.has_value());
|
|
291
|
+
|
|
292
|
+
// Group C. The deltas between B and A would be negative, so they are
|
|
293
|
+
// discarded.
|
|
294
|
+
REQUIRE(!feedAt(
|
|
295
|
+
interArrivalDelta,
|
|
296
|
+
/*sendTimeMs*/ InitialSendTimeMs + 40,
|
|
297
|
+
/*arrivalTimeMs*/ InitialSendTimeMs + 600,
|
|
298
|
+
/*feedbackAtMs*/ InitialSendTimeMs + 600)
|
|
299
|
+
.has_value());
|
|
300
|
+
}
|
|
301
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
#include "common.hpp"
|
|
2
|
+
#include "RTC/BWE/BweTypes.hpp"
|
|
3
|
+
#include "RTC/BWE/LinkCapacityEstimator.hpp"
|
|
4
|
+
#include <catch2/catch_test_macros.hpp>
|
|
5
|
+
|
|
6
|
+
SCENARIO("BWE LinkCapacityEstimator", "[bwe][linkcapacityestimator]")
|
|
7
|
+
{
|
|
8
|
+
SECTION("there is no estimate until a sample is fed")
|
|
9
|
+
{
|
|
10
|
+
const RTC::BWE::LinkCapacityEstimator linkCapacityEstimator;
|
|
11
|
+
|
|
12
|
+
REQUIRE(!linkCapacityEstimator.GetEstimate().has_value());
|
|
13
|
+
// Without an estimate there is no interval either, so the bounds must not
|
|
14
|
+
// constrain anything.
|
|
15
|
+
REQUIRE(linkCapacityEstimator.GetUpperBound() == RTC::BWE::Types::BitrateInfinite);
|
|
16
|
+
REQUIRE(linkCapacityEstimator.GetLowerBound() == 0);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
SECTION("the first sample is taken as is")
|
|
20
|
+
{
|
|
21
|
+
RTC::BWE::LinkCapacityEstimator linkCapacityEstimator;
|
|
22
|
+
|
|
23
|
+
linkCapacityEstimator.OnOveruseDetected(500000);
|
|
24
|
+
|
|
25
|
+
REQUIRE(linkCapacityEstimator.GetEstimate() == 500000);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
SECTION("an overuse sample moves the estimate by 5%")
|
|
29
|
+
{
|
|
30
|
+
RTC::BWE::LinkCapacityEstimator linkCapacityEstimator;
|
|
31
|
+
|
|
32
|
+
linkCapacityEstimator.OnOveruseDetected(500000);
|
|
33
|
+
linkCapacityEstimator.OnOveruseDetected(1000000);
|
|
34
|
+
|
|
35
|
+
// 0.95 * 500 kbps + 0.05 * 1000 kbps.
|
|
36
|
+
REQUIRE(linkCapacityEstimator.GetEstimate() == 525000);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
SECTION("a probe sample moves the estimate by 50%")
|
|
40
|
+
{
|
|
41
|
+
RTC::BWE::LinkCapacityEstimator linkCapacityEstimator;
|
|
42
|
+
|
|
43
|
+
linkCapacityEstimator.OnOveruseDetected(500000);
|
|
44
|
+
// A probe measures the capacity directly, so it's trusted far more than an
|
|
45
|
+
// overuse, which only tells that the capacity was exceeded.
|
|
46
|
+
linkCapacityEstimator.OnProbeRate(1000000);
|
|
47
|
+
|
|
48
|
+
// 0.5 * 500 kbps + 0.5 * 1000 kbps.
|
|
49
|
+
REQUIRE(linkCapacityEstimator.GetEstimate() == 750000);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
SECTION("samples are taken with a resolution of 1 kbps")
|
|
53
|
+
{
|
|
54
|
+
RTC::BWE::LinkCapacityEstimator roundedDown;
|
|
55
|
+
RTC::BWE::LinkCapacityEstimator roundedUp;
|
|
56
|
+
|
|
57
|
+
roundedDown.OnOveruseDetected(500499);
|
|
58
|
+
roundedUp.OnOveruseDetected(500500);
|
|
59
|
+
|
|
60
|
+
REQUIRE(roundedDown.GetEstimate() == 500000);
|
|
61
|
+
REQUIRE(roundedUp.GetEstimate() == 501000);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
SECTION("the bounds bracket the estimate by three standard deviations")
|
|
65
|
+
{
|
|
66
|
+
RTC::BWE::LinkCapacityEstimator linkCapacityEstimator;
|
|
67
|
+
|
|
68
|
+
linkCapacityEstimator.OnOveruseDetected(500000);
|
|
69
|
+
|
|
70
|
+
// A single sample matching the estimate leaves the tracked variance at its
|
|
71
|
+
// minimum of 0.4, so the standard deviation is sqrt(0.4 * 500) = 14.14 kbps
|
|
72
|
+
// and the interval is 42.43 kbps wide on each side.
|
|
73
|
+
REQUIRE(linkCapacityEstimator.GetUpperBound() == 542426);
|
|
74
|
+
REQUIRE(linkCapacityEstimator.GetLowerBound() == 457573);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
SECTION("a sample far from the estimate widens the bounds")
|
|
78
|
+
{
|
|
79
|
+
RTC::BWE::LinkCapacityEstimator linkCapacityEstimator;
|
|
80
|
+
|
|
81
|
+
linkCapacityEstimator.OnOveruseDetected(500000);
|
|
82
|
+
linkCapacityEstimator.OnOveruseDetected(1000000);
|
|
83
|
+
|
|
84
|
+
// The error saturates the tracked variance at its maximum of 2.5, so the
|
|
85
|
+
// standard deviation becomes sqrt(2.5 * 525) = 36.23 kbps.
|
|
86
|
+
REQUIRE(linkCapacityEstimator.GetEstimate() == 525000);
|
|
87
|
+
REQUIRE(linkCapacityEstimator.GetUpperBound() == 633685);
|
|
88
|
+
REQUIRE(linkCapacityEstimator.GetLowerBound() == 416314);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
SECTION("resetting drops the estimate but keeps how noisy the samples were")
|
|
92
|
+
{
|
|
93
|
+
RTC::BWE::LinkCapacityEstimator linkCapacityEstimator;
|
|
94
|
+
|
|
95
|
+
linkCapacityEstimator.OnOveruseDetected(500000);
|
|
96
|
+
linkCapacityEstimator.OnOveruseDetected(1000000);
|
|
97
|
+
linkCapacityEstimator.Reset();
|
|
98
|
+
|
|
99
|
+
REQUIRE(!linkCapacityEstimator.GetEstimate().has_value());
|
|
100
|
+
REQUIRE(linkCapacityEstimator.GetUpperBound() == RTC::BWE::Types::BitrateInfinite);
|
|
101
|
+
REQUIRE(linkCapacityEstimator.GetLowerBound() == 0);
|
|
102
|
+
|
|
103
|
+
// The next sample is taken as is, since there is nothing to filter it
|
|
104
|
+
// against anymore.
|
|
105
|
+
linkCapacityEstimator.OnOveruseDetected(500000);
|
|
106
|
+
|
|
107
|
+
REQUIRE(linkCapacityEstimator.GetEstimate() == 500000);
|
|
108
|
+
|
|
109
|
+
// The variance was not dropped along with the estimate, so the interval is
|
|
110
|
+
// still far wider than the one of a network that had always been quiet.
|
|
111
|
+
// It decays from 2.5 towards its minimum as quiet samples come in.
|
|
112
|
+
REQUIRE(linkCapacityEstimator.GetUpperBound() == 603380);
|
|
113
|
+
REQUIRE(linkCapacityEstimator.GetLowerBound() == 396619);
|
|
114
|
+
}
|
|
115
|
+
}
|