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
|
@@ -5,18 +5,19 @@
|
|
|
5
5
|
#include "RTC/TransportCongestionControlClient.hpp"
|
|
6
6
|
#include "Logger.hpp"
|
|
7
7
|
#include <libwebrtc/api/transport/network_types.h> // webrtc::TargetRateConstraints
|
|
8
|
+
#include <cmath> // std::llround()
|
|
8
9
|
#include <limits> // std::numeric_limits
|
|
9
10
|
|
|
10
11
|
namespace RTC
|
|
11
12
|
{
|
|
12
13
|
/* Static. */
|
|
13
14
|
|
|
14
|
-
// NOTE:
|
|
15
|
-
//
|
|
16
|
-
static constexpr
|
|
17
|
-
static constexpr
|
|
18
|
-
static constexpr
|
|
19
|
-
static constexpr
|
|
15
|
+
// NOTE: These are double rather than float because they are applied to bitrates,
|
|
16
|
+
// and float only holds exact integers up to 2^24 (16.7 Mbps).
|
|
17
|
+
static constexpr double MaxBitrateMarginFactor{ 0.1 };
|
|
18
|
+
static constexpr double MaxBitrateIncrementFactor{ 1.35 };
|
|
19
|
+
static constexpr double MaxPaddingBitrateFactor{ 0.85 };
|
|
20
|
+
static constexpr int64_t AvailableBitrateEventIntervalMs{ 1000 };
|
|
20
21
|
static constexpr size_t PacketLossHistogramLength{ 24 };
|
|
21
22
|
|
|
22
23
|
/* Instance methods. */
|
|
@@ -25,15 +26,15 @@ namespace RTC
|
|
|
25
26
|
RTC::TransportCongestionControlClient::Listener* listener,
|
|
26
27
|
SharedInterface* shared,
|
|
27
28
|
RTC::BweType bweType,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
int64_t absoluteMinOutgoingBitrate,
|
|
30
|
+
int64_t initialAvailableBitrate,
|
|
31
|
+
int64_t maxOutgoingBitrate,
|
|
32
|
+
int64_t minOutgoingBitrate)
|
|
31
33
|
: listener(listener),
|
|
32
34
|
shared(shared),
|
|
33
35
|
bweType(bweType),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
initialAvailableBitrate, RTC::TransportCongestionControlMinOutgoingBitrate)),
|
|
36
|
+
absoluteMinOutgoingBitrate(absoluteMinOutgoingBitrate),
|
|
37
|
+
initialAvailableBitrate(std::max<int64_t>(initialAvailableBitrate, absoluteMinOutgoingBitrate)),
|
|
37
38
|
maxOutgoingBitrate(maxOutgoingBitrate),
|
|
38
39
|
minOutgoingBitrate(minOutgoingBitrate)
|
|
39
40
|
{
|
|
@@ -64,7 +65,10 @@ namespace RTC
|
|
|
64
65
|
MS_ASSERT(this->rtpTransportControllerSend == nullptr, "transport controller already initialized");
|
|
65
66
|
|
|
66
67
|
webrtc::BitrateConstraints bitrateConfig;
|
|
67
|
-
|
|
68
|
+
|
|
69
|
+
// NOTE: The dependency takes a signed 32 bits bitrate, so it is clamped here.
|
|
70
|
+
bitrateConfig.start_bitrate_bps = static_cast<int>(
|
|
71
|
+
std::min<int64_t>(this->initialAvailableBitrate, std::numeric_limits<int>::max()));
|
|
68
72
|
|
|
69
73
|
this->rtpTransportControllerSend =
|
|
70
74
|
new webrtc::RtpTransportControllerSend(this, nullptr, this->controllerFactory, bitrateConfig);
|
|
@@ -78,7 +82,8 @@ namespace RTC
|
|
|
78
82
|
// videos are muted or using screensharing with still images)
|
|
79
83
|
this->rtpTransportControllerSend->EnablePeriodicAlrProbing(true);
|
|
80
84
|
|
|
81
|
-
this->processTimer =
|
|
85
|
+
this->processTimer =
|
|
86
|
+
this->shared->CreateTimer(this, "transport-congestion-control-client-process");
|
|
82
87
|
|
|
83
88
|
this->processTimer->Start(
|
|
84
89
|
std::min(
|
|
@@ -119,14 +124,14 @@ namespace RTC
|
|
|
119
124
|
MS_TRACE();
|
|
120
125
|
|
|
121
126
|
#ifdef USE_TREND_CALCULATOR
|
|
122
|
-
const auto nowMs = this->shared->
|
|
127
|
+
const auto nowMs = this->shared->GetTimeMs();
|
|
123
128
|
#endif
|
|
124
129
|
|
|
125
|
-
this->bitrates.desiredBitrate =
|
|
126
|
-
this->bitrates.effectiveDesiredBitrate =
|
|
130
|
+
this->bitrates.desiredBitrate = 0;
|
|
131
|
+
this->bitrates.effectiveDesiredBitrate = 0;
|
|
127
132
|
|
|
128
133
|
#ifdef USE_TREND_CALCULATOR
|
|
129
|
-
this->desiredBitrateTrend.ForceUpdate(
|
|
134
|
+
this->desiredBitrateTrend.ForceUpdate(0, nowMs);
|
|
130
135
|
#endif
|
|
131
136
|
|
|
132
137
|
this->rtpTransportControllerSend->OnNetworkAvailability(false);
|
|
@@ -158,7 +163,7 @@ namespace RTC
|
|
|
158
163
|
}
|
|
159
164
|
|
|
160
165
|
void TransportCongestionControlClient::PacketSent(
|
|
161
|
-
const webrtc::RtpPacketSendInfo& packetInfo, int64_t
|
|
166
|
+
const webrtc::RtpPacketSendInfo& packetInfo, int64_t nowUs)
|
|
162
167
|
{
|
|
163
168
|
MS_TRACE();
|
|
164
169
|
|
|
@@ -168,11 +173,14 @@ namespace RTC
|
|
|
168
173
|
}
|
|
169
174
|
|
|
170
175
|
// Notify the transport feedback adapter about the sent packet.
|
|
171
|
-
|
|
176
|
+
// NOTE: The send time is truncated to whole milliseconds because that's the
|
|
177
|
+
// resolution the current estimator takes.
|
|
178
|
+
const rtc::SentPacket sentPacket(packetInfo.transport_sequence_number, nowUs / 1000);
|
|
179
|
+
|
|
172
180
|
this->rtpTransportControllerSend->OnSentPacket(sentPacket, packetInfo.length);
|
|
173
181
|
}
|
|
174
182
|
|
|
175
|
-
void TransportCongestionControlClient::ReceiveEstimatedBitrate(
|
|
183
|
+
void TransportCongestionControlClient::ReceiveEstimatedBitrate(int64_t bitrate)
|
|
176
184
|
{
|
|
177
185
|
MS_TRACE();
|
|
178
186
|
|
|
@@ -181,11 +189,13 @@ namespace RTC
|
|
|
181
189
|
return;
|
|
182
190
|
}
|
|
183
191
|
|
|
184
|
-
|
|
192
|
+
// NOTE: The dependency takes an unsigned 32 bits bitrate, so it is clamped here.
|
|
193
|
+
this->rtpTransportControllerSend->OnReceivedEstimatedBitrate(
|
|
194
|
+
static_cast<uint32_t>(std::clamp<int64_t>(bitrate, 0, std::numeric_limits<uint32_t>::max())));
|
|
185
195
|
}
|
|
186
196
|
|
|
187
197
|
void TransportCongestionControlClient::ReceiveRtcpReceiverReport(
|
|
188
|
-
RTC::RTCP::ReceiverReportPacket* packet, float
|
|
198
|
+
RTC::RTCP::ReceiverReportPacket* packet, float rttMs, int64_t receivedAtUs)
|
|
189
199
|
{
|
|
190
200
|
MS_TRACE();
|
|
191
201
|
|
|
@@ -211,8 +221,10 @@ namespace RTC
|
|
|
211
221
|
return;
|
|
212
222
|
}
|
|
213
223
|
|
|
224
|
+
// NOTE: The dependency works in milliseconds, so the arrival time is
|
|
225
|
+
// truncated here.
|
|
214
226
|
this->rtpTransportControllerSend->OnReceivedRtcpReceiverReport(
|
|
215
|
-
reportBlockList, static_cast<int64_t>(
|
|
227
|
+
reportBlockList, static_cast<int64_t>(rttMs), receivedAtUs / 1000);
|
|
216
228
|
}
|
|
217
229
|
|
|
218
230
|
void TransportCongestionControlClient::ReceiveRtcpTransportFeedback(
|
|
@@ -224,9 +236,9 @@ namespace RTC
|
|
|
224
236
|
const size_t expectedPackets = feedback->GetPacketStatusCount();
|
|
225
237
|
size_t lostPackets = 0;
|
|
226
238
|
|
|
227
|
-
for (const auto&
|
|
239
|
+
for (const auto& packetStatus : feedback->GetPacketStatuses())
|
|
228
240
|
{
|
|
229
|
-
if (!
|
|
241
|
+
if (!packetStatus.received)
|
|
230
242
|
{
|
|
231
243
|
lostPackets += 1;
|
|
232
244
|
}
|
|
@@ -286,7 +298,7 @@ namespace RTC
|
|
|
286
298
|
this->packetLoss = totalPacketLoss / samples;
|
|
287
299
|
}
|
|
288
300
|
|
|
289
|
-
void TransportCongestionControlClient::SetMaxOutgoingBitrate(
|
|
301
|
+
void TransportCongestionControlClient::SetMaxOutgoingBitrate(int64_t maxBitrate)
|
|
290
302
|
{
|
|
291
303
|
MS_TRACE();
|
|
292
304
|
|
|
@@ -294,14 +306,14 @@ namespace RTC
|
|
|
294
306
|
|
|
295
307
|
ApplyBitrateUpdates();
|
|
296
308
|
|
|
297
|
-
if (this->maxOutgoingBitrate >
|
|
309
|
+
if (this->maxOutgoingBitrate > 0)
|
|
298
310
|
{
|
|
299
311
|
this->bitrates.availableBitrate =
|
|
300
|
-
std::min<
|
|
312
|
+
std::min<int64_t>(this->maxOutgoingBitrate, this->bitrates.availableBitrate);
|
|
301
313
|
}
|
|
302
314
|
}
|
|
303
315
|
|
|
304
|
-
void TransportCongestionControlClient::SetMinOutgoingBitrate(
|
|
316
|
+
void TransportCongestionControlClient::SetMinOutgoingBitrate(int64_t minBitrate)
|
|
305
317
|
{
|
|
306
318
|
MS_TRACE();
|
|
307
319
|
|
|
@@ -309,16 +321,16 @@ namespace RTC
|
|
|
309
321
|
|
|
310
322
|
ApplyBitrateUpdates();
|
|
311
323
|
|
|
312
|
-
this->bitrates.minBitrate =
|
|
313
|
-
this->minOutgoingBitrate,
|
|
324
|
+
this->bitrates.minBitrate =
|
|
325
|
+
std::max<int64_t>(this->minOutgoingBitrate, this->absoluteMinOutgoingBitrate);
|
|
314
326
|
}
|
|
315
327
|
|
|
316
|
-
void TransportCongestionControlClient::SetDesiredBitrate(
|
|
328
|
+
void TransportCongestionControlClient::SetDesiredBitrate(int64_t desiredBitrate, bool force)
|
|
317
329
|
{
|
|
318
330
|
MS_TRACE();
|
|
319
331
|
|
|
320
332
|
#ifdef USE_TREND_CALCULATOR
|
|
321
|
-
const auto nowMs = this->shared->
|
|
333
|
+
const auto nowMs = this->shared->GetTimeMs();
|
|
322
334
|
#endif
|
|
323
335
|
|
|
324
336
|
// Manage it via trending and increase it a bit to avoid immediate oscillations.
|
|
@@ -341,13 +353,13 @@ namespace RTC
|
|
|
341
353
|
this->bitrates.effectiveDesiredBitrate = desiredBitrate;
|
|
342
354
|
#endif
|
|
343
355
|
|
|
344
|
-
this->bitrates.minBitrate =
|
|
345
|
-
this->minOutgoingBitrate,
|
|
356
|
+
this->bitrates.minBitrate =
|
|
357
|
+
std::max<int64_t>(this->minOutgoingBitrate, this->absoluteMinOutgoingBitrate);
|
|
346
358
|
|
|
347
359
|
// NOTE: Setting 'startBitrate' to 'availableBitrate' has proven to generate
|
|
348
360
|
// more stable values.
|
|
349
|
-
this->bitrates.startBitrate =
|
|
350
|
-
|
|
361
|
+
this->bitrates.startBitrate =
|
|
362
|
+
std::max<int64_t>(this->absoluteMinOutgoingBitrate, this->bitrates.availableBitrate);
|
|
351
363
|
|
|
352
364
|
ApplyBitrateUpdates();
|
|
353
365
|
}
|
|
@@ -357,27 +369,28 @@ namespace RTC
|
|
|
357
369
|
MS_TRACE();
|
|
358
370
|
|
|
359
371
|
auto currentMaxBitrate = this->bitrates.maxBitrate;
|
|
360
|
-
|
|
372
|
+
int64_t newMaxBitrate = 0;
|
|
361
373
|
|
|
362
374
|
#ifdef USE_TREND_CALCULATOR
|
|
363
|
-
if (this->desiredBitrateTrend.GetValue() >
|
|
375
|
+
if (this->desiredBitrateTrend.GetValue() > 0)
|
|
364
376
|
#else
|
|
365
|
-
if (this->bitrates.desiredBitrate >
|
|
377
|
+
if (this->bitrates.desiredBitrate > 0)
|
|
366
378
|
#endif
|
|
367
379
|
{
|
|
368
|
-
newMaxBitrate = std::max<
|
|
380
|
+
newMaxBitrate = std::max<int64_t>(
|
|
369
381
|
this->initialAvailableBitrate,
|
|
370
382
|
#ifdef USE_TREND_CALCULATOR
|
|
371
|
-
this->desiredBitrateTrend.GetValue() * MaxBitrateIncrementFactor);
|
|
383
|
+
std::llround(this->desiredBitrateTrend.GetValue() * MaxBitrateIncrementFactor));
|
|
372
384
|
#else
|
|
373
|
-
this->bitrates.desiredBitrate * MaxBitrateIncrementFactor);
|
|
385
|
+
std::llround(this->bitrates.desiredBitrate * MaxBitrateIncrementFactor));
|
|
374
386
|
#endif
|
|
375
387
|
|
|
376
388
|
// If max bitrate requested didn't change by more than a small % keep the
|
|
377
389
|
// previous settings to avoid constant small fluctuations requiring extra
|
|
378
390
|
// probing and making the estimation less stable (requires constant
|
|
379
391
|
// redistribution of bitrate accross consumers).
|
|
380
|
-
|
|
392
|
+
const int64_t maxBitrateMargin = std::llround(newMaxBitrate * MaxBitrateMarginFactor);
|
|
393
|
+
|
|
381
394
|
if (currentMaxBitrate > newMaxBitrate - maxBitrateMargin && currentMaxBitrate < newMaxBitrate + maxBitrateMargin)
|
|
382
395
|
{
|
|
383
396
|
newMaxBitrate = currentMaxBitrate;
|
|
@@ -388,23 +401,23 @@ namespace RTC
|
|
|
388
401
|
newMaxBitrate = this->initialAvailableBitrate;
|
|
389
402
|
}
|
|
390
403
|
|
|
391
|
-
if (this->maxOutgoingBitrate >
|
|
404
|
+
if (this->maxOutgoingBitrate > 0)
|
|
392
405
|
{
|
|
393
|
-
newMaxBitrate = std::min<
|
|
406
|
+
newMaxBitrate = std::min<int64_t>(this->maxOutgoingBitrate, newMaxBitrate);
|
|
394
407
|
}
|
|
395
408
|
|
|
396
409
|
if (newMaxBitrate != currentMaxBitrate)
|
|
397
410
|
{
|
|
398
|
-
this->bitrates.maxPaddingBitrate = newMaxBitrate * MaxPaddingBitrateFactor;
|
|
411
|
+
this->bitrates.maxPaddingBitrate = std::llround(newMaxBitrate * MaxPaddingBitrateFactor);
|
|
399
412
|
this->bitrates.maxBitrate = newMaxBitrate;
|
|
400
413
|
}
|
|
401
414
|
|
|
402
|
-
this->bitrates.minBitrate =
|
|
403
|
-
this->minOutgoingBitrate,
|
|
415
|
+
this->bitrates.minBitrate =
|
|
416
|
+
std::max<int64_t>(this->minOutgoingBitrate, this->absoluteMinOutgoingBitrate);
|
|
404
417
|
|
|
405
418
|
MS_DEBUG_DEV(
|
|
406
|
-
"[desiredBitrate:%"
|
|
407
|
-
", minBitrate:%"
|
|
419
|
+
"[desiredBitrate:%" PRIi64 ", desiredBitrateTrend:%" PRIu32 ", startBitrate:%" PRIi64
|
|
420
|
+
", minBitrate:%" PRIi64 ", maxBitrate:%" PRIi64 ", maxPaddingBitrate:%" PRIi64 "]",
|
|
408
421
|
this->bitrates.desiredBitrate,
|
|
409
422
|
this->desiredBitrateTrend.GetValue(),
|
|
410
423
|
this->bitrates.startBitrate,
|
|
@@ -430,7 +443,7 @@ namespace RTC
|
|
|
430
443
|
this->rtpTransportControllerSend->SetClientBitratePreferences(constraints);
|
|
431
444
|
}
|
|
432
445
|
|
|
433
|
-
|
|
446
|
+
int64_t TransportCongestionControlClient::GetAvailableBitrate() const
|
|
434
447
|
{
|
|
435
448
|
MS_TRACE();
|
|
436
449
|
|
|
@@ -451,17 +464,17 @@ namespace RTC
|
|
|
451
464
|
this->lastAvailableBitrateEventAtMs = this->shared->GetTimeMs();
|
|
452
465
|
}
|
|
453
466
|
|
|
454
|
-
void TransportCongestionControlClient::MayEmitAvailableBitrateEvent(
|
|
467
|
+
void TransportCongestionControlClient::MayEmitAvailableBitrateEvent(int64_t previousAvailableBitrate)
|
|
455
468
|
{
|
|
456
469
|
MS_TRACE();
|
|
457
470
|
|
|
458
|
-
const
|
|
471
|
+
const int64_t nowMs = this->shared->GetTimeMs();
|
|
459
472
|
bool notify{ false };
|
|
460
473
|
|
|
461
474
|
// Ignore if first event.
|
|
462
475
|
// NOTE: Otherwise it will make the Transport crash since this event also happens
|
|
463
476
|
// during the constructor of this class.
|
|
464
|
-
if (this->lastAvailableBitrateEventAtMs ==
|
|
477
|
+
if (this->lastAvailableBitrateEventAtMs == 0)
|
|
465
478
|
{
|
|
466
479
|
this->lastAvailableBitrateEventAtMs = nowMs;
|
|
467
480
|
|
|
@@ -475,8 +488,8 @@ namespace RTC
|
|
|
475
488
|
|
|
476
489
|
notify = true;
|
|
477
490
|
}
|
|
478
|
-
// Emit event if
|
|
479
|
-
else if (nowMs - this->lastAvailableBitrateEventAtMs >=
|
|
491
|
+
// Emit event if AvailableBitrateEventIntervalMs elapsed.
|
|
492
|
+
else if (nowMs - this->lastAvailableBitrateEventAtMs >= AvailableBitrateEventIntervalMs)
|
|
480
493
|
{
|
|
481
494
|
notify = true;
|
|
482
495
|
}
|
|
@@ -485,7 +498,7 @@ namespace RTC
|
|
|
485
498
|
{
|
|
486
499
|
MS_WARN_TAG(
|
|
487
500
|
bwe,
|
|
488
|
-
"high BWE value decrease detected, notifying the listener [now:%"
|
|
501
|
+
"high BWE value decrease detected, notifying the listener [now:%" PRIi64 ", before:%" PRIi64
|
|
489
502
|
"]",
|
|
490
503
|
this->bitrates.availableBitrate,
|
|
491
504
|
previousAvailableBitrate);
|
|
@@ -497,7 +510,7 @@ namespace RTC
|
|
|
497
510
|
{
|
|
498
511
|
MS_DEBUG_TAG(
|
|
499
512
|
bwe,
|
|
500
|
-
"high BWE value increase detected, notifying the listener [now:%"
|
|
513
|
+
"high BWE value increase detected, notifying the listener [now:%" PRIi64 ", before:%" PRIi64
|
|
501
514
|
"]",
|
|
502
515
|
this->bitrates.availableBitrate,
|
|
503
516
|
previousAvailableBitrate);
|
|
@@ -508,7 +521,7 @@ namespace RTC
|
|
|
508
521
|
if (notify)
|
|
509
522
|
{
|
|
510
523
|
MS_DEBUG_DEV(
|
|
511
|
-
"notifying the listener with new available bitrate:%"
|
|
524
|
+
"notifying the listener with new available bitrate:%" PRIi64,
|
|
512
525
|
this->bitrates.availableBitrate);
|
|
513
526
|
|
|
514
527
|
this->lastAvailableBitrateEventAtMs = nowMs;
|
|
@@ -532,17 +545,11 @@ namespace RTC
|
|
|
532
545
|
auto previousAvailableBitrate = this->bitrates.availableBitrate;
|
|
533
546
|
|
|
534
547
|
// Update availableBitrate.
|
|
535
|
-
// NOTE:
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
this->bitrates.availableBitrate = std::numeric_limits<uint32_t>::max();
|
|
539
|
-
}
|
|
540
|
-
else
|
|
541
|
-
{
|
|
542
|
-
this->bitrates.availableBitrate = static_cast<uint32_t>(targetTransferRate.target_rate.bps());
|
|
543
|
-
}
|
|
548
|
+
// NOTE: The dependency gives a signed 64 bits bitrate, so no clamping is
|
|
549
|
+
// needed other than discarding a negative value.
|
|
550
|
+
this->bitrates.availableBitrate = std::max<int64_t>(targetTransferRate.target_rate.bps(), 0);
|
|
544
551
|
|
|
545
|
-
MS_DEBUG_DEV("new available bitrate:%"
|
|
552
|
+
MS_DEBUG_DEV("new available bitrate:%" PRIi64, this->bitrates.availableBitrate);
|
|
546
553
|
|
|
547
554
|
MayEmitAvailableBitrateEvent(previousAvailableBitrate);
|
|
548
555
|
}
|
|
@@ -9,9 +9,9 @@ namespace RTC
|
|
|
9
9
|
{
|
|
10
10
|
/* Static. */
|
|
11
11
|
|
|
12
|
-
static constexpr
|
|
13
|
-
static constexpr
|
|
14
|
-
static constexpr
|
|
12
|
+
static constexpr int64_t TransportCcFeedbackSendIntervalMs{ 100 };
|
|
13
|
+
static constexpr int64_t LimitationRembIntervalMs{ 1500 };
|
|
14
|
+
static constexpr int64_t PacketArrivalTimestampWindowUs{ 500 * 1000 };
|
|
15
15
|
static constexpr uint8_t UnlimitedRembNumPackets{ 4u };
|
|
16
16
|
static constexpr size_t PacketLossHistogramLength{ 24 };
|
|
17
17
|
|
|
@@ -34,7 +34,8 @@ namespace RTC
|
|
|
34
34
|
ResetTransportCcFeedback(0u);
|
|
35
35
|
|
|
36
36
|
// Create the feedback send periodic timer.
|
|
37
|
-
this->transportCcFeedbackSendPeriodicTimer =
|
|
37
|
+
this->transportCcFeedbackSendPeriodicTimer =
|
|
38
|
+
this->shared->CreateTimer(this, "transport-congestion-control-server-feedback-send");
|
|
38
39
|
|
|
39
40
|
break;
|
|
40
41
|
}
|
|
@@ -69,7 +70,7 @@ namespace RTC
|
|
|
69
70
|
case RTC::BweType::TRANSPORT_CC:
|
|
70
71
|
{
|
|
71
72
|
this->transportCcFeedbackSendPeriodicTimer->Start(
|
|
72
|
-
|
|
73
|
+
TransportCcFeedbackSendIntervalMs, TransportCcFeedbackSendIntervalMs);
|
|
73
74
|
|
|
74
75
|
break;
|
|
75
76
|
}
|
|
@@ -105,7 +106,7 @@ namespace RTC
|
|
|
105
106
|
return this->packetLoss;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
void TransportCongestionControlServer::IncomingPacket(
|
|
109
|
+
void TransportCongestionControlServer::IncomingPacket(int64_t nowUs, const RTC::RTP::Packet* packet)
|
|
109
110
|
{
|
|
110
111
|
MS_TRACE();
|
|
111
112
|
|
|
@@ -121,7 +122,7 @@ namespace RTC
|
|
|
121
122
|
}
|
|
122
123
|
|
|
123
124
|
// Only insert the packet when receiving it for the first time.
|
|
124
|
-
if (!this->mapPacketArrivalTimes.try_emplace(wideSeqNumber,
|
|
125
|
+
if (!this->mapPacketArrivalTimes.try_emplace(wideSeqNumber, nowUs).second)
|
|
125
126
|
{
|
|
126
127
|
break;
|
|
127
128
|
}
|
|
@@ -140,13 +141,13 @@ namespace RTC
|
|
|
140
141
|
|
|
141
142
|
this->transportWideSeqNumberReceived = true;
|
|
142
143
|
|
|
143
|
-
MayDropOldPacketArrivalTimes(wideSeqNumber,
|
|
144
|
+
MayDropOldPacketArrivalTimes(wideSeqNumber, nowUs);
|
|
144
145
|
|
|
145
146
|
// Update the RTCP media SSRC of the ongoing Transport-CC Feedback packet.
|
|
146
147
|
this->transportCcFeedbackSenderSsrc = 0u;
|
|
147
148
|
this->transportCcFeedbackMediaSsrc = packet->GetSsrc();
|
|
148
149
|
|
|
149
|
-
MaySendLimitationRembFeedback(
|
|
150
|
+
MaySendLimitationRembFeedback(nowUs / 1000);
|
|
150
151
|
|
|
151
152
|
break;
|
|
152
153
|
}
|
|
@@ -160,12 +161,8 @@ namespace RTC
|
|
|
160
161
|
break;
|
|
161
162
|
}
|
|
162
163
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
// conversion so it would be converted within the method call).
|
|
166
|
-
auto nowMsInt64 = static_cast<int64_t>(nowMs);
|
|
167
|
-
|
|
168
|
-
this->rembServer->IncomingPacket(nowMsInt64, packet->GetPayloadLength(), *packet, absSendTime);
|
|
164
|
+
this->rembServer->IncomingPacket(
|
|
165
|
+
nowUs / 1000, packet->GetPayloadLength(), *packet, absSendTime);
|
|
169
166
|
|
|
170
167
|
break;
|
|
171
168
|
}
|
|
@@ -191,7 +188,7 @@ namespace RTC
|
|
|
191
188
|
for (; it != this->mapPacketArrivalTimes.end(); ++it)
|
|
192
189
|
{
|
|
193
190
|
auto sequenceNumber = it->first;
|
|
194
|
-
auto
|
|
191
|
+
auto timestampUs = it->second;
|
|
195
192
|
|
|
196
193
|
// If the base is not set in this packet let's set it.
|
|
197
194
|
// NOTE: This maybe needed many times during this loop since the current
|
|
@@ -200,11 +197,12 @@ namespace RTC
|
|
|
200
197
|
if (!this->transportCcFeedbackPacket->IsBaseSet())
|
|
201
198
|
{
|
|
202
199
|
// Set base sequence num and reference time.
|
|
203
|
-
this->transportCcFeedbackPacket->SetBase(
|
|
200
|
+
this->transportCcFeedbackPacket->SetBase(
|
|
201
|
+
this->transportCcFeedbackWideSeqNumStart, timestampUs);
|
|
204
202
|
}
|
|
205
203
|
|
|
206
204
|
auto result = this->transportCcFeedbackPacket->AddPacket(
|
|
207
|
-
sequenceNumber,
|
|
205
|
+
sequenceNumber, timestampUs, this->maxRtcpPacketLen);
|
|
208
206
|
|
|
209
207
|
switch (result)
|
|
210
208
|
{
|
|
@@ -273,7 +271,7 @@ namespace RTC
|
|
|
273
271
|
ResetTransportCcFeedback(this->transportCcFeedbackPacketCount);
|
|
274
272
|
}
|
|
275
273
|
|
|
276
|
-
void TransportCongestionControlServer::SetMaxIncomingBitrate(
|
|
274
|
+
void TransportCongestionControlServer::SetMaxIncomingBitrate(int64_t bitrate)
|
|
277
275
|
{
|
|
278
276
|
MS_TRACE();
|
|
279
277
|
|
|
@@ -281,12 +279,12 @@ namespace RTC
|
|
|
281
279
|
|
|
282
280
|
this->maxIncomingBitrate = bitrate;
|
|
283
281
|
|
|
284
|
-
if (previousMaxIncomingBitrate
|
|
282
|
+
if (previousMaxIncomingBitrate > 0 && this->maxIncomingBitrate == 0)
|
|
285
283
|
{
|
|
286
284
|
// This is to ensure that we send N REMB packets with bitrate 0 (unlimited).
|
|
287
285
|
this->unlimitedRembCounter = UnlimitedRembNumPackets;
|
|
288
286
|
|
|
289
|
-
|
|
287
|
+
const int64_t nowMs = this->shared->GetTimeMs();
|
|
290
288
|
|
|
291
289
|
MaySendLimitationRembFeedback(nowMs);
|
|
292
290
|
}
|
|
@@ -315,9 +313,9 @@ namespace RTC
|
|
|
315
313
|
const size_t expectedPackets = this->transportCcFeedbackPacket->GetPacketStatusCount();
|
|
316
314
|
size_t lostPackets = 0;
|
|
317
315
|
|
|
318
|
-
for (const auto&
|
|
316
|
+
for (const auto& packetStatus : this->transportCcFeedbackPacket->GetPacketStatuses())
|
|
319
317
|
{
|
|
320
|
-
if (!
|
|
318
|
+
if (!packetStatus.received)
|
|
321
319
|
{
|
|
322
320
|
lostPackets += 1;
|
|
323
321
|
}
|
|
@@ -333,47 +331,47 @@ namespace RTC
|
|
|
333
331
|
return true;
|
|
334
332
|
}
|
|
335
333
|
|
|
336
|
-
void TransportCongestionControlServer::MayDropOldPacketArrivalTimes(uint16_t seqNum,
|
|
334
|
+
void TransportCongestionControlServer::MayDropOldPacketArrivalTimes(uint16_t seqNum, int64_t nowUs)
|
|
337
335
|
{
|
|
338
336
|
MS_TRACE();
|
|
339
337
|
|
|
340
|
-
// Ignore
|
|
338
|
+
// Ignore nowUs value if it's smaller than PacketArrivalTimestampWindowUs in
|
|
341
339
|
// order to avoid negative values (should never happen) and return early if
|
|
342
340
|
// the condition is met.
|
|
343
|
-
if (
|
|
341
|
+
if (nowUs >= PacketArrivalTimestampWindowUs)
|
|
344
342
|
{
|
|
345
|
-
const
|
|
346
|
-
auto it
|
|
343
|
+
const int64_t expiryTimestampUs = nowUs - PacketArrivalTimestampWindowUs;
|
|
344
|
+
auto it = this->mapPacketArrivalTimes.begin();
|
|
347
345
|
|
|
348
346
|
while (it != this->mapPacketArrivalTimes.end() &&
|
|
349
347
|
it->first != this->transportCcFeedbackWideSeqNumStart &&
|
|
350
348
|
RTC::SeqManager<uint16_t>::IsSeqLowerThan(it->first, seqNum) &&
|
|
351
|
-
it->second <=
|
|
349
|
+
it->second <= expiryTimestampUs)
|
|
352
350
|
{
|
|
353
351
|
it = this->mapPacketArrivalTimes.erase(it);
|
|
354
352
|
}
|
|
355
353
|
}
|
|
356
354
|
}
|
|
357
355
|
|
|
358
|
-
void TransportCongestionControlServer::MaySendLimitationRembFeedback(
|
|
356
|
+
void TransportCongestionControlServer::MaySendLimitationRembFeedback(int64_t nowMs)
|
|
359
357
|
{
|
|
360
358
|
MS_TRACE();
|
|
361
359
|
|
|
362
360
|
// May fix unlimitedRembCounter.
|
|
363
|
-
if (this->unlimitedRembCounter >
|
|
361
|
+
if (this->unlimitedRembCounter > 0 && this->maxIncomingBitrate > 0)
|
|
364
362
|
{
|
|
365
|
-
this->unlimitedRembCounter =
|
|
363
|
+
this->unlimitedRembCounter = 0;
|
|
366
364
|
}
|
|
367
365
|
|
|
368
366
|
// In case this is the first unlimited REMB packet, send it fast.
|
|
369
367
|
if (
|
|
370
|
-
((this->bweType != RTC::BweType::REMB && this->maxIncomingBitrate
|
|
371
|
-
|
|
372
|
-
(nowMs - this->limitationRembSentAtMs >
|
|
373
|
-
|
|
368
|
+
((this->bweType != RTC::BweType::REMB && this->maxIncomingBitrate > 0) ||
|
|
369
|
+
this->unlimitedRembCounter > 0) &&
|
|
370
|
+
(nowMs - this->limitationRembSentAtMs > LimitationRembIntervalMs ||
|
|
371
|
+
this->unlimitedRembCounter == UnlimitedRembNumPackets))
|
|
374
372
|
{
|
|
375
373
|
MS_DEBUG_DEV(
|
|
376
|
-
"sending limitation RTCP REMB packet [bitrate:%"
|
|
374
|
+
"sending limitation RTCP REMB packet [bitrate:%" PRIi64 "]", this->maxIncomingBitrate);
|
|
377
375
|
|
|
378
376
|
RTC::RTCP::FeedbackPsRembPacket packet(0u, 0u);
|
|
379
377
|
|
|
@@ -435,12 +433,12 @@ namespace RTC
|
|
|
435
433
|
void TransportCongestionControlServer::OnRembServerAvailableBitrate(
|
|
436
434
|
const webrtc::RemoteBitrateEstimator* /*rembServer*/,
|
|
437
435
|
const std::vector<uint32_t>& ssrcs,
|
|
438
|
-
|
|
436
|
+
int64_t availableBitrate)
|
|
439
437
|
{
|
|
440
438
|
MS_TRACE();
|
|
441
439
|
|
|
442
440
|
// Limit announced bitrate if requested via API.
|
|
443
|
-
if (this->maxIncomingBitrate
|
|
441
|
+
if (this->maxIncomingBitrate > 0)
|
|
444
442
|
{
|
|
445
443
|
availableBitrate = std::min(availableBitrate, this->maxIncomingBitrate);
|
|
446
444
|
}
|
|
@@ -455,7 +453,7 @@ namespace RTC
|
|
|
455
453
|
}
|
|
456
454
|
|
|
457
455
|
MS_DEBUG_DEV(
|
|
458
|
-
"sending RTCP REMB packet [bitrate:%"
|
|
456
|
+
"sending RTCP REMB packet [bitrate:%" PRIi64 ", ssrcs:%s]",
|
|
459
457
|
availableBitrate,
|
|
460
458
|
ssrcsStream.str().c_str());
|
|
461
459
|
#endif
|
|
@@ -11,7 +11,7 @@ namespace RTC
|
|
|
11
11
|
MS_TRACE();
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
void TrendCalculator::Update(uint32_t value,
|
|
14
|
+
void TrendCalculator::Update(uint32_t value, int64_t nowMs)
|
|
15
15
|
{
|
|
16
16
|
MS_TRACE();
|
|
17
17
|
|
|
@@ -34,7 +34,7 @@ namespace RTC
|
|
|
34
34
|
// Otherwise decrease current value.
|
|
35
35
|
else
|
|
36
36
|
{
|
|
37
|
-
const
|
|
37
|
+
const int64_t elapsedMs = nowMs - this->highestValueUpdatedAtMs;
|
|
38
38
|
auto subtraction =
|
|
39
39
|
static_cast<uint32_t>(this->highestValue * this->decreaseFactor * (elapsedMs / 1000.0));
|
|
40
40
|
|
|
@@ -43,7 +43,7 @@ namespace RTC
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
void TrendCalculator::ForceUpdate(uint32_t value,
|
|
46
|
+
void TrendCalculator::ForceUpdate(uint32_t value, int64_t nowMs)
|
|
47
47
|
{
|
|
48
48
|
MS_TRACE();
|
|
49
49
|
|
|
@@ -11,10 +11,15 @@ namespace RTC
|
|
|
11
11
|
/* Instance methods. */
|
|
12
12
|
|
|
13
13
|
UdpSocket::UdpSocket(
|
|
14
|
-
Listener* listener,
|
|
14
|
+
Listener* listener,
|
|
15
|
+
SharedInterface* shared,
|
|
16
|
+
std::string& ip,
|
|
17
|
+
uint16_t port,
|
|
18
|
+
RTC::Transport::SocketFlags& flags)
|
|
15
19
|
: // This may throw.
|
|
16
20
|
::UdpSocketHandle::UdpSocketHandle(RTC::PortManager::BindUdp(ip, port, flags)),
|
|
17
21
|
listener(listener),
|
|
22
|
+
shared(shared),
|
|
18
23
|
fixedPort(true)
|
|
19
24
|
{
|
|
20
25
|
MS_TRACE();
|
|
@@ -22,6 +27,7 @@ namespace RTC
|
|
|
22
27
|
|
|
23
28
|
UdpSocket::UdpSocket(
|
|
24
29
|
Listener* listener,
|
|
30
|
+
SharedInterface* shared,
|
|
25
31
|
std::string& ip,
|
|
26
32
|
uint16_t minPort,
|
|
27
33
|
uint16_t maxPort,
|
|
@@ -30,7 +36,8 @@ namespace RTC
|
|
|
30
36
|
: // This may throw.
|
|
31
37
|
::UdpSocketHandle::UdpSocketHandle(
|
|
32
38
|
RTC::PortManager::BindUdp(ip, minPort, maxPort, flags, portRangeKey)),
|
|
33
|
-
listener(listener)
|
|
39
|
+
listener(listener),
|
|
40
|
+
shared(shared)
|
|
34
41
|
{
|
|
35
42
|
MS_TRACE();
|
|
36
43
|
|
|
@@ -52,6 +59,10 @@ namespace RTC
|
|
|
52
59
|
{
|
|
53
60
|
MS_TRACE();
|
|
54
61
|
|
|
62
|
+
// NOTE: Take the arrival time before anything else is done with the
|
|
63
|
+
// datagram, so that it doesn't include the cost of processing it.
|
|
64
|
+
const int64_t receivedAtUs = this->shared->GetTimeUs();
|
|
65
|
+
|
|
55
66
|
if (!this->listener)
|
|
56
67
|
{
|
|
57
68
|
MS_ERROR("no listener set");
|
|
@@ -60,6 +71,6 @@ namespace RTC
|
|
|
60
71
|
}
|
|
61
72
|
|
|
62
73
|
// Notify the reader.
|
|
63
|
-
this->listener->OnUdpSocketPacketReceived(this, data, len, bufferLen, addr);
|
|
74
|
+
this->listener->OnUdpSocketPacketReceived(this, data, len, bufferLen, addr, receivedAtUs);
|
|
64
75
|
}
|
|
65
76
|
} // namespace RTC
|