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
|
@@ -1059,16 +1059,16 @@ SCENARIO("RTP Packet", "[serializable][rtp][packet]")
|
|
|
1059
1059
|
/*paddingLength*/ 0);
|
|
1060
1060
|
|
|
1061
1061
|
REQUIRE(packet->IsPaddedTo4Bytes() == true);
|
|
1062
|
-
REQUIRE(packet->
|
|
1062
|
+
REQUIRE(packet->GetCaptureAtUs() == std::nullopt);
|
|
1063
1063
|
|
|
1064
1064
|
packet->SetPayloadType(100);
|
|
1065
1065
|
packet->SetMarker(true);
|
|
1066
1066
|
packet->SetSequenceNumber(12345);
|
|
1067
1067
|
packet->SetTimestamp(987654321);
|
|
1068
1068
|
packet->SetSsrc(1234567890);
|
|
1069
|
-
packet->
|
|
1069
|
+
packet->SetCaptureAtUs(99998888);
|
|
1070
1070
|
|
|
1071
|
-
REQUIRE(packet->
|
|
1071
|
+
REQUIRE(packet->GetCaptureAtUs() == 99998888);
|
|
1072
1072
|
|
|
1073
1073
|
std::vector<RTC::RTP::Packet::Extension> extensions;
|
|
1074
1074
|
|
|
@@ -1208,7 +1208,7 @@ SCENARIO("RTP Packet", "[serializable][rtp][packet]")
|
|
|
1208
1208
|
REQUIRE(extensionLen == 3);
|
|
1209
1209
|
|
|
1210
1210
|
REQUIRE(packet->IsPaddedTo4Bytes() == true);
|
|
1211
|
-
REQUIRE(packet->
|
|
1211
|
+
REQUIRE(packet->GetCaptureAtUs() == 99998888);
|
|
1212
1212
|
|
|
1213
1213
|
/* Clone it. */
|
|
1214
1214
|
|
|
@@ -1257,7 +1257,7 @@ SCENARIO("RTP Packet", "[serializable][rtp][packet]")
|
|
|
1257
1257
|
REQUIRE(extensionLen == 3);
|
|
1258
1258
|
|
|
1259
1259
|
REQUIRE(packet->IsPaddedTo4Bytes() == true);
|
|
1260
|
-
REQUIRE(packet->
|
|
1260
|
+
REQUIRE(packet->GetCaptureAtUs() == 99998888);
|
|
1261
1261
|
|
|
1262
1262
|
/* Set payload. */
|
|
1263
1263
|
|
|
@@ -1547,12 +1547,12 @@ SCENARIO("RTP Packet", "[serializable][rtp][packet]")
|
|
|
1547
1547
|
REQUIRE(packet->ReadTransportWideCc01(readWideSeqNumber));
|
|
1548
1548
|
REQUIRE(readWideSeqNumber == wideSeqNumber);
|
|
1549
1549
|
|
|
1550
|
-
std::string newMid{ "mid-®2" };
|
|
1551
|
-
|
|
1552
|
-
uint16_t newWideSeqNumber{ 5556 };
|
|
1550
|
+
const std::string newMid{ "mid-®2" };
|
|
1551
|
+
const int64_t newAbsSendtimeUs{ 999999250 };
|
|
1552
|
+
const uint16_t newWideSeqNumber{ 5556 };
|
|
1553
1553
|
|
|
1554
1554
|
REQUIRE(packet->UpdateMid(newMid));
|
|
1555
|
-
REQUIRE(packet->UpdateAbsSendTime(
|
|
1555
|
+
REQUIRE(packet->UpdateAbsSendTime(newAbsSendtimeUs));
|
|
1556
1556
|
REQUIRE(packet->UpdateTransportWideCc01(newWideSeqNumber));
|
|
1557
1557
|
|
|
1558
1558
|
REQUIRE(packet->ReadMid(readMid));
|
|
@@ -1560,7 +1560,7 @@ SCENARIO("RTP Packet", "[serializable][rtp][packet]")
|
|
|
1560
1560
|
REQUIRE(packet->ReadRid(readRid));
|
|
1561
1561
|
REQUIRE(readRid == rid);
|
|
1562
1562
|
REQUIRE(packet->ReadAbsSendTime(readAbsSendtime));
|
|
1563
|
-
REQUIRE(readAbsSendtime == Utils::Time::
|
|
1563
|
+
REQUIRE(readAbsSendtime == Utils::Time::TimeUsToAbsSendTime(newAbsSendtimeUs));
|
|
1564
1564
|
REQUIRE(packet->ReadTransportWideCc01(readWideSeqNumber));
|
|
1565
1565
|
REQUIRE(readWideSeqNumber == newWideSeqNumber);
|
|
1566
1566
|
|
|
@@ -1587,7 +1587,7 @@ SCENARIO("RTP Packet", "[serializable][rtp][packet]")
|
|
|
1587
1587
|
REQUIRE(packet2->ReadRid(readRid));
|
|
1588
1588
|
REQUIRE(readRid == rid);
|
|
1589
1589
|
REQUIRE(packet2->ReadAbsSendTime(readAbsSendtime));
|
|
1590
|
-
REQUIRE(readAbsSendtime == Utils::Time::
|
|
1590
|
+
REQUIRE(readAbsSendtime == Utils::Time::TimeUsToAbsSendTime(newAbsSendtimeUs));
|
|
1591
1591
|
REQUIRE(packet2->ReadTransportWideCc01(readWideSeqNumber));
|
|
1592
1592
|
REQUIRE(readWideSeqNumber == newWideSeqNumber);
|
|
1593
1593
|
}
|
|
@@ -20,7 +20,7 @@ SCENARIO("RTP RetransmissionBuffer", "[rtp][rtx]")
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
public:
|
|
23
|
-
RtpMyRetransmissionBuffer(uint16_t maxItems,
|
|
23
|
+
RtpMyRetransmissionBuffer(uint16_t maxItems, int64_t maxRetransmissionDelayMs, uint32_t clockRate)
|
|
24
24
|
: RTC::RTP::RetransmissionBuffer(maxItems, maxRetransmissionDelayMs, clockRate)
|
|
25
25
|
{
|
|
26
26
|
}
|
|
@@ -51,7 +51,7 @@ SCENARIO("RTP RetransmissionBuffer", "[rtp][rtx]")
|
|
|
51
51
|
{
|
|
52
52
|
REQUIRE(verificationBuffer.size() == this->buffer.size());
|
|
53
53
|
|
|
54
|
-
for (size_t idx{
|
|
54
|
+
for (size_t idx{ 0 }; idx < verificationBuffer.size(); ++idx)
|
|
55
55
|
{
|
|
56
56
|
auto& verificationItem = verificationBuffer.at(idx);
|
|
57
57
|
auto* item = this->buffer.at(idx);
|
|
@@ -70,7 +70,7 @@ SCENARIO("RTP RetransmissionBuffer", "[rtp][rtx]")
|
|
|
70
70
|
SECTION("proper packets received in order")
|
|
71
71
|
{
|
|
72
72
|
const uint16_t maxItems{ 4 };
|
|
73
|
-
const
|
|
73
|
+
const int64_t maxRetransmissionDelayMs{ 2000 };
|
|
74
74
|
const uint32_t clockRate{ 90000 };
|
|
75
75
|
|
|
76
76
|
RtpMyRetransmissionBuffer myRetransmissionBuffer(maxItems, maxRetransmissionDelayMs, clockRate);
|
|
@@ -95,7 +95,7 @@ SCENARIO("RTP RetransmissionBuffer", "[rtp][rtx]")
|
|
|
95
95
|
SECTION("proper packets received out of order")
|
|
96
96
|
{
|
|
97
97
|
const uint16_t maxItems{ 4 };
|
|
98
|
-
const
|
|
98
|
+
const int64_t maxRetransmissionDelayMs{ 2000 };
|
|
99
99
|
const uint32_t clockRate{ 90000 };
|
|
100
100
|
|
|
101
101
|
RtpMyRetransmissionBuffer myRetransmissionBuffer(maxItems, maxRetransmissionDelayMs, clockRate);
|
|
@@ -120,7 +120,7 @@ SCENARIO("RTP RetransmissionBuffer", "[rtp][rtx]")
|
|
|
120
120
|
SECTION("packet with too new sequence number produces buffer emptying")
|
|
121
121
|
{
|
|
122
122
|
const uint16_t maxItems{ 4 };
|
|
123
|
-
const
|
|
123
|
+
const int64_t maxRetransmissionDelayMs{ 2000 };
|
|
124
124
|
const uint32_t clockRate{ 90000 };
|
|
125
125
|
|
|
126
126
|
RtpMyRetransmissionBuffer myRetransmissionBuffer(maxItems, maxRetransmissionDelayMs, clockRate);
|
|
@@ -142,7 +142,7 @@ SCENARIO("RTP RetransmissionBuffer", "[rtp][rtx]")
|
|
|
142
142
|
SECTION("blank slots are properly created")
|
|
143
143
|
{
|
|
144
144
|
const uint16_t maxItems{ 10 };
|
|
145
|
-
const
|
|
145
|
+
const int64_t maxRetransmissionDelayMs{ 2000 };
|
|
146
146
|
const uint32_t clockRate{ 90000 };
|
|
147
147
|
|
|
148
148
|
RtpMyRetransmissionBuffer myRetransmissionBuffer(maxItems, maxRetransmissionDelayMs, clockRate);
|
|
@@ -180,7 +180,7 @@ SCENARIO("RTP RetransmissionBuffer", "[rtp][rtx]")
|
|
|
180
180
|
SECTION("packet with too old sequence number is discarded")
|
|
181
181
|
{
|
|
182
182
|
const uint16_t maxItems{ 4 };
|
|
183
|
-
const
|
|
183
|
+
const int64_t maxRetransmissionDelayMs{ 2000 };
|
|
184
184
|
const uint32_t clockRate{ 90000 };
|
|
185
185
|
|
|
186
186
|
RtpMyRetransmissionBuffer myRetransmissionBuffer(maxItems, maxRetransmissionDelayMs, clockRate);
|
|
@@ -205,7 +205,7 @@ SCENARIO("RTP RetransmissionBuffer", "[rtp][rtx]")
|
|
|
205
205
|
SECTION("packet with too old timestamp is discarded")
|
|
206
206
|
{
|
|
207
207
|
const uint16_t maxItems{ 4 };
|
|
208
|
-
const
|
|
208
|
+
const int64_t maxRetransmissionDelayMs{ 2000 };
|
|
209
209
|
const uint32_t clockRate{ 90000 };
|
|
210
210
|
|
|
211
211
|
RtpMyRetransmissionBuffer myRetransmissionBuffer(maxItems, maxRetransmissionDelayMs, clockRate);
|
|
@@ -232,7 +232,7 @@ SCENARIO("RTP RetransmissionBuffer", "[rtp][rtx]")
|
|
|
232
232
|
SECTION("packet with very newest timestamp is inserted as newest item despite its seq is old")
|
|
233
233
|
{
|
|
234
234
|
const uint16_t maxItems{ 4 };
|
|
235
|
-
const
|
|
235
|
+
const int64_t maxRetransmissionDelayMs{ 2000 };
|
|
236
236
|
const uint32_t clockRate{ 90000 };
|
|
237
237
|
|
|
238
238
|
RtpMyRetransmissionBuffer myRetransmissionBuffer(maxItems, maxRetransmissionDelayMs, clockRate);
|
|
@@ -256,7 +256,7 @@ SCENARIO("RTP RetransmissionBuffer", "[rtp][rtx]")
|
|
|
256
256
|
"packet with lower seq than newest packet in the buffer and higher timestamp forces buffer emptying")
|
|
257
257
|
{
|
|
258
258
|
const uint16_t maxItems{ 4 };
|
|
259
|
-
const
|
|
259
|
+
const int64_t maxRetransmissionDelayMs{ 2000 };
|
|
260
260
|
const uint32_t clockRate{ 90000 };
|
|
261
261
|
|
|
262
262
|
RtpMyRetransmissionBuffer myRetransmissionBuffer(maxItems, maxRetransmissionDelayMs, clockRate);
|
|
@@ -276,8 +276,8 @@ SCENARIO("RTP RetransmissionBuffer", "[rtp][rtx]")
|
|
|
276
276
|
|
|
277
277
|
SECTION("fuzzer generated packets")
|
|
278
278
|
{
|
|
279
|
-
const uint16_t maxItems{
|
|
280
|
-
const
|
|
279
|
+
const uint16_t maxItems{ 2500 };
|
|
280
|
+
const int64_t maxRetransmissionDelayMs{ 2000 };
|
|
281
281
|
const uint32_t clockRate{ 90000 };
|
|
282
282
|
|
|
283
283
|
RtpMyRetransmissionBuffer myRetransmissionBuffer(maxItems, maxRetransmissionDelayMs, clockRate);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
#include "common.hpp"
|
|
2
|
+
#include "RTC/RTCP/FeedbackPs.hpp"
|
|
3
|
+
#include "RTC/RTCP/FeedbackRtpNack.hpp"
|
|
2
4
|
#include "RTC/RTP/Packet.hpp"
|
|
3
5
|
#include "RTC/RTP/RtpStream.hpp"
|
|
4
6
|
#include "RTC/RTP/RtpStreamRecv.hpp"
|
|
@@ -111,6 +113,11 @@ SCENARIO("RtpStreamRecv", "[rtp][rtpstream][rtpstreamrecv]")
|
|
|
111
113
|
return 0;
|
|
112
114
|
}
|
|
113
115
|
|
|
116
|
+
void OnRtpStreamSpatialLayerActivityChanged(
|
|
117
|
+
RTC::RTP::RtpStreamRecv* /*rtpStream*/, uint8_t /*spatialLayer*/, bool /*isActive*/) override
|
|
118
|
+
{
|
|
119
|
+
}
|
|
120
|
+
|
|
114
121
|
public:
|
|
115
122
|
bool shouldTriggerNack = false;
|
|
116
123
|
bool shouldTriggerPLI = false;
|
|
@@ -118,10 +125,10 @@ SCENARIO("RtpStreamRecv", "[rtp][rtpstream][rtpstreamrecv]")
|
|
|
118
125
|
std::vector<uint16_t> nackedSeqNumbers;
|
|
119
126
|
};
|
|
120
127
|
|
|
121
|
-
mocks::MockShared shared(/*
|
|
122
|
-
[]()
|
|
128
|
+
mocks::MockShared shared(/*getTimeUs*/
|
|
129
|
+
[]() -> int64_t
|
|
123
130
|
{
|
|
124
|
-
return 1000;
|
|
131
|
+
return 1000 * 1000;
|
|
125
132
|
});
|
|
126
133
|
|
|
127
134
|
// clang-format off
|
|
@@ -158,25 +165,25 @@ SCENARIO("RtpStreamRecv", "[rtp][rtpstream][rtpstreamrecv]")
|
|
|
158
165
|
std::addressof(listener), std::addressof(shared), params, SendNackDelay, UseRtpInactivityCheck);
|
|
159
166
|
|
|
160
167
|
packet->SetSequenceNumber(1);
|
|
161
|
-
rtpStream.ReceivePacket(packet.get());
|
|
168
|
+
rtpStream.ReceivePacket(packet.get(), shared.GetTimeUs());
|
|
162
169
|
|
|
163
170
|
packet->SetSequenceNumber(3);
|
|
164
171
|
listener.shouldTriggerNack = true;
|
|
165
172
|
listener.shouldTriggerPLI = false;
|
|
166
173
|
listener.shouldTriggerFIR = false;
|
|
167
|
-
rtpStream.ReceivePacket(packet.get());
|
|
174
|
+
rtpStream.ReceivePacket(packet.get(), shared.GetTimeUs());
|
|
168
175
|
|
|
169
176
|
REQUIRE(listener.nackedSeqNumbers.size() == 1);
|
|
170
177
|
REQUIRE(listener.nackedSeqNumbers[0] == 2);
|
|
171
178
|
listener.nackedSeqNumbers.clear();
|
|
172
179
|
|
|
173
180
|
packet->SetSequenceNumber(2);
|
|
174
|
-
rtpStream.ReceivePacket(packet.get());
|
|
181
|
+
rtpStream.ReceivePacket(packet.get(), shared.GetTimeUs());
|
|
175
182
|
|
|
176
183
|
REQUIRE(listener.nackedSeqNumbers.empty());
|
|
177
184
|
|
|
178
185
|
packet->SetSequenceNumber(4);
|
|
179
|
-
rtpStream.ReceivePacket(packet.get());
|
|
186
|
+
rtpStream.ReceivePacket(packet.get(), shared.GetTimeUs());
|
|
180
187
|
|
|
181
188
|
REQUIRE(listener.nackedSeqNumbers.empty());
|
|
182
189
|
}
|
|
@@ -188,19 +195,19 @@ SCENARIO("RtpStreamRecv", "[rtp][rtpstream][rtpstreamrecv]")
|
|
|
188
195
|
std::addressof(listener), std::addressof(shared), params, SendNackDelay, UseRtpInactivityCheck);
|
|
189
196
|
|
|
190
197
|
packet->SetSequenceNumber(1);
|
|
191
|
-
rtpStream.ReceivePacket(packet.get());
|
|
198
|
+
rtpStream.ReceivePacket(packet.get(), shared.GetTimeUs());
|
|
192
199
|
|
|
193
200
|
packet->SetSequenceNumber(2);
|
|
194
|
-
rtpStream.ReceivePacket(packet.get());
|
|
201
|
+
rtpStream.ReceivePacket(packet.get(), shared.GetTimeUs());
|
|
195
202
|
|
|
196
203
|
packet->SetSequenceNumber(3);
|
|
197
|
-
rtpStream.ReceivePacket(packet.get());
|
|
204
|
+
rtpStream.ReceivePacket(packet.get(), shared.GetTimeUs());
|
|
198
205
|
|
|
199
206
|
packet->SetSequenceNumber(4);
|
|
200
|
-
rtpStream.ReceivePacket(packet.get());
|
|
207
|
+
rtpStream.ReceivePacket(packet.get(), shared.GetTimeUs());
|
|
201
208
|
|
|
202
209
|
packet->SetSequenceNumber(5);
|
|
203
|
-
rtpStream.ReceivePacket(packet.get());
|
|
210
|
+
rtpStream.ReceivePacket(packet.get(), shared.GetTimeUs());
|
|
204
211
|
|
|
205
212
|
// Sequence number 6 arrives via RTX before the original RTP packet.
|
|
206
213
|
|
|
@@ -222,13 +229,13 @@ SCENARIO("RtpStreamRecv", "[rtp][rtpstream][rtpstreamrecv]")
|
|
|
222
229
|
std::addressof(listener), std::addressof(shared), params, SendNackDelay, UseRtpInactivityCheck);
|
|
223
230
|
|
|
224
231
|
packet->SetSequenceNumber(0xfffe);
|
|
225
|
-
rtpStream.ReceivePacket(packet.get());
|
|
232
|
+
rtpStream.ReceivePacket(packet.get(), shared.GetTimeUs());
|
|
226
233
|
|
|
227
234
|
packet->SetSequenceNumber(1);
|
|
228
235
|
listener.shouldTriggerNack = true;
|
|
229
236
|
listener.shouldTriggerPLI = false;
|
|
230
237
|
listener.shouldTriggerFIR = false;
|
|
231
|
-
rtpStream.ReceivePacket(packet.get());
|
|
238
|
+
rtpStream.ReceivePacket(packet.get(), shared.GetTimeUs());
|
|
232
239
|
|
|
233
240
|
REQUIRE(listener.nackedSeqNumbers.size() == 2);
|
|
234
241
|
REQUIRE(listener.nackedSeqNumbers[0] == 0xffff);
|
|
@@ -243,13 +250,13 @@ SCENARIO("RtpStreamRecv", "[rtp][rtpstream][rtpstreamrecv]")
|
|
|
243
250
|
std::addressof(listener), std::addressof(shared), params, SendNackDelay, UseRtpInactivityCheck);
|
|
244
251
|
|
|
245
252
|
packet->SetSequenceNumber(1);
|
|
246
|
-
rtpStream.ReceivePacket(packet.get());
|
|
253
|
+
rtpStream.ReceivePacket(packet.get(), shared.GetTimeUs());
|
|
247
254
|
|
|
248
255
|
// Seq different is bigger than MaxNackPackets in NackGenerator, so it
|
|
249
256
|
// triggers a key frame.
|
|
250
257
|
packet->SetSequenceNumber(1003);
|
|
251
258
|
listener.shouldTriggerPLI = true;
|
|
252
259
|
listener.shouldTriggerFIR = false;
|
|
253
|
-
rtpStream.ReceivePacket(packet.get());
|
|
260
|
+
rtpStream.ReceivePacket(packet.get(), shared.GetTimeUs());
|
|
254
261
|
}
|
|
255
262
|
}
|
|
@@ -107,10 +107,10 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
|
|
|
107
107
|
packet->SetPayloadDescriptorHandler(payloadDescriptorHandler);
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
-
mocks::MockShared shared(/*
|
|
111
|
-
[]()
|
|
110
|
+
mocks::MockShared shared(/*getTimeUs*/
|
|
111
|
+
[]() -> int64_t
|
|
112
112
|
{
|
|
113
|
-
return 1000;
|
|
113
|
+
return 1000 * 1000;
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
// clang-format off
|
|
@@ -1129,7 +1129,7 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
|
|
|
1129
1129
|
SECTION("Sender Report RTP timestamp is based on the capture instant when known")
|
|
1130
1130
|
{
|
|
1131
1131
|
// Instant reported by the mocked clock, and hence the one at which packets are seen.
|
|
1132
|
-
constexpr
|
|
1132
|
+
constexpr int64_t PacketAtUs{ 1000 * 1000 };
|
|
1133
1133
|
constexpr uint32_t PacketTs{ 1533790901 };
|
|
1134
1134
|
|
|
1135
1135
|
TestRtpStreamListener testRtpStreamListener;
|
|
@@ -1155,7 +1155,7 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
|
|
|
1155
1155
|
packet.get());
|
|
1156
1156
|
|
|
1157
1157
|
const std::unique_ptr<RTC::RTCP::SenderReport> report(
|
|
1158
|
-
stream.GetRtcpSenderReport(
|
|
1158
|
+
stream.GetRtcpSenderReport(PacketAtUs + 1000000));
|
|
1159
1159
|
|
|
1160
1160
|
REQUIRE(report);
|
|
1161
1161
|
REQUIRE(report->GetRtpTs() == PacketTs + params.clockRate);
|
|
@@ -1167,7 +1167,7 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
|
|
|
1167
1167
|
std::addressof(testRtpStreamListener), std::addressof(shared), params, mid);
|
|
1168
1168
|
auto packet(createRtpPacket(rtpBuffer1, sizeof(rtpBuffer1), 21006, PacketTs));
|
|
1169
1169
|
|
|
1170
|
-
packet->
|
|
1170
|
+
packet->SetCaptureAtUs(PacketAtUs - 500000);
|
|
1171
1171
|
|
|
1172
1172
|
sendRtpPacket(
|
|
1173
1173
|
{
|
|
@@ -1176,7 +1176,7 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
|
|
|
1176
1176
|
packet.get());
|
|
1177
1177
|
|
|
1178
1178
|
const std::unique_ptr<RTC::RTCP::SenderReport> report(
|
|
1179
|
-
stream.GetRtcpSenderReport(
|
|
1179
|
+
stream.GetRtcpSenderReport(PacketAtUs + 1000000));
|
|
1180
1180
|
|
|
1181
1181
|
REQUIRE(report);
|
|
1182
1182
|
REQUIRE(report->GetRtpTs() == PacketTs + ((1500 * params.clockRate) / 1000));
|
|
@@ -1189,7 +1189,7 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
|
|
|
1189
1189
|
std::addressof(testRtpStreamListener), std::addressof(shared), params, mid);
|
|
1190
1190
|
auto packet(createRtpPacket(rtpBuffer1, sizeof(rtpBuffer1), 21006, PacketTs));
|
|
1191
1191
|
|
|
1192
|
-
packet->
|
|
1192
|
+
packet->SetCaptureAtUs(PacketAtUs + 3000000);
|
|
1193
1193
|
|
|
1194
1194
|
sendRtpPacket(
|
|
1195
1195
|
{
|
|
@@ -1198,7 +1198,7 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
|
|
|
1198
1198
|
packet.get());
|
|
1199
1199
|
|
|
1200
1200
|
const std::unique_ptr<RTC::RTCP::SenderReport> report(
|
|
1201
|
-
stream.GetRtcpSenderReport(
|
|
1201
|
+
stream.GetRtcpSenderReport(PacketAtUs + 1000000));
|
|
1202
1202
|
|
|
1203
1203
|
REQUIRE(report);
|
|
1204
1204
|
REQUIRE(report->GetRtpTs() == PacketTs);
|
|
@@ -1208,7 +1208,7 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
|
|
|
1208
1208
|
SECTION("no Sender Report is generated once the stream has stopped sending")
|
|
1209
1209
|
{
|
|
1210
1210
|
// Instant reported by the mocked clock, and hence the one at which packets are seen.
|
|
1211
|
-
constexpr
|
|
1211
|
+
constexpr int64_t PacketAtUs{ 1000 * 1000 };
|
|
1212
1212
|
constexpr uint32_t PacketTs{ 1533790901 };
|
|
1213
1213
|
|
|
1214
1214
|
TestRtpStreamListener testRtpStreamListener;
|
|
@@ -1232,14 +1232,14 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
|
|
|
1232
1232
|
packet.get());
|
|
1233
1233
|
|
|
1234
1234
|
// Right at the limit the Sender Report is still generated.
|
|
1235
|
-
const std::unique_ptr<RTC::RTCP::SenderReport> report(
|
|
1236
|
-
|
|
1235
|
+
const std::unique_ptr<RTC::RTCP::SenderReport> report(stream.GetRtcpSenderReport(
|
|
1236
|
+
PacketAtUs + (RTC::RTP::RtpStreamSend::MaxSenderReportReferenceAgeMs * 1000)));
|
|
1237
1237
|
|
|
1238
1238
|
REQUIRE(report);
|
|
1239
1239
|
|
|
1240
1240
|
// Past the limit it is not.
|
|
1241
1241
|
const std::unique_ptr<RTC::RTCP::SenderReport> staleReport(stream.GetRtcpSenderReport(
|
|
1242
|
-
|
|
1242
|
+
PacketAtUs + ((RTC::RTP::RtpStreamSend::MaxSenderReportReferenceAgeMs + 1) * 1000)));
|
|
1243
1243
|
|
|
1244
1244
|
REQUIRE_FALSE(staleReport);
|
|
1245
1245
|
}
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
|
|
34
34
|
namespace
|
|
35
35
|
{
|
|
36
|
-
// Initial value of the simulated clock (
|
|
37
|
-
constexpr
|
|
36
|
+
// Initial value of the simulated clock (us).
|
|
37
|
+
constexpr int64_t InitialNowUs{ 1000000 * 1000 };
|
|
38
38
|
|
|
39
39
|
// All backoff timer labels an SCTP association may create. Used by `runTimers()`
|
|
40
40
|
// to fire whichever timers have expired after advancing time.
|
|
@@ -78,10 +78,10 @@ namespace
|
|
|
78
78
|
bool mayConnectOnReceivedSctpData = false)
|
|
79
79
|
// NOTE: The order in which these members are initialized is **critical**.
|
|
80
80
|
: sctpOptions(sctpOptions),
|
|
81
|
-
shared(/*
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return this->
|
|
81
|
+
shared(/*getTimeUs*/
|
|
82
|
+
[this]() -> int64_t
|
|
83
|
+
{
|
|
84
|
+
return this->nowUs;
|
|
85
85
|
}),
|
|
86
86
|
association(
|
|
87
87
|
this->sctpOptions,
|
|
@@ -94,14 +94,18 @@ namespace
|
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
96
|
* Advances the simulated clock of this association by `incrementMs`.
|
|
97
|
+
*
|
|
98
|
+
* @remarks
|
|
99
|
+
* - The increment is given in milliseconds since it comes from the SCTP
|
|
100
|
+
* options and the timers, which work in milliseconds.
|
|
97
101
|
*/
|
|
98
|
-
void AdvanceTimeMs(
|
|
102
|
+
void AdvanceTimeMs(int64_t incrementMs)
|
|
99
103
|
{
|
|
100
|
-
this->
|
|
104
|
+
this->nowUs += incrementMs * 1000;
|
|
101
105
|
}
|
|
102
106
|
|
|
103
107
|
public:
|
|
104
|
-
|
|
108
|
+
int64_t nowUs{ InitialNowUs };
|
|
105
109
|
RTC::SCTP::SctpOptions sctpOptions;
|
|
106
110
|
mocks::RTC::SCTP::MockAssociationListener listener;
|
|
107
111
|
mocks::MockShared shared;
|
|
@@ -148,7 +152,7 @@ namespace
|
|
|
148
152
|
|
|
149
153
|
REQUIRE(!buffer.empty());
|
|
150
154
|
|
|
151
|
-
to.association.ReceiveSctpData(buffer.data(), buffer.size());
|
|
155
|
+
to.association.ReceiveSctpData(buffer.data(), buffer.size(), to.shared.GetTimeUs());
|
|
152
156
|
}
|
|
153
157
|
|
|
154
158
|
/**
|
|
@@ -168,7 +172,7 @@ namespace
|
|
|
168
172
|
if (!bufferFromA.empty())
|
|
169
173
|
{
|
|
170
174
|
deliveredPacket = true;
|
|
171
|
-
z.association.ReceiveSctpData(bufferFromA.data(), bufferFromA.size());
|
|
175
|
+
z.association.ReceiveSctpData(bufferFromA.data(), bufferFromA.size(), z.shared.GetTimeUs());
|
|
172
176
|
}
|
|
173
177
|
|
|
174
178
|
const auto bufferFromZ = z.listener.ConsumeFirstSentPacket();
|
|
@@ -176,7 +180,7 @@ namespace
|
|
|
176
180
|
if (!bufferFromZ.empty())
|
|
177
181
|
{
|
|
178
182
|
deliveredPacket = true;
|
|
179
|
-
a.association.ReceiveSctpData(bufferFromZ.data(), bufferFromZ.size());
|
|
183
|
+
a.association.ReceiveSctpData(bufferFromZ.data(), bufferFromZ.size(), a.shared.GetTimeUs());
|
|
180
184
|
}
|
|
181
185
|
} while (deliveredPacket);
|
|
182
186
|
}
|
|
@@ -212,7 +216,7 @@ namespace
|
|
|
212
216
|
* Advances the simulated clock of both associations by `durationMs` and fires
|
|
213
217
|
* any timer that has expired.
|
|
214
218
|
*/
|
|
215
|
-
void advanceTimeMs(AssociationUnderTest& a, AssociationUnderTest& z,
|
|
219
|
+
void advanceTimeMs(AssociationUnderTest& a, AssociationUnderTest& z, int64_t durationMs)
|
|
216
220
|
{
|
|
217
221
|
a.AdvanceTimeMs(durationMs);
|
|
218
222
|
z.AdvanceTimeMs(durationMs);
|
|
@@ -259,7 +263,7 @@ namespace
|
|
|
259
263
|
const uint32_t verificationTag = parsePacket(buffer)->GetVerificationTag();
|
|
260
264
|
|
|
261
265
|
// Deliver the COOKIE-ACK so the connection is fully established on A.
|
|
262
|
-
a.association.ReceiveSctpData(buffer.data(), buffer.size());
|
|
266
|
+
a.association.ReceiveSctpData(buffer.data(), buffer.size(), a.shared.GetTimeUs());
|
|
263
267
|
|
|
264
268
|
REQUIRE(a.association.GetAssociationState() == RTC::SCTP::Types::AssociationState::CONNECTED);
|
|
265
269
|
REQUIRE(z.association.GetAssociationState() == RTC::SCTP::Types::AssociationState::CONNECTED);
|
|
@@ -291,7 +295,8 @@ namespace
|
|
|
291
295
|
{
|
|
292
296
|
packet->WriteCRC32cChecksum();
|
|
293
297
|
|
|
294
|
-
target.association.ReceiveSctpData(
|
|
298
|
+
target.association.ReceiveSctpData(
|
|
299
|
+
packet->GetBuffer(), packet->GetLength(), target.shared.GetTimeUs());
|
|
295
300
|
}
|
|
296
301
|
|
|
297
302
|
/**
|
|
@@ -836,7 +841,7 @@ SCENARIO("SCTP Association", "[sctp][association]")
|
|
|
836
841
|
REQUIRE(packetHasSingleChunkOfType<RTC::SCTP::HeartbeatRequestChunk>(buffer) == true);
|
|
837
842
|
|
|
838
843
|
// Feed it to Z and expect a HEARTBEAT-ACK that is propagated back to A.
|
|
839
|
-
z.association.ReceiveSctpData(buffer.data(), buffer.size());
|
|
844
|
+
z.association.ReceiveSctpData(buffer.data(), buffer.size(), z.shared.GetTimeUs());
|
|
840
845
|
deliverFirstSentPacket(z, a);
|
|
841
846
|
}
|
|
842
847
|
|
|
@@ -1282,7 +1287,7 @@ SCENARIO("SCTP Association", "[sctp][association]")
|
|
|
1282
1287
|
REQUIRE(packetHasSingleChunkOfType<RTC::SCTP::HeartbeatRequestChunk>(bufferA) == true);
|
|
1283
1288
|
|
|
1284
1289
|
// Z receives the heartbeat and sends an ACK that is propagated back to A.
|
|
1285
|
-
z.association.ReceiveSctpData(bufferA.data(), bufferA.size());
|
|
1290
|
+
z.association.ReceiveSctpData(bufferA.data(), bufferA.size(), z.shared.GetTimeUs());
|
|
1286
1291
|
deliverFirstSentPacket(z, a);
|
|
1287
1292
|
|
|
1288
1293
|
// A little while later, Z should send heartbeats to A.
|
|
@@ -1293,7 +1298,7 @@ SCENARIO("SCTP Association", "[sctp][association]")
|
|
|
1293
1298
|
REQUIRE(packetHasSingleChunkOfType<RTC::SCTP::HeartbeatRequestChunk>(bufferZ) == true);
|
|
1294
1299
|
|
|
1295
1300
|
// A receives the heartbeat and sends an ACK that is propagated back to Z.
|
|
1296
|
-
a.association.ReceiveSctpData(bufferZ.data(), bufferZ.size());
|
|
1301
|
+
a.association.ReceiveSctpData(bufferZ.data(), bufferZ.size(), a.shared.GetTimeUs());
|
|
1297
1302
|
deliverFirstSentPacket(a, z);
|
|
1298
1303
|
}
|
|
1299
1304
|
|
|
@@ -1313,7 +1318,7 @@ SCENARIO("SCTP Association", "[sctp][association]")
|
|
|
1313
1318
|
|
|
1314
1319
|
const auto maxRetransmissions = a.sctpOptions.maxRetransmissions.value();
|
|
1315
1320
|
|
|
1316
|
-
|
|
1321
|
+
int64_t timeToNextHeartbeatMs = a.sctpOptions.heartbeatIntervalMs;
|
|
1317
1322
|
|
|
1318
1323
|
for (size_t i = 0; i < maxRetransmissions; ++i)
|
|
1319
1324
|
{
|
|
@@ -1362,7 +1367,7 @@ SCENARIO("SCTP Association", "[sctp][association]")
|
|
|
1362
1367
|
|
|
1363
1368
|
const auto maxRetransmissions = a.sctpOptions.maxRetransmissions.value();
|
|
1364
1369
|
|
|
1365
|
-
|
|
1370
|
+
int64_t timeToNextHeartbeatMs = a.sctpOptions.heartbeatIntervalMs;
|
|
1366
1371
|
|
|
1367
1372
|
for (size_t i = 0; i < maxRetransmissions; ++i)
|
|
1368
1373
|
{
|
|
@@ -1384,7 +1389,7 @@ SCENARIO("SCTP Association", "[sctp][association]")
|
|
|
1384
1389
|
|
|
1385
1390
|
REQUIRE(packetHasSingleChunkOfType<RTC::SCTP::HeartbeatRequestChunk>(buffer) == true);
|
|
1386
1391
|
|
|
1387
|
-
z.association.ReceiveSctpData(buffer.data(), buffer.size());
|
|
1392
|
+
z.association.ReceiveSctpData(buffer.data(), buffer.size(), z.shared.GetTimeUs());
|
|
1388
1393
|
// A reads the HEARTBEAT-ACK, which clears the error counter.
|
|
1389
1394
|
deliverFirstSentPacket(z, a);
|
|
1390
1395
|
|
|
@@ -1890,7 +1895,7 @@ SCENARIO("SCTP Association", "[sctp][association]")
|
|
|
1890
1895
|
|
|
1891
1896
|
// Make the cookie stale on Z's side by advancing its clock beyond the cookie
|
|
1892
1897
|
// lifespan before the COOKIE-ECHO is delivered.
|
|
1893
|
-
z.AdvanceTimeMs(RTC::SCTP::StateCookie::
|
|
1898
|
+
z.AdvanceTimeMs((RTC::SCTP::StateCookie::ValidCookieLifeUs / 1000) + 1000);
|
|
1894
1899
|
|
|
1895
1900
|
// Z reads the now stale COOKIE-ECHO.
|
|
1896
1901
|
deliverFirstSentPacket(a, z);
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
|
|
19
19
|
SCENARIO("SCTP HeartbeatHandler", "[sctp][heartbeathandler]")
|
|
20
20
|
{
|
|
21
|
-
constexpr
|
|
22
|
-
constexpr
|
|
21
|
+
constexpr int64_t InitialNowUs{ 1000000 * 1000 };
|
|
22
|
+
constexpr int64_t HeartbeatIntervalMs{ 30000 };
|
|
23
23
|
|
|
24
24
|
class TestHeartbeatHandler
|
|
25
25
|
{
|
|
26
26
|
public:
|
|
27
|
-
explicit TestHeartbeatHandler(
|
|
27
|
+
explicit TestHeartbeatHandler(int64_t heartbeatIntervalMs)
|
|
28
28
|
// NOTE: The order in which these members are initialized is **critical**.
|
|
29
29
|
: sctpOptions(
|
|
30
30
|
RTC::SCTP::SctpOptions{
|
|
@@ -33,10 +33,10 @@ SCENARIO("SCTP HeartbeatHandler", "[sctp][heartbeathandler]")
|
|
|
33
33
|
.zeroChecksumAlternateErrorDetectionMethod =
|
|
34
34
|
RTC::SCTP::ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod::NONE }),
|
|
35
35
|
tcbContext(this->associationListener, this->sctpOptions),
|
|
36
|
-
shared(/*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return this->
|
|
36
|
+
shared(/*getTimeUs*/
|
|
37
|
+
[this]() -> int64_t
|
|
38
|
+
{
|
|
39
|
+
return this->nowUs;
|
|
40
40
|
}),
|
|
41
41
|
heartbeatHandler(
|
|
42
42
|
this->associationListenerDeferrer,
|
|
@@ -49,13 +49,18 @@ SCENARIO("SCTP HeartbeatHandler", "[sctp][heartbeathandler]")
|
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
public:
|
|
52
|
+
/**
|
|
53
|
+
* @remarks
|
|
54
|
+
* - The increment is given in milliseconds since it comes from the SCTP
|
|
55
|
+
* options and the timers, which work in milliseconds.
|
|
56
|
+
*/
|
|
52
57
|
void AdvanceTimeMs(int64_t incrementMs)
|
|
53
58
|
{
|
|
54
|
-
this->
|
|
59
|
+
this->nowUs += incrementMs * 1000;
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
private:
|
|
58
|
-
|
|
63
|
+
int64_t nowUs{ InitialNowUs };
|
|
59
64
|
|
|
60
65
|
// NOTE: Public members for testing.
|
|
61
66
|
public:
|
|
@@ -185,9 +190,10 @@ SCENARIO("SCTP HeartbeatHandler", "[sctp][heartbeathandler]")
|
|
|
185
190
|
receivedHeartbeatInfoParameter->Consolidate();
|
|
186
191
|
|
|
187
192
|
// Respond a while later.
|
|
188
|
-
const
|
|
193
|
+
const int64_t rttMs{ 313 };
|
|
189
194
|
|
|
190
|
-
test.tcbContext.
|
|
195
|
+
test.tcbContext.ExpectObserveRttUsCalledTimes(1).ExpectObserveRttUsCalledWith(
|
|
196
|
+
static_cast<int64_t>(rttMs * 1000));
|
|
191
197
|
|
|
192
198
|
test.AdvanceTimeMs(rttMs);
|
|
193
199
|
test.heartbeatHandler.HandleReceivedHeartbeatAckChunk(receivedHeartbeatAckChunk.get());
|
|
@@ -237,7 +243,7 @@ SCENARIO("SCTP HeartbeatHandler", "[sctp][heartbeathandler]")
|
|
|
237
243
|
sentHeartbeatInfoParameter->GetInfo(), sentHeartbeatInfoParameter->GetInfoLength());
|
|
238
244
|
receivedHeartbeatInfoParameter->Consolidate();
|
|
239
245
|
|
|
240
|
-
test.tcbContext.
|
|
246
|
+
test.tcbContext.ExpectObserveRttUsCalledTimes(0);
|
|
241
247
|
|
|
242
248
|
// Go backwards in time to make the HEARTBEAT-ACK have an invalid timestamp
|
|
243
249
|
// in it, as it will be in the future.
|
|
@@ -251,12 +257,12 @@ SCENARIO("SCTP HeartbeatHandler", "[sctp][heartbeathandler]")
|
|
|
251
257
|
{
|
|
252
258
|
TestHeartbeatHandler test(HeartbeatIntervalMs);
|
|
253
259
|
|
|
254
|
-
const
|
|
260
|
+
const int64_t rtoMs{ 105 };
|
|
255
261
|
|
|
256
|
-
test.tcbContext.
|
|
262
|
+
test.tcbContext.WillGetCurrentRtoUsOnce(
|
|
257
263
|
[]()
|
|
258
264
|
{
|
|
259
|
-
return rtoMs;
|
|
265
|
+
return static_cast<int64_t>(rtoMs * 1000);
|
|
260
266
|
});
|
|
261
267
|
|
|
262
268
|
test.AdvanceTimeMs(test.sctpOptions.heartbeatIntervalMs);
|
|
@@ -614,9 +614,9 @@ SCENARIO("SCTP State Cookie", "[sctp][statecookie]")
|
|
|
614
614
|
RTC::SCTP::ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod::NONE
|
|
615
615
|
};
|
|
616
616
|
|
|
617
|
-
const uint8_t macKey[]
|
|
618
|
-
|
|
619
|
-
const
|
|
617
|
+
const uint8_t macKey[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
|
618
|
+
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF };
|
|
619
|
+
const int64_t creationTimestampUs = 1234567890;
|
|
620
620
|
|
|
621
621
|
auto* buffer = sctpCommon::FactoryBuffer;
|
|
622
622
|
|
|
@@ -630,7 +630,7 @@ SCENARIO("SCTP State Cookie", "[sctp][statecookie]")
|
|
|
630
630
|
/*remoteAdvertisedReceiverWindowCredit*/ 999909999,
|
|
631
631
|
/*tieTag*/ 1111222233334444,
|
|
632
632
|
remoteCapabilities,
|
|
633
|
-
/*
|
|
633
|
+
/*creationTimestampUs*/ creationTimestampUs,
|
|
634
634
|
/*macKey*/ macKey,
|
|
635
635
|
/*macKeyLength*/ sizeof(macKey));
|
|
636
636
|
|
|
@@ -648,7 +648,7 @@ SCENARIO("SCTP State Cookie", "[sctp][statecookie]")
|
|
|
648
648
|
REQUIRE(stateCookie);
|
|
649
649
|
REQUIRE(stateCookie->GetLength() == RTC::SCTP::StateCookie::AuthenticatedStateCookieLength);
|
|
650
650
|
REQUIRE(stateCookie->IsAuthenticated() == true);
|
|
651
|
-
REQUIRE(stateCookie->
|
|
651
|
+
REQUIRE(stateCookie->GetCreationTimestampUs() == creationTimestampUs);
|
|
652
652
|
REQUIRE(stateCookie->GetLocalVerificationTag() == 6660666);
|
|
653
653
|
REQUIRE(stateCookie->GetRemoteVerificationTag() == 9990999);
|
|
654
654
|
|
|
@@ -662,7 +662,7 @@ SCENARIO("SCTP State Cookie", "[sctp][statecookie]")
|
|
|
662
662
|
/* The MAC must NOT verify with a wrong key. */
|
|
663
663
|
|
|
664
664
|
const uint8_t wrongMacKey[] = { 0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88,
|
|
665
|
-
|
|
665
|
+
0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00 };
|
|
666
666
|
|
|
667
667
|
REQUIRE(
|
|
668
668
|
RTC::SCTP::StateCookie::VerifyMac(
|