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
|
@@ -11,7 +11,7 @@ namespace
|
|
|
11
11
|
{
|
|
12
12
|
constexpr uint64_t Mtu{ 1000 };
|
|
13
13
|
constexpr size_t PayloadLength{ 4 };
|
|
14
|
-
constexpr
|
|
14
|
+
constexpr int64_t NowUs{ 0 };
|
|
15
15
|
|
|
16
16
|
bool checkDataToSendHasMid(
|
|
17
17
|
std::optional<RTC::SCTP::SendQueueInterface::DataToSend> dataToSend, uint32_t mid)
|
|
@@ -29,11 +29,10 @@ namespace
|
|
|
29
29
|
return true;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
std::function<std::optional<RTC::SCTP::SendQueueInterface::DataToSend>(
|
|
32
|
+
std::function<std::optional<RTC::SCTP::SendQueueInterface::DataToSend>(int64_t, size_t)> createChunk(
|
|
33
33
|
uint32_t outgoingMessageId, uint16_t streamId, uint32_t mid, size_t payloadLength = PayloadLength)
|
|
34
34
|
{
|
|
35
|
-
return
|
|
36
|
-
[streamId, mid, payloadLength, outgoingMessageId](uint64_t /*nowMs*/, size_t /*maxLength*/)
|
|
35
|
+
return [streamId, mid, payloadLength, outgoingMessageId](int64_t /*nowUs*/, size_t /*maxLength*/)
|
|
37
36
|
{
|
|
38
37
|
return RTC::SCTP::SendQueueInterface::DataToSend(
|
|
39
38
|
outgoingMessageId,
|
|
@@ -58,7 +57,7 @@ namespace
|
|
|
58
57
|
for (size_t i{ 0 }; i < packetsToGenerate; ++i)
|
|
59
58
|
{
|
|
60
59
|
const std::optional<RTC::SCTP::SendQueueInterface::DataToSend> dataToSend =
|
|
61
|
-
scheduler.Produce(
|
|
60
|
+
scheduler.Produce(NowUs, Mtu);
|
|
62
61
|
|
|
63
62
|
if (dataToSend.has_value())
|
|
64
63
|
{
|
|
@@ -77,7 +76,7 @@ namespace
|
|
|
77
76
|
* in dcsctp.
|
|
78
77
|
*/
|
|
79
78
|
void PushProduce(
|
|
80
|
-
std::function<std::optional<RTC::SCTP::SendQueueInterface::DataToSend>(
|
|
79
|
+
std::function<std::optional<RTC::SCTP::SendQueueInterface::DataToSend>(int64_t, size_t)> fn)
|
|
81
80
|
{
|
|
82
81
|
this->produceQueue.push_back(std::move(fn));
|
|
83
82
|
}
|
|
@@ -91,7 +90,7 @@ namespace
|
|
|
91
90
|
this->bytesQueue.push_back(bytes);
|
|
92
91
|
}
|
|
93
92
|
|
|
94
|
-
std::optional<RTC::SCTP::SendQueueInterface::DataToSend> Produce(
|
|
93
|
+
std::optional<RTC::SCTP::SendQueueInterface::DataToSend> Produce(int64_t nowUs, size_t maxLength) override
|
|
95
94
|
{
|
|
96
95
|
REQUIRE(!this->produceQueue.empty());
|
|
97
96
|
|
|
@@ -99,7 +98,7 @@ namespace
|
|
|
99
98
|
|
|
100
99
|
this->produceQueue.pop_front();
|
|
101
100
|
|
|
102
|
-
return fn(
|
|
101
|
+
return fn(nowUs, maxLength);
|
|
103
102
|
}
|
|
104
103
|
|
|
105
104
|
size_t GetBytesToSendInNextMessage() const override
|
|
@@ -114,7 +113,7 @@ namespace
|
|
|
114
113
|
}
|
|
115
114
|
|
|
116
115
|
private:
|
|
117
|
-
std::deque<std::function<std::optional<RTC::SCTP::SendQueueInterface::DataToSend>(
|
|
116
|
+
std::deque<std::function<std::optional<RTC::SCTP::SendQueueInterface::DataToSend>(int64_t, size_t)>>
|
|
118
117
|
produceQueue;
|
|
119
118
|
mutable std::deque<size_t> bytesQueue;
|
|
120
119
|
};
|
|
@@ -159,7 +158,7 @@ SCENARIO("SCTP StreamScheduler", "[sctp][streamscheduler]")
|
|
|
159
158
|
{
|
|
160
159
|
RTC::SCTP::StreamScheduler scheduler(Mtu);
|
|
161
160
|
|
|
162
|
-
REQUIRE(!scheduler.Produce(
|
|
161
|
+
REQUIRE(!scheduler.Produce(NowUs, Mtu).has_value());
|
|
163
162
|
}
|
|
164
163
|
|
|
165
164
|
// Stream properties can be set and retrieved.
|
|
@@ -190,8 +189,8 @@ SCENARIO("SCTP StreamScheduler", "[sctp][streamscheduler]")
|
|
|
190
189
|
|
|
191
190
|
stream->MayMakeActive();
|
|
192
191
|
|
|
193
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
194
|
-
REQUIRE(!scheduler.Produce(
|
|
192
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 0));
|
|
193
|
+
REQUIRE(!scheduler.Produce(NowUs, Mtu).has_value());
|
|
195
194
|
}
|
|
196
195
|
|
|
197
196
|
// A scheduler with a single stream produced packets from it.
|
|
@@ -226,13 +225,13 @@ SCENARIO("SCTP StreamScheduler", "[sctp][streamscheduler]")
|
|
|
226
225
|
|
|
227
226
|
stream2->MayMakeActive();
|
|
228
227
|
|
|
229
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
230
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
231
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
232
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
233
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
234
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
235
|
-
REQUIRE(!scheduler.Produce(
|
|
228
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 100));
|
|
229
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 200));
|
|
230
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 101));
|
|
231
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 201));
|
|
232
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 102));
|
|
233
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 202));
|
|
234
|
+
REQUIRE(!scheduler.Produce(NowUs, Mtu).has_value());
|
|
236
235
|
}
|
|
237
236
|
|
|
238
237
|
// Switches between two streams after every packet.
|
|
@@ -267,13 +266,13 @@ SCENARIO("SCTP StreamScheduler", "[sctp][streamscheduler]")
|
|
|
267
266
|
|
|
268
267
|
stream2->MayMakeActive();
|
|
269
268
|
|
|
270
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
271
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
272
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
273
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
274
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
275
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
276
|
-
REQUIRE(!scheduler.Produce(
|
|
269
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 100));
|
|
270
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 200));
|
|
271
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 101));
|
|
272
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 201));
|
|
273
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 102));
|
|
274
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 202));
|
|
275
|
+
REQUIRE(!scheduler.Produce(NowUs, Mtu).has_value());
|
|
277
276
|
}
|
|
278
277
|
|
|
279
278
|
// Switches between two streams after every packet, but keeps producing from
|
|
@@ -291,21 +290,21 @@ SCENARIO("SCTP StreamScheduler", "[sctp][streamscheduler]")
|
|
|
291
290
|
// 2. beginning:false, end:false
|
|
292
291
|
// 3. beginning:false, end:true
|
|
293
292
|
producer1.PushProduce(
|
|
294
|
-
[](
|
|
293
|
+
[](int64_t, size_t)
|
|
295
294
|
{
|
|
296
295
|
return RTC::SCTP::SendQueueInterface::DataToSend(
|
|
297
296
|
1, RTC::SCTP::UserData(1, 0, 101, 0, 42, std::vector<uint8_t>(4), true, false, true));
|
|
298
297
|
});
|
|
299
298
|
producer1.PushBytesToSend(PayloadLength);
|
|
300
299
|
producer1.PushProduce(
|
|
301
|
-
[](
|
|
300
|
+
[](int64_t, size_t)
|
|
302
301
|
{
|
|
303
302
|
return RTC::SCTP::SendQueueInterface::DataToSend(
|
|
304
303
|
1, RTC::SCTP::UserData(1, 0, 101, 0, 42, std::vector<uint8_t>(4), false, false, true));
|
|
305
304
|
});
|
|
306
305
|
producer1.PushBytesToSend(PayloadLength);
|
|
307
306
|
producer1.PushProduce(
|
|
308
|
-
[](
|
|
307
|
+
[](int64_t, size_t)
|
|
309
308
|
{
|
|
310
309
|
return RTC::SCTP::SendQueueInterface::DataToSend(
|
|
311
310
|
1, RTC::SCTP::UserData(1, 0, 101, 0, 42, std::vector<uint8_t>(4), false, true, true));
|
|
@@ -332,16 +331,16 @@ SCENARIO("SCTP StreamScheduler", "[sctp][streamscheduler]")
|
|
|
332
331
|
|
|
333
332
|
stream2->MayMakeActive();
|
|
334
333
|
|
|
335
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
336
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
334
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 100));
|
|
335
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 200));
|
|
337
336
|
// MID(101) is fully produced before giving up on stream2.
|
|
338
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
339
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
340
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
341
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
342
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
343
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
344
|
-
REQUIRE(!scheduler.Produce(
|
|
337
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 101));
|
|
338
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 101));
|
|
339
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 101));
|
|
340
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 201));
|
|
341
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 102));
|
|
342
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 202));
|
|
343
|
+
REQUIRE(!scheduler.Produce(NowUs, Mtu).has_value());
|
|
345
344
|
}
|
|
346
345
|
|
|
347
346
|
// Resumes a paused stream - makes a stream active after inactivating it.
|
|
@@ -363,17 +362,17 @@ SCENARIO("SCTP StreamScheduler", "[sctp][streamscheduler]")
|
|
|
363
362
|
|
|
364
363
|
stream1->MayMakeActive();
|
|
365
364
|
|
|
366
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
367
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
365
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 100));
|
|
366
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 101));
|
|
368
367
|
|
|
369
368
|
stream1->MakeInactive();
|
|
370
369
|
|
|
371
|
-
REQUIRE(!scheduler.Produce(
|
|
370
|
+
REQUIRE(!scheduler.Produce(NowUs, Mtu).has_value());
|
|
372
371
|
|
|
373
372
|
stream1->MayMakeActive();
|
|
374
373
|
|
|
375
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
376
|
-
REQUIRE(!scheduler.Produce(
|
|
374
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 102));
|
|
375
|
+
REQUIRE(!scheduler.Produce(NowUs, Mtu).has_value());
|
|
377
376
|
}
|
|
378
377
|
|
|
379
378
|
// Iterates between streams, where one is suddenly paused and later resumed.
|
|
@@ -409,18 +408,18 @@ SCENARIO("SCTP StreamScheduler", "[sctp][streamscheduler]")
|
|
|
409
408
|
|
|
410
409
|
stream2->MayMakeActive();
|
|
411
410
|
|
|
412
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
413
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
411
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 100));
|
|
412
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 200));
|
|
414
413
|
|
|
415
414
|
stream1->MakeInactive();
|
|
416
415
|
|
|
417
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
418
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
416
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 201));
|
|
417
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 202));
|
|
419
418
|
|
|
420
419
|
stream1->MayMakeActive();
|
|
421
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
422
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
423
|
-
REQUIRE(!scheduler.Produce(
|
|
420
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 101));
|
|
421
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 102));
|
|
422
|
+
REQUIRE(!scheduler.Produce(NowUs, Mtu).has_value());
|
|
424
423
|
}
|
|
425
424
|
|
|
426
425
|
// Verifies that packet counts are evenly distributed in round robin
|
|
@@ -514,13 +513,13 @@ SCENARIO("SCTP StreamScheduler", "[sctp][streamscheduler]")
|
|
|
514
513
|
|
|
515
514
|
stream2->MayMakeActive();
|
|
516
515
|
|
|
517
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
518
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
519
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
520
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
521
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
522
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
523
|
-
REQUIRE(!scheduler.Produce(
|
|
516
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 100)); // t = 30
|
|
517
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 101)); // t = 60
|
|
518
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 200)); // t = 70
|
|
519
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 102)); // t = 90
|
|
520
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 201)); // t = 140
|
|
521
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 202)); // t = 210
|
|
522
|
+
REQUIRE(!scheduler.Produce(NowUs, Mtu).has_value());
|
|
524
523
|
}
|
|
525
524
|
|
|
526
525
|
// Will do weighted fair queuing with three streams having different priority.
|
|
@@ -575,16 +574,16 @@ SCENARIO("SCTP StreamScheduler", "[sctp][streamscheduler]")
|
|
|
575
574
|
|
|
576
575
|
stream3->MayMakeActive();
|
|
577
576
|
|
|
578
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
579
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
580
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
581
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
582
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
583
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
584
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
585
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
586
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
587
|
-
REQUIRE(!scheduler.Produce(
|
|
577
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 300)); // t ~= 20
|
|
578
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 301)); // t ~= 40
|
|
579
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 200)); // t ~= 50
|
|
580
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 302)); // t ~= 60
|
|
581
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 100)); // t ~= 80
|
|
582
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 201)); // t ~= 100
|
|
583
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 202)); // t ~= 150
|
|
584
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 101)); // t ~= 160
|
|
585
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 102)); // t ~= 240
|
|
586
|
+
REQUIRE(!scheduler.Produce(NowUs, Mtu).has_value());
|
|
588
587
|
}
|
|
589
588
|
|
|
590
589
|
// Will do weighted fair queuing with three streams having different priority
|
|
@@ -644,16 +643,16 @@ SCENARIO("SCTP StreamScheduler", "[sctp][streamscheduler]")
|
|
|
644
643
|
|
|
645
644
|
stream3->MayMakeActive();
|
|
646
645
|
|
|
647
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
648
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
649
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
650
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
651
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
652
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
653
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
654
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
655
|
-
REQUIRE(checkDataToSendHasMid(scheduler.Produce(
|
|
656
|
-
REQUIRE(!scheduler.Produce(
|
|
646
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 300)); // t ~= 400
|
|
647
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 301)); // t ~= 1400
|
|
648
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 200)); // t ~= 2500
|
|
649
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 302)); // t ~= 2800
|
|
650
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 100)); // t ~= 4000
|
|
651
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 101)); // t ~= 5600
|
|
652
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 201)); // t ~= 6000
|
|
653
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 202)); // t ~= 7000
|
|
654
|
+
REQUIRE(checkDataToSendHasMid(scheduler.Produce(NowUs, Mtu), 102)); // t ~= 11200
|
|
655
|
+
REQUIRE(!scheduler.Produce(NowUs, Mtu).has_value());
|
|
657
656
|
}
|
|
658
657
|
|
|
659
658
|
// Two streams of different priority, identical packet size: ratio of packets
|
|
@@ -14,10 +14,10 @@ namespace
|
|
|
14
14
|
{
|
|
15
15
|
// NOLINTBEGIN(readability-identifier-naming)
|
|
16
16
|
const uint8_t payloadType = 111;
|
|
17
|
-
mocks::MockShared shared(/*
|
|
18
|
-
[]()
|
|
17
|
+
mocks::MockShared shared(/*getTimeUs*/
|
|
18
|
+
[]() -> int64_t
|
|
19
19
|
{
|
|
20
|
-
return 1000;
|
|
20
|
+
return 1000 * 1000;
|
|
21
21
|
});
|
|
22
22
|
// NOLINTEND(readability-identifier-naming)
|
|
23
23
|
|
|
@@ -37,6 +37,11 @@ namespace
|
|
|
37
37
|
{
|
|
38
38
|
return 0;
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
void OnRtpStreamSpatialLayerActivityChanged(
|
|
42
|
+
RTC::RTP::RtpStreamRecv* /*rtpStream*/, uint8_t /*spatialLayer*/, bool /*isActive*/) override
|
|
43
|
+
{
|
|
44
|
+
}
|
|
40
45
|
};
|
|
41
46
|
|
|
42
47
|
class ConsumerListener : public RTC::Consumer::Listener
|
|
@@ -23,10 +23,10 @@ SCENARIO("KeyFrameRequestManager", "[rtp][keyframe]")
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
TestKeyFrameRequestManagerListener listener;
|
|
26
|
-
mocks::MockShared shared(/*
|
|
27
|
-
[]()
|
|
26
|
+
mocks::MockShared shared(/*getTimeUs*/
|
|
27
|
+
[]() -> int64_t
|
|
28
28
|
{
|
|
29
|
-
return 1000;
|
|
29
|
+
return 1000 * 1000;
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
SECTION("key frame requested once, not received on time")
|
|
@@ -125,10 +125,10 @@ SCENARIO("NackGenerator generator", "[rtp][rtcp][nack]")
|
|
|
125
125
|
bool keyFrameRequiredTriggered{ false };
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
-
mocks::MockShared shared(/*
|
|
129
|
-
[]()
|
|
128
|
+
mocks::MockShared shared(/*getTimeUs*/
|
|
129
|
+
[]() -> int64_t
|
|
130
130
|
{
|
|
131
|
-
return 1000;
|
|
131
|
+
return 1000 * 1000;
|
|
132
132
|
});
|
|
133
133
|
|
|
134
134
|
auto validate =
|
|
@@ -96,10 +96,10 @@ namespace
|
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
// NOLINTNEXTLINE(readability-identifier-naming)
|
|
99
|
-
mocks::MockShared shared(/*
|
|
100
|
-
[]()
|
|
99
|
+
mocks::MockShared shared(/*getTimeUs*/
|
|
100
|
+
[]() -> int64_t
|
|
101
101
|
{
|
|
102
|
-
return DepLibUV::
|
|
102
|
+
return DepLibUV::GetTimeUs();
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
std::unique_ptr<RTC::PipeProducerStreamManager> createManager(
|
|
@@ -454,7 +454,7 @@ SCENARIO("PipeProducerStreamManager", "[rtp][producerstreammanager][pipe]")
|
|
|
454
454
|
|
|
455
455
|
manager->SetExternallyManagedBitrate();
|
|
456
456
|
|
|
457
|
-
const auto used = manager->IncreaseLayer(
|
|
457
|
+
const auto used = manager->IncreaseLayer(1000000, false, 0.0f, DepLibUV::GetTimeMs());
|
|
458
458
|
|
|
459
459
|
REQUIRE(used == 0u);
|
|
460
460
|
}
|
|
@@ -466,6 +466,6 @@ SCENARIO("PipeProducerStreamManager", "[rtp][producerstreammanager][pipe]")
|
|
|
466
466
|
|
|
467
467
|
manager->SetExternallyManagedBitrate();
|
|
468
468
|
|
|
469
|
-
REQUIRE(manager->GetDesiredBitrate(DepLibUV::GetTimeMs()) ==
|
|
469
|
+
REQUIRE(manager->GetDesiredBitrate(DepLibUV::GetTimeMs()) == 0);
|
|
470
470
|
}
|
|
471
471
|
}
|
|
@@ -14,7 +14,7 @@ SCENARIO("RateCalculator", "[rate-calculator]")
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
auto validate =
|
|
17
|
-
[](RTC::RateCalculator& rate,
|
|
17
|
+
[](RTC::RateCalculator& rate, int64_t timeBaseMs, const std::vector<TestRateCalculatorData>& input)
|
|
18
18
|
{
|
|
19
19
|
for (const auto& item : input)
|
|
20
20
|
{
|
|
@@ -23,28 +23,22 @@ SCENARIO("RateCalculator", "[rate-calculator]")
|
|
|
23
23
|
REQUIRE(rate.GetRate(timeBaseMs + item.offset) == item.rate);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
// Repeat
|
|
26
|
+
// Repeat asking for the rate at a time older than the whole window, which
|
|
27
|
+
// must leave it untouched.
|
|
27
28
|
rate.Reset();
|
|
28
29
|
|
|
29
30
|
for (const auto& item : input)
|
|
30
31
|
{
|
|
31
32
|
rate.Update(item.size, timeBaseMs + item.offset);
|
|
32
33
|
|
|
33
|
-
REQUIRE(rate.GetRate(
|
|
34
|
+
REQUIRE(rate.GetRate(item.offset) == item.rate);
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
//
|
|
37
|
-
rate.
|
|
38
|
-
|
|
39
|
-
for (const auto& item : input)
|
|
40
|
-
{
|
|
41
|
-
rate.Update(item.size, timeBaseMs + item.offset);
|
|
42
|
-
|
|
43
|
-
REQUIRE(rate.GetRate(std::numeric_limits<uint64_t>::max() - 100 + item.offset) == item.rate);
|
|
44
|
-
}
|
|
37
|
+
// Asking for the rate far in the future expires every item.
|
|
38
|
+
REQUIRE(rate.GetRate(std::numeric_limits<int64_t>::max()) == 0);
|
|
45
39
|
};
|
|
46
40
|
|
|
47
|
-
const
|
|
41
|
+
const int64_t nowMs = 12345678;
|
|
48
42
|
|
|
49
43
|
SECTION("receive single item per 1000 ms")
|
|
50
44
|
{
|
|
@@ -163,7 +157,7 @@ SCENARIO("RateCalculator", "[rate-calculator]")
|
|
|
163
157
|
// https://github.com/versatica/mediasoup/issues/1316
|
|
164
158
|
SECTION("buffer overflow should not crash")
|
|
165
159
|
{
|
|
166
|
-
// window: 1000ms, items: 3 (granularity:
|
|
160
|
+
// window: 1000ms, items: 3 (granularity: 334ms)
|
|
167
161
|
RTC::RateCalculator rate(1000, 8000, 3);
|
|
168
162
|
|
|
169
163
|
// clang-format off
|
|
@@ -178,4 +172,106 @@ SCENARIO("RateCalculator", "[rate-calculator]")
|
|
|
178
172
|
|
|
179
173
|
validate(rate, nowMs, input);
|
|
180
174
|
}
|
|
175
|
+
|
|
176
|
+
// NOTE: This pins the item grid alignment. Items must advance by whole
|
|
177
|
+
// itemSizeMs steps so that a full ring always spans the window size. If the
|
|
178
|
+
// newest item start time jumped to nowMs instead, items would absorb the
|
|
179
|
+
// elapsed time remainder, the ring would span more time than the window, and
|
|
180
|
+
// the rate would be over-reported.
|
|
181
|
+
SECTION("item boundaries do not drift with traffic timing")
|
|
182
|
+
{
|
|
183
|
+
// window: 1000ms, items: 100 (granularity: 10ms)
|
|
184
|
+
RTC::RateCalculator rate(1000, 8000, 100);
|
|
185
|
+
|
|
186
|
+
// 11ms spacing, deliberately not a multiple of the 10ms granularity.
|
|
187
|
+
for (int64_t i{ 0 }; i <= 100; ++i)
|
|
188
|
+
{
|
|
189
|
+
rate.Update(1, nowMs + (i * 11));
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// The ring spans the items starting at [110, 1100], which hold the 91
|
|
193
|
+
// packets sent at 110, 121 ... 1100.
|
|
194
|
+
REQUIRE(rate.GetRate(nowMs + 1100) == 91 * 8);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// NOTE: This pins the GetRate() memoization key, which is both nowMs and the
|
|
198
|
+
// total count. Keying it on nowMs alone would return a stale rate.
|
|
199
|
+
SECTION("rate is recalculated after Update() with the same now")
|
|
200
|
+
{
|
|
201
|
+
RTC::RateCalculator rate(1000, 8000, 100);
|
|
202
|
+
|
|
203
|
+
rate.Update(5, nowMs);
|
|
204
|
+
|
|
205
|
+
REQUIRE(rate.GetRate(nowMs) == 40);
|
|
206
|
+
|
|
207
|
+
rate.Update(5, nowMs);
|
|
208
|
+
|
|
209
|
+
REQUIRE(rate.GetRate(nowMs) == 80);
|
|
210
|
+
|
|
211
|
+
rate.Update(5, nowMs);
|
|
212
|
+
|
|
213
|
+
REQUIRE(rate.GetRate(nowMs) == 120);
|
|
214
|
+
|
|
215
|
+
// Repeated reads with no Update() in between must be stable.
|
|
216
|
+
REQUIRE(rate.GetRate(nowMs) == 120);
|
|
217
|
+
REQUIRE(rate.GetRate(nowMs) == 120);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// NOTE: This pins the item size rounding for a window size which is not a
|
|
221
|
+
// multiple of it. Rounding the item size down would make a full ring span more
|
|
222
|
+
// time than the window, over-reporting the rate.
|
|
223
|
+
SECTION("window not divisible by items spans the window size")
|
|
224
|
+
{
|
|
225
|
+
// window: 1000ms, items: 3 (granularity: 334ms)
|
|
226
|
+
RTC::RateCalculator rate(1000, 8000, 3);
|
|
227
|
+
|
|
228
|
+
// Feed way past the ring size, so that any extra span accumulates.
|
|
229
|
+
for (int64_t i{ 0 }; i < 100; ++i)
|
|
230
|
+
{
|
|
231
|
+
rate.Update(1, nowMs + (i * 334));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Steady state is a full ring of 3 items holding 1 byte each.
|
|
235
|
+
REQUIRE(rate.GetRate(nowMs + (99 * 334)) == 24);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// NOTE: This pins that the GetRate() memoization needs no "not calculated yet"
|
|
239
|
+
// mark. Its zeroed initial state is a valid entry, so a read at time 0 must be
|
|
240
|
+
// neither a stale hit nor a miss returning something else than 0.
|
|
241
|
+
SECTION("rate at time 0 on a fresh and on a reset calculator")
|
|
242
|
+
{
|
|
243
|
+
RTC::RateCalculator rate(1000, 8000, 100);
|
|
244
|
+
|
|
245
|
+
REQUIRE(rate.GetRate(0) == 0);
|
|
246
|
+
|
|
247
|
+
rate.Update(5, 0);
|
|
248
|
+
|
|
249
|
+
REQUIRE(rate.GetRate(0) == 40);
|
|
250
|
+
|
|
251
|
+
rate.Reset();
|
|
252
|
+
|
|
253
|
+
REQUIRE(rate.GetRate(0) == 0);
|
|
254
|
+
|
|
255
|
+
rate.Update(5, 0);
|
|
256
|
+
|
|
257
|
+
REQUIRE(rate.GetRate(0) == 40);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// NOTE: This pins the constructor clamping. A zero number of items used to
|
|
261
|
+
// divide by zero, and a zero window size to leave an empty buffer.
|
|
262
|
+
SECTION("degenerate constructor arguments are clamped")
|
|
263
|
+
{
|
|
264
|
+
RTC::RateCalculator noItems(1000, 8000, 0);
|
|
265
|
+
RTC::RateCalculator oneItem(1000, 8000, 1);
|
|
266
|
+
RTC::RateCalculator noWindow(0, 8000, 100);
|
|
267
|
+
|
|
268
|
+
noItems.Update(5, nowMs);
|
|
269
|
+
oneItem.Update(5, nowMs);
|
|
270
|
+
noWindow.Update(5, nowMs);
|
|
271
|
+
|
|
272
|
+
REQUIRE(noItems.GetRate(nowMs) == 40);
|
|
273
|
+
REQUIRE(oneItem.GetRate(nowMs) == 40);
|
|
274
|
+
// The window size is clamped to 1ms.
|
|
275
|
+
REQUIRE(noWindow.GetRate(nowMs) == 40000);
|
|
276
|
+
}
|
|
181
277
|
}
|
|
@@ -13,7 +13,7 @@ SCENARIO("RemoteCaptureTimeEstimator", "[rtp][rtcp][remotecapturetimeestimator]"
|
|
|
13
13
|
// RTP timestamp that first Sender Report reports about.
|
|
14
14
|
constexpr uint32_t RemoteBaseTs{ 1000000 };
|
|
15
15
|
// Our own monotonic clock when that first Sender Report arrives.
|
|
16
|
-
constexpr
|
|
16
|
+
constexpr int64_t LocalBaseUs{ 1000000 * 1000 };
|
|
17
17
|
constexpr uint32_t ClockRate{ 90000 };
|
|
18
18
|
constexpr uint32_t Ssrc{ 1111 };
|
|
19
19
|
|
|
@@ -34,14 +34,19 @@ SCENARIO("RemoteCaptureTimeEstimator", "[rtp][rtcp][remotecapturetimeestimator]"
|
|
|
34
34
|
{
|
|
35
35
|
return 0;
|
|
36
36
|
}
|
|
37
|
+
|
|
38
|
+
void OnRtpStreamSpatialLayerActivityChanged(
|
|
39
|
+
RTC::RTP::RtpStreamRecv* /*rtpStream*/, uint8_t /*spatialLayer*/, bool /*isActive*/) override
|
|
40
|
+
{
|
|
41
|
+
}
|
|
37
42
|
};
|
|
38
43
|
|
|
39
|
-
|
|
44
|
+
int64_t nowUs{ LocalBaseUs };
|
|
40
45
|
|
|
41
|
-
mocks::MockShared shared(/*
|
|
42
|
-
[&
|
|
46
|
+
mocks::MockShared shared(/*getTimeUs*/
|
|
47
|
+
[&nowUs]() -> int64_t
|
|
43
48
|
{
|
|
44
|
-
return
|
|
49
|
+
return nowUs;
|
|
45
50
|
});
|
|
46
51
|
|
|
47
52
|
RTC::RTP::RtpStream::Params params;
|
|
@@ -61,9 +66,9 @@ SCENARIO("RemoteCaptureTimeEstimator", "[rtp][rtcp][remotecapturetimeestimator]"
|
|
|
61
66
|
|
|
62
67
|
// Makes the Sender Report about `RemoteBaseTs` plus `idx` seconds of media reach
|
|
63
68
|
// us with no delay at all, and feeds it to the estimator.
|
|
64
|
-
auto receiveSenderReport = [&
|
|
69
|
+
auto receiveSenderReport = [&nowUs, &shared, &rtpStream, &estimator](uint32_t idx) -> void
|
|
65
70
|
{
|
|
66
|
-
|
|
71
|
+
nowUs = LocalBaseUs + (idx * 1000000);
|
|
67
72
|
|
|
68
73
|
RTC::RTCP::SenderReport report;
|
|
69
74
|
|
|
@@ -72,14 +77,14 @@ SCENARIO("RemoteCaptureTimeEstimator", "[rtp][rtcp][remotecapturetimeestimator]"
|
|
|
72
77
|
report.SetNtpFrac(0);
|
|
73
78
|
report.SetRtpTs(RemoteBaseTs + (idx * ClockRate));
|
|
74
79
|
|
|
75
|
-
rtpStream.ReceiveRtcpSenderReport(std::addressof(report));
|
|
80
|
+
rtpStream.ReceiveRtcpSenderReport(std::addressof(report), shared.GetTimeUs());
|
|
76
81
|
estimator.SenderReportReceived(std::addressof(rtpStream));
|
|
77
82
|
};
|
|
78
83
|
|
|
79
84
|
SECTION("no source until the first Producer has been taken into account")
|
|
80
85
|
{
|
|
81
86
|
REQUIRE_FALSE(estimator.GetSource().has_value());
|
|
82
|
-
REQUIRE_FALSE(estimator.
|
|
87
|
+
REQUIRE_FALSE(estimator.GetLocalCaptureAtUs(std::addressof(rtpStream), RemoteBaseTs).has_value());
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
SECTION("the first Producer chooses abs-capture-time when it negotiated it")
|
|
@@ -120,7 +125,7 @@ SCENARIO("RemoteCaptureTimeEstimator", "[rtp][rtcp][remotecapturetimeestimator]"
|
|
|
120
125
|
// A single Sender Report is not enough for the clock offset to be estimated.
|
|
121
126
|
receiveSenderReport(0);
|
|
122
127
|
|
|
123
|
-
REQUIRE_FALSE(estimator.
|
|
128
|
+
REQUIRE_FALSE(estimator.GetLocalCaptureAtUs(std::addressof(rtpStream), RemoteBaseTs).has_value());
|
|
124
129
|
|
|
125
130
|
for (uint32_t idx{ 1 }; idx < RTC::RemoteClockOffsetEstimator::MinSampleCount; ++idx)
|
|
126
131
|
{
|
|
@@ -132,20 +137,20 @@ SCENARIO("RemoteCaptureTimeEstimator", "[rtp][rtcp][remotecapturetimeestimator]"
|
|
|
132
137
|
const auto lastIdx = RTC::RemoteClockOffsetEstimator::MinSampleCount - 1;
|
|
133
138
|
const auto lastTs = static_cast<uint32_t>(RemoteBaseTs + (lastIdx * ClockRate));
|
|
134
139
|
|
|
135
|
-
REQUIRE(estimator.
|
|
140
|
+
REQUIRE(estimator.GetLocalCaptureAtUs(std::addressof(rtpStream), lastTs).has_value());
|
|
136
141
|
REQUIRE(
|
|
137
142
|
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
138
|
-
estimator.
|
|
139
|
-
|
|
143
|
+
estimator.GetLocalCaptureAtUs(std::addressof(rtpStream), lastTs).value() ==
|
|
144
|
+
LocalBaseUs + (lastIdx * 1000000));
|
|
140
145
|
|
|
141
146
|
// One second of media later maps one second later in our clock too.
|
|
142
147
|
const auto nextTs = static_cast<uint32_t>(RemoteBaseTs + ((lastIdx + 1) * ClockRate));
|
|
143
148
|
|
|
144
|
-
REQUIRE(estimator.
|
|
149
|
+
REQUIRE(estimator.GetLocalCaptureAtUs(std::addressof(rtpStream), nextTs).has_value());
|
|
145
150
|
REQUIRE(
|
|
146
151
|
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
147
|
-
estimator.
|
|
148
|
-
|
|
152
|
+
estimator.GetLocalCaptureAtUs(std::addressof(rtpStream), nextTs).value() ==
|
|
153
|
+
LocalBaseUs + ((lastIdx + 1) * 1000000));
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
SECTION("no capture instant while the abs-capture-time source has nothing to offer")
|
|
@@ -159,6 +164,6 @@ SCENARIO("RemoteCaptureTimeEstimator", "[rtp][rtcp][remotecapturetimeestimator]"
|
|
|
159
164
|
|
|
160
165
|
// Sender Reports have been received, but the source in use is not allowed to
|
|
161
166
|
// fall back to them.
|
|
162
|
-
REQUIRE_FALSE(estimator.
|
|
167
|
+
REQUIRE_FALSE(estimator.GetLocalCaptureAtUs(std::addressof(rtpStream), RemoteBaseTs).has_value());
|
|
163
168
|
}
|
|
164
169
|
}
|