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
|
@@ -63,9 +63,13 @@ namespace RTC
|
|
|
63
63
|
flatbuffers::Offset<FBS::WebRtcTransport::DumpResponse> FillBuffer(
|
|
64
64
|
flatbuffers::FlatBufferBuilder& builder) const;
|
|
65
65
|
void ProcessStunPacketFromWebRtcServer(
|
|
66
|
-
RTC::TransportTuple* tuple, const RTC::ICE::StunPacket* packet);
|
|
66
|
+
RTC::TransportTuple* tuple, const RTC::ICE::StunPacket* packet, int64_t receivedAtUs);
|
|
67
67
|
void ProcessNonStunPacketFromWebRtcServer(
|
|
68
|
-
RTC::TransportTuple* tuple,
|
|
68
|
+
RTC::TransportTuple* tuple,
|
|
69
|
+
const uint8_t* data,
|
|
70
|
+
size_t len,
|
|
71
|
+
size_t bufferLen,
|
|
72
|
+
int64_t receivedAtUs);
|
|
69
73
|
void RemoveTuple(RTC::TransportTuple* tuple);
|
|
70
74
|
|
|
71
75
|
/* Methods inherited from Channel::ChannelSocket::RequestHandler. */
|
|
@@ -92,11 +96,24 @@ namespace RTC
|
|
|
92
96
|
bool SendData(const uint8_t* data, size_t len) override;
|
|
93
97
|
void RecvStreamClosed(uint32_t ssrc) override;
|
|
94
98
|
void SendStreamClosed(uint32_t ssrc) override;
|
|
95
|
-
void OnPacketReceived(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
void OnPacketReceived(
|
|
100
|
+
RTC::TransportTuple* tuple,
|
|
101
|
+
const uint8_t* data,
|
|
102
|
+
size_t len,
|
|
103
|
+
size_t bufferLen,
|
|
104
|
+
int64_t receivedAtUs);
|
|
105
|
+
void OnStunDataReceived(
|
|
106
|
+
RTC::TransportTuple* tuple, const uint8_t* data, size_t len, int64_t receivedAtUs);
|
|
107
|
+
void OnDtlsDataReceived(
|
|
108
|
+
const RTC::TransportTuple* tuple, const uint8_t* data, size_t len, int64_t receivedAtUs);
|
|
109
|
+
void OnRtpDataReceived(
|
|
110
|
+
RTC::TransportTuple* tuple,
|
|
111
|
+
const uint8_t* data,
|
|
112
|
+
size_t len,
|
|
113
|
+
size_t bufferLen,
|
|
114
|
+
int64_t receivedAtUs);
|
|
115
|
+
void OnRtcpDataReceived(
|
|
116
|
+
RTC::TransportTuple* tuple, const uint8_t* data, size_t len, int64_t receivedAtUs);
|
|
100
117
|
|
|
101
118
|
/* Pure virtual methods inherited from RTC::UdpSocket::Listener. */
|
|
102
119
|
public:
|
|
@@ -105,7 +122,8 @@ namespace RTC
|
|
|
105
122
|
const uint8_t* data,
|
|
106
123
|
size_t len,
|
|
107
124
|
size_t bufferLen,
|
|
108
|
-
const struct sockaddr* remoteAddr
|
|
125
|
+
const struct sockaddr* remoteAddr,
|
|
126
|
+
int64_t receivedAtUs) override;
|
|
109
127
|
|
|
110
128
|
/* Pure virtual methods inherited from RTC::TcpServer::Listener. */
|
|
111
129
|
public:
|
|
@@ -114,7 +132,11 @@ namespace RTC
|
|
|
114
132
|
/* Pure virtual methods inherited from RTC::TcpConnection::Listener. */
|
|
115
133
|
public:
|
|
116
134
|
void OnTcpConnectionPacketReceived(
|
|
117
|
-
RTC::TcpConnection* connection,
|
|
135
|
+
RTC::TcpConnection* connection,
|
|
136
|
+
const uint8_t* data,
|
|
137
|
+
size_t len,
|
|
138
|
+
size_t bufferLen,
|
|
139
|
+
int64_t receivedAtUs) override;
|
|
118
140
|
|
|
119
141
|
/* Pure virtual methods inherited from RTC::ICE::IceServer::Listener. */
|
|
120
142
|
public:
|
|
@@ -150,7 +172,10 @@ namespace RTC
|
|
|
150
172
|
void OnDtlsTransportSendData(
|
|
151
173
|
const RTC::DtlsTransport* dtlsTransport, const uint8_t* data, size_t len) override;
|
|
152
174
|
void OnDtlsTransportApplicationDataReceived(
|
|
153
|
-
const RTC::DtlsTransport* dtlsTransport,
|
|
175
|
+
const RTC::DtlsTransport* dtlsTransport,
|
|
176
|
+
const uint8_t* data,
|
|
177
|
+
size_t len,
|
|
178
|
+
int64_t receivedAtUs) override;
|
|
154
179
|
|
|
155
180
|
private:
|
|
156
181
|
// Passed by argument.
|
|
@@ -34,11 +34,13 @@ public:
|
|
|
34
34
|
{
|
|
35
35
|
LogLevel logLevel{ LogLevel::LOG_ERROR };
|
|
36
36
|
struct LogTags logTags;
|
|
37
|
-
uint16_t rtcMinPort{
|
|
38
|
-
uint16_t rtcMaxPort{
|
|
37
|
+
uint16_t rtcMinPort{ 10000 };
|
|
38
|
+
uint16_t rtcMaxPort{ 59999 };
|
|
39
39
|
std::string dtlsCertificateFile;
|
|
40
40
|
std::string dtlsPrivateKeyFile;
|
|
41
|
+
#ifndef MS_USE_BUILTIN_BWE
|
|
41
42
|
std::string libwebrtcFieldTrials{ "WebRTC-Bwe-AlrLimitedBackoff/Enabled/" };
|
|
43
|
+
#endif
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
public:
|
|
@@ -26,39 +26,24 @@ public:
|
|
|
26
26
|
return this->channelNotifier.get();
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
TimerHandleInterface* CreateTimer(TimerHandleInterface::Listener* listener) override;
|
|
29
|
+
TimerHandleInterface* CreateTimer(TimerHandleInterface::Listener* listener, std::string label) override;
|
|
30
30
|
|
|
31
31
|
BackoffTimerHandleInterface* CreateBackoffTimer(
|
|
32
32
|
const BackoffTimerHandleInterface::BackoffTimerHandleOptions& options) override;
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
int64_t GetTimeMs() override
|
|
35
35
|
{
|
|
36
36
|
return DepLibUV::GetTimeMs();
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
int64_t GetTimeUs() override
|
|
40
40
|
{
|
|
41
41
|
return DepLibUV::GetTimeUs();
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
int64_t GetNtpOffsetUs() override
|
|
45
45
|
{
|
|
46
|
-
return DepLibUV::
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
int64_t GetTimeMsInt64() override
|
|
50
|
-
{
|
|
51
|
-
return DepLibUV::GetTimeMsInt64();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
int64_t GetTimeUsInt64() override
|
|
55
|
-
{
|
|
56
|
-
return DepLibUV::GetTimeUsInt64();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
uint64_t GetNtpOffsetMs() override
|
|
60
|
-
{
|
|
61
|
-
return DepLibUV::GetNtpOffsetMs();
|
|
46
|
+
return DepLibUV::GetNtpOffsetUs();
|
|
62
47
|
}
|
|
63
48
|
|
|
64
49
|
private:
|
|
@@ -29,7 +29,8 @@ public:
|
|
|
29
29
|
* @remarks
|
|
30
30
|
* - The caller is responsible for freeing it.
|
|
31
31
|
*/
|
|
32
|
-
virtual TimerHandleInterface* CreateTimer(
|
|
32
|
+
virtual TimerHandleInterface* CreateTimer(
|
|
33
|
+
TimerHandleInterface::Listener* listener, std::string label) = 0;
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
* Creates a BackoffTimerHandle timer.
|
|
@@ -43,41 +44,18 @@ public:
|
|
|
43
44
|
/**
|
|
44
45
|
* Get current time in milliseconds.
|
|
45
46
|
*/
|
|
46
|
-
virtual
|
|
47
|
+
virtual int64_t GetTimeMs() = 0;
|
|
47
48
|
|
|
48
49
|
/**
|
|
49
50
|
* Get current time in microseconds.
|
|
50
51
|
*/
|
|
51
|
-
virtual
|
|
52
|
+
virtual int64_t GetTimeUs() = 0;
|
|
52
53
|
|
|
53
54
|
/**
|
|
54
|
-
*
|
|
55
|
-
*/
|
|
56
|
-
virtual uint64_t GetTimeNs() = 0;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @remarks
|
|
60
|
-
* - Used within libwebrtc dependency which uses int64_t values for time
|
|
61
|
-
* representation.
|
|
62
|
-
*
|
|
63
|
-
* @todo Remove once not needed.
|
|
64
|
-
*/
|
|
65
|
-
virtual int64_t GetTimeMsInt64() = 0;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @remarks
|
|
69
|
-
* - Used within libwebrtc dependency which uses int64_t values for time
|
|
70
|
-
* representation.
|
|
71
|
-
*
|
|
72
|
-
* @todo Remove once not needed.
|
|
73
|
-
*/
|
|
74
|
-
virtual int64_t GetTimeUsInt64() = 0;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Distance from the clock above to the NTP epoch (ms), which is what has to be added
|
|
55
|
+
* Distance from the clock above to the NTP epoch (us), which is what has to be added
|
|
78
56
|
* to it to obtain the NTP timestamps of the RTCP we generate.
|
|
79
57
|
*/
|
|
80
|
-
virtual
|
|
58
|
+
virtual int64_t GetNtpOffsetUs() = 0;
|
|
81
59
|
};
|
|
82
60
|
|
|
83
61
|
#endif
|
package/worker/include/Utils.hpp
CHANGED
|
@@ -197,13 +197,13 @@ namespace Utils
|
|
|
197
197
|
template<typename T>
|
|
198
198
|
typename std::enable_if<std::is_unsigned<T>::value, bool>::type static IsPaddedTo4Bytes(T size)
|
|
199
199
|
{
|
|
200
|
-
return (size & 0x03) ==
|
|
200
|
+
return (size & 0x03) == 0;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
template<typename T>
|
|
204
204
|
typename std::enable_if<std::is_unsigned<T>::value, bool>::type static IsPaddedTo8Bytes(T size)
|
|
205
205
|
{
|
|
206
|
-
return (size & 0x07) ==
|
|
206
|
+
return (size & 0x07) == 0;
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
template<typename T>
|
|
@@ -515,7 +515,10 @@ namespace Utils
|
|
|
515
515
|
uint32_t fractions;
|
|
516
516
|
};
|
|
517
517
|
|
|
518
|
-
|
|
518
|
+
/**
|
|
519
|
+
* Convert microseconds into an NTP timestamp.
|
|
520
|
+
*/
|
|
521
|
+
static Time::Ntp TimeUs2Ntp(int64_t timeUs)
|
|
519
522
|
{
|
|
520
523
|
Time::Ntp ntp{}; // NOLINT(cppcoreguidelines-pro-type-member-init)
|
|
521
524
|
|
|
@@ -523,28 +526,44 @@ namespace Utils
|
|
|
523
526
|
// every 2^32 seconds since Jan 1, 1900, being Feb 7, 2036 the next time it
|
|
524
527
|
// happens. That is the NTP era and receivers deal with it by doing modular
|
|
525
528
|
// arithmetic, so there is nothing to protect against here.
|
|
526
|
-
ntp.seconds = static_cast<uint32_t>(
|
|
529
|
+
ntp.seconds = static_cast<uint32_t>(timeUs / 1000000);
|
|
527
530
|
ntp.fractions =
|
|
528
|
-
static_cast<uint32_t>((static_cast<double>(
|
|
531
|
+
static_cast<uint32_t>((static_cast<double>(timeUs % 1000000) / 1000000) * NtpFractionalUnit);
|
|
529
532
|
|
|
530
533
|
return ntp;
|
|
531
534
|
}
|
|
532
535
|
|
|
533
|
-
|
|
536
|
+
/**
|
|
537
|
+
* Convert an NTP timestamp into microseconds.
|
|
538
|
+
*/
|
|
539
|
+
static int64_t Ntp2TimeUs(Time::Ntp ntp)
|
|
534
540
|
{
|
|
535
541
|
return (
|
|
536
|
-
(static_cast<
|
|
537
|
-
static_cast<
|
|
538
|
-
std::round((static_cast<double>(ntp.fractions) *
|
|
542
|
+
(static_cast<int64_t>(ntp.seconds) * 1000000) +
|
|
543
|
+
static_cast<int64_t>(
|
|
544
|
+
std::round((static_cast<double>(ntp.fractions) * 1000000) / NtpFractionalUnit)));
|
|
539
545
|
}
|
|
540
546
|
|
|
541
|
-
|
|
547
|
+
/**
|
|
548
|
+
* Convert microseconds into the 6.18 fixed point seconds of the
|
|
549
|
+
* `abs-send-time` RTP header extension, whose resolution is hence 1/262144
|
|
550
|
+
* of a second.
|
|
551
|
+
*/
|
|
552
|
+
static uint32_t TimeUsToAbsSendTime(int64_t timeUs)
|
|
542
553
|
{
|
|
543
|
-
|
|
554
|
+
// Period after which the 24 bits of the field wrap around.
|
|
555
|
+
constexpr int64_t WrapPeriodUs{ 64 * 1000000 };
|
|
556
|
+
|
|
557
|
+
// NOTE: Bring the given time into the period first. This keeps the shift
|
|
558
|
+
// below from overflowing, and makes a negative time yield the same value
|
|
559
|
+
// as the positive time it's congruent with rather than a meaningless one.
|
|
560
|
+
const int64_t wrappedUs = ((timeUs % WrapPeriodUs) + WrapPeriodUs) % WrapPeriodUs;
|
|
561
|
+
|
|
562
|
+
return static_cast<uint32_t>(((wrappedUs << 18) + 500000) / 1000000) & 0x00FFFFFF;
|
|
544
563
|
}
|
|
545
564
|
|
|
546
565
|
/**
|
|
547
|
-
* Convert
|
|
566
|
+
* Convert microseconds into signed Q32.32 fixed point seconds, which is how the
|
|
548
567
|
* `abs-capture-time` RTP header extension encodes its clock offset, being the
|
|
549
568
|
* capture timestamp itself unsigned instead (UQ32.32).
|
|
550
569
|
*
|
|
@@ -553,29 +572,29 @@ namespace Utils
|
|
|
553
572
|
*
|
|
554
573
|
* @see https://datatracker.ietf.org/doc/html/draft-ietf-avtcore-abs-capture-time-00
|
|
555
574
|
*/
|
|
556
|
-
static std::optional<int64_t>
|
|
575
|
+
static std::optional<int64_t> TimeUs2Q32x32(int64_t timeUs)
|
|
557
576
|
{
|
|
558
577
|
// The seconds of the format are 32 bits wide, so from here on it does not fit.
|
|
559
|
-
static constexpr int64_t
|
|
578
|
+
static constexpr int64_t OutOfRangeUs{ (1LL << 31) * 1000000 };
|
|
560
579
|
|
|
561
|
-
if (
|
|
580
|
+
if (timeUs >= OutOfRangeUs || timeUs <= -OutOfRangeUs)
|
|
562
581
|
{
|
|
563
582
|
return std::nullopt;
|
|
564
583
|
}
|
|
565
584
|
|
|
566
|
-
return static_cast<int64_t>(
|
|
567
|
-
|
|
585
|
+
return static_cast<int64_t>(std::round(
|
|
586
|
+
static_cast<double>(timeUs) * (static_cast<double>(NtpFractionalUnit) / 1000000)));
|
|
568
587
|
}
|
|
569
588
|
|
|
570
589
|
/**
|
|
571
|
-
* Convert signed Q32.32 fixed point seconds into
|
|
590
|
+
* Convert signed Q32.32 fixed point seconds into microseconds.
|
|
572
591
|
*
|
|
573
592
|
* @see https://datatracker.ietf.org/doc/html/draft-ietf-avtcore-abs-capture-time-00
|
|
574
593
|
*/
|
|
575
|
-
static int64_t
|
|
594
|
+
static int64_t Q32x32ToTimeUs(int64_t q32x32)
|
|
576
595
|
{
|
|
577
|
-
return static_cast<int64_t>(
|
|
578
|
-
|
|
596
|
+
return static_cast<int64_t>(std::round(
|
|
597
|
+
static_cast<double>(q32x32) * (1000000 / static_cast<double>(NtpFractionalUnit))));
|
|
579
598
|
}
|
|
580
599
|
};
|
|
581
600
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#ifndef MS_COMMON_HPP
|
|
2
2
|
#define MS_COMMON_HPP
|
|
3
3
|
|
|
4
|
+
// NOTE: This is an umbrella header. The includes below are not meant to be used
|
|
5
|
+
// by this file, but re-exported to whoever includes it.
|
|
6
|
+
// IWYU pragma: begin_exports
|
|
4
7
|
#include <algorithm> // std::transform(), std::find(), std::min(), std::max(), std::copy(), std::clamp(), std::ranges
|
|
5
8
|
#include <cinttypes> // PRIu64, etc
|
|
6
9
|
#include <cstddef> // size_t
|
|
@@ -24,6 +27,7 @@ typedef SSIZE_T ssize_t;
|
|
|
24
27
|
#include <netinet/in.h> // sockaddr_in, sockaddr_in6
|
|
25
28
|
#include <sys/socket.h> // struct sockaddr, struct sockaddr_storage, AF_INET, AF_INET6
|
|
26
29
|
#endif
|
|
30
|
+
// IWYU pragma: end_exports
|
|
27
31
|
|
|
28
32
|
// This is a macro to silence false warnings in GCC in switch() blocks with FBS
|
|
29
33
|
// types.
|
|
@@ -40,7 +40,7 @@ public:
|
|
|
40
40
|
* Set the base timeout duration. It will be applied after the next timeout
|
|
41
41
|
* and effective duration can be larger if backoff algorithm is exponential.
|
|
42
42
|
*/
|
|
43
|
-
void SetBaseTimeoutMs(
|
|
43
|
+
void SetBaseTimeoutMs(int64_t baseTimeoutMs) override;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* Whether the BackoffTimer is running. Useful to check if this BackoffTimer
|
|
@@ -77,7 +77,7 @@ public:
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
private:
|
|
80
|
-
|
|
80
|
+
int64_t ComputeNextTimeoutMs() const;
|
|
81
81
|
|
|
82
82
|
/* Pure virtual methods inherited from TimerHandleInterface::Listener. */
|
|
83
83
|
public:
|
|
@@ -87,9 +87,9 @@ private:
|
|
|
87
87
|
// Passed by argument.
|
|
88
88
|
BackoffTimerHandleInterface::Listener* listener{ nullptr };
|
|
89
89
|
const std::string label;
|
|
90
|
-
|
|
90
|
+
int64_t baseTimeoutMs;
|
|
91
91
|
BackoffAlgorithm backoffAlgorithm;
|
|
92
|
-
std::optional<
|
|
92
|
+
std::optional<int64_t> maxBackoffTimeoutMs;
|
|
93
93
|
std::optional<size_t> maxRestarts;
|
|
94
94
|
// Allocated by this.
|
|
95
95
|
TimerHandle* timer{ nullptr };
|
|
@@ -23,7 +23,7 @@ public:
|
|
|
23
23
|
* it must signal it be setting `stop` to true.
|
|
24
24
|
*/
|
|
25
25
|
virtual void OnBackoffTimer(
|
|
26
|
-
BackoffTimerHandleInterface* backoffTimer,
|
|
26
|
+
BackoffTimerHandleInterface* backoffTimer, int64_t& baseTimeoutMs, bool& stop) = 0;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
public:
|
|
@@ -51,7 +51,7 @@ public:
|
|
|
51
51
|
/**
|
|
52
52
|
* Base timeout duration (ms).
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
int64_t baseTimeoutMs;
|
|
55
55
|
/**
|
|
56
56
|
* Backoff algorithm.
|
|
57
57
|
*/
|
|
@@ -60,7 +60,7 @@ public:
|
|
|
60
60
|
* Maximum duration of the backoff timeout (ms). If no value is given, no
|
|
61
61
|
* limit is set.
|
|
62
62
|
*/
|
|
63
|
-
std::optional<
|
|
63
|
+
std::optional<int64_t> maxBackoffTimeoutMs;
|
|
64
64
|
/**
|
|
65
65
|
* Maximum number of restarts. If no value is given, it will restart
|
|
66
66
|
* forever until stopped.
|
|
@@ -69,7 +69,7 @@ public:
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
public:
|
|
72
|
-
static constexpr
|
|
72
|
+
static constexpr int64_t MaxTimeoutMs{ std::numeric_limits<int64_t>::max() / 2 };
|
|
73
73
|
|
|
74
74
|
public:
|
|
75
75
|
BackoffTimerHandleInterface() = default;
|
|
@@ -96,7 +96,7 @@ public:
|
|
|
96
96
|
* Set the base timeout duration. It will be applied after the next timeout
|
|
97
97
|
* and effective duration can be larger if backoff algorithm is exponential.
|
|
98
98
|
*/
|
|
99
|
-
virtual void SetBaseTimeoutMs(
|
|
99
|
+
virtual void SetBaseTimeoutMs(int64_t baseTimeoutMs) = 0;
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
102
|
* Whether the BackoffTimer is running. Useful to check if this BackoffTimer
|
|
@@ -125,16 +125,16 @@ protected:
|
|
|
125
125
|
|
|
126
126
|
protected:
|
|
127
127
|
// Passed by argument.
|
|
128
|
-
size_t bufferSize{
|
|
128
|
+
size_t bufferSize{ 0 };
|
|
129
129
|
// Allocated by this.
|
|
130
130
|
uint8_t* buffer{ nullptr };
|
|
131
131
|
// Others.
|
|
132
|
-
size_t bufferDataLen{
|
|
132
|
+
size_t bufferDataLen{ 0 };
|
|
133
133
|
std::string localIp;
|
|
134
|
-
uint16_t localPort{
|
|
134
|
+
uint16_t localPort{ 0 };
|
|
135
135
|
struct sockaddr_storage peerAddr{};
|
|
136
136
|
std::string peerIp;
|
|
137
|
-
uint16_t peerPort{
|
|
137
|
+
uint16_t peerPort{ 0 };
|
|
138
138
|
|
|
139
139
|
private:
|
|
140
140
|
// Passed by argument.
|
|
@@ -144,8 +144,8 @@ private:
|
|
|
144
144
|
// Others.
|
|
145
145
|
struct sockaddr_storage* localAddr{ nullptr };
|
|
146
146
|
bool closed{ false };
|
|
147
|
-
size_t recvBytes{
|
|
148
|
-
size_t sentBytes{
|
|
147
|
+
size_t recvBytes{ 0 };
|
|
148
|
+
size_t sentBytes{ 0 };
|
|
149
149
|
bool isClosedByPeer{ false };
|
|
150
150
|
bool hasError{ false };
|
|
151
151
|
};
|
|
@@ -16,7 +16,7 @@ class TimerHandle : public TimerHandleInterface
|
|
|
16
16
|
friend class BackoffTimerHandle;
|
|
17
17
|
|
|
18
18
|
private:
|
|
19
|
-
explicit TimerHandle(TimerHandleInterface::Listener* listener);
|
|
19
|
+
explicit TimerHandle(TimerHandleInterface::Listener* listener, std::string label);
|
|
20
20
|
|
|
21
21
|
public:
|
|
22
22
|
TimerHandle& operator=(const TimerHandle&) = delete;
|
|
@@ -26,22 +26,22 @@ public:
|
|
|
26
26
|
~TimerHandle() override;
|
|
27
27
|
|
|
28
28
|
public:
|
|
29
|
-
void Start(
|
|
29
|
+
void Start(int64_t timeoutMs, int64_t repeatMs = 0) override;
|
|
30
30
|
|
|
31
31
|
void Stop() override;
|
|
32
32
|
|
|
33
33
|
void Restart() override;
|
|
34
34
|
|
|
35
|
-
void Restart(
|
|
35
|
+
void Restart(int64_t timeoutMs, int64_t repeatMs = 0) override;
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
int64_t GetTimeoutMs() const override
|
|
38
38
|
{
|
|
39
|
-
return this->
|
|
39
|
+
return this->timeoutMs;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
int64_t GetRepeatMs() const override
|
|
43
43
|
{
|
|
44
|
-
return this->
|
|
44
|
+
return this->repeatMs;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
bool IsActive() const override
|
|
@@ -49,6 +49,11 @@ public:
|
|
|
49
49
|
return uv_is_active(reinterpret_cast<uv_handle_t*>(this->uvHandle)) != 0;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
const std::string GetLabel() const override
|
|
53
|
+
{
|
|
54
|
+
return this->label;
|
|
55
|
+
}
|
|
56
|
+
|
|
52
57
|
private:
|
|
53
58
|
void InternalClose();
|
|
54
59
|
|
|
@@ -59,12 +64,13 @@ public:
|
|
|
59
64
|
private:
|
|
60
65
|
// Passed by argument.
|
|
61
66
|
TimerHandleInterface::Listener* listener{ nullptr };
|
|
67
|
+
const std::string label;
|
|
62
68
|
// Allocated by this.
|
|
63
69
|
uv_timer_t* uvHandle{ nullptr };
|
|
64
70
|
// Others.
|
|
65
71
|
bool closed{ false };
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
int64_t timeoutMs{ 0 };
|
|
73
|
+
int64_t repeatMs{ 0 };
|
|
68
74
|
};
|
|
69
75
|
|
|
70
76
|
#endif
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#define MS_TIMER_HANDLE_INTERFACE_HPP
|
|
3
3
|
|
|
4
4
|
#include "common.hpp"
|
|
5
|
+
#include <string>
|
|
5
6
|
|
|
6
7
|
class TimerHandleInterface
|
|
7
8
|
{
|
|
@@ -25,19 +26,24 @@ public:
|
|
|
25
26
|
virtual ~TimerHandleInterface() = default;
|
|
26
27
|
|
|
27
28
|
public:
|
|
28
|
-
virtual void Start(
|
|
29
|
+
virtual void Start(int64_t timeoutMs, int64_t repeatMs = 0) = 0;
|
|
29
30
|
|
|
30
31
|
virtual void Stop() = 0;
|
|
31
32
|
|
|
32
33
|
virtual void Restart() = 0;
|
|
33
34
|
|
|
34
|
-
virtual void Restart(
|
|
35
|
+
virtual void Restart(int64_t timeoutMs, int64_t repeatMs = 0) = 0;
|
|
35
36
|
|
|
36
|
-
virtual
|
|
37
|
+
virtual int64_t GetTimeoutMs() const = 0;
|
|
37
38
|
|
|
38
|
-
virtual
|
|
39
|
+
virtual int64_t GetRepeatMs() const = 0;
|
|
39
40
|
|
|
40
41
|
virtual bool IsActive() const = 0;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Label of this timer, given at creation time.
|
|
45
|
+
*/
|
|
46
|
+
virtual const std::string GetLabel() const = 0;
|
|
41
47
|
};
|
|
42
48
|
|
|
43
49
|
#endif
|
|
@@ -96,15 +96,15 @@ protected:
|
|
|
96
96
|
protected:
|
|
97
97
|
struct sockaddr_storage localAddr{};
|
|
98
98
|
std::string localIp;
|
|
99
|
-
uint16_t localPort{
|
|
99
|
+
uint16_t localPort{ 0 };
|
|
100
100
|
|
|
101
101
|
private:
|
|
102
102
|
// Allocated by this (may be passed by argument).
|
|
103
103
|
uv_udp_t* uvHandle{ nullptr };
|
|
104
104
|
// Others.
|
|
105
105
|
bool closed{ false };
|
|
106
|
-
size_t recvBytes{
|
|
107
|
-
size_t sentBytes{
|
|
106
|
+
size_t recvBytes{ 0 };
|
|
107
|
+
size_t sentBytes{ 0 };
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
#endif
|
|
@@ -71,12 +71,12 @@ private:
|
|
|
71
71
|
|
|
72
72
|
protected:
|
|
73
73
|
// Passed by argument.
|
|
74
|
-
size_t bufferSize{
|
|
74
|
+
size_t bufferSize{ 0 };
|
|
75
75
|
UnixStreamSocketHandle::Role role;
|
|
76
76
|
// Allocated by this.
|
|
77
77
|
uint8_t* buffer{ nullptr };
|
|
78
78
|
// Others.
|
|
79
|
-
size_t bufferDataLen{
|
|
79
|
+
size_t bufferDataLen{ 0 };
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
#endif
|