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
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "common.hpp"
|
|
5
5
|
#include "handles/TimerHandleInterface.hpp"
|
|
6
|
+
#include <limits>
|
|
6
7
|
|
|
7
8
|
namespace mocks
|
|
8
9
|
{
|
|
@@ -15,48 +16,49 @@ namespace mocks
|
|
|
15
16
|
friend class mocks::MockShared;
|
|
16
17
|
|
|
17
18
|
private:
|
|
18
|
-
explicit MockTimerHandle(
|
|
19
|
+
explicit MockTimerHandle(
|
|
20
|
+
TimerHandleInterface::Listener* listener,
|
|
21
|
+
std::string label,
|
|
22
|
+
std::function<int64_t()> getTimeMs,
|
|
23
|
+
std::function<void()> onDelete);
|
|
19
24
|
|
|
20
25
|
public:
|
|
21
26
|
MockTimerHandle& operator=(const MockTimerHandle&) = delete;
|
|
22
27
|
|
|
23
28
|
MockTimerHandle(const MockTimerHandle&) = delete;
|
|
24
29
|
|
|
25
|
-
~MockTimerHandle() override
|
|
26
|
-
|
|
27
|
-
public:
|
|
28
|
-
void Start(uint64_t timeout, uint64_t repeat = 0) override
|
|
30
|
+
~MockTimerHandle() override
|
|
29
31
|
{
|
|
30
|
-
this->
|
|
31
|
-
this->timeout = timeout;
|
|
32
|
-
this->repeat = repeat;
|
|
32
|
+
this->onDelete();
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
public:
|
|
36
|
+
void Dump(int indentation = 0) const;
|
|
37
|
+
|
|
38
|
+
void Start(int64_t timeoutMs, int64_t repeatMs = 0) override;
|
|
39
|
+
|
|
35
40
|
void Stop() override
|
|
36
41
|
{
|
|
37
|
-
this->running
|
|
42
|
+
this->running = false;
|
|
43
|
+
this->expiresAtMs = std::numeric_limits<int64_t>::max();
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
void Restart() override
|
|
41
47
|
{
|
|
42
|
-
this->running
|
|
48
|
+
this->running = true;
|
|
49
|
+
this->expiresAtMs = this->getTimeMs() + this->timeoutMs;
|
|
43
50
|
}
|
|
44
51
|
|
|
45
|
-
void Restart(
|
|
46
|
-
{
|
|
47
|
-
this->running = true;
|
|
48
|
-
this->timeout = timeout;
|
|
49
|
-
this->repeat = repeat;
|
|
50
|
-
}
|
|
52
|
+
void Restart(int64_t timeoutMs, int64_t repeatMs = 0) override;
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
int64_t GetTimeoutMs() const override
|
|
53
55
|
{
|
|
54
|
-
return this->
|
|
56
|
+
return this->timeoutMs;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
|
|
59
|
+
int64_t GetRepeatMs() const override
|
|
58
60
|
{
|
|
59
|
-
return this->
|
|
61
|
+
return this->repeatMs;
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
bool IsActive() const override
|
|
@@ -64,10 +66,46 @@ namespace mocks
|
|
|
64
66
|
return this->running;
|
|
65
67
|
}
|
|
66
68
|
|
|
69
|
+
const std::string GetLabel() const override
|
|
70
|
+
{
|
|
71
|
+
return this->label;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Methods for testing.
|
|
75
|
+
public:
|
|
76
|
+
int64_t GetExpiresAtMs() const
|
|
77
|
+
{
|
|
78
|
+
return this->expiresAtMs;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
bool EvaluateHasExpired()
|
|
82
|
+
{
|
|
83
|
+
if (this->getTimeMs() >= this->expiresAtMs)
|
|
84
|
+
{
|
|
85
|
+
TriggerExpire();
|
|
86
|
+
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
else
|
|
90
|
+
{
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private:
|
|
96
|
+
void TriggerExpire();
|
|
97
|
+
|
|
67
98
|
private:
|
|
99
|
+
// Passed by argument.
|
|
100
|
+
TimerHandleInterface::Listener* listener{ nullptr };
|
|
101
|
+
const std::string label;
|
|
102
|
+
std::function<int64_t()> getTimeMs;
|
|
103
|
+
const std::function<void()> onDelete;
|
|
104
|
+
// Others.
|
|
68
105
|
bool running{ false };
|
|
69
|
-
|
|
70
|
-
|
|
106
|
+
int64_t timeoutMs{ 0 };
|
|
107
|
+
int64_t repeatMs{ 0 };
|
|
108
|
+
int64_t expiresAtMs{ std::numeric_limits<int64_t>::max() };
|
|
71
109
|
};
|
|
72
110
|
} // namespace mocks
|
|
73
111
|
|
|
@@ -3,24 +3,56 @@
|
|
|
3
3
|
|
|
4
4
|
#include "mocks/include/MockShared.hpp"
|
|
5
5
|
#include "Logger.hpp"
|
|
6
|
+
#include "MediaSoupErrors.hpp"
|
|
6
7
|
#include "mocks/include/handles/MockTimerHandle.hpp"
|
|
7
8
|
|
|
8
9
|
namespace mocks
|
|
9
10
|
{
|
|
10
|
-
MockShared::MockShared(std::function<
|
|
11
|
-
:
|
|
11
|
+
MockShared::MockShared(std::function<int64_t()> getTimeUs)
|
|
12
|
+
: getTimeUs(std::move(getTimeUs)),
|
|
12
13
|
channelSocket(new ::Channel::ChannelSocket()),
|
|
13
14
|
channelMessageRegistrator(new mocks::Channel::MockChannelMessageRegistrator()),
|
|
14
15
|
channelNotifier(new ::Channel::ChannelNotifier(this->channelSocket.get()))
|
|
15
16
|
{
|
|
16
17
|
MS_TRACE();
|
|
18
|
+
|
|
19
|
+
// Give the Channel the Shared instance, which it needs to take the arrival
|
|
20
|
+
// time of received notifications.
|
|
21
|
+
this->channelSocket->SetShared(this);
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
TimerHandleInterface* MockShared::CreateTimer(
|
|
24
|
+
TimerHandleInterface* MockShared::CreateTimer(
|
|
25
|
+
TimerHandleInterface::Listener* listener, std::string label)
|
|
20
26
|
{
|
|
21
27
|
MS_TRACE();
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
// NOTE: Timers are indexed by label so that tests can retrieve them via
|
|
30
|
+
// GetTimer(). Two alive timers sharing a label would make that lookup
|
|
31
|
+
// ambiguous.
|
|
32
|
+
if (this->timers.find(label) != this->timers.end())
|
|
33
|
+
{
|
|
34
|
+
MS_THROW_ERROR("a timer with same label already exists [label:%s]", label.c_str());
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
auto* timer = new MockTimerHandle(
|
|
38
|
+
listener,
|
|
39
|
+
label,
|
|
40
|
+
// NOTE: The timer mocks take a milliseconds callback, being that the
|
|
41
|
+
// resolution of the libuv handles they mimic.
|
|
42
|
+
/*getTimeMs*/
|
|
43
|
+
[getTimeUs = this->getTimeUs]() -> int64_t
|
|
44
|
+
{
|
|
45
|
+
return getTimeUs() / 1000;
|
|
46
|
+
},
|
|
47
|
+
/*onDelete*/
|
|
48
|
+
[this, label]()
|
|
49
|
+
{
|
|
50
|
+
this->timers.erase(label);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
this->timers[label] = timer;
|
|
54
|
+
|
|
55
|
+
return timer;
|
|
24
56
|
}
|
|
25
57
|
|
|
26
58
|
BackoffTimerHandleInterface* MockShared::CreateBackoffTimer(
|
|
@@ -30,9 +62,23 @@ namespace mocks
|
|
|
30
62
|
|
|
31
63
|
const auto& label = options.label;
|
|
32
64
|
|
|
65
|
+
// NOTE: Backoff timers are indexed by label so that tests can retrieve them
|
|
66
|
+
// via GetBackoffTimer(). Two alive timers sharing a label would make that
|
|
67
|
+
// lookup ambiguous.
|
|
68
|
+
if (this->backoffTimers.find(label) != this->backoffTimers.end())
|
|
69
|
+
{
|
|
70
|
+
MS_THROW_ERROR("a backoff timer with same label already exists [label:%s]", label.c_str());
|
|
71
|
+
}
|
|
72
|
+
|
|
33
73
|
auto* backoffTimer = new MockBackoffTimerHandle(
|
|
34
74
|
options,
|
|
35
|
-
|
|
75
|
+
// NOTE: The timer mocks take a milliseconds callback, being that the
|
|
76
|
+
// resolution of the libuv handles they mimic.
|
|
77
|
+
/*getTimeMs*/
|
|
78
|
+
[getTimeUs = this->getTimeUs]() -> int64_t
|
|
79
|
+
{
|
|
80
|
+
return getTimeUs() / 1000;
|
|
81
|
+
},
|
|
36
82
|
/*onDelete*/
|
|
37
83
|
[this, label]()
|
|
38
84
|
{
|
|
@@ -10,7 +10,7 @@ namespace mocks
|
|
|
10
10
|
{
|
|
11
11
|
MockBackoffTimerHandle::MockBackoffTimerHandle(
|
|
12
12
|
BackoffTimerHandleOptions options,
|
|
13
|
-
std::function<
|
|
13
|
+
std::function<int64_t()> getTimeMs,
|
|
14
14
|
std::function<void()> onDelete)
|
|
15
15
|
: listener(options.listener),
|
|
16
16
|
label(std::move(options.label)),
|
|
@@ -25,7 +25,7 @@ namespace mocks
|
|
|
25
25
|
|
|
26
26
|
if (!this->listener)
|
|
27
27
|
{
|
|
28
|
-
MS_THROW_TYPE_ERROR("options.listener must be given");
|
|
28
|
+
MS_THROW_TYPE_ERROR("[%s] options.listener must be given", this->label.c_str());
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
if (this->label.empty())
|
|
@@ -33,10 +33,18 @@ namespace mocks
|
|
|
33
33
|
MS_THROW_TYPE_ERROR("options.label must be given");
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
if (this->baseTimeoutMs < 0)
|
|
37
|
+
{
|
|
38
|
+
MS_THROW_TYPE_ERROR(
|
|
39
|
+
"[%s] options.baseTimeoutMs (%" PRIi64 " ms) cannot be negative",
|
|
40
|
+
this->label.c_str(),
|
|
41
|
+
this->baseTimeoutMs);
|
|
42
|
+
}
|
|
43
|
+
|
|
36
44
|
if (this->baseTimeoutMs > BackoffTimerHandleInterface::MaxTimeoutMs)
|
|
37
45
|
{
|
|
38
|
-
|
|
39
|
-
"[%s]
|
|
46
|
+
MS_THROW_TYPE_ERROR(
|
|
47
|
+
"[%s] options.baseTimeoutMs (%" PRIi64 " ms) cannot be greater than %" PRIi64 " ms",
|
|
40
48
|
this->label.c_str(),
|
|
41
49
|
this->baseTimeoutMs,
|
|
42
50
|
BackoffTimerHandleInterface::MaxTimeoutMs);
|
|
@@ -47,39 +55,45 @@ namespace mocks
|
|
|
47
55
|
{
|
|
48
56
|
MS_TRACE();
|
|
49
57
|
|
|
50
|
-
const
|
|
58
|
+
const int64_t nowMs = this->getTimeMs();
|
|
51
59
|
|
|
52
60
|
MS_DUMP_CLEAN(indentation, "<mocks::MockBackoffTimerHandle>");
|
|
53
61
|
|
|
54
62
|
MS_DUMP_CLEAN(indentation, " label: %s", this->label.c_str());
|
|
55
|
-
MS_DUMP_CLEAN(indentation, " base timeout (ms): %"
|
|
63
|
+
MS_DUMP_CLEAN(indentation, " base timeout (ms): %" PRIi64, this->baseTimeoutMs);
|
|
56
64
|
MS_DUMP_CLEAN(
|
|
57
65
|
indentation,
|
|
58
66
|
" max backoff timeout (ms): %s",
|
|
59
67
|
this->maxBackoffTimeoutMs.has_value()
|
|
60
68
|
? std::to_string(this->maxBackoffTimeoutMs.value()).c_str()
|
|
61
|
-
|
|
69
|
+
: "(unset)");
|
|
62
70
|
MS_DUMP_CLEAN(
|
|
63
71
|
indentation,
|
|
64
72
|
" max restarts (ms): %s",
|
|
65
73
|
this->maxRestarts.has_value() ? std::to_string(this->maxRestarts.value()).c_str() : "(unset)");
|
|
66
74
|
MS_DUMP_CLEAN(indentation, " running: %s", this->running ? "yes" : "no");
|
|
67
75
|
MS_DUMP_CLEAN(indentation, " expiration count: %zu", this->expirationCount);
|
|
68
|
-
MS_DUMP_CLEAN(indentation, " now (ms): %"
|
|
69
|
-
MS_DUMP_CLEAN(indentation, " expires at (ms): %"
|
|
70
|
-
MS_DUMP_CLEAN(indentation, " expires in (ms): %"
|
|
76
|
+
MS_DUMP_CLEAN(indentation, " now (ms): %" PRIi64, nowMs);
|
|
77
|
+
MS_DUMP_CLEAN(indentation, " expires at (ms): %" PRIi64, this->expiresAtMs);
|
|
78
|
+
MS_DUMP_CLEAN(indentation, " expires in (ms): %" PRIi64, this->expiresAtMs - nowMs);
|
|
71
79
|
|
|
72
80
|
MS_DUMP_CLEAN(indentation, "</mocks::MockBackoffTimerHandle>");
|
|
73
81
|
}
|
|
74
82
|
|
|
75
|
-
void MockBackoffTimerHandle::SetBaseTimeoutMs(
|
|
83
|
+
void MockBackoffTimerHandle::SetBaseTimeoutMs(int64_t baseTimeoutMs)
|
|
76
84
|
{
|
|
77
85
|
MS_TRACE();
|
|
78
86
|
|
|
87
|
+
if (baseTimeoutMs < 0)
|
|
88
|
+
{
|
|
89
|
+
MS_THROW_TYPE_ERROR(
|
|
90
|
+
"[%s] baseTimeoutMs (%" PRIi64 " ms) cannot be negative", this->label.c_str(), baseTimeoutMs);
|
|
91
|
+
}
|
|
92
|
+
|
|
79
93
|
if (baseTimeoutMs > BackoffTimerHandleInterface::MaxTimeoutMs)
|
|
80
94
|
{
|
|
81
|
-
|
|
82
|
-
"[%s]
|
|
95
|
+
MS_THROW_TYPE_ERROR(
|
|
96
|
+
"[%s] baseTimeoutMs (%" PRIi64 " ms) cannot be greater than %" PRIi64 " ms",
|
|
83
97
|
this->label.c_str(),
|
|
84
98
|
baseTimeoutMs,
|
|
85
99
|
BackoffTimerHandleInterface::MaxTimeoutMs);
|
|
@@ -100,7 +114,7 @@ namespace mocks
|
|
|
100
114
|
this->running =
|
|
101
115
|
!this->maxRestarts.has_value() || this->expirationCount <= this->maxRestarts.value();
|
|
102
116
|
|
|
103
|
-
|
|
117
|
+
int64_t baseTimeoutMs{ this->baseTimeoutMs };
|
|
104
118
|
bool stop{ false };
|
|
105
119
|
|
|
106
120
|
// Call the listener by passing base timeout as reference so the parent has
|
|
@@ -128,7 +142,7 @@ namespace mocks
|
|
|
128
142
|
// again. Mirror that here so a stopped timer doesn't keep expiring.
|
|
129
143
|
else
|
|
130
144
|
{
|
|
131
|
-
this->expiresAtMs = std::numeric_limits<
|
|
145
|
+
this->expiresAtMs = std::numeric_limits<int64_t>::max();
|
|
132
146
|
}
|
|
133
147
|
}
|
|
134
148
|
} // namespace mocks
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
#define MS_CLASS "mocks::MockTimerHandle"
|
|
2
|
+
// #define MS_LOG_DEV_LEVEL 3
|
|
3
|
+
|
|
4
|
+
#include "mocks/include/handles/MockTimerHandle.hpp"
|
|
5
|
+
#include "Logger.hpp"
|
|
6
|
+
#include "MediaSoupErrors.hpp"
|
|
7
|
+
|
|
8
|
+
namespace mocks
|
|
9
|
+
{
|
|
10
|
+
MockTimerHandle::MockTimerHandle(
|
|
11
|
+
TimerHandleInterface::Listener* listener,
|
|
12
|
+
std::string label,
|
|
13
|
+
std::function<int64_t()> getTimeMs,
|
|
14
|
+
std::function<void()> onDelete)
|
|
15
|
+
: listener(listener),
|
|
16
|
+
label(std::move(label)),
|
|
17
|
+
getTimeMs(std::move(getTimeMs)),
|
|
18
|
+
onDelete(std::move(onDelete))
|
|
19
|
+
{
|
|
20
|
+
MS_TRACE();
|
|
21
|
+
|
|
22
|
+
if (!this->listener)
|
|
23
|
+
{
|
|
24
|
+
MS_THROW_TYPE_ERROR("[%s] listener must be given", this->label.c_str());
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (this->label.empty())
|
|
28
|
+
{
|
|
29
|
+
MS_THROW_TYPE_ERROR("label must be given");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
void MockTimerHandle::Dump(int indentation) const
|
|
34
|
+
{
|
|
35
|
+
MS_TRACE();
|
|
36
|
+
|
|
37
|
+
const int64_t nowMs = this->getTimeMs();
|
|
38
|
+
|
|
39
|
+
MS_DUMP_CLEAN(indentation, "<mocks::MockTimerHandle>");
|
|
40
|
+
|
|
41
|
+
MS_DUMP_CLEAN(indentation, " label: %s", this->label.c_str());
|
|
42
|
+
MS_DUMP_CLEAN(indentation, " timeout (ms): %" PRIi64, this->timeoutMs);
|
|
43
|
+
MS_DUMP_CLEAN(indentation, " repeat (ms): %" PRIi64, this->repeatMs);
|
|
44
|
+
MS_DUMP_CLEAN(indentation, " running: %s", this->running ? "yes" : "no");
|
|
45
|
+
MS_DUMP_CLEAN(indentation, " now (ms): %" PRIi64, nowMs);
|
|
46
|
+
MS_DUMP_CLEAN(indentation, " expires at (ms): %" PRIi64, this->expiresAtMs);
|
|
47
|
+
MS_DUMP_CLEAN(indentation, " expires in (ms): %" PRIi64, this->expiresAtMs - nowMs);
|
|
48
|
+
|
|
49
|
+
MS_DUMP_CLEAN(indentation, "</mocks::MockTimerHandle>");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
void MockTimerHandle::Start(int64_t timeoutMs, int64_t repeatMs)
|
|
53
|
+
{
|
|
54
|
+
MS_TRACE();
|
|
55
|
+
|
|
56
|
+
if (timeoutMs < 0)
|
|
57
|
+
{
|
|
58
|
+
MS_THROW_TYPE_ERROR(
|
|
59
|
+
"[%s] timeoutMs (%" PRIi64 " ms) cannot be negative", this->label.c_str(), timeoutMs);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (repeatMs < 0)
|
|
63
|
+
{
|
|
64
|
+
MS_THROW_TYPE_ERROR(
|
|
65
|
+
"[%s] repeatMs (%" PRIi64 " ms) cannot be negative", this->label.c_str(), repeatMs);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
this->timeoutMs = timeoutMs;
|
|
69
|
+
this->repeatMs = repeatMs;
|
|
70
|
+
|
|
71
|
+
this->running = true;
|
|
72
|
+
this->expiresAtMs = this->getTimeMs() + this->timeoutMs;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
void MockTimerHandle::Restart(int64_t timeoutMs, int64_t repeatMs)
|
|
76
|
+
{
|
|
77
|
+
MS_TRACE();
|
|
78
|
+
|
|
79
|
+
if (timeoutMs < 0)
|
|
80
|
+
{
|
|
81
|
+
MS_THROW_TYPE_ERROR(
|
|
82
|
+
"[%s] timeoutMs (%" PRIi64 " ms) cannot be negative", this->label.c_str(), timeoutMs);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (repeatMs < 0)
|
|
86
|
+
{
|
|
87
|
+
MS_THROW_TYPE_ERROR(
|
|
88
|
+
"[%s] repeatMs (%" PRIi64 " ms) cannot be negative", this->label.c_str(), repeatMs);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
Start(timeoutMs, repeatMs);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
void MockTimerHandle::TriggerExpire()
|
|
95
|
+
{
|
|
96
|
+
MS_TRACE();
|
|
97
|
+
|
|
98
|
+
// Schedule the next expiration, or deactivate the timer if it doesn't
|
|
99
|
+
// repeat, just like the real TimerHandle does. This is done before invoking
|
|
100
|
+
// the callback for two reasons: the listener may call Start(), Restart() or
|
|
101
|
+
// Stop() within it, which must win over this, and the listener may delete
|
|
102
|
+
// this instance within it, so nothing can be accessed afterwards.
|
|
103
|
+
if (this->repeatMs != 0)
|
|
104
|
+
{
|
|
105
|
+
this->running = true;
|
|
106
|
+
this->expiresAtMs = this->getTimeMs() + this->repeatMs;
|
|
107
|
+
}
|
|
108
|
+
else
|
|
109
|
+
{
|
|
110
|
+
this->running = false;
|
|
111
|
+
this->expiresAtMs = std::numeric_limits<int64_t>::max();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Notify the listener.
|
|
115
|
+
this->listener->OnTimer(this);
|
|
116
|
+
}
|
|
117
|
+
} // namespace mocks
|
|
@@ -9,7 +9,7 @@ const PYTHON = getPython();
|
|
|
9
9
|
const ROOT_DIR = getRootDir();
|
|
10
10
|
const BUILD_DIR = getBuildDir();
|
|
11
11
|
const NUM_CORES = getNumCores();
|
|
12
|
-
const CLANG_FORMAT_VERSION =
|
|
12
|
+
const CLANG_FORMAT_VERSION = 23;
|
|
13
13
|
const CLANG_TIDY_VERSION = 21;
|
|
14
14
|
|
|
15
15
|
const CLANG_FORMAT_PATHS = [
|
|
@@ -351,7 +351,7 @@ function getBuildDir() {
|
|
|
351
351
|
const workerInstallDir =
|
|
352
352
|
process.env.MEDIASOUP_INSTALL_DIR ??
|
|
353
353
|
`${workerOutDir}/${mediasoupBuildtype}`;
|
|
354
|
-
const buildDir = process.
|
|
354
|
+
const buildDir = process.env.BUILD_DIR ?? `${workerInstallDir}/build`;
|
|
355
355
|
|
|
356
356
|
return buildDir;
|
|
357
357
|
}
|
|
@@ -22,18 +22,17 @@ namespace Channel
|
|
|
22
22
|
|
|
23
23
|
/* Instance methods. */
|
|
24
24
|
|
|
25
|
-
ChannelNotification::ChannelNotification(
|
|
25
|
+
ChannelNotification::ChannelNotification(
|
|
26
|
+
const FBS::Notification::Notification* notification, int64_t receivedAtUs)
|
|
27
|
+
: data(notification), receivedAtUs(receivedAtUs)
|
|
26
28
|
{
|
|
27
29
|
MS_TRACE();
|
|
28
30
|
|
|
29
|
-
this->data
|
|
30
|
-
this->event = notification->event();
|
|
31
|
-
|
|
32
|
-
auto eventCStrIt = Event2String.find(this->event);
|
|
31
|
+
auto eventCStrIt = Event2String.find(this->data->event());
|
|
33
32
|
|
|
34
33
|
if (eventCStrIt == Event2String.end())
|
|
35
34
|
{
|
|
36
|
-
MS_THROW_ERROR("unknown event '%" PRIu8 "'", static_cast<uint8_t>(this->event));
|
|
35
|
+
MS_THROW_ERROR("unknown event '%" PRIu8 "'", static_cast<uint8_t>(this->data->event()));
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
this->eventCStr = eventCStrIt->second;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
#include "DepLibUV.hpp"
|
|
6
6
|
#include "Logger.hpp"
|
|
7
7
|
#include "MediaSoupErrors.hpp"
|
|
8
|
+
#include "SharedInterface.hpp"
|
|
8
9
|
#include <cstring> // std::memcpy(), std::memmove()
|
|
9
10
|
|
|
10
11
|
namespace Channel
|
|
@@ -134,6 +135,13 @@ namespace Channel
|
|
|
134
135
|
this->listener = listener;
|
|
135
136
|
}
|
|
136
137
|
|
|
138
|
+
void ChannelSocket::SetShared(SharedInterface* shared)
|
|
139
|
+
{
|
|
140
|
+
MS_TRACE_STD();
|
|
141
|
+
|
|
142
|
+
this->shared = shared;
|
|
143
|
+
}
|
|
144
|
+
|
|
137
145
|
void ChannelSocket::Send(const uint8_t* data, uint32_t dataLen)
|
|
138
146
|
{
|
|
139
147
|
MS_TRACE_STD();
|
|
@@ -204,6 +212,10 @@ namespace Channel
|
|
|
204
212
|
// and will need to be freed later.
|
|
205
213
|
if (free)
|
|
206
214
|
{
|
|
215
|
+
// NOTE: Take the arrival time before the message is parsed, so that it
|
|
216
|
+
// doesn't include the cost of processing it.
|
|
217
|
+
const int64_t receivedAtUs = this->shared->GetTimeUs();
|
|
218
|
+
|
|
207
219
|
const auto* message = FBS::Message::GetMessage(msg);
|
|
208
220
|
|
|
209
221
|
#if MS_LOG_DEV_LEVEL == 3
|
|
@@ -244,7 +256,8 @@ namespace Channel
|
|
|
244
256
|
|
|
245
257
|
try
|
|
246
258
|
{
|
|
247
|
-
notification = new ChannelNotification(
|
|
259
|
+
notification = new ChannelNotification(
|
|
260
|
+
message->data_as<FBS::Notification::Notification>(), receivedAtUs);
|
|
248
261
|
|
|
249
262
|
// Notify the listener.
|
|
250
263
|
this->listener->HandleNotification(notification);
|
|
@@ -289,6 +302,10 @@ namespace Channel
|
|
|
289
302
|
{
|
|
290
303
|
MS_TRACE();
|
|
291
304
|
|
|
305
|
+
// NOTE: Take the arrival time before the message is parsed, so that it
|
|
306
|
+
// doesn't include the cost of processing it.
|
|
307
|
+
const int64_t receivedAtUs = this->shared->GetTimeUs();
|
|
308
|
+
|
|
292
309
|
const auto* message = FBS::Message::GetMessage(msg);
|
|
293
310
|
|
|
294
311
|
#if MS_LOG_DEV_LEVEL == 3
|
|
@@ -329,7 +346,8 @@ namespace Channel
|
|
|
329
346
|
|
|
330
347
|
try
|
|
331
348
|
{
|
|
332
|
-
notification =
|
|
349
|
+
notification =
|
|
350
|
+
new ChannelNotification(message->data_as<FBS::Notification::Notification>(), receivedAtUs);
|
|
333
351
|
|
|
334
352
|
// Notify the listener.
|
|
335
353
|
this->listener->HandleNotification(notification);
|
package/worker/src/DepLibUV.cpp
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/* Class variables. */
|
|
9
9
|
|
|
10
10
|
thread_local uv_loop_t* DepLibUV::loop{ nullptr };
|
|
11
|
-
thread_local
|
|
11
|
+
thread_local int64_t DepLibUV::ntpOffsetUs{ 0 };
|
|
12
12
|
|
|
13
13
|
/* Static methods for UV callbacks. */
|
|
14
14
|
|
|
@@ -60,11 +60,10 @@ void DepLibUV::ClassInit()
|
|
|
60
60
|
MS_ABORT("uv_gettimeofday() failed");
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
const auto
|
|
64
|
-
const auto
|
|
65
|
-
const auto ntpMs = unixMs + (static_cast<uint64_t>(Utils::Time::UnixNtpOffsetSec) * 1000);
|
|
63
|
+
const auto unixUs = (timeval.tv_sec * 1000000) + static_cast<int64_t>(timeval.tv_usec);
|
|
64
|
+
const auto ntpUs = unixUs + (static_cast<int64_t>(Utils::Time::UnixNtpOffsetSec) * 1000000);
|
|
66
65
|
|
|
67
|
-
DepLibUV::
|
|
66
|
+
DepLibUV::ntpOffsetUs = ntpUs - DepLibUV::GetTimeUs();
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
void DepLibUV::ClassDestroy()
|