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
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
#include "common.hpp"
|
|
2
|
+
#include "RTC/BWE/FeedbackAdapter.hpp"
|
|
3
|
+
#include "RTC/BWE/SendPacketHistory.hpp"
|
|
4
|
+
#include "RTC/RTCP/FeedbackRtpTransport.hpp"
|
|
5
|
+
#include <catch2/catch_test_macros.hpp>
|
|
6
|
+
|
|
7
|
+
SCENARIO("BWE FeedbackAdapter", "[bwe][feedbackadapter]")
|
|
8
|
+
{
|
|
9
|
+
// The clock starts well away from zero so that a mistake taking a time for a
|
|
10
|
+
// duration doesn't go unnoticed.
|
|
11
|
+
constexpr int64_t InitialTimeUs{ 100000000 };
|
|
12
|
+
// The remote clock has nothing to do with ours, and is a whole number of base
|
|
13
|
+
// time ticks so that the arrival times survive the feedback untouched.
|
|
14
|
+
constexpr int64_t RemoteTimeUs{ 1000000000000 };
|
|
15
|
+
constexpr size_t PacketSize{ 1000 };
|
|
16
|
+
constexpr uint32_t Ssrc{ 1111 };
|
|
17
|
+
constexpr uint32_t SenderSsrc{ 2222 };
|
|
18
|
+
constexpr uint32_t MediaSsrc{ 3333 };
|
|
19
|
+
constexpr size_t RtcpMtu{ 1200 };
|
|
20
|
+
|
|
21
|
+
// Builds the feedback a receiver would send, reporting the given arrival
|
|
22
|
+
// times. The sequence numbers left out of them are reported as lost.
|
|
23
|
+
auto createFeedback = [SenderSsrc, MediaSsrc](
|
|
24
|
+
uint16_t baseSequenceNumber,
|
|
25
|
+
int64_t baseTimeUs,
|
|
26
|
+
const std::vector<std::pair<uint16_t, int64_t>>& receivedPackets)
|
|
27
|
+
-> std::unique_ptr<RTC::RTCP::FeedbackRtpTransportPacket>
|
|
28
|
+
{
|
|
29
|
+
auto feedback = std::make_unique<RTC::RTCP::FeedbackRtpTransportPacket>(SenderSsrc, MediaSsrc);
|
|
30
|
+
|
|
31
|
+
feedback->SetBase(baseSequenceNumber, baseTimeUs);
|
|
32
|
+
|
|
33
|
+
for (const auto& [sequenceNumber, receivedAtUs] : receivedPackets)
|
|
34
|
+
{
|
|
35
|
+
feedback->AddPacket(sequenceNumber, receivedAtUs, RtcpMtu);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
feedback->Finish();
|
|
39
|
+
|
|
40
|
+
return feedback;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
SECTION("a feedback is resolved into the packets that were sent")
|
|
44
|
+
{
|
|
45
|
+
RTC::BWE::SendPacketHistory sendPacketHistory;
|
|
46
|
+
RTC::BWE::FeedbackAdapter feedbackAdapter(&sendPacketHistory);
|
|
47
|
+
|
|
48
|
+
sendPacketHistory.AddPacket(Ssrc, 100, PacketSize, false, InitialTimeUs);
|
|
49
|
+
sendPacketHistory.AddPacket(Ssrc, 101, PacketSize, false, InitialTimeUs + 10000);
|
|
50
|
+
sendPacketHistory.AddPacket(Ssrc, 102, PacketSize, false, InitialTimeUs + 20000);
|
|
51
|
+
|
|
52
|
+
const auto feedback = createFeedback(
|
|
53
|
+
0,
|
|
54
|
+
RemoteTimeUs,
|
|
55
|
+
{
|
|
56
|
+
{ 0, RemoteTimeUs },
|
|
57
|
+
{ 1, RemoteTimeUs + 10000 },
|
|
58
|
+
{ 2, RemoteTimeUs + 20000 }
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const auto processedFeedback =
|
|
62
|
+
feedbackAdapter.ProcessTransportFeedback(feedback.get(), InitialTimeUs + 50000);
|
|
63
|
+
|
|
64
|
+
REQUIRE(processedFeedback.has_value());
|
|
65
|
+
|
|
66
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
67
|
+
const auto& result = processedFeedback.value();
|
|
68
|
+
|
|
69
|
+
REQUIRE(result.feedbackTimeUs == InitialTimeUs + 50000);
|
|
70
|
+
REQUIRE(result.packetFeedbacks.size() == 3);
|
|
71
|
+
|
|
72
|
+
int64_t expectedSequenceNumber{ 0 };
|
|
73
|
+
|
|
74
|
+
for (const auto& packetResult : result.packetFeedbacks)
|
|
75
|
+
{
|
|
76
|
+
REQUIRE(packetResult.sentPacket.sequenceNumber == expectedSequenceNumber);
|
|
77
|
+
REQUIRE(packetResult.sentPacket.sendTimeUs == InitialTimeUs + (expectedSequenceNumber * 10000));
|
|
78
|
+
REQUIRE(packetResult.sentPacket.size == PacketSize);
|
|
79
|
+
REQUIRE(packetResult.IsReceived());
|
|
80
|
+
|
|
81
|
+
++expectedSequenceNumber;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// The first feedback is anchored on the time it was received.
|
|
85
|
+
REQUIRE(result.packetFeedbacks[0].receiveTimeUs == InitialTimeUs + 50000);
|
|
86
|
+
REQUIRE(result.packetFeedbacks[1].receiveTimeUs == InitialTimeUs + 60000);
|
|
87
|
+
REQUIRE(result.packetFeedbacks[2].receiveTimeUs == InitialTimeUs + 70000);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
SECTION("a packet reported as lost comes back with no arrival time")
|
|
91
|
+
{
|
|
92
|
+
RTC::BWE::SendPacketHistory sendPacketHistory;
|
|
93
|
+
RTC::BWE::FeedbackAdapter feedbackAdapter(&sendPacketHistory);
|
|
94
|
+
|
|
95
|
+
sendPacketHistory.AddPacket(Ssrc, 100, PacketSize, false, InitialTimeUs);
|
|
96
|
+
sendPacketHistory.AddPacket(Ssrc, 101, PacketSize, false, InitialTimeUs + 10000);
|
|
97
|
+
sendPacketHistory.AddPacket(Ssrc, 102, PacketSize, false, InitialTimeUs + 20000);
|
|
98
|
+
|
|
99
|
+
const auto feedback = createFeedback(
|
|
100
|
+
0,
|
|
101
|
+
RemoteTimeUs,
|
|
102
|
+
{
|
|
103
|
+
{ 0, RemoteTimeUs },
|
|
104
|
+
{ 2, RemoteTimeUs + 20000 }
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const auto processedFeedback =
|
|
108
|
+
feedbackAdapter.ProcessTransportFeedback(feedback.get(), InitialTimeUs + 50000);
|
|
109
|
+
|
|
110
|
+
REQUIRE(processedFeedback.has_value());
|
|
111
|
+
|
|
112
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
113
|
+
const auto& result = processedFeedback.value();
|
|
114
|
+
|
|
115
|
+
REQUIRE(result.packetFeedbacks.size() == 3);
|
|
116
|
+
REQUIRE(result.packetFeedbacks[0].IsReceived());
|
|
117
|
+
REQUIRE(!result.packetFeedbacks[1].IsReceived());
|
|
118
|
+
REQUIRE(result.packetFeedbacks[2].IsReceived());
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
SECTION("whether a packet is audio survives the feedback")
|
|
122
|
+
{
|
|
123
|
+
RTC::BWE::SendPacketHistory sendPacketHistory;
|
|
124
|
+
RTC::BWE::FeedbackAdapter feedbackAdapter(&sendPacketHistory);
|
|
125
|
+
|
|
126
|
+
sendPacketHistory.AddPacket(Ssrc, 100, PacketSize, true, InitialTimeUs);
|
|
127
|
+
sendPacketHistory.AddPacket(Ssrc, 101, PacketSize, false, InitialTimeUs + 10000);
|
|
128
|
+
|
|
129
|
+
const auto feedback = createFeedback(
|
|
130
|
+
0,
|
|
131
|
+
RemoteTimeUs,
|
|
132
|
+
{
|
|
133
|
+
{ 0, RemoteTimeUs },
|
|
134
|
+
{ 1, RemoteTimeUs + 10000 }
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const auto processedFeedback =
|
|
138
|
+
feedbackAdapter.ProcessTransportFeedback(feedback.get(), InitialTimeUs + 50000);
|
|
139
|
+
|
|
140
|
+
REQUIRE(processedFeedback.has_value());
|
|
141
|
+
|
|
142
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
143
|
+
const auto& result = processedFeedback.value();
|
|
144
|
+
|
|
145
|
+
REQUIRE(result.packetFeedbacks.size() == 2);
|
|
146
|
+
REQUIRE(result.packetFeedbacks[0].sentPacket.audio == true);
|
|
147
|
+
REQUIRE(result.packetFeedbacks[1].sentPacket.audio == false);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
SECTION("the feedback tells the data still in flight once it's been resolved")
|
|
151
|
+
{
|
|
152
|
+
RTC::BWE::SendPacketHistory sendPacketHistory;
|
|
153
|
+
RTC::BWE::FeedbackAdapter feedbackAdapter(&sendPacketHistory);
|
|
154
|
+
|
|
155
|
+
sendPacketHistory.AddPacket(Ssrc, 100, 200, false, InitialTimeUs);
|
|
156
|
+
sendPacketHistory.AddPacket(Ssrc, 101, 300, false, InitialTimeUs + 10000);
|
|
157
|
+
|
|
158
|
+
const auto firstFeedback = createFeedback(
|
|
159
|
+
0,
|
|
160
|
+
RemoteTimeUs,
|
|
161
|
+
{
|
|
162
|
+
{ 0, RemoteTimeUs }
|
|
163
|
+
});
|
|
164
|
+
const auto secondFeedback = createFeedback(
|
|
165
|
+
1,
|
|
166
|
+
RemoteTimeUs + 10000,
|
|
167
|
+
{
|
|
168
|
+
{ 1, RemoteTimeUs + 10000 }
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const auto firstResult =
|
|
172
|
+
feedbackAdapter.ProcessTransportFeedback(firstFeedback.get(), InitialTimeUs + 50000);
|
|
173
|
+
|
|
174
|
+
REQUIRE(firstResult.has_value());
|
|
175
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
176
|
+
REQUIRE(firstResult->dataInFlight == 300);
|
|
177
|
+
|
|
178
|
+
const auto secondResult =
|
|
179
|
+
feedbackAdapter.ProcessTransportFeedback(secondFeedback.get(), InitialTimeUs + 60000);
|
|
180
|
+
|
|
181
|
+
REQUIRE(secondResult.has_value());
|
|
182
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
183
|
+
REQUIRE(secondResult->dataInFlight == 0);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
SECTION("the packets the history no longer holds are left out")
|
|
187
|
+
{
|
|
188
|
+
constexpr int64_t WindowDurationUs{ 1000000 };
|
|
189
|
+
|
|
190
|
+
RTC::BWE::SendPacketHistory sendPacketHistory({ .windowDurationUs = WindowDurationUs });
|
|
191
|
+
RTC::BWE::FeedbackAdapter feedbackAdapter(&sendPacketHistory);
|
|
192
|
+
|
|
193
|
+
sendPacketHistory.AddPacket(Ssrc, 100, PacketSize, false, InitialTimeUs);
|
|
194
|
+
|
|
195
|
+
// Long enough afterwards for the window to drop the first packet.
|
|
196
|
+
sendPacketHistory.AddPacket(
|
|
197
|
+
Ssrc, 101, PacketSize, false, InitialTimeUs + WindowDurationUs + 10000);
|
|
198
|
+
|
|
199
|
+
const auto feedback = createFeedback(
|
|
200
|
+
0,
|
|
201
|
+
RemoteTimeUs,
|
|
202
|
+
{
|
|
203
|
+
{ 0, RemoteTimeUs },
|
|
204
|
+
{ 1, RemoteTimeUs + 10000 }
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
const auto processedFeedback = feedbackAdapter.ProcessTransportFeedback(
|
|
208
|
+
feedback.get(), InitialTimeUs + WindowDurationUs + 50000);
|
|
209
|
+
|
|
210
|
+
REQUIRE(processedFeedback.has_value());
|
|
211
|
+
|
|
212
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
213
|
+
const auto& result = processedFeedback.value();
|
|
214
|
+
|
|
215
|
+
REQUIRE(result.packetFeedbacks.size() == 1);
|
|
216
|
+
REQUIRE(result.packetFeedbacks[0].sentPacket.sequenceNumber == 1);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
SECTION("the arrival times of consecutive feedbacks share a single timeline")
|
|
220
|
+
{
|
|
221
|
+
RTC::BWE::SendPacketHistory sendPacketHistory;
|
|
222
|
+
RTC::BWE::FeedbackAdapter feedbackAdapter(&sendPacketHistory);
|
|
223
|
+
|
|
224
|
+
sendPacketHistory.AddPacket(Ssrc, 100, PacketSize, false, InitialTimeUs);
|
|
225
|
+
sendPacketHistory.AddPacket(Ssrc, 101, PacketSize, false, InitialTimeUs + 100000);
|
|
226
|
+
|
|
227
|
+
const auto firstFeedback = createFeedback(
|
|
228
|
+
0,
|
|
229
|
+
RemoteTimeUs,
|
|
230
|
+
{
|
|
231
|
+
{ 0, RemoteTimeUs }
|
|
232
|
+
});
|
|
233
|
+
const auto secondFeedback = createFeedback(
|
|
234
|
+
1,
|
|
235
|
+
RemoteTimeUs + 100000,
|
|
236
|
+
{
|
|
237
|
+
{ 1, RemoteTimeUs + 100000 }
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
const auto firstProcessedFeedback =
|
|
241
|
+
feedbackAdapter.ProcessTransportFeedback(firstFeedback.get(), InitialTimeUs + 50000);
|
|
242
|
+
const auto secondProcessedFeedback =
|
|
243
|
+
feedbackAdapter.ProcessTransportFeedback(secondFeedback.get(), InitialTimeUs + 150000);
|
|
244
|
+
|
|
245
|
+
REQUIRE(firstProcessedFeedback.has_value());
|
|
246
|
+
REQUIRE(secondProcessedFeedback.has_value());
|
|
247
|
+
|
|
248
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
249
|
+
const auto& firstResult = firstProcessedFeedback.value();
|
|
250
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
251
|
+
const auto& secondResult = secondProcessedFeedback.value();
|
|
252
|
+
|
|
253
|
+
REQUIRE(firstResult.packetFeedbacks.size() == 1);
|
|
254
|
+
REQUIRE(secondResult.packetFeedbacks.size() == 1);
|
|
255
|
+
|
|
256
|
+
// Both packets took the very same time to arrive, so both feedbacks have to
|
|
257
|
+
// tell the same however each of them was anchored.
|
|
258
|
+
const auto& firstPacketResult = firstResult.packetFeedbacks[0];
|
|
259
|
+
const auto& secondPacketResult = secondResult.packetFeedbacks[0];
|
|
260
|
+
|
|
261
|
+
const int64_t firstDelayUs =
|
|
262
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
263
|
+
firstPacketResult.receiveTimeUs.value() - firstPacketResult.sentPacket.sendTimeUs;
|
|
264
|
+
const int64_t secondDelayUs =
|
|
265
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
266
|
+
secondPacketResult.receiveTimeUs.value() - secondPacketResult.sentPacket.sendTimeUs;
|
|
267
|
+
|
|
268
|
+
REQUIRE(firstDelayUs == secondDelayUs);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
SECTION("a feedback arriving out of order keeps the timeline")
|
|
272
|
+
{
|
|
273
|
+
RTC::BWE::SendPacketHistory sendPacketHistory;
|
|
274
|
+
RTC::BWE::FeedbackAdapter feedbackAdapter(&sendPacketHistory);
|
|
275
|
+
|
|
276
|
+
sendPacketHistory.AddPacket(Ssrc, 100, PacketSize, false, InitialTimeUs);
|
|
277
|
+
sendPacketHistory.AddPacket(Ssrc, 101, PacketSize, false, InitialTimeUs + 100000);
|
|
278
|
+
|
|
279
|
+
const auto firstFeedback = createFeedback(
|
|
280
|
+
0,
|
|
281
|
+
RemoteTimeUs,
|
|
282
|
+
{
|
|
283
|
+
{ 0, RemoteTimeUs }
|
|
284
|
+
});
|
|
285
|
+
const auto secondFeedback = createFeedback(
|
|
286
|
+
1,
|
|
287
|
+
RemoteTimeUs + 100000,
|
|
288
|
+
{
|
|
289
|
+
{ 1, RemoteTimeUs + 100000 }
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// The second feedback is processed first, and the first one arrives late.
|
|
293
|
+
const auto secondProcessedFeedback =
|
|
294
|
+
feedbackAdapter.ProcessTransportFeedback(secondFeedback.get(), InitialTimeUs + 150000);
|
|
295
|
+
const auto firstProcessedFeedback =
|
|
296
|
+
feedbackAdapter.ProcessTransportFeedback(firstFeedback.get(), InitialTimeUs + 160000);
|
|
297
|
+
|
|
298
|
+
REQUIRE(secondProcessedFeedback.has_value());
|
|
299
|
+
REQUIRE(firstProcessedFeedback.has_value());
|
|
300
|
+
|
|
301
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
302
|
+
const auto& firstResult = firstProcessedFeedback.value();
|
|
303
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
304
|
+
const auto& secondResult = secondProcessedFeedback.value();
|
|
305
|
+
|
|
306
|
+
REQUIRE(firstResult.packetFeedbacks.size() == 1);
|
|
307
|
+
REQUIRE(secondResult.packetFeedbacks.size() == 1);
|
|
308
|
+
|
|
309
|
+
const auto& firstPacketResult = firstResult.packetFeedbacks[0];
|
|
310
|
+
const auto& secondPacketResult = secondResult.packetFeedbacks[0];
|
|
311
|
+
|
|
312
|
+
const int64_t firstDelayUs =
|
|
313
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
314
|
+
firstPacketResult.receiveTimeUs.value() - firstPacketResult.sentPacket.sendTimeUs;
|
|
315
|
+
const int64_t secondDelayUs =
|
|
316
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
317
|
+
secondPacketResult.receiveTimeUs.value() - secondPacketResult.sentPacket.sendTimeUs;
|
|
318
|
+
|
|
319
|
+
REQUIRE(firstDelayUs == secondDelayUs);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
SECTION("the base time wrapping around does not break the timeline")
|
|
323
|
+
{
|
|
324
|
+
constexpr int64_t FirstBaseTimeUs{ RTC::RTCP::FeedbackRtpTransportPacket::TimeWrapPeriodUs -
|
|
325
|
+
RTC::RTCP::FeedbackRtpTransportPacket::BaseTimeTickUs };
|
|
326
|
+
constexpr int64_t SecondBaseTimeUs{ RTC::RTCP::FeedbackRtpTransportPacket::TimeWrapPeriodUs };
|
|
327
|
+
constexpr int64_t ElapsedUs{ SecondBaseTimeUs - FirstBaseTimeUs };
|
|
328
|
+
|
|
329
|
+
RTC::BWE::SendPacketHistory sendPacketHistory;
|
|
330
|
+
RTC::BWE::FeedbackAdapter feedbackAdapter(&sendPacketHistory);
|
|
331
|
+
|
|
332
|
+
sendPacketHistory.AddPacket(Ssrc, 100, PacketSize, false, InitialTimeUs);
|
|
333
|
+
sendPacketHistory.AddPacket(Ssrc, 101, PacketSize, false, InitialTimeUs + ElapsedUs);
|
|
334
|
+
|
|
335
|
+
const auto firstFeedback = createFeedback(
|
|
336
|
+
0,
|
|
337
|
+
FirstBaseTimeUs,
|
|
338
|
+
{
|
|
339
|
+
{ 0, FirstBaseTimeUs }
|
|
340
|
+
});
|
|
341
|
+
const auto secondFeedback = createFeedback(
|
|
342
|
+
1,
|
|
343
|
+
SecondBaseTimeUs,
|
|
344
|
+
{
|
|
345
|
+
{ 1, SecondBaseTimeUs }
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
const auto firstProcessedFeedback =
|
|
349
|
+
feedbackAdapter.ProcessTransportFeedback(firstFeedback.get(), InitialTimeUs + 50000);
|
|
350
|
+
const auto secondProcessedFeedback = feedbackAdapter.ProcessTransportFeedback(
|
|
351
|
+
secondFeedback.get(), InitialTimeUs + ElapsedUs + 50000);
|
|
352
|
+
|
|
353
|
+
REQUIRE(firstProcessedFeedback.has_value());
|
|
354
|
+
REQUIRE(secondProcessedFeedback.has_value());
|
|
355
|
+
|
|
356
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
357
|
+
const auto& firstResult = firstProcessedFeedback.value();
|
|
358
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
359
|
+
const auto& secondResult = secondProcessedFeedback.value();
|
|
360
|
+
|
|
361
|
+
REQUIRE(firstResult.packetFeedbacks.size() == 1);
|
|
362
|
+
REQUIRE(secondResult.packetFeedbacks.size() == 1);
|
|
363
|
+
|
|
364
|
+
const auto& firstPacketResult = firstResult.packetFeedbacks[0];
|
|
365
|
+
const auto& secondPacketResult = secondResult.packetFeedbacks[0];
|
|
366
|
+
|
|
367
|
+
const int64_t firstDelayUs =
|
|
368
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
369
|
+
firstPacketResult.receiveTimeUs.value() - firstPacketResult.sentPacket.sendTimeUs;
|
|
370
|
+
const int64_t secondDelayUs =
|
|
371
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
372
|
+
secondPacketResult.receiveTimeUs.value() - secondPacketResult.sentPacket.sendTimeUs;
|
|
373
|
+
|
|
374
|
+
REQUIRE(firstDelayUs == secondDelayUs);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
SECTION("the packets are reported in the order the feedback reports them")
|
|
378
|
+
{
|
|
379
|
+
RTC::BWE::SendPacketHistory sendPacketHistory;
|
|
380
|
+
RTC::BWE::FeedbackAdapter feedbackAdapter(&sendPacketHistory);
|
|
381
|
+
|
|
382
|
+
sendPacketHistory.AddPacket(Ssrc, 100, PacketSize, false, InitialTimeUs);
|
|
383
|
+
sendPacketHistory.AddPacket(Ssrc, 101, PacketSize, false, InitialTimeUs + 10000);
|
|
384
|
+
sendPacketHistory.AddPacket(Ssrc, 102, PacketSize, false, InitialTimeUs + 20000);
|
|
385
|
+
|
|
386
|
+
// The packets sent later arrived earlier, which is up to whoever consumes
|
|
387
|
+
// this to reorder.
|
|
388
|
+
const auto feedback = createFeedback(
|
|
389
|
+
0,
|
|
390
|
+
RemoteTimeUs + 20000,
|
|
391
|
+
{
|
|
392
|
+
{ 0, RemoteTimeUs + 20000 },
|
|
393
|
+
{ 1, RemoteTimeUs + 10000 },
|
|
394
|
+
{ 2, RemoteTimeUs }
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
const auto processedFeedback =
|
|
398
|
+
feedbackAdapter.ProcessTransportFeedback(feedback.get(), InitialTimeUs + 50000);
|
|
399
|
+
|
|
400
|
+
REQUIRE(processedFeedback.has_value());
|
|
401
|
+
|
|
402
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
403
|
+
const auto& result = processedFeedback.value();
|
|
404
|
+
|
|
405
|
+
REQUIRE(result.packetFeedbacks.size() == 3);
|
|
406
|
+
REQUIRE(result.packetFeedbacks[0].sentPacket.sequenceNumber == 0);
|
|
407
|
+
REQUIRE(result.packetFeedbacks[1].sentPacket.sequenceNumber == 1);
|
|
408
|
+
REQUIRE(result.packetFeedbacks[2].sentPacket.sequenceNumber == 2);
|
|
409
|
+
REQUIRE(result.packetFeedbacks[0].receiveTimeUs > result.packetFeedbacks[1].receiveTimeUs);
|
|
410
|
+
REQUIRE(result.packetFeedbacks[1].receiveTimeUs > result.packetFeedbacks[2].receiveTimeUs);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
SECTION("the packets a lost feedback reported on are not reported as lost")
|
|
414
|
+
{
|
|
415
|
+
RTC::BWE::SendPacketHistory sendPacketHistory;
|
|
416
|
+
RTC::BWE::FeedbackAdapter feedbackAdapter(&sendPacketHistory);
|
|
417
|
+
|
|
418
|
+
sendPacketHistory.AddPacket(Ssrc, 100, PacketSize, false, InitialTimeUs);
|
|
419
|
+
sendPacketHistory.AddPacket(Ssrc, 101, PacketSize, false, InitialTimeUs + 10000);
|
|
420
|
+
sendPacketHistory.AddPacket(Ssrc, 102, PacketSize, false, InitialTimeUs + 20000);
|
|
421
|
+
|
|
422
|
+
// The feedback reporting on the first two packets never made it, so the next
|
|
423
|
+
// one starts at the third.
|
|
424
|
+
const auto feedback = createFeedback(
|
|
425
|
+
2,
|
|
426
|
+
RemoteTimeUs + 20000,
|
|
427
|
+
{
|
|
428
|
+
{ 2, RemoteTimeUs + 20000 }
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
const auto processedFeedback =
|
|
432
|
+
feedbackAdapter.ProcessTransportFeedback(feedback.get(), InitialTimeUs + 50000);
|
|
433
|
+
|
|
434
|
+
REQUIRE(processedFeedback.has_value());
|
|
435
|
+
|
|
436
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
437
|
+
const auto& result = processedFeedback.value();
|
|
438
|
+
|
|
439
|
+
REQUIRE(result.packetFeedbacks.size() == 1);
|
|
440
|
+
REQUIRE(result.packetFeedbacks[0].sentPacket.sequenceNumber == 2);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
SECTION("the feedbacks are resolved although the packets being sent run far ahead of them")
|
|
444
|
+
{
|
|
445
|
+
// More than half the range of the sequence numbers the wire carries, which is
|
|
446
|
+
// what makes the latest packet sent useless to resolve against.
|
|
447
|
+
constexpr int64_t PacketCount{ 40000 };
|
|
448
|
+
|
|
449
|
+
RTC::BWE::SendPacketHistory sendPacketHistory;
|
|
450
|
+
RTC::BWE::FeedbackAdapter feedbackAdapter(&sendPacketHistory);
|
|
451
|
+
|
|
452
|
+
sendPacketHistory.AddPacket(Ssrc, 100, PacketSize, false, InitialTimeUs);
|
|
453
|
+
sendPacketHistory.AddPacket(Ssrc, 101, PacketSize, false, InitialTimeUs);
|
|
454
|
+
|
|
455
|
+
// The first feedback reports on the packets sent so far.
|
|
456
|
+
const auto firstFeedback = createFeedback(
|
|
457
|
+
0,
|
|
458
|
+
RemoteTimeUs,
|
|
459
|
+
{
|
|
460
|
+
{ 0, RemoteTimeUs },
|
|
461
|
+
{ 1, RemoteTimeUs }
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
const auto firstResult =
|
|
465
|
+
feedbackAdapter.ProcessTransportFeedback(firstFeedback.get(), InitialTimeUs + 50000);
|
|
466
|
+
|
|
467
|
+
REQUIRE(firstResult.has_value());
|
|
468
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
469
|
+
REQUIRE(firstResult->packetFeedbacks.size() == 2);
|
|
470
|
+
|
|
471
|
+
// And now a lot of packets are sent before the next feedback comes.
|
|
472
|
+
for (int64_t idx{ 2 }; idx < PacketCount; ++idx)
|
|
473
|
+
{
|
|
474
|
+
sendPacketHistory.AddPacket(Ssrc, 102, PacketSize, false, InitialTimeUs);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
REQUIRE(sendPacketHistory.GetLastSequenceNumber() == PacketCount - 1);
|
|
478
|
+
|
|
479
|
+
const auto secondFeedback = createFeedback(
|
|
480
|
+
2,
|
|
481
|
+
RemoteTimeUs,
|
|
482
|
+
{
|
|
483
|
+
{ 2, RemoteTimeUs }
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
const auto secondProcessedFeedback =
|
|
487
|
+
feedbackAdapter.ProcessTransportFeedback(secondFeedback.get(), InitialTimeUs + 60000);
|
|
488
|
+
|
|
489
|
+
REQUIRE(secondProcessedFeedback.has_value());
|
|
490
|
+
|
|
491
|
+
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
|
|
492
|
+
const auto& secondResult = secondProcessedFeedback.value();
|
|
493
|
+
|
|
494
|
+
REQUIRE(secondResult.packetFeedbacks.size() == 1);
|
|
495
|
+
REQUIRE(secondResult.packetFeedbacks[0].sentPacket.sequenceNumber == 2);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
SECTION("a feedback reporting on no packet at all yields no value")
|
|
499
|
+
{
|
|
500
|
+
RTC::BWE::SendPacketHistory sendPacketHistory;
|
|
501
|
+
RTC::BWE::FeedbackAdapter feedbackAdapter(&sendPacketHistory);
|
|
502
|
+
|
|
503
|
+
sendPacketHistory.AddPacket(Ssrc, 100, PacketSize, false, InitialTimeUs);
|
|
504
|
+
|
|
505
|
+
const auto feedback = createFeedback(0, RemoteTimeUs, {});
|
|
506
|
+
|
|
507
|
+
REQUIRE(feedback->GetPacketStatusCount() == 0);
|
|
508
|
+
REQUIRE(
|
|
509
|
+
feedbackAdapter.ProcessTransportFeedback(feedback.get(), InitialTimeUs + 50000) == std::nullopt);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
SECTION("a feedback received before any packet was sent yields no value")
|
|
513
|
+
{
|
|
514
|
+
RTC::BWE::SendPacketHistory sendPacketHistory;
|
|
515
|
+
RTC::BWE::FeedbackAdapter feedbackAdapter(&sendPacketHistory);
|
|
516
|
+
|
|
517
|
+
const auto feedback = createFeedback(
|
|
518
|
+
0,
|
|
519
|
+
RemoteTimeUs,
|
|
520
|
+
{
|
|
521
|
+
{ 0, RemoteTimeUs }
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
REQUIRE(
|
|
525
|
+
feedbackAdapter.ProcessTransportFeedback(feedback.get(), InitialTimeUs + 50000) == std::nullopt);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
SECTION("a feedback reporting on no packet the history holds yields no value")
|
|
529
|
+
{
|
|
530
|
+
RTC::BWE::SendPacketHistory sendPacketHistory;
|
|
531
|
+
RTC::BWE::FeedbackAdapter feedbackAdapter(&sendPacketHistory);
|
|
532
|
+
|
|
533
|
+
sendPacketHistory.AddPacket(Ssrc, 100, PacketSize, false, InitialTimeUs);
|
|
534
|
+
|
|
535
|
+
// A sequence number this history never gave out.
|
|
536
|
+
const auto feedback = createFeedback(
|
|
537
|
+
1000,
|
|
538
|
+
RemoteTimeUs,
|
|
539
|
+
{
|
|
540
|
+
{ 1000, RemoteTimeUs }
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
REQUIRE(
|
|
544
|
+
feedbackAdapter.ProcessTransportFeedback(feedback.get(), InitialTimeUs + 50000) == std::nullopt);
|
|
545
|
+
}
|
|
546
|
+
}
|