mediasoup 3.26.0 → 3.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/node/lib/DataConsumer.js +1 -1
- package/node/lib/Router.js +1 -1
- package/node/lib/Transport.js +15 -15
- package/node/lib/fbs/rtp-parameters/encoding-mapping.d.ts +2 -6
- package/node/lib/fbs/rtp-parameters/encoding-mapping.d.ts.map +1 -1
- package/node/lib/fbs/rtp-parameters/encoding-mapping.js +7 -19
- package/node/lib/fbs/rtp-parameters/rtp-encoding-parameters.d.ts +4 -4
- package/node/lib/fbs/rtp-parameters/rtp-encoding-parameters.js +2 -2
- package/node/lib/fbs/rtp-stream/bitrate-by-layer.d.ts +5 -5
- package/node/lib/fbs/rtp-stream/bitrate-by-layer.d.ts.map +1 -1
- package/node/lib/fbs/rtp-stream/bitrate-by-layer.js +3 -3
- package/node/lib/fbs/rtp-stream/recv-stats.d.ts +5 -5
- package/node/lib/fbs/rtp-stream/recv-stats.d.ts.map +1 -1
- package/node/lib/fbs/rtp-stream/recv-stats.js +3 -3
- package/node/lib/fbs/rtp-stream/send-stats.d.ts +5 -5
- package/node/lib/fbs/rtp-stream/send-stats.d.ts.map +1 -1
- package/node/lib/fbs/rtp-stream/send-stats.js +3 -3
- package/node/lib/fbs/transport/bwe-trace-info.d.ts +23 -23
- package/node/lib/fbs/transport/bwe-trace-info.d.ts.map +1 -1
- package/node/lib/fbs/transport/bwe-trace-info.js +15 -15
- package/node/lib/fbs/transport/options.d.ts +5 -5
- package/node/lib/fbs/transport/options.js +2 -2
- package/node/lib/fbs/transport/set-max-incoming-bitrate-request.d.ts +5 -5
- package/node/lib/fbs/transport/set-max-incoming-bitrate-request.d.ts.map +1 -1
- package/node/lib/fbs/transport/set-max-incoming-bitrate-request.js +3 -3
- package/node/lib/fbs/transport/set-max-outgoing-bitrate-request.d.ts +5 -5
- package/node/lib/fbs/transport/set-max-outgoing-bitrate-request.d.ts.map +1 -1
- package/node/lib/fbs/transport/set-max-outgoing-bitrate-request.js +3 -3
- package/node/lib/fbs/transport/set-min-outgoing-bitrate-request.d.ts +5 -5
- package/node/lib/fbs/transport/set-min-outgoing-bitrate-request.d.ts.map +1 -1
- package/node/lib/fbs/transport/set-min-outgoing-bitrate-request.js +3 -3
- package/node/lib/fbs/transport/stats.d.ts +38 -38
- package/node/lib/fbs/transport/stats.d.ts.map +1 -1
- package/node/lib/fbs/transport/stats.js +25 -25
- package/node/lib/ortc.d.ts +0 -1
- package/node/lib/ortc.d.ts.map +1 -1
- package/node/lib/ortc.js +1 -2
- package/node/lib/rtpParametersFbsUtils.d.ts.map +1 -1
- package/node/lib/rtpParametersFbsUtils.js +2 -2
- package/package.json +9 -9
- package/worker/deps/libwebrtc/libwebrtc/call/rtp_transport_controller_send.cc +10 -10
- package/worker/deps/libwebrtc/libwebrtc/mediasoup_helpers.h +6 -6
- package/worker/deps/libwebrtc/libwebrtc/modules/congestion_controller/goog_cc/alr_detector.cc +1 -1
- package/worker/deps/libwebrtc/libwebrtc/modules/pacing/paced_sender.cc +7 -7
- package/worker/deps/libwebrtc/libwebrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h +1 -1
- package/worker/deps/libwebrtc/libwebrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc +1 -1
- package/worker/fbs/FBS/meson.build +25 -0
- package/worker/fbs/meson.build +15 -18
- package/worker/fbs/rtpParameters.fbs +1 -2
- package/worker/fbs/rtpStream.fbs +3 -3
- package/worker/fbs/transport.fbs +23 -23
- package/worker/fuzzer/include/RTC/FuzzerDtlsTransport.hpp +4 -1
- package/worker/fuzzer/src/FuzzerUtils.cpp +5 -3
- package/worker/fuzzer/src/RTC/FuzzerDtlsTransport.cpp +8 -5
- package/worker/fuzzer/src/RTC/FuzzerRateCalculator.cpp +3 -3
- package/worker/fuzzer/src/RTC/FuzzerTrendCalculator.cpp +6 -6
- package/worker/fuzzer/src/RTC/RTCP/FuzzerFeedbackRtpTransport.cpp +3 -3
- package/worker/fuzzer/src/RTC/RTP/FuzzerPacket.cpp +2 -2
- package/worker/fuzzer/src/RTC/RTP/FuzzerRetransmissionBuffer.cpp +5 -5
- package/worker/fuzzer/src/RTC/RTP/FuzzerRtpStreamSend.cpp +3 -3
- package/worker/fuzzer/src/fuzzer.cpp +4 -0
- package/worker/include/Channel/ChannelNotification.hpp +3 -3
- package/worker/include/Channel/ChannelRequest.hpp +1 -1
- package/worker/include/Channel/ChannelSocket.hpp +11 -0
- package/worker/include/DepLibUV.hpp +16 -33
- package/worker/include/RTC/ActiveSpeakerObserver.hpp +11 -11
- package/worker/include/RTC/AudioLevelObserver.hpp +4 -4
- package/worker/include/RTC/BWE/AcknowledgedBitrateEstimatorInterface.hpp +55 -0
- package/worker/include/RTC/BWE/AimdRateControl.hpp +190 -0
- package/worker/include/RTC/BWE/BweTypes.hpp +211 -0
- package/worker/include/RTC/BWE/DelayBasedBwe.hpp +173 -0
- package/worker/include/RTC/BWE/FeedbackAdapter.hpp +72 -0
- package/worker/include/RTC/BWE/InterArrivalDelta.hpp +106 -0
- package/worker/include/RTC/BWE/LinkCapacityEstimator.hpp +84 -0
- package/worker/include/RTC/BWE/LossBasedController.hpp +520 -0
- package/worker/include/RTC/BWE/RobustThroughputEstimator.hpp +94 -0
- package/worker/include/RTC/BWE/SendPacketHistory.hpp +137 -0
- package/worker/include/RTC/BWE/TargetRateController.hpp +306 -0
- package/worker/include/RTC/BWE/TrendlineEstimator.hpp +143 -0
- package/worker/include/RTC/BWE/Utils.hpp +39 -0
- package/worker/include/RTC/Consts.hpp +6 -6
- package/worker/include/RTC/Consumer.hpp +14 -12
- package/worker/include/RTC/DataConsumer.hpp +3 -3
- package/worker/include/RTC/DataProducer.hpp +3 -3
- package/worker/include/RTC/DtlsTransport.hpp +5 -2
- package/worker/include/RTC/ICE/IceCandidate.hpp +2 -2
- package/worker/include/RTC/ICE/IceServer.hpp +3 -3
- package/worker/include/RTC/KeyFrameRequestManager.hpp +3 -3
- package/worker/include/RTC/NEW_RTCP/packet/Packet.hpp +1 -1
- package/worker/include/RTC/NackGenerator.hpp +12 -12
- package/worker/include/RTC/PipeProducerStreamManager.hpp +3 -4
- package/worker/include/RTC/PipeTransport.hpp +18 -5
- package/worker/include/RTC/PlainTransport.hpp +18 -5
- package/worker/include/RTC/PortManager.hpp +4 -4
- package/worker/include/RTC/Producer.hpp +21 -12
- package/worker/include/RTC/ProducerStreamManager.hpp +12 -6
- package/worker/include/RTC/RTCP/Bye.hpp +2 -2
- package/worker/include/RTC/RTCP/FeedbackPsRemb.hpp +4 -4
- package/worker/include/RTC/RTCP/FeedbackRtpTmmb.hpp +3 -3
- package/worker/include/RTC/RTCP/FeedbackRtpTransport.hpp +54 -39
- package/worker/include/RTC/RTCP/Packet.hpp +3 -3
- package/worker/include/RTC/RTCP/ReceiverReport.hpp +3 -3
- package/worker/include/RTC/RTCP/Sdes.hpp +2 -2
- package/worker/include/RTC/RTCP/XR.hpp +2 -2
- package/worker/include/RTC/RTCP/XrDelaySinceLastRr.hpp +1 -1
- package/worker/include/RTC/RTP/Codecs/H264.hpp +1 -1
- package/worker/include/RTC/RTP/Codecs/Opus.hpp +2 -2
- package/worker/include/RTC/RTP/Codecs/PayloadDescriptorHandler.hpp +3 -3
- package/worker/include/RTC/RTP/Codecs/VP8.hpp +2 -2
- package/worker/include/RTC/RTP/Codecs/VP9.hpp +2 -2
- package/worker/include/RTC/RTP/HeaderExtensionIds.hpp +12 -12
- package/worker/include/RTC/RTP/Packet.hpp +13 -13
- package/worker/include/RTC/RTP/ProbationGenerator.hpp +1 -1
- package/worker/include/RTC/RTP/RetransmissionBuffer.hpp +7 -7
- package/worker/include/RTC/RTP/RtpStream.hpp +37 -51
- package/worker/include/RTC/RTP/RtpStreamRecv.hpp +59 -41
- package/worker/include/RTC/RTP/RtpStreamSend.hpp +20 -14
- package/worker/include/RTC/RTP/RtxStream.hpp +12 -13
- package/worker/include/RTC/RateCalculator.hpp +50 -44
- package/worker/include/RTC/RemoteCaptureTimeEstimator.hpp +5 -4
- package/worker/include/RTC/RemoteClockOffsetEstimator.hpp +11 -11
- package/worker/include/RTC/Router.hpp +6 -0
- package/worker/include/RTC/RtcLogger.hpp +1 -1
- package/worker/include/RTC/RtpDictionaries.hpp +10 -10
- package/worker/include/RTC/SCTP/association/Association.hpp +56 -28
- package/worker/include/RTC/SCTP/association/HeartbeatHandler.hpp +4 -4
- package/worker/include/RTC/SCTP/association/StateCookie.hpp +14 -14
- package/worker/include/RTC/SCTP/association/StreamResetHandler.hpp +38 -2
- package/worker/include/RTC/SCTP/association/TransmissionControlBlock.hpp +12 -12
- package/worker/include/RTC/SCTP/association/TransmissionControlBlockContextInterface.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/TLV.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/StateCookieParameter.hpp +3 -3
- package/worker/include/RTC/SCTP/public/AssociationInterface.hpp +4 -1
- package/worker/include/RTC/SCTP/public/AssociationMetrics.hpp +1 -1
- package/worker/include/RTC/SCTP/public/SctpOptions.hpp +12 -12
- package/worker/include/RTC/SCTP/public/SctpTypes.hpp +6 -6
- package/worker/include/RTC/SCTP/rx/ReassemblyQueue.hpp +10 -0
- package/worker/include/RTC/SCTP/tx/OutstandingData.hpp +15 -16
- package/worker/include/RTC/SCTP/tx/RetransmissionQueue.hpp +7 -8
- package/worker/include/RTC/SCTP/tx/RetransmissionTimeout.hpp +20 -16
- package/worker/include/RTC/SCTP/tx/RoundRobinSendQueue.hpp +5 -6
- package/worker/include/RTC/SCTP/tx/SendQueueInterface.hpp +2 -2
- package/worker/include/RTC/SCTP/tx/StreamScheduler.hpp +5 -5
- package/worker/include/RTC/SctpDictionaries.hpp +3 -3
- package/worker/include/RTC/Serializable.hpp +1 -1
- package/worker/include/RTC/SimpleProducerStreamManager.hpp +3 -4
- package/worker/include/RTC/SimulcastProducerStreamManager.hpp +6 -7
- package/worker/include/RTC/SvcProducerStreamManager.hpp +6 -5
- package/worker/include/RTC/TcpConnection.hpp +9 -3
- package/worker/include/RTC/TcpServer.hpp +3 -0
- package/worker/include/RTC/Transport.hpp +52 -45
- package/worker/include/RTC/TransportCongestionControlClient.hpp +30 -25
- package/worker/include/RTC/TransportCongestionControlServer.hpp +17 -17
- package/worker/include/RTC/TrendCalculator.hpp +5 -5
- package/worker/include/RTC/UdpSocket.hpp +11 -2
- package/worker/include/RTC/WebRtcServer.hpp +20 -5
- package/worker/include/RTC/WebRtcTransport.hpp +35 -10
- package/worker/include/Settings.hpp +4 -2
- package/worker/include/Shared.hpp +5 -20
- package/worker/include/SharedInterface.hpp +6 -28
- package/worker/include/Utils.hpp +40 -21
- package/worker/include/common.hpp +4 -0
- package/worker/include/handles/BackoffTimerHandle.hpp +4 -4
- package/worker/include/handles/BackoffTimerHandleInterface.hpp +5 -5
- package/worker/include/handles/TcpConnectionHandle.hpp +6 -6
- package/worker/include/handles/TcpServerHandle.hpp +1 -1
- package/worker/include/handles/TimerHandle.hpp +15 -9
- package/worker/include/handles/TimerHandleInterface.hpp +10 -4
- package/worker/include/handles/UdpSocketHandle.hpp +3 -3
- package/worker/include/handles/UnixStreamSocketHandle.hpp +2 -2
- package/worker/meson.build +87 -36
- package/worker/meson_options.txt +1 -0
- package/worker/mocks/include/MockShared.hpp +24 -23
- package/worker/mocks/include/RTC/SCTP/association/MockTransmissionControlBlockContext.hpp +51 -27
- package/worker/mocks/include/RTC/SCTP/tx/MockSendQueue.hpp +11 -11
- package/worker/mocks/include/handles/MockBackoffTimerHandle.hpp +10 -10
- package/worker/mocks/include/handles/MockTimerHandle.hpp +60 -22
- package/worker/mocks/src/MockShared.cpp +51 -5
- package/worker/mocks/src/handles/MockBackoffTimerHandle.cpp +29 -15
- package/worker/mocks/src/handles/MockTimerHandle.cpp +117 -0
- package/worker/scripts/clang-scripts.mjs +2 -2
- package/worker/src/Channel/ChannelNotification.cpp +5 -6
- package/worker/src/Channel/ChannelSocket.cpp +20 -2
- package/worker/src/DepLibUV.cpp +4 -5
- package/worker/src/RTC/ActiveSpeakerObserver.cpp +59 -47
- package/worker/src/RTC/AudioLevelObserver.cpp +7 -7
- package/worker/src/RTC/BWE/AimdRateControl.cpp +468 -0
- package/worker/src/RTC/BWE/BweTypes.cpp +61 -0
- package/worker/src/RTC/BWE/DelayBasedBwe.cpp +275 -0
- package/worker/src/RTC/BWE/FeedbackAdapter.cpp +148 -0
- package/worker/src/RTC/BWE/InterArrivalDelta.cpp +181 -0
- package/worker/src/RTC/BWE/LinkCapacityEstimator.cpp +133 -0
- package/worker/src/RTC/BWE/LossBasedController.cpp +1046 -0
- package/worker/src/RTC/BWE/RobustThroughputEstimator.cpp +245 -0
- package/worker/src/RTC/BWE/SendPacketHistory.cpp +184 -0
- package/worker/src/RTC/BWE/TargetRateController.cpp +435 -0
- package/worker/src/RTC/BWE/TrendlineEstimator.cpp +311 -0
- package/worker/src/RTC/BWE/Utils.cpp +54 -0
- package/worker/src/RTC/Consumer.cpp +48 -35
- package/worker/src/RTC/DataConsumer.cpp +4 -4
- package/worker/src/RTC/DataProducer.cpp +3 -3
- package/worker/src/RTC/DirectTransport.cpp +2 -2
- package/worker/src/RTC/DtlsTransport.cpp +14 -11
- package/worker/src/RTC/ICE/IceServer.cpp +2 -2
- package/worker/src/RTC/KeyFrameRequestManager.cpp +16 -12
- package/worker/src/RTC/NackGenerator.cpp +12 -12
- package/worker/src/RTC/PipeProducerStreamManager.cpp +6 -6
- package/worker/src/RTC/PipeTransport.cpp +16 -13
- package/worker/src/RTC/PlainTransport.cpp +25 -16
- package/worker/src/RTC/Producer.cpp +50 -36
- package/worker/src/RTC/RTCP/FeedbackPsRemb.cpp +13 -6
- package/worker/src/RTC/RTCP/FeedbackRtpTmmb.cpp +14 -5
- package/worker/src/RTC/RTCP/FeedbackRtpTransport.cpp +76 -50
- package/worker/src/RTC/RTP/Codecs/VP8.cpp +1 -1
- package/worker/src/RTC/RTP/Codecs/VP9.cpp +4 -4
- package/worker/src/RTC/RTP/Packet.cpp +9 -10
- package/worker/src/RTC/RTP/RetransmissionBuffer.cpp +6 -6
- package/worker/src/RTC/RTP/RtpStream.cpp +19 -19
- package/worker/src/RTC/RTP/RtpStreamRecv.cpp +146 -81
- package/worker/src/RTC/RTP/RtpStreamSend.cpp +49 -44
- package/worker/src/RTC/RTP/RtxStream.cpp +7 -10
- package/worker/src/RTC/RateCalculator.cpp +99 -136
- package/worker/src/RTC/RemoteCaptureTimeEstimator.cpp +13 -13
- package/worker/src/RTC/RemoteClockOffsetEstimator.cpp +18 -17
- package/worker/src/RTC/Router.cpp +18 -1
- package/worker/src/RTC/RtpDictionaries/RtpEncodingParameters.cpp +5 -2
- package/worker/src/RTC/SCTP/association/Association.cpp +146 -103
- package/worker/src/RTC/SCTP/association/AssociationListenerDeferrer.cpp +4 -4
- package/worker/src/RTC/SCTP/association/Capabilities.cpp +1 -1
- package/worker/src/RTC/SCTP/association/HeartbeatHandler.cpp +25 -18
- package/worker/src/RTC/SCTP/association/StateCookie.cpp +7 -6
- package/worker/src/RTC/SCTP/association/StreamResetHandler.cpp +122 -14
- package/worker/src/RTC/SCTP/association/TransmissionControlBlock.cpp +28 -26
- package/worker/src/RTC/SCTP/packet/chunks/SackChunk.cpp +0 -1
- package/worker/src/RTC/SCTP/packet/parameters/StateCookieParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/public/AssociationMetrics.cpp +2 -2
- package/worker/src/RTC/SCTP/public/SctpOptions.cpp +13 -13
- package/worker/src/RTC/SCTP/rx/DataTracker.cpp +1 -1
- package/worker/src/RTC/SCTP/rx/ReassemblyQueue.cpp +5 -5
- package/worker/src/RTC/SCTP/tx/OutstandingData.cpp +15 -15
- package/worker/src/RTC/SCTP/tx/RetransmissionQueue.cpp +15 -15
- package/worker/src/RTC/SCTP/tx/RetransmissionTimeout.cpp +29 -26
- package/worker/src/RTC/SCTP/tx/RoundRobinSendQueue.cpp +12 -11
- package/worker/src/RTC/SCTP/tx/StreamScheduler.cpp +4 -4
- package/worker/src/RTC/SctpDictionaries/SctpStreamParameters.cpp +2 -2
- package/worker/src/RTC/SimpleProducerStreamManager.cpp +10 -10
- package/worker/src/RTC/SimulcastProducerStreamManager.cpp +39 -37
- package/worker/src/RTC/SvcProducerStreamManager.cpp +39 -25
- package/worker/src/RTC/TcpConnection.cpp +9 -3
- package/worker/src/RTC/TcpServer.cpp +7 -2
- package/worker/src/RTC/Transport.cpp +266 -307
- package/worker/src/RTC/TransportCongestionControlClient.cpp +78 -71
- package/worker/src/RTC/TransportCongestionControlServer.cpp +38 -40
- package/worker/src/RTC/TrendCalculator.cpp +3 -3
- package/worker/src/RTC/UdpSocket.cpp +14 -3
- package/worker/src/RTC/WebRtcServer.cpp +20 -14
- package/worker/src/RTC/WebRtcTransport.cpp +35 -30
- package/worker/src/Settings.cpp +10 -0
- package/worker/src/Shared.cpp +2 -2
- package/worker/src/Utils/Crypto.cpp +2 -2
- package/worker/src/Worker.cpp +5 -1
- package/worker/src/handles/BackoffTimerHandle.cpp +24 -11
- package/worker/src/handles/TimerHandle.cpp +74 -25
- package/worker/src/lib.cpp +6 -0
- package/worker/tasks.py +197 -45
- package/worker/test/include/RTC/BWE/helpers/LinkSimulator.hpp +117 -0
- package/worker/test/src/RTC/BWE/TestAimdRateControl.cpp +400 -0
- package/worker/test/src/RTC/BWE/TestDelayBasedBwe.cpp +568 -0
- package/worker/test/src/RTC/BWE/TestFeedbackAdapter.cpp +546 -0
- package/worker/test/src/RTC/BWE/TestInterArrivalDelta.cpp +301 -0
- package/worker/test/src/RTC/BWE/TestLinkCapacityEstimator.cpp +115 -0
- package/worker/test/src/RTC/BWE/TestLossBasedController.cpp +1199 -0
- package/worker/test/src/RTC/BWE/TestRobustThroughputEstimator.cpp +433 -0
- package/worker/test/src/RTC/BWE/TestSendPacketHistory.cpp +259 -0
- package/worker/test/src/RTC/BWE/TestTargetRateController.cpp +337 -0
- package/worker/test/src/RTC/BWE/TestTrendlineEstimator.cpp +182 -0
- package/worker/test/src/RTC/BWE/TestUtils.cpp +61 -0
- package/worker/test/src/RTC/BWE/helpers/LinkSimulator.cpp +171 -0
- package/worker/test/src/RTC/RTCP/TestFeedbackPsRemb.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackRtpTmmb.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackRtpTransport.cpp +246 -208
- package/worker/test/src/RTC/RTP/TestPacket.cpp +11 -11
- package/worker/test/src/RTC/RTP/TestRetransmissionBuffer.cpp +12 -12
- package/worker/test/src/RTC/RTP/TestRtpStreamRecv.cpp +23 -16
- package/worker/test/src/RTC/RTP/TestRtpStreamSend.cpp +13 -13
- package/worker/test/src/RTC/SCTP/association/TestAssociation.cpp +27 -22
- package/worker/test/src/RTC/SCTP/association/TestHeartbeatHandler.cpp +21 -15
- package/worker/test/src/RTC/SCTP/association/TestStateCookie.cpp +6 -6
- package/worker/test/src/RTC/SCTP/association/TestStreamResetHandler.cpp +128 -13
- package/worker/test/src/RTC/SCTP/association/TestTransmissionControlBlock.cpp +3 -3
- package/worker/test/src/RTC/SCTP/packet/chunks/TestForwardTsnChunk.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/chunks/TestIForwardTsnChunk.cpp +23 -23
- package/worker/test/src/RTC/SCTP/packet/chunks/TestInitChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestSackChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestIPv6AddressParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/rx/TestDataTracker.cpp +37 -37
- package/worker/test/src/RTC/SCTP/rx/TestInterleavedReassemblyStreams.cpp +10 -10
- package/worker/test/src/RTC/SCTP/rx/TestReassemblyQueue.cpp +1 -1
- package/worker/test/src/RTC/SCTP/tx/TestOutstandingData.cpp +93 -93
- package/worker/test/src/RTC/SCTP/tx/TestRetransmissionQueue.cpp +247 -247
- package/worker/test/src/RTC/SCTP/tx/TestRetransmissionTimeout.cpp +100 -80
- package/worker/test/src/RTC/SCTP/tx/TestRoundRobinSendQueue.cpp +163 -163
- package/worker/test/src/RTC/SCTP/tx/TestStreamScheduler.cpp +76 -77
- package/worker/test/src/RTC/TestConsumer.cpp +8 -3
- package/worker/test/src/RTC/TestKeyFrameRequestManager.cpp +3 -3
- package/worker/test/src/RTC/TestNackGenerator.cpp +3 -3
- package/worker/test/src/RTC/TestPipeProducerStreamManager.cpp +5 -5
- package/worker/test/src/RTC/TestRateCalculator.cpp +110 -14
- package/worker/test/src/RTC/TestRemoteCaptureTimeEstimator.cpp +22 -17
- package/worker/test/src/RTC/TestRemoteClockOffsetEstimator.cpp +87 -85
- package/worker/test/src/RTC/TestSimpleProducerStreamManager.cpp +54 -47
- package/worker/test/src/RTC/TestSimulcastProducerStreamManager.cpp +83 -69
- package/worker/test/src/RTC/TestSvcProducerStreamManager.cpp +76 -65
- package/worker/test/src/RTC/TestTransportCongestionControlServer.cpp +72 -66
- package/worker/test/src/RTC/TestTransportTuple.cpp +19 -4
- package/worker/test/src/TestDepLibUV.cpp +19 -0
- package/worker/test/src/Utils/TestTime.cpp +57 -26
- package/worker/test/src/testHelpers.cpp +1 -1
- package/worker/test/src/tests.cpp +6 -0
- package/worker/include/RTC/SenderBandwidthEstimator.hpp +0 -118
- package/worker/src/RTC/SenderBandwidthEstimator.cpp +0 -269
|
@@ -13,14 +13,14 @@ SCENARIO("TransportCongestionControlServer", "[rtp]")
|
|
|
13
13
|
struct TestTransportCongestionControlServerInput
|
|
14
14
|
{
|
|
15
15
|
uint16_t wideSeqNumber;
|
|
16
|
-
|
|
16
|
+
int64_t nowUs;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
struct TestTransportCongestionControlServerResult
|
|
20
20
|
{
|
|
21
21
|
uint16_t wideSeqNumber;
|
|
22
22
|
bool received;
|
|
23
|
-
|
|
23
|
+
int64_t timestampUs;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
using TestResults = std::deque<std::vector<TestTransportCongestionControlServerResult>>;
|
|
@@ -39,27 +39,32 @@ SCENARIO("TransportCongestionControlServer", "[rtp]")
|
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
auto
|
|
42
|
+
auto packetStatuses = tccPacket->GetPacketStatuses();
|
|
43
43
|
|
|
44
44
|
REQUIRE(!this->results.empty());
|
|
45
45
|
|
|
46
46
|
auto testResults = this->results.front();
|
|
47
47
|
this->results.pop_front();
|
|
48
48
|
|
|
49
|
-
REQUIRE(testResults.size() ==
|
|
49
|
+
REQUIRE(testResults.size() == packetStatuses.size());
|
|
50
50
|
|
|
51
|
-
auto
|
|
51
|
+
auto packetStatusIt = packetStatuses.begin();
|
|
52
52
|
auto testResultIt = testResults.begin();
|
|
53
53
|
|
|
54
|
-
for (;
|
|
55
|
-
++
|
|
54
|
+
for (; packetStatusIt != packetStatuses.end() && testResultIt != testResults.end();
|
|
55
|
+
++packetStatusIt, ++testResultIt)
|
|
56
56
|
{
|
|
57
|
-
REQUIRE(
|
|
58
|
-
REQUIRE(
|
|
57
|
+
REQUIRE(packetStatusIt->sequenceNumber == testResultIt->wideSeqNumber);
|
|
58
|
+
REQUIRE(packetStatusIt->received == testResultIt->received);
|
|
59
59
|
|
|
60
|
-
if (
|
|
60
|
+
if (packetStatusIt->received)
|
|
61
61
|
{
|
|
62
|
-
|
|
62
|
+
// The reconstructed times sit in the frame of the reference time,
|
|
63
|
+
// which is shifted by a whole wrap period so that it's positive
|
|
64
|
+
// regardless of the sign of the reference time on the wire.
|
|
65
|
+
REQUIRE(
|
|
66
|
+
packetStatusIt->receivedAtUs ==
|
|
67
|
+
RTC::RTCP::FeedbackRtpTransportPacket::TimeWrapPeriodUs + testResultIt->timestampUs);
|
|
63
68
|
}
|
|
64
69
|
}
|
|
65
70
|
}
|
|
@@ -79,10 +84,10 @@ SCENARIO("TransportCongestionControlServer", "[rtp]")
|
|
|
79
84
|
TestResults results;
|
|
80
85
|
};
|
|
81
86
|
|
|
82
|
-
mocks::MockShared shared(/*
|
|
83
|
-
[]()
|
|
87
|
+
mocks::MockShared shared(/*getTimeUs*/
|
|
88
|
+
[]() -> int64_t
|
|
84
89
|
{
|
|
85
|
-
return 1000;
|
|
90
|
+
return 1000 * 1000;
|
|
86
91
|
});
|
|
87
92
|
|
|
88
93
|
// clang-format off
|
|
@@ -98,7 +103,7 @@ SCENARIO("TransportCongestionControlServer", "[rtp]")
|
|
|
98
103
|
|
|
99
104
|
auto validate =
|
|
100
105
|
[&buffer,
|
|
101
|
-
|
|
106
|
+
&shared](std::vector<TestTransportCongestionControlServerInput>& inputs, TestResults& results)
|
|
102
107
|
{
|
|
103
108
|
TestTransportCongestionControlServerListener listener;
|
|
104
109
|
auto tccServer = RTC::TransportCongestionControlServer(
|
|
@@ -122,22 +127,23 @@ SCENARIO("TransportCongestionControlServer", "[rtp]")
|
|
|
122
127
|
// Save results.
|
|
123
128
|
listener.SetResults(results);
|
|
124
129
|
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
static constexpr int64_t TransportCcFeedbackSendIntervalUs{ 100 * 1000 };
|
|
131
|
+
|
|
132
|
+
int64_t startTsUs = inputs[0].nowUs;
|
|
127
133
|
|
|
128
134
|
for (auto input : inputs)
|
|
129
135
|
{
|
|
130
136
|
// Periodic sending TCC packets.
|
|
131
|
-
|
|
137
|
+
const int64_t diffTsUs = input.nowUs - startTsUs;
|
|
132
138
|
|
|
133
|
-
if (
|
|
139
|
+
if (diffTsUs >= TransportCcFeedbackSendIntervalUs)
|
|
134
140
|
{
|
|
135
141
|
tccServer.FillAndSendTransportCcFeedback();
|
|
136
|
-
|
|
142
|
+
startTsUs = input.nowUs;
|
|
137
143
|
}
|
|
138
144
|
|
|
139
145
|
packet->UpdateTransportWideCc01(input.wideSeqNumber);
|
|
140
|
-
tccServer.IncomingPacket(input.
|
|
146
|
+
tccServer.IncomingPacket(input.nowUs, packet.get());
|
|
141
147
|
}
|
|
142
148
|
|
|
143
149
|
tccServer.FillAndSendTransportCcFeedback();
|
|
@@ -149,25 +155,25 @@ SCENARIO("TransportCongestionControlServer", "[rtp]")
|
|
|
149
155
|
// clang-format off
|
|
150
156
|
std::vector<TestTransportCongestionControlServerInput> inputs
|
|
151
157
|
{
|
|
152
|
-
{ 1u,
|
|
153
|
-
{ 2u,
|
|
154
|
-
{ 3u,
|
|
155
|
-
{ 4u,
|
|
156
|
-
{ 5u,
|
|
158
|
+
{ 1u, 1000000 },
|
|
159
|
+
{ 2u, 1050000 },
|
|
160
|
+
{ 3u, 1100000 },
|
|
161
|
+
{ 4u, 1150000 },
|
|
162
|
+
{ 5u, 1200000 },
|
|
157
163
|
};
|
|
158
164
|
|
|
159
165
|
TestResults results
|
|
160
166
|
{
|
|
161
167
|
{
|
|
162
|
-
{ 1u, true,
|
|
163
|
-
{ 2u, true,
|
|
168
|
+
{ 1u, true, 1000000 },
|
|
169
|
+
{ 2u, true, 1050000 },
|
|
164
170
|
},
|
|
165
171
|
{
|
|
166
|
-
{ 3u, true,
|
|
167
|
-
{ 4u, true,
|
|
172
|
+
{ 3u, true, 1100000 },
|
|
173
|
+
{ 4u, true, 1150000 },
|
|
168
174
|
},
|
|
169
175
|
{
|
|
170
|
-
{ 5u, true,
|
|
176
|
+
{ 5u, true, 1200000 },
|
|
171
177
|
},
|
|
172
178
|
};
|
|
173
179
|
// clang-format on
|
|
@@ -180,23 +186,23 @@ SCENARIO("TransportCongestionControlServer", "[rtp]")
|
|
|
180
186
|
// clang-format off
|
|
181
187
|
std::vector<TestTransportCongestionControlServerInput> inputs
|
|
182
188
|
{
|
|
183
|
-
{ 1u,
|
|
184
|
-
{ 3u,
|
|
185
|
-
{ 5u,
|
|
186
|
-
{ 6u,
|
|
189
|
+
{ 1u, 1000000 },
|
|
190
|
+
{ 3u, 1050000 },
|
|
191
|
+
{ 5u, 1100000 },
|
|
192
|
+
{ 6u, 1150000 },
|
|
187
193
|
};
|
|
188
194
|
|
|
189
195
|
TestResults results
|
|
190
196
|
{
|
|
191
197
|
{
|
|
192
|
-
{ 1u, true,
|
|
193
|
-
{ 2u, false,
|
|
194
|
-
{ 3u, true,
|
|
198
|
+
{ 1u, true, 1000000 },
|
|
199
|
+
{ 2u, false, 0 },
|
|
200
|
+
{ 3u, true, 1050000 },
|
|
195
201
|
},
|
|
196
202
|
{
|
|
197
|
-
{ 4u, false,
|
|
198
|
-
{ 5u, true,
|
|
199
|
-
{ 6u, true,
|
|
203
|
+
{ 4u, false, 0 },
|
|
204
|
+
{ 5u, true, 1100000 },
|
|
205
|
+
{ 6u, true, 1150000 },
|
|
200
206
|
},
|
|
201
207
|
};
|
|
202
208
|
// clang-format on
|
|
@@ -209,25 +215,25 @@ SCENARIO("TransportCongestionControlServer", "[rtp]")
|
|
|
209
215
|
// clang-format off
|
|
210
216
|
std::vector<TestTransportCongestionControlServerInput> inputs
|
|
211
217
|
{
|
|
212
|
-
{ 1u,
|
|
213
|
-
{ 1u,
|
|
214
|
-
{ 2u,
|
|
215
|
-
{ 3u,
|
|
216
|
-
{ 3u,
|
|
217
|
-
{ 4u,
|
|
218
|
+
{ 1u, 1000000 },
|
|
219
|
+
{ 1u, 1050000 },
|
|
220
|
+
{ 2u, 1100000 },
|
|
221
|
+
{ 3u, 1150000 },
|
|
222
|
+
{ 3u, 1200000 },
|
|
223
|
+
{ 4u, 1250000 },
|
|
218
224
|
};
|
|
219
225
|
|
|
220
226
|
TestResults results
|
|
221
227
|
{
|
|
222
228
|
{
|
|
223
|
-
{ 1u, true,
|
|
229
|
+
{ 1u, true, 1000000 },
|
|
224
230
|
},
|
|
225
231
|
{
|
|
226
|
-
{ 2u, true,
|
|
227
|
-
{ 3u, true,
|
|
232
|
+
{ 2u, true, 1100000 },
|
|
233
|
+
{ 3u, true, 1150000 },
|
|
228
234
|
},
|
|
229
235
|
{
|
|
230
|
-
{ 4u, true,
|
|
236
|
+
{ 4u, true, 1250000 },
|
|
231
237
|
},
|
|
232
238
|
};
|
|
233
239
|
// clang-format on
|
|
@@ -240,30 +246,30 @@ SCENARIO("TransportCongestionControlServer", "[rtp]")
|
|
|
240
246
|
// clang-format off
|
|
241
247
|
std::vector<TestTransportCongestionControlServerInput> inputs
|
|
242
248
|
{
|
|
243
|
-
{ 1u,
|
|
244
|
-
{ 2u,
|
|
245
|
-
{ 4u,
|
|
246
|
-
{ 5u,
|
|
247
|
-
{ 3u,
|
|
248
|
-
{ 6u,
|
|
249
|
+
{ 1u, 1000000 },
|
|
250
|
+
{ 2u, 1050000 },
|
|
251
|
+
{ 4u, 1100000 },
|
|
252
|
+
{ 5u, 1150000 },
|
|
253
|
+
{ 3u, 1200000 }, // Out of order
|
|
254
|
+
{ 6u, 1250000 },
|
|
249
255
|
};
|
|
250
256
|
|
|
251
257
|
TestResults results
|
|
252
258
|
{
|
|
253
259
|
{
|
|
254
|
-
{ 1u, true,
|
|
255
|
-
{ 2u, true,
|
|
260
|
+
{ 1u, true, 1000000 },
|
|
261
|
+
{ 2u, true, 1050000 },
|
|
256
262
|
},
|
|
257
263
|
{
|
|
258
|
-
{ 3u, false,
|
|
259
|
-
{ 4u, true,
|
|
260
|
-
{ 5u, true,
|
|
264
|
+
{ 3u, false, 0 },
|
|
265
|
+
{ 4u, true, 1100000 },
|
|
266
|
+
{ 5u, true, 1150000 },
|
|
261
267
|
},
|
|
262
268
|
{
|
|
263
|
-
{ 3u, true,
|
|
264
|
-
{ 4u, true,
|
|
265
|
-
{ 5u, true,
|
|
266
|
-
{ 6u, true,
|
|
269
|
+
{ 3u, true, 1200000 },
|
|
270
|
+
{ 4u, true, 1100000 },
|
|
271
|
+
{ 5u, true, 1150000 },
|
|
272
|
+
{ 6u, true, 1250000 },
|
|
267
273
|
},
|
|
268
274
|
};
|
|
269
275
|
// clang-format on
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
#include "RTC/Transport.hpp"
|
|
4
4
|
#include "RTC/TransportTuple.hpp"
|
|
5
5
|
#include "RTC/UdpSocket.hpp"
|
|
6
|
+
#include "mocks/include/MockShared.hpp"
|
|
6
7
|
#include <uv.h>
|
|
7
8
|
#include <catch2/catch_test_macros.hpp>
|
|
8
9
|
|
|
@@ -16,18 +17,32 @@ SCENARIO("TransportTuple", "[transporttuple]")
|
|
|
16
17
|
const uint8_t* /*data*/,
|
|
17
18
|
size_t /*len*/,
|
|
18
19
|
size_t /*bufferLen*/,
|
|
19
|
-
const struct sockaddr* /*remoteAddr
|
|
20
|
+
const struct sockaddr* /*remoteAddr*/,
|
|
21
|
+
int64_t /*receivedAtUs*/) override
|
|
20
22
|
{
|
|
21
23
|
}
|
|
22
24
|
};
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
// NOTE: These outlive the sockets created below, which hold pointers to them.
|
|
27
|
+
UdpSocketListener listener;
|
|
28
|
+
mocks::MockShared shared(/*getTimeUs*/
|
|
29
|
+
[]() -> int64_t
|
|
30
|
+
{
|
|
31
|
+
return 1000 * 1000;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
auto makeUdpSocket = [&listener, &shared](const std::string& ip, uint16_t minPort, uint16_t maxPort)
|
|
25
35
|
{
|
|
26
|
-
UdpSocketListener listener;
|
|
27
36
|
auto flags = RTC::Transport::SocketFlags{ .ipv6Only = false, .udpReusePort = false };
|
|
28
37
|
RTC::PortManager::PortRangeKey portRangeKey{};
|
|
29
38
|
auto* udpSocket = new RTC::UdpSocket(
|
|
30
|
-
std::addressof(listener),
|
|
39
|
+
std::addressof(listener),
|
|
40
|
+
std::addressof(shared),
|
|
41
|
+
const_cast<std::string&>(ip),
|
|
42
|
+
minPort,
|
|
43
|
+
maxPort,
|
|
44
|
+
flags,
|
|
45
|
+
portRangeKey);
|
|
31
46
|
|
|
32
47
|
return std::unique_ptr<RTC::UdpSocket>(udpSocket);
|
|
33
48
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#include "common.hpp"
|
|
2
|
+
#include "DepLibUV.hpp"
|
|
3
|
+
#include <catch2/catch_test_macros.hpp>
|
|
4
|
+
|
|
5
|
+
SCENARIO("DepLibUV", "[deplibuv]")
|
|
6
|
+
{
|
|
7
|
+
SECTION("GetNtpOffsetUs()")
|
|
8
|
+
{
|
|
9
|
+
// Added to our own clock it must give an NTP instant of the current era, so
|
|
10
|
+
// past the moment this test was written.
|
|
11
|
+
//
|
|
12
|
+
// Seconds since Jan 1, 1900 at Jan 1, 2026.
|
|
13
|
+
constexpr int64_t Jan2026NtpSec{ 3976214400 };
|
|
14
|
+
|
|
15
|
+
const int64_t ntpUs = DepLibUV::GetTimeUs() + DepLibUV::GetNtpOffsetUs();
|
|
16
|
+
|
|
17
|
+
REQUIRE(ntpUs / 1000000 > Jan2026NtpSec);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -5,64 +5,95 @@
|
|
|
5
5
|
|
|
6
6
|
SCENARIO("Utils::Time", "[utils][time]")
|
|
7
7
|
{
|
|
8
|
-
SECTION("
|
|
8
|
+
SECTION("Ntp2TimeUs()")
|
|
9
9
|
{
|
|
10
|
-
const auto
|
|
11
|
-
const auto ntp = Utils::Time::
|
|
12
|
-
const auto
|
|
13
|
-
const auto ntp2 = Utils::Time::
|
|
10
|
+
const auto nowUs = DepLibUV::GetTimeUs();
|
|
11
|
+
const auto ntp = Utils::Time::TimeUs2Ntp(nowUs);
|
|
12
|
+
const auto nowUs2 = Utils::Time::Ntp2TimeUs(ntp);
|
|
13
|
+
const auto ntp2 = Utils::Time::TimeUs2Ntp(nowUs2);
|
|
14
14
|
|
|
15
|
-
REQUIRE(
|
|
15
|
+
REQUIRE(nowUs2 == nowUs);
|
|
16
16
|
REQUIRE(ntp2.seconds == ntp.seconds);
|
|
17
17
|
REQUIRE(ntp2.fractions == ntp.fractions);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
SECTION("
|
|
20
|
+
SECTION("TimeUs2Ntp()")
|
|
21
21
|
{
|
|
22
|
-
auto ntp = Utils::Time::
|
|
22
|
+
auto ntp = Utils::Time::TimeUs2Ntp(1500000);
|
|
23
23
|
|
|
24
24
|
REQUIRE(ntp.seconds == 1);
|
|
25
25
|
// Half a second in NTP fractional units.
|
|
26
26
|
REQUIRE(ntp.fractions == 2147483648);
|
|
27
27
|
|
|
28
28
|
// A real NTP instant, seconds since Jan 1, 1900, which still fits in 32 bits.
|
|
29
|
-
ntp = Utils::Time::
|
|
29
|
+
ntp = Utils::Time::TimeUs2Ntp(3990000000750000);
|
|
30
30
|
|
|
31
31
|
REQUIRE(ntp.seconds == 3990000000);
|
|
32
|
-
REQUIRE(Utils::Time::
|
|
32
|
+
REQUIRE(Utils::Time::Ntp2TimeUs(ntp) == 3990000000750000);
|
|
33
|
+
|
|
34
|
+
// Sub-millisecond times are kept.
|
|
35
|
+
REQUIRE(Utils::Time::TimeUs2Ntp(1000500).fractions > Utils::Time::TimeUs2Ntp(1000000).fractions);
|
|
36
|
+
REQUIRE(Utils::Time::TimeUs2Ntp(1000500).fractions < Utils::Time::TimeUs2Ntp(1001000).fractions);
|
|
37
|
+
REQUIRE(Utils::Time::Ntp2TimeUs(Utils::Time::TimeUs2Ntp(1000500)) == 1000500);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
SECTION("TimeUsToAbsSendTime()")
|
|
41
|
+
{
|
|
42
|
+
// A whole second is the fractional unit itself, being the format 6.18 fixed
|
|
43
|
+
// point seconds.
|
|
44
|
+
REQUIRE(Utils::Time::TimeUsToAbsSendTime(1000000) == 262144);
|
|
45
|
+
REQUIRE(Utils::Time::TimeUsToAbsSendTime(1500000) == 393216);
|
|
46
|
+
REQUIRE(Utils::Time::TimeUsToAbsSendTime(0) == 0);
|
|
47
|
+
// Resolution is 1/262144 of a second, so a couple of microseconds already
|
|
48
|
+
// move the value.
|
|
49
|
+
REQUIRE(Utils::Time::TimeUsToAbsSendTime(2) == 1);
|
|
50
|
+
|
|
51
|
+
// Only 6 bits of seconds are kept, so the value wraps every 64 seconds.
|
|
52
|
+
constexpr int64_t WrapPeriodUs{ 64 * 1000000 };
|
|
53
|
+
|
|
54
|
+
REQUIRE(Utils::Time::TimeUsToAbsSendTime(WrapPeriodUs) == 0);
|
|
55
|
+
REQUIRE(
|
|
56
|
+
Utils::Time::TimeUsToAbsSendTime(WrapPeriodUs + 1000000) ==
|
|
57
|
+
Utils::Time::TimeUsToAbsSendTime(1000000));
|
|
58
|
+
|
|
59
|
+
// A negative time yields the value of the positive time it's congruent with.
|
|
60
|
+
REQUIRE(
|
|
61
|
+
Utils::Time::TimeUsToAbsSendTime(-1000000) ==
|
|
62
|
+
Utils::Time::TimeUsToAbsSendTime(WrapPeriodUs - 1000000));
|
|
63
|
+
REQUIRE(Utils::Time::TimeUsToAbsSendTime(-WrapPeriodUs) == 0);
|
|
33
64
|
}
|
|
34
65
|
|
|
35
|
-
SECTION("
|
|
66
|
+
SECTION("TimeUs2Q32x32()")
|
|
36
67
|
{
|
|
37
68
|
// A whole second is the fractional unit itself.
|
|
38
69
|
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
39
|
-
REQUIRE(Utils::Time::
|
|
70
|
+
REQUIRE(Utils::Time::TimeUs2Q32x32(1000000).value() == 4294967296);
|
|
40
71
|
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
41
|
-
REQUIRE(Utils::Time::
|
|
72
|
+
REQUIRE(Utils::Time::TimeUs2Q32x32(-1000000).value() == -4294967296);
|
|
42
73
|
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
43
|
-
REQUIRE(Utils::Time::
|
|
74
|
+
REQUIRE(Utils::Time::TimeUs2Q32x32(0).value() == 0);
|
|
44
75
|
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
45
|
-
REQUIRE(Utils::Time::
|
|
76
|
+
REQUIRE(Utils::Time::TimeUs2Q32x32(1000).value() == 4294967);
|
|
46
77
|
|
|
47
78
|
// Seconds are 32 bits wide in the format, so 2^31 seconds no longer fit.
|
|
48
|
-
constexpr int64_t
|
|
79
|
+
constexpr int64_t OutOfRangeUs{ (1LL << 31) * 1000000 };
|
|
49
80
|
|
|
50
|
-
REQUIRE(Utils::Time::
|
|
51
|
-
REQUIRE(Utils::Time::
|
|
52
|
-
REQUIRE(Utils::Time::
|
|
53
|
-
REQUIRE(Utils::Time::
|
|
81
|
+
REQUIRE(Utils::Time::TimeUs2Q32x32(OutOfRangeUs) == std::nullopt);
|
|
82
|
+
REQUIRE(Utils::Time::TimeUs2Q32x32(-OutOfRangeUs) == std::nullopt);
|
|
83
|
+
REQUIRE(Utils::Time::TimeUs2Q32x32(OutOfRangeUs - 1).has_value());
|
|
84
|
+
REQUIRE(Utils::Time::TimeUs2Q32x32(-OutOfRangeUs + 1).has_value());
|
|
54
85
|
}
|
|
55
86
|
|
|
56
|
-
SECTION("
|
|
87
|
+
SECTION("Q32x32ToTimeUs()")
|
|
57
88
|
{
|
|
58
|
-
REQUIRE(Utils::Time::
|
|
59
|
-
REQUIRE(Utils::Time::
|
|
60
|
-
REQUIRE(Utils::Time::
|
|
89
|
+
REQUIRE(Utils::Time::Q32x32ToTimeUs(4294967296) == 1000000);
|
|
90
|
+
REQUIRE(Utils::Time::Q32x32ToTimeUs(-4294967296) == -1000000);
|
|
91
|
+
REQUIRE(Utils::Time::Q32x32ToTimeUs(0) == 0);
|
|
61
92
|
|
|
62
|
-
for (const int64_t
|
|
93
|
+
for (const int64_t us : { 1, -1, 1000, -1000, 1000000, -1000000, 123456789, -123456789 })
|
|
63
94
|
{
|
|
64
95
|
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
65
|
-
REQUIRE(Utils::Time::
|
|
96
|
+
REQUIRE(Utils::Time::Q32x32ToTimeUs(Utils::Time::TimeUs2Q32x32(us).value()) == us);
|
|
66
97
|
}
|
|
67
98
|
}
|
|
68
99
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#include "common.hpp"
|
|
2
2
|
#include "DepLibSRTP.hpp"
|
|
3
3
|
#include "DepLibUV.hpp"
|
|
4
|
+
#ifndef MS_USE_BUILTIN_BWE
|
|
4
5
|
#include "DepLibWebRTC.hpp"
|
|
6
|
+
#endif
|
|
5
7
|
#include "DepOpenSSL.hpp"
|
|
6
8
|
#include "Settings.hpp"
|
|
7
9
|
#include "Utils.hpp"
|
|
@@ -46,7 +48,9 @@ int main(int argc, char* argv[])
|
|
|
46
48
|
DepLibUV::ClassInit();
|
|
47
49
|
DepOpenSSL::ClassInit();
|
|
48
50
|
DepLibSRTP::ClassInit();
|
|
51
|
+
#ifndef MS_USE_BUILTIN_BWE
|
|
49
52
|
DepLibWebRTC::ClassInit();
|
|
53
|
+
#endif
|
|
50
54
|
Utils::Crypto::ClassInit();
|
|
51
55
|
|
|
52
56
|
Catch::Session session;
|
|
@@ -56,7 +60,9 @@ int main(int argc, char* argv[])
|
|
|
56
60
|
// Free static stuff.
|
|
57
61
|
DepLibSRTP::ClassDestroy();
|
|
58
62
|
Utils::Crypto::ClassDestroy();
|
|
63
|
+
#ifndef MS_USE_BUILTIN_BWE
|
|
59
64
|
DepLibWebRTC::ClassDestroy();
|
|
65
|
+
#endif
|
|
60
66
|
DepLibUV::ClassDestroy();
|
|
61
67
|
|
|
62
68
|
return status;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
#ifndef MS_RTC_SENDER_BANDWIDTH_ESTIMATOR_HPP
|
|
2
|
-
#define MS_RTC_SENDER_BANDWIDTH_ESTIMATOR_HPP
|
|
3
|
-
|
|
4
|
-
#include "common.hpp"
|
|
5
|
-
#include "RTC/RTCP/FeedbackRtpTransport.hpp"
|
|
6
|
-
#include "RTC/RateCalculator.hpp"
|
|
7
|
-
#include "RTC/SeqManager.hpp"
|
|
8
|
-
#include "RTC/TrendCalculator.hpp"
|
|
9
|
-
#include "SharedInterface.hpp"
|
|
10
|
-
#include <map>
|
|
11
|
-
|
|
12
|
-
namespace RTC
|
|
13
|
-
{
|
|
14
|
-
class SenderBandwidthEstimator
|
|
15
|
-
{
|
|
16
|
-
public:
|
|
17
|
-
class Listener
|
|
18
|
-
{
|
|
19
|
-
public:
|
|
20
|
-
virtual ~Listener() = default;
|
|
21
|
-
|
|
22
|
-
public:
|
|
23
|
-
virtual void OnSenderBandwidthEstimatorAvailableBitrate(
|
|
24
|
-
RTC::SenderBandwidthEstimator* senderBwe,
|
|
25
|
-
uint32_t availableBitrate,
|
|
26
|
-
uint32_t previousAvailableBitrate) = 0;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
public:
|
|
30
|
-
struct SentInfo
|
|
31
|
-
{
|
|
32
|
-
uint16_t wideSeq{ 0u };
|
|
33
|
-
size_t size{ 0u };
|
|
34
|
-
bool isProbation{ false };
|
|
35
|
-
uint64_t sendingAtMs{ 0u };
|
|
36
|
-
uint64_t sentAtMs{ 0u };
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
private:
|
|
40
|
-
class CummulativeResult
|
|
41
|
-
{
|
|
42
|
-
public:
|
|
43
|
-
CummulativeResult() = default;
|
|
44
|
-
|
|
45
|
-
public:
|
|
46
|
-
uint64_t GetStartedAtMs() const
|
|
47
|
-
{
|
|
48
|
-
return this->firstPacketSentAtMs;
|
|
49
|
-
}
|
|
50
|
-
size_t GetNumPackets() const
|
|
51
|
-
{
|
|
52
|
-
return this->numPackets;
|
|
53
|
-
}
|
|
54
|
-
size_t GetTotalSize() const
|
|
55
|
-
{
|
|
56
|
-
return this->totalSize;
|
|
57
|
-
}
|
|
58
|
-
uint32_t GetSendBitrate() const
|
|
59
|
-
{
|
|
60
|
-
auto sendIntervalMs =
|
|
61
|
-
std::max<uint64_t>(this->lastPacketSentAtMs - this->firstPacketSentAtMs, 1u);
|
|
62
|
-
|
|
63
|
-
return static_cast<uint32_t>(this->totalSize / sendIntervalMs) * 8 * 1000;
|
|
64
|
-
}
|
|
65
|
-
uint32_t GetReceiveBitrate() const
|
|
66
|
-
{
|
|
67
|
-
auto recvIntervalMs =
|
|
68
|
-
std::max<uint64_t>(this->lastPacketReceivedAtMs - this->firstPacketReceivedAtMs, 1u);
|
|
69
|
-
|
|
70
|
-
return static_cast<uint32_t>(this->totalSize / recvIntervalMs) * 8 * 1000;
|
|
71
|
-
}
|
|
72
|
-
void AddPacket(size_t size, int64_t sentAtMs, int64_t receivedAtMs);
|
|
73
|
-
void Reset();
|
|
74
|
-
|
|
75
|
-
private:
|
|
76
|
-
size_t numPackets{ 0u };
|
|
77
|
-
size_t totalSize{ 0u };
|
|
78
|
-
int64_t firstPacketSentAtMs{ 0u };
|
|
79
|
-
int64_t lastPacketSentAtMs{ 0u };
|
|
80
|
-
int64_t firstPacketReceivedAtMs{ 0u };
|
|
81
|
-
int64_t lastPacketReceivedAtMs{ 0u };
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
public:
|
|
85
|
-
SenderBandwidthEstimator(
|
|
86
|
-
RTC::SenderBandwidthEstimator::Listener* listener,
|
|
87
|
-
SharedInterface* shared,
|
|
88
|
-
uint32_t initialAvailableBitrate);
|
|
89
|
-
virtual ~SenderBandwidthEstimator();
|
|
90
|
-
|
|
91
|
-
public:
|
|
92
|
-
void TransportConnected();
|
|
93
|
-
void TransportDisconnected();
|
|
94
|
-
void RtpPacketSent(const SentInfo& sentInfo);
|
|
95
|
-
void ReceiveRtcpTransportFeedback(const RTC::RTCP::FeedbackRtpTransportPacket* feedback);
|
|
96
|
-
void EstimateAvailableBitrate(CummulativeResult& cummulativeResult);
|
|
97
|
-
void UpdateRtt(float rtt);
|
|
98
|
-
uint32_t GetAvailableBitrate() const;
|
|
99
|
-
void RescheduleNextAvailableBitrateEvent();
|
|
100
|
-
|
|
101
|
-
private:
|
|
102
|
-
// Passed by argument.
|
|
103
|
-
Listener* listener{ nullptr };
|
|
104
|
-
SharedInterface* shared{ nullptr };
|
|
105
|
-
// Others.
|
|
106
|
-
uint32_t initialAvailableBitrate{ 0u };
|
|
107
|
-
uint32_t availableBitrate{ 0u };
|
|
108
|
-
uint64_t lastAvailableBitrateEventAtMs{ 0u };
|
|
109
|
-
std::map<uint16_t, SentInfo, RTC::SeqManager<uint16_t>::SeqLowerThan> sentInfos;
|
|
110
|
-
float rtt{ 0 }; // Round trip time in ms.
|
|
111
|
-
CummulativeResult cummulativeResult;
|
|
112
|
-
CummulativeResult probationCummulativeResult;
|
|
113
|
-
RTC::RateCalculator sendTransmission;
|
|
114
|
-
RTC::TrendCalculator sendTransmissionTrend;
|
|
115
|
-
};
|
|
116
|
-
} // namespace RTC
|
|
117
|
-
|
|
118
|
-
#endif
|