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
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#include "common.hpp"
|
|
2
|
-
#include "Logger.hpp"
|
|
3
2
|
#include "RTC/RTCP/FeedbackRtpTransport.hpp"
|
|
4
3
|
#include <catch2/catch_test_macros.hpp>
|
|
5
4
|
#include <cstring> // std::memcmp()
|
|
@@ -8,13 +7,13 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
8
7
|
{
|
|
9
8
|
struct TestFeedbackRtpTransportInput
|
|
10
9
|
{
|
|
11
|
-
TestFeedbackRtpTransportInput(uint16_t sequenceNumber,
|
|
12
|
-
: sequenceNumber(sequenceNumber),
|
|
10
|
+
TestFeedbackRtpTransportInput(uint16_t sequenceNumber, int64_t timestampUs, size_t maxPacketSize)
|
|
11
|
+
: sequenceNumber(sequenceNumber), timestampUs(timestampUs), maxPacketSize(maxPacketSize)
|
|
13
12
|
{
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
uint16_t sequenceNumber{ 0u };
|
|
17
|
-
|
|
16
|
+
int64_t timestampUs{ 0 };
|
|
18
17
|
size_t maxPacketSize{ 0u };
|
|
19
18
|
};
|
|
20
19
|
|
|
@@ -26,43 +25,53 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
26
25
|
auto verify =
|
|
27
26
|
[](
|
|
28
27
|
const std::vector<struct TestFeedbackRtpTransportInput>& inputs,
|
|
29
|
-
std::vector<struct RTC::RTCP::FeedbackRtpTransportPacket::
|
|
28
|
+
const std::vector<struct RTC::RTCP::FeedbackRtpTransportPacket::PacketStatus>& packetStatuses)
|
|
30
29
|
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
// The reference time only carries whole base time ticks and wraps around,
|
|
31
|
+
// so the reconstructed times sit in a frame shifted a constant amount from
|
|
32
|
+
// the given ones. The shift comes from the timestamp the base was set with,
|
|
33
|
+
// which is the first input.
|
|
34
|
+
const int64_t baseTimeTicks =
|
|
35
|
+
inputs.front().timestampUs / RTC::RTCP::FeedbackRtpTransportPacket::BaseTimeTickUs;
|
|
36
|
+
const int64_t maskedBaseTimeTicks = baseTimeTicks & 0xFFFFFF;
|
|
37
|
+
// The reference time is a 24 bits signed integer.
|
|
38
|
+
const int64_t referenceTime =
|
|
39
|
+
maskedBaseTimeTicks >= (1 << 23) ? maskedBaseTimeTicks - (1 << 24) : maskedBaseTimeTicks;
|
|
40
|
+
const int64_t frameOffsetUs =
|
|
41
|
+
RTC::RTCP::FeedbackRtpTransportPacket::TimeWrapPeriodUs +
|
|
42
|
+
((referenceTime - baseTimeTicks) * RTC::RTCP::FeedbackRtpTransportPacket::BaseTimeTickUs);
|
|
43
|
+
|
|
44
|
+
auto packetStatusesIterator = packetStatuses.begin();
|
|
45
|
+
auto lastInput = inputs.front();
|
|
46
|
+
|
|
47
|
+
for (auto inputsIterator = inputs.begin() + 1; inputsIterator != inputs.end(); ++inputsIterator)
|
|
36
48
|
{
|
|
37
49
|
const auto& input = *inputsIterator;
|
|
38
|
-
auto& packetResult = *packetResultsIterator;
|
|
39
50
|
const uint16_t missingPackets = input.sequenceNumber - lastInput.sequenceNumber - 1;
|
|
40
51
|
|
|
41
|
-
|
|
52
|
+
// All missing packets must be represented in packetStatuses.
|
|
53
|
+
for (uint16_t i{ 0u }; i < missingPackets; ++i)
|
|
42
54
|
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
packetResult = *packetResultsIterator;
|
|
47
|
-
|
|
48
|
-
REQUIRE(packetResult.sequenceNumber == lastInput.sequenceNumber + i + 1);
|
|
49
|
-
REQUIRE(packetResult.received == false);
|
|
55
|
+
REQUIRE(packetStatusesIterator != packetStatuses.end());
|
|
56
|
+
REQUIRE(packetStatusesIterator->sequenceNumber == lastInput.sequenceNumber + i + 1);
|
|
57
|
+
REQUIRE(packetStatusesIterator->received == false);
|
|
50
58
|
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
else
|
|
55
|
-
{
|
|
56
|
-
REQUIRE(packetResult.sequenceNumber == lastInput.sequenceNumber + 1);
|
|
57
|
-
REQUIRE(packetResult.sequenceNumber == input.sequenceNumber);
|
|
58
|
-
REQUIRE(packetResult.received == true);
|
|
59
|
-
REQUIRE(
|
|
60
|
-
static_cast<int32_t>(packetResult.receivedAtMs & 0x1FFFFFC0) / 64 ==
|
|
61
|
-
static_cast<int32_t>(input.timestamp & 0x1FFFFFC0) / 64);
|
|
59
|
+
++packetStatusesIterator;
|
|
62
60
|
}
|
|
63
61
|
|
|
62
|
+
REQUIRE(packetStatusesIterator != packetStatuses.end());
|
|
63
|
+
REQUIRE(packetStatusesIterator->sequenceNumber == input.sequenceNumber);
|
|
64
|
+
REQUIRE(packetStatusesIterator->received == true);
|
|
65
|
+
// Deltas carry the arrival times with no loss as long as the given ones
|
|
66
|
+
// are multiples of a delta tick.
|
|
67
|
+
REQUIRE(packetStatusesIterator->receivedAtUs == input.timestampUs + frameOffsetUs);
|
|
68
|
+
|
|
69
|
+
++packetStatusesIterator;
|
|
70
|
+
|
|
64
71
|
lastInput = input;
|
|
65
72
|
}
|
|
73
|
+
|
|
74
|
+
REQUIRE(packetStatusesIterator == packetStatuses.end());
|
|
66
75
|
};
|
|
67
76
|
|
|
68
77
|
SECTION(
|
|
@@ -75,21 +84,21 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
75
84
|
/* clang-format off */
|
|
76
85
|
std::vector<struct TestFeedbackRtpTransportInput> inputs =
|
|
77
86
|
{
|
|
78
|
-
{ 999,
|
|
79
|
-
{ 1000,
|
|
80
|
-
{ 1001,
|
|
81
|
-
{ 1002,
|
|
82
|
-
{ 1003,
|
|
83
|
-
{ 1004,
|
|
84
|
-
{ 1005,
|
|
85
|
-
{ 1006,
|
|
86
|
-
{ 1007,
|
|
87
|
-
{ 1008,
|
|
88
|
-
{ 1009,
|
|
89
|
-
{ 1010,
|
|
90
|
-
{ 1011,
|
|
91
|
-
{ 1012,
|
|
92
|
-
{ 1013,
|
|
87
|
+
{ 999, 1000000000000, RtcpMtu }, // Pre base.
|
|
88
|
+
{ 1000, 1000000000000, RtcpMtu }, // Base.
|
|
89
|
+
{ 1001, 1000000001000, RtcpMtu },
|
|
90
|
+
{ 1002, 1000000012000, RtcpMtu },
|
|
91
|
+
{ 1003, 1000000015000, RtcpMtu },
|
|
92
|
+
{ 1004, 1000000017000, RtcpMtu },
|
|
93
|
+
{ 1005, 1000000018000, RtcpMtu },
|
|
94
|
+
{ 1006, 1000000018000, RtcpMtu },
|
|
95
|
+
{ 1007, 1000000018000, RtcpMtu },
|
|
96
|
+
{ 1008, 1000000018000, RtcpMtu },
|
|
97
|
+
{ 1009, 1000000019000, RtcpMtu },
|
|
98
|
+
{ 1010, 1000000010000, RtcpMtu },
|
|
99
|
+
{ 1011, 1000000011000, RtcpMtu },
|
|
100
|
+
{ 1012, 1000000011000, RtcpMtu },
|
|
101
|
+
{ 1013, 1000000013000, RtcpMtu }
|
|
93
102
|
};
|
|
94
103
|
/* clang-format on */
|
|
95
104
|
|
|
@@ -99,32 +108,32 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
99
108
|
{
|
|
100
109
|
if (std::addressof(input) == std::addressof(inputs.front()))
|
|
101
110
|
{
|
|
102
|
-
packet->SetBase(input.sequenceNumber + 1, input.
|
|
111
|
+
packet->SetBase(input.sequenceNumber + 1, input.timestampUs);
|
|
103
112
|
}
|
|
104
113
|
else
|
|
105
114
|
{
|
|
106
|
-
packet->AddPacket(input.sequenceNumber, input.
|
|
115
|
+
packet->AddPacket(input.sequenceNumber, input.timestampUs, input.maxPacketSize);
|
|
107
116
|
}
|
|
108
117
|
}
|
|
109
118
|
|
|
110
119
|
REQUIRE(packet->GetLatestSequenceNumber() == 1013);
|
|
111
|
-
REQUIRE(packet->
|
|
120
|
+
REQUIRE(packet->GetLatestTimestampUs() == 1000000013000);
|
|
112
121
|
|
|
113
122
|
// Add a packet with greater seq number but older timestamp.
|
|
114
|
-
packet->AddPacket(1014,
|
|
115
|
-
inputs.emplace_back(1014,
|
|
123
|
+
packet->AddPacket(1014, 1000000013000 - 128000, RtcpMtu);
|
|
124
|
+
inputs.emplace_back(1014, 1000000013000 - 128000, RtcpMtu);
|
|
116
125
|
|
|
117
126
|
REQUIRE(packet->GetLatestSequenceNumber() == 1014);
|
|
118
|
-
REQUIRE(packet->
|
|
127
|
+
REQUIRE(packet->GetLatestTimestampUs() == 1000000013000 - 128000);
|
|
119
128
|
|
|
120
|
-
packet->AddPacket(1015,
|
|
121
|
-
inputs.emplace_back(1015,
|
|
129
|
+
packet->AddPacket(1015, 1000000015000, RtcpMtu);
|
|
130
|
+
inputs.emplace_back(1015, 1000000015000, RtcpMtu);
|
|
122
131
|
|
|
123
132
|
REQUIRE(packet->GetLatestSequenceNumber() == 1015);
|
|
124
|
-
REQUIRE(packet->
|
|
133
|
+
REQUIRE(packet->GetLatestTimestampUs() == 1000000015000);
|
|
125
134
|
|
|
126
135
|
packet->Finish();
|
|
127
|
-
verify(inputs, packet->
|
|
136
|
+
verify(inputs, packet->GetPacketStatuses());
|
|
128
137
|
|
|
129
138
|
REQUIRE(packet->GetBaseSequenceNumber() == 1000);
|
|
130
139
|
REQUIRE(packet->GetPacketStatusCount() == 16);
|
|
@@ -150,6 +159,11 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
150
159
|
REQUIRE(packet2->GetFeedbackPacketCount() == 1);
|
|
151
160
|
REQUIRE(packet2->GetPacketFractionLost() == 0);
|
|
152
161
|
|
|
162
|
+
// The reference time survives the round trip, so a parsed packet tells
|
|
163
|
+
// the very same arrival times as the one it was serialized from.
|
|
164
|
+
REQUIRE(packet2->GetReferenceTime() == packet->GetReferenceTime());
|
|
165
|
+
verify(inputs, packet2->GetPacketStatuses());
|
|
166
|
+
|
|
153
167
|
alignas(4) uint8_t buffer2[1024];
|
|
154
168
|
auto len2 = packet2->Serialize(buffer2);
|
|
155
169
|
|
|
@@ -160,16 +174,16 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
160
174
|
}
|
|
161
175
|
}
|
|
162
176
|
|
|
163
|
-
SECTION("create FeedbackRtpTransportPacket, run length chunk
|
|
177
|
+
SECTION("create FeedbackRtpTransportPacket, not received run length chunk and large delta")
|
|
164
178
|
{
|
|
165
179
|
auto packet = std::make_unique<RTC::RTCP::FeedbackRtpTransportPacket>(senderSsrc, mediaSsrc);
|
|
166
180
|
|
|
167
181
|
/* clang-format off */
|
|
168
182
|
std::vector<TestFeedbackRtpTransportInput> inputs =
|
|
169
183
|
{
|
|
170
|
-
{ 999,
|
|
171
|
-
{ 1000,
|
|
172
|
-
{ 1050,
|
|
184
|
+
{ 999, 1000000000000, RtcpMtu }, // Pre base.
|
|
185
|
+
{ 1000, 1000000000000, RtcpMtu }, // Base.
|
|
186
|
+
{ 1050, 1000000216000, RtcpMtu }
|
|
173
187
|
};
|
|
174
188
|
/* clang-format on */
|
|
175
189
|
|
|
@@ -179,23 +193,23 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
179
193
|
{
|
|
180
194
|
if (std::addressof(input) == std::addressof(inputs.front()))
|
|
181
195
|
{
|
|
182
|
-
packet->SetBase(input.sequenceNumber + 1, input.
|
|
196
|
+
packet->SetBase(input.sequenceNumber + 1, input.timestampUs);
|
|
183
197
|
}
|
|
184
198
|
else
|
|
185
199
|
{
|
|
186
|
-
packet->AddPacket(input.sequenceNumber, input.
|
|
200
|
+
packet->AddPacket(input.sequenceNumber, input.timestampUs, input.maxPacketSize);
|
|
187
201
|
}
|
|
188
202
|
}
|
|
189
203
|
|
|
190
204
|
packet->Finish();
|
|
191
|
-
verify(inputs, packet->
|
|
205
|
+
verify(inputs, packet->GetPacketStatuses());
|
|
192
206
|
|
|
193
207
|
REQUIRE(packet->GetBaseSequenceNumber() == 1000);
|
|
194
208
|
REQUIRE(packet->GetPacketStatusCount() == 51);
|
|
195
209
|
REQUIRE(packet->GetFeedbackPacketCount() == 10);
|
|
196
210
|
REQUIRE(packet->GetPacketFractionLost() > 0);
|
|
197
211
|
REQUIRE(packet->GetLatestSequenceNumber() == 1050);
|
|
198
|
-
REQUIRE(packet->
|
|
212
|
+
REQUIRE(packet->GetLatestTimestampUs() == 1000000216000);
|
|
199
213
|
|
|
200
214
|
SECTION("serialize packet instance")
|
|
201
215
|
{
|
|
@@ -231,13 +245,13 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
231
245
|
/* clang-format off */
|
|
232
246
|
std::vector<TestFeedbackRtpTransportInput> inputs =
|
|
233
247
|
{
|
|
234
|
-
{ 999,
|
|
235
|
-
{ 1000,
|
|
236
|
-
{ 1001,
|
|
237
|
-
{ 1002,
|
|
238
|
-
{ 1015,
|
|
239
|
-
{ 1016,
|
|
240
|
-
{ 1017,
|
|
248
|
+
{ 999, 1000000000000, RtcpMtu }, // Pre base.
|
|
249
|
+
{ 1000, 1000000000000, RtcpMtu }, // Base.
|
|
250
|
+
{ 1001, 1000000100000, RtcpMtu },
|
|
251
|
+
{ 1002, 1000000200000, RtcpMtu },
|
|
252
|
+
{ 1015, 1000000300000, RtcpMtu },
|
|
253
|
+
{ 1016, 1000000400000, RtcpMtu },
|
|
254
|
+
{ 1017, 1000000500000, RtcpMtu }
|
|
241
255
|
};
|
|
242
256
|
/* clang-format on */
|
|
243
257
|
|
|
@@ -249,23 +263,23 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
249
263
|
{
|
|
250
264
|
if (std::addressof(input) == std::addressof(inputs.front()))
|
|
251
265
|
{
|
|
252
|
-
packet->SetBase(input.sequenceNumber + 1, input.
|
|
266
|
+
packet->SetBase(input.sequenceNumber + 1, input.timestampUs);
|
|
253
267
|
}
|
|
254
268
|
else
|
|
255
269
|
{
|
|
256
|
-
packet->AddPacket(input.sequenceNumber, input.
|
|
270
|
+
packet->AddPacket(input.sequenceNumber, input.timestampUs, input.maxPacketSize);
|
|
257
271
|
}
|
|
258
272
|
}
|
|
259
273
|
|
|
260
274
|
packet->Finish();
|
|
261
|
-
verify(inputs, packet->
|
|
275
|
+
verify(inputs, packet->GetPacketStatuses());
|
|
262
276
|
|
|
263
277
|
REQUIRE(packet->GetBaseSequenceNumber() == 1000);
|
|
264
278
|
REQUIRE(packet->GetPacketStatusCount() == 18);
|
|
265
279
|
REQUIRE(packet->GetFeedbackPacketCount() == 1);
|
|
266
280
|
REQUIRE(packet->GetPacketFractionLost() > 0);
|
|
267
281
|
REQUIRE(packet->GetLatestSequenceNumber() == 1017);
|
|
268
|
-
REQUIRE(packet->
|
|
282
|
+
REQUIRE(packet->GetLatestTimestampUs() == 1000000500000);
|
|
269
283
|
|
|
270
284
|
SECTION("serialize packet instance")
|
|
271
285
|
{
|
|
@@ -299,9 +313,9 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
299
313
|
SECTION("create FeedbackRtpTransportPacket, incomplete two bit vector chunk")
|
|
300
314
|
{
|
|
301
315
|
std::vector<TestFeedbackRtpTransportInput> inputs = {
|
|
302
|
-
{ 999,
|
|
303
|
-
{ 1000,
|
|
304
|
-
{ 1001,
|
|
316
|
+
{ 999, 1000000000000, RtcpMtu }, // Pre base.
|
|
317
|
+
{ 1000, 1000000100000, RtcpMtu }, // Base.
|
|
318
|
+
{ 1001, 1000000700000, RtcpMtu },
|
|
305
319
|
};
|
|
306
320
|
|
|
307
321
|
auto packet = std::make_unique<RTC::RTCP::FeedbackRtpTransportPacket>(senderSsrc, mediaSsrc);
|
|
@@ -312,23 +326,23 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
312
326
|
{
|
|
313
327
|
if (std::addressof(input) == std::addressof(inputs.front()))
|
|
314
328
|
{
|
|
315
|
-
packet->SetBase(input.sequenceNumber + 1, input.
|
|
329
|
+
packet->SetBase(input.sequenceNumber + 1, input.timestampUs);
|
|
316
330
|
}
|
|
317
331
|
else
|
|
318
332
|
{
|
|
319
|
-
packet->AddPacket(input.sequenceNumber, input.
|
|
333
|
+
packet->AddPacket(input.sequenceNumber, input.timestampUs, input.maxPacketSize);
|
|
320
334
|
}
|
|
321
335
|
}
|
|
322
336
|
|
|
323
337
|
packet->Finish();
|
|
324
|
-
verify(inputs, packet->
|
|
338
|
+
verify(inputs, packet->GetPacketStatuses());
|
|
325
339
|
|
|
326
340
|
REQUIRE(packet->GetBaseSequenceNumber() == 1000);
|
|
327
341
|
REQUIRE(packet->GetPacketStatusCount() == 2);
|
|
328
342
|
REQUIRE(packet->GetFeedbackPacketCount() == 1);
|
|
329
343
|
REQUIRE(packet->GetPacketFractionLost() == 0);
|
|
330
344
|
REQUIRE(packet->GetLatestSequenceNumber() == 1001);
|
|
331
|
-
REQUIRE(packet->
|
|
345
|
+
REQUIRE(packet->GetLatestTimestampUs() == 1000000700000);
|
|
332
346
|
|
|
333
347
|
SECTION("serialize packet instance")
|
|
334
348
|
{
|
|
@@ -364,15 +378,15 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
364
378
|
/* clang-format off */
|
|
365
379
|
std::vector<TestFeedbackRtpTransportInput> inputs =
|
|
366
380
|
{
|
|
367
|
-
{ 999,
|
|
368
|
-
{ 1000,
|
|
369
|
-
{ 1001,
|
|
370
|
-
{ 1002,
|
|
371
|
-
{ 1003,
|
|
372
|
-
{ 1004,
|
|
373
|
-
{ 1005,
|
|
374
|
-
{ 1006,
|
|
375
|
-
{ 1007,
|
|
381
|
+
{ 999, 1000000000000, RtcpMtu }, // Pre base.
|
|
382
|
+
{ 1000, 1000000000000, RtcpMtu }, // Base.
|
|
383
|
+
{ 1001, 1000000003000, RtcpMtu },
|
|
384
|
+
{ 1002, 1000000003000, RtcpMtu },
|
|
385
|
+
{ 1003, 1000000003000, RtcpMtu },
|
|
386
|
+
{ 1004, 1000000004000, RtcpMtu },
|
|
387
|
+
{ 1005, 1000000005000, RtcpMtu },
|
|
388
|
+
{ 1006, 1000000005000, RtcpMtu },
|
|
389
|
+
{ 1007, 1000000007000, RtcpMtu }
|
|
376
390
|
};
|
|
377
391
|
/* clang-format on */
|
|
378
392
|
|
|
@@ -384,23 +398,23 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
384
398
|
{
|
|
385
399
|
if (std::addressof(input) == std::addressof(inputs.front()))
|
|
386
400
|
{
|
|
387
|
-
packet->SetBase(input.sequenceNumber + 1, input.
|
|
401
|
+
packet->SetBase(input.sequenceNumber + 1, input.timestampUs);
|
|
388
402
|
}
|
|
389
403
|
else
|
|
390
404
|
{
|
|
391
|
-
packet->AddPacket(input.sequenceNumber, input.
|
|
405
|
+
packet->AddPacket(input.sequenceNumber, input.timestampUs, input.maxPacketSize);
|
|
392
406
|
}
|
|
393
407
|
}
|
|
394
408
|
|
|
395
409
|
packet->Finish();
|
|
396
|
-
verify(inputs, packet->
|
|
410
|
+
verify(inputs, packet->GetPacketStatuses());
|
|
397
411
|
|
|
398
412
|
REQUIRE(packet->GetBaseSequenceNumber() == 1000);
|
|
399
413
|
REQUIRE(packet->GetPacketStatusCount() == 8);
|
|
400
414
|
REQUIRE(packet->GetFeedbackPacketCount() == 1);
|
|
401
415
|
REQUIRE(packet->GetPacketFractionLost() == 0);
|
|
402
416
|
REQUIRE(packet->GetLatestSequenceNumber() == 1007);
|
|
403
|
-
REQUIRE(packet->
|
|
417
|
+
REQUIRE(packet->GetLatestTimestampUs() == 1000000007000);
|
|
404
418
|
|
|
405
419
|
alignas(4) uint8_t buffer[1024];
|
|
406
420
|
auto len = packet->Serialize(buffer);
|
|
@@ -428,19 +442,19 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
428
442
|
}
|
|
429
443
|
|
|
430
444
|
auto latestWideSeqNumber = packet->GetLatestSequenceNumber();
|
|
431
|
-
auto
|
|
445
|
+
auto latestTimestampUs = packet->GetLatestTimestampUs();
|
|
432
446
|
|
|
433
447
|
/* clang-format off */
|
|
434
448
|
std::vector<TestFeedbackRtpTransportInput> inputs2 =
|
|
435
449
|
{
|
|
436
|
-
{ latestWideSeqNumber,
|
|
437
|
-
{ 1008,
|
|
438
|
-
{ 1009,
|
|
439
|
-
{ 1010,
|
|
440
|
-
{ 1011,
|
|
441
|
-
{ 1012,
|
|
442
|
-
{ 1013,
|
|
443
|
-
{ 1014,
|
|
450
|
+
{ latestWideSeqNumber, latestTimestampUs, RtcpMtu },
|
|
451
|
+
{ 1008, 1000000008000, RtcpMtu },
|
|
452
|
+
{ 1009, 1000000009000, RtcpMtu },
|
|
453
|
+
{ 1010, 1000000010000, RtcpMtu },
|
|
454
|
+
{ 1011, 1000000010000, RtcpMtu },
|
|
455
|
+
{ 1012, 1000000010000, RtcpMtu },
|
|
456
|
+
{ 1013, 1000000014000, RtcpMtu },
|
|
457
|
+
{ 1014, 1000000014000, RtcpMtu }
|
|
444
458
|
};
|
|
445
459
|
/* clang-format on */
|
|
446
460
|
|
|
@@ -452,23 +466,23 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
452
466
|
{
|
|
453
467
|
if (std::addressof(input) == std::addressof(inputs2.front()))
|
|
454
468
|
{
|
|
455
|
-
packet2->SetBase(input.sequenceNumber + 1, input.
|
|
469
|
+
packet2->SetBase(input.sequenceNumber + 1, input.timestampUs);
|
|
456
470
|
}
|
|
457
471
|
else
|
|
458
472
|
{
|
|
459
|
-
packet2->AddPacket(input.sequenceNumber, input.
|
|
473
|
+
packet2->AddPacket(input.sequenceNumber, input.timestampUs, input.maxPacketSize);
|
|
460
474
|
}
|
|
461
475
|
}
|
|
462
476
|
|
|
463
477
|
packet2->Finish();
|
|
464
|
-
verify(inputs2, packet2->
|
|
478
|
+
verify(inputs2, packet2->GetPacketStatuses());
|
|
465
479
|
|
|
466
480
|
REQUIRE(packet2->GetBaseSequenceNumber() == 1008);
|
|
467
481
|
REQUIRE(packet2->GetPacketStatusCount() == 7);
|
|
468
482
|
REQUIRE(packet2->GetFeedbackPacketCount() == 2);
|
|
469
483
|
REQUIRE(packet2->GetPacketFractionLost() == 0);
|
|
470
484
|
REQUIRE(packet2->GetLatestSequenceNumber() == 1014);
|
|
471
|
-
REQUIRE(packet2->
|
|
485
|
+
REQUIRE(packet2->GetLatestTimestampUs() == 1000000014000);
|
|
472
486
|
|
|
473
487
|
len = packet2->Serialize(buffer);
|
|
474
488
|
|
|
@@ -521,9 +535,9 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
521
535
|
REQUIRE(packet->GetPacketStatusCount() == 13);
|
|
522
536
|
REQUIRE(packet->GetReferenceTime() == 6275825); // 0x5FC2F1 (signed 24 bits)
|
|
523
537
|
REQUIRE(
|
|
524
|
-
packet->
|
|
525
|
-
RTC::RTCP::FeedbackRtpTransportPacket::
|
|
526
|
-
(static_cast<int64_t>(6275825) * RTC::RTCP::FeedbackRtpTransportPacket::
|
|
538
|
+
packet->GetReferenceTimestampUs() ==
|
|
539
|
+
RTC::RTCP::FeedbackRtpTransportPacket::TimeWrapPeriodUs +
|
|
540
|
+
(static_cast<int64_t>(6275825) * RTC::RTCP::FeedbackRtpTransportPacket::BaseTimeTickUs));
|
|
527
541
|
REQUIRE(packet->GetFeedbackPacketCount() == 3);
|
|
528
542
|
|
|
529
543
|
SECTION("serialize packet")
|
|
@@ -559,9 +573,9 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
559
573
|
REQUIRE(packet->GetPacketStatusCount() == 0);
|
|
560
574
|
REQUIRE(packet->GetReferenceTime() == -2); // 0xFFFFFE = -2 (signed 24 bits)
|
|
561
575
|
REQUIRE(
|
|
562
|
-
packet->
|
|
563
|
-
RTC::RTCP::FeedbackRtpTransportPacket::
|
|
564
|
-
(static_cast<int64_t>(-2) * RTC::RTCP::FeedbackRtpTransportPacket::
|
|
576
|
+
packet->GetReferenceTimestampUs() ==
|
|
577
|
+
RTC::RTCP::FeedbackRtpTransportPacket::TimeWrapPeriodUs +
|
|
578
|
+
(static_cast<int64_t>(-2) * RTC::RTCP::FeedbackRtpTransportPacket::BaseTimeTickUs));
|
|
565
579
|
REQUIRE(packet->GetFeedbackPacketCount() == 1);
|
|
566
580
|
|
|
567
581
|
SECTION("serialize packet")
|
|
@@ -598,9 +612,9 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
598
612
|
REQUIRE(packet->GetPacketStatusCount() == 2);
|
|
599
613
|
REQUIRE(packet->GetReferenceTime() == -4368470);
|
|
600
614
|
REQUIRE(
|
|
601
|
-
packet->
|
|
602
|
-
RTC::RTCP::FeedbackRtpTransportPacket::
|
|
603
|
-
(static_cast<int64_t>(-4368470) * RTC::RTCP::FeedbackRtpTransportPacket::
|
|
615
|
+
packet->GetReferenceTimestampUs() ==
|
|
616
|
+
RTC::RTCP::FeedbackRtpTransportPacket::TimeWrapPeriodUs +
|
|
617
|
+
(static_cast<int64_t>(-4368470) * RTC::RTCP::FeedbackRtpTransportPacket::BaseTimeTickUs));
|
|
604
618
|
|
|
605
619
|
REQUIRE(packet->GetFeedbackPacketCount() == 0);
|
|
606
620
|
|
|
@@ -619,9 +633,10 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
619
633
|
using FeedbackPacketsMeta = struct
|
|
620
634
|
{
|
|
621
635
|
int32_t baseTimeRaw;
|
|
622
|
-
int64_t
|
|
636
|
+
int64_t baseTimeUs;
|
|
623
637
|
uint16_t baseSequence;
|
|
624
638
|
size_t packetStatusCount;
|
|
639
|
+
// In DeltaTickUs units, so these are the delta bytes of the buffer below.
|
|
625
640
|
std::vector<int16_t> deltas;
|
|
626
641
|
std::vector<uint8_t> buffer;
|
|
627
642
|
};
|
|
@@ -630,124 +645,124 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
630
645
|
// were generated by chrome in direction of mediasoup.
|
|
631
646
|
const std::vector<FeedbackPacketsMeta> feedbackPacketsMeta = {
|
|
632
647
|
{ .baseTimeRaw = 35504,
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
648
|
+
.baseTimeUs = 1076014080000,
|
|
649
|
+
.baseSequence = 13,
|
|
650
|
+
.packetStatusCount = 1,
|
|
651
|
+
.deltas = std::vector<int16_t>{ 228 },
|
|
652
|
+
.buffer = std::vector<uint8_t>{ 0xaf, 0xcd, 0x00, 0x05, 0xfa, 0x17, 0xfa, 0x17,
|
|
638
653
|
0x00, 0x00, 0x04, 0xd2, 0x00, 0x0d, 0x00, 0x01,
|
|
639
654
|
0x00, 0x8A, 0xB0, 0x00, 0x20, 0x01, 0xE4, 0x01 } },
|
|
640
655
|
{ .baseTimeRaw = 35504,
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
656
|
+
.baseTimeUs = 1076014080000,
|
|
657
|
+
.baseSequence = 14,
|
|
658
|
+
.packetStatusCount = 4,
|
|
659
|
+
.deltas = std::vector<int16_t>{ 232, 8, 12, 220 },
|
|
660
|
+
.buffer = std::vector<uint8_t>{ 0xaf, 0xcd, 0x00, 0x06, 0xFA, 0x17, 0xFA, 0x17, 0x1C, 0xB7,
|
|
646
661
|
0xDA, 0xF3, 0x00, 0x0E, 0x00, 0x04, 0x00, 0x8A, 0xB0, 0x01,
|
|
647
662
|
0x20, 0x04, 0xE8, 0x08, 0x0C, 0xDC, 0x00, 0x02 } },
|
|
648
663
|
{ .baseTimeRaw = 35505,
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
664
|
+
.baseTimeUs = 1076014144000,
|
|
665
|
+
.baseSequence = 18,
|
|
666
|
+
.packetStatusCount = 5,
|
|
667
|
+
.deltas = std::vector<int16_t>{ 240, 24, 20, 36, 88 },
|
|
668
|
+
.buffer = std::vector<uint8_t>{ 0xAF, 0xCD, 0x00, 0x06, 0xFA, 0x17, 0xFA, 0x17, 0x1C, 0xB7,
|
|
654
669
|
0xDA, 0xF3, 0x00, 0x12, 0x00, 0x05, 0x00, 0x8A, 0xB1, 0x02,
|
|
655
670
|
0x20, 0x05, 0xF0, 0x18, 0x14, 0x24, 0x58, 0x01 } },
|
|
656
671
|
|
|
657
672
|
{ .baseTimeRaw = 617873,
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
673
|
+
.baseTimeUs = 1113285696000,
|
|
674
|
+
.baseSequence = 2924,
|
|
675
|
+
.packetStatusCount = 22,
|
|
676
|
+
.deltas = std::vector<int16_t>{ 12, 20, 20, 0, 40, 0, 0, 16, 0, 4, 0,
|
|
677
|
+
8, 0, 8, 0, 8, 0, 8, 0, 4, 0, 16 },
|
|
678
|
+
.buffer = std::vector<uint8_t>{ 0x8F, 0xCD, 0x00, 0x0A, 0xFA, 0x17, 0xFA, 0x17, 0x06,
|
|
664
679
|
0xF5, 0x11, 0x4C, 0x0B, 0x6C, 0x00, 0x16, 0x09, 0x6D,
|
|
665
680
|
0x91, 0xEE, 0x20, 0x16, 0x0C, 0x14, 0x14, 0x00, 0x28,
|
|
666
681
|
0x00, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08,
|
|
667
682
|
0x00, 0x08, 0x00, 0x08, 0x00, 0x04, 0x00, 0x10 } },
|
|
668
683
|
|
|
669
684
|
{ .baseTimeRaw = -4368470,
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
685
|
+
.baseTimeUs = 794159744000,
|
|
686
|
+
.baseSequence = 1,
|
|
687
|
+
.packetStatusCount = 2,
|
|
688
|
+
.deltas = std::vector<int16_t>{ 140, 68 },
|
|
689
|
+
.buffer = std::vector<uint8_t>{ 0x8F, 0xCD, 0x00, 0x05, 0xFA, 0x17, 0xFA, 0x17,
|
|
675
690
|
0x39, 0xE9, 0x42, 0x38, 0x00, 0x01, 0x00, 0x02,
|
|
676
691
|
0xBD, 0x57, 0xAA, 0x00, 0x20, 0x02, 0x8C, 0x44 } },
|
|
677
692
|
|
|
678
693
|
{ .baseTimeRaw = 818995,
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
694
|
+
.baseTimeUs = 1126157504000,
|
|
695
|
+
.baseSequence = 930,
|
|
696
|
+
.packetStatusCount = 5,
|
|
697
|
+
.deltas = std::vector<int16_t>{ 248, 72, 20, 24, 76 },
|
|
698
|
+
.buffer = std::vector<uint8_t>{ 0xAF, 0xCD, 0x00, 0x06, 0xFA, 0x17, 0xFA, 0x17, 0x26, 0x9E,
|
|
684
699
|
0x8E, 0x50, 0x03, 0xA2, 0x00, 0x05, 0x0C, 0x7F, 0x33, 0x9F,
|
|
685
700
|
0x20, 0x05, 0xF8, 0x48, 0x14, 0x18, 0x4C, 0x01 } },
|
|
686
701
|
{ .baseTimeRaw = 818996,
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
702
|
+
.baseTimeUs = 1126157568000,
|
|
703
|
+
.baseSequence = 921,
|
|
704
|
+
.packetStatusCount = 7,
|
|
705
|
+
.deltas = std::vector<int16_t>{ 56, 20, 24, 24, 28, 56, 20 },
|
|
706
|
+
.buffer =
|
|
692
707
|
std::vector<uint8_t>{ 0xAF, 0xCD, 0x00, 0x07, 0xFA, 0x17, 0xFA, 0x17, 0x33, 0xB0, 0x4A,
|
|
693
708
|
0xE8, 0x03, 0x99, 0x00, 0x07, 0x0C, 0x7F, 0x34, 0x9F, 0x20, 0x07,
|
|
694
709
|
0x38, 0x14, 0x18, 0x18, 0x1C, 0x38, 0x14, 0x00, 0x00, 0x03 } },
|
|
695
710
|
{ .baseTimeRaw = 818996,
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
711
|
+
.baseTimeUs = 1126157568000,
|
|
712
|
+
.baseSequence = 935,
|
|
713
|
+
.packetStatusCount = 7,
|
|
714
|
+
.deltas = std::vector<int16_t>{ 228, 0, 24, 20, 20, 96, 0 },
|
|
715
|
+
.buffer =
|
|
701
716
|
std::vector<uint8_t>{ 0xAF, 0xCD, 0x00, 0x07, 0xFA, 0x17, 0xFA, 0x17, 0x26, 0x9E, 0x8E,
|
|
702
717
|
0x50, 0x03, 0xA7, 0x00, 0x07, 0x0C, 0x7F, 0x34, 0xA0, 0x20, 0x07,
|
|
703
718
|
0xE4, 0x00, 0x18, 0x14, 0x14, 0x60, 0x00, 0x00, 0x00, 0x03 } },
|
|
704
719
|
{ .baseTimeRaw = 818996,
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
720
|
+
.baseTimeUs = 1126157568000,
|
|
721
|
+
.baseSequence = 928,
|
|
722
|
+
.packetStatusCount = 5,
|
|
723
|
+
.deltas = std::vector<int16_t>{ 252, 44, 84, 24, 0 },
|
|
724
|
+
.buffer = std::vector<uint8_t>{ 0xAF, 0xCD, 0x00, 0x06, 0xFA, 0x17, 0xFA, 0x17, 0x33, 0xB0,
|
|
710
725
|
0x4A, 0xE8, 0x03, 0xA0, 0x00, 0x05, 0x0C, 0x7F, 0x34, 0xA0,
|
|
711
726
|
0x20, 0x05, 0xFC, 0x2C, 0x54, 0x18, 0x00, 0x01 } },
|
|
712
727
|
{ .baseTimeRaw = 818997,
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
728
|
+
.baseTimeUs = 1126157632000,
|
|
729
|
+
.baseSequence = 942,
|
|
730
|
+
.packetStatusCount = 6,
|
|
731
|
+
.deltas = std::vector<int16_t>{ 156, 52, 36, 20, 16, 52 },
|
|
732
|
+
.buffer = std::vector<uint8_t>{ 0x8F, 0xCD, 0x00, 0x06, 0xFA, 0x17, 0xFA, 0x17, 0x26, 0x9E,
|
|
718
733
|
0x8E, 0x50, 0x03, 0xAE, 0x00, 0x06, 0x0C, 0x7F, 0x35, 0xA1,
|
|
719
734
|
0x20, 0x06, 0x9C, 0x34, 0x24, 0x14, 0x10, 0x34 } },
|
|
720
735
|
{ .baseTimeRaw = 821523,
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
736
|
+
.baseTimeUs = 1126319296000,
|
|
737
|
+
.baseSequence = 10,
|
|
738
|
+
.packetStatusCount = 7,
|
|
739
|
+
.deltas = std::vector<int16_t>{ 100, 8, 8, 12, 4, 4, 12 },
|
|
740
|
+
.buffer =
|
|
726
741
|
std::vector<uint8_t>{ 0xAF, 0xCD, 0x00, 0x07, 0xFA, 0x17, 0xFA, 0x17, 0x00, 0x00, 0x04,
|
|
727
742
|
0xD2, 0x00, 0x0A, 0x00, 0x07, 0x0C, 0x89, 0x13, 0x00, 0x20, 0x07,
|
|
728
743
|
0x64, 0x08, 0x08, 0x0C, 0x04, 0x04, 0x0C, 0x00, 0x00, 0x03 } },
|
|
729
744
|
{ .baseTimeRaw = 821524,
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
745
|
+
.baseTimeUs = 1126319360000,
|
|
746
|
+
.baseSequence = 17,
|
|
747
|
+
.packetStatusCount = 2,
|
|
748
|
+
.deltas = std::vector<int16_t>{ 176, 72 },
|
|
749
|
+
.buffer = std::vector<uint8_t>{ 0x8F, 0xCD, 0x00, 0x05, 0xFA, 0x17, 0xFA, 0x17,
|
|
735
750
|
0x08, 0xEB, 0x06, 0xD7, 0x00, 0x11, 0x00, 0x02,
|
|
736
751
|
0x0C, 0x89, 0x14, 0x01, 0x20, 0x02, 0xB0, 0x48 } },
|
|
737
752
|
{ .baseTimeRaw = 821524,
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
753
|
+
.baseTimeUs = 1126319360000,
|
|
754
|
+
.baseSequence = 17,
|
|
755
|
+
.packetStatusCount = 1,
|
|
756
|
+
.deltas = std::vector<int16_t>{ 248 },
|
|
757
|
+
.buffer = std::vector<uint8_t>{ 0xAF, 0xCD, 0x00, 0x05, 0xFA, 0x17, 0xFA, 0x17,
|
|
743
758
|
0x20, 0x92, 0x5E, 0xB7, 0x00, 0x11, 0x00, 0x01,
|
|
744
759
|
0x0C, 0x89, 0x14, 0x00, 0x20, 0x01, 0xF8, 0x01 } },
|
|
745
760
|
{ .baseTimeRaw = 821526,
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
761
|
+
.baseTimeUs = 1126319488000,
|
|
762
|
+
.baseSequence = 19,
|
|
763
|
+
.packetStatusCount = 4,
|
|
764
|
+
.deltas = std::vector<int16_t>{ 16, 0, 16, 0 },
|
|
765
|
+
.buffer = std::vector<uint8_t>{ 0xAF, 0xCD, 0x00, 0x06, 0xFA, 0x17, 0xFA, 0x17, 0x08, 0xEB,
|
|
751
766
|
0x06, 0xD7, 0x00, 0x13, 0x00, 0x04, 0x0C, 0x89, 0x16, 0x02,
|
|
752
767
|
0x20, 0x04, 0x10, 0x00, 0x10, 0x00, 0x00, 0x02 } }
|
|
753
768
|
};
|
|
@@ -761,48 +776,71 @@ SCENARIO("RTCP Feedback RTP Transport", "[rtcp][feedback-rtp][transport]")
|
|
|
761
776
|
};
|
|
762
777
|
|
|
763
778
|
REQUIRE(feedback->GetReferenceTime() == packetMeta.baseTimeRaw);
|
|
764
|
-
REQUIRE(feedback->
|
|
779
|
+
REQUIRE(feedback->GetReferenceTimestampUs() == packetMeta.baseTimeUs);
|
|
765
780
|
REQUIRE(feedback->GetBaseSequenceNumber() == packetMeta.baseSequence);
|
|
766
781
|
REQUIRE(feedback->GetPacketStatusCount() == packetMeta.packetStatusCount);
|
|
767
782
|
|
|
768
|
-
auto
|
|
783
|
+
auto packetStatuses = feedback->GetPacketStatuses();
|
|
769
784
|
|
|
770
785
|
int deltasIt = 0;
|
|
771
786
|
for (const auto& delta : packetMeta.deltas)
|
|
772
787
|
{
|
|
773
|
-
|
|
774
|
-
REQUIRE(static_cast<int16_t>(resultDelta / 4) == delta);
|
|
788
|
+
REQUIRE(packetStatuses[deltasIt].delta == delta);
|
|
775
789
|
deltasIt++;
|
|
776
790
|
}
|
|
777
791
|
}
|
|
778
792
|
}
|
|
779
793
|
|
|
780
|
-
SECTION("check
|
|
794
|
+
SECTION("check GetBaseDeltaUs() wraparound")
|
|
781
795
|
{
|
|
782
|
-
static
|
|
783
|
-
|
|
796
|
+
static constexpr int64_t MaxBaseTimeUs{ RTC::RTCP::FeedbackRtpTransportPacket::TimeWrapPeriodUs -
|
|
797
|
+
RTC::RTCP::FeedbackRtpTransportPacket::BaseTimeTickUs };
|
|
784
798
|
|
|
785
799
|
auto packet1 = std::make_unique<RTC::RTCP::FeedbackRtpTransportPacket>(senderSsrc, mediaSsrc);
|
|
786
800
|
auto packet2 = std::make_unique<RTC::RTCP::FeedbackRtpTransportPacket>(senderSsrc, mediaSsrc);
|
|
787
801
|
auto packet3 = std::make_unique<RTC::RTCP::FeedbackRtpTransportPacket>(senderSsrc, mediaSsrc);
|
|
788
802
|
|
|
789
|
-
packet1->
|
|
790
|
-
packet2->
|
|
791
|
-
packet3->
|
|
792
|
-
|
|
793
|
-
RTC::RTCP::FeedbackRtpTransportPacket::
|
|
803
|
+
packet1->SetReferenceTimeUs(MaxBaseTimeUs);
|
|
804
|
+
packet2->SetReferenceTimeUs(MaxBaseTimeUs + RTC::RTCP::FeedbackRtpTransportPacket::BaseTimeTickUs);
|
|
805
|
+
packet3->SetReferenceTimeUs(
|
|
806
|
+
MaxBaseTimeUs + RTC::RTCP::FeedbackRtpTransportPacket::BaseTimeTickUs +
|
|
807
|
+
RTC::RTCP::FeedbackRtpTransportPacket::BaseTimeTickUs);
|
|
794
808
|
|
|
795
|
-
REQUIRE(packet1->GetReferenceTime() ==
|
|
809
|
+
REQUIRE(packet1->GetReferenceTime() == -1);
|
|
796
810
|
REQUIRE(packet2->GetReferenceTime() == 0);
|
|
797
811
|
REQUIRE(packet3->GetReferenceTime() == 1);
|
|
798
812
|
|
|
799
|
-
REQUIRE(packet1->
|
|
800
|
-
REQUIRE(packet2->
|
|
801
|
-
REQUIRE(packet3->
|
|
813
|
+
REQUIRE(packet1->GetReferenceTimestampUs() == 1073741760000);
|
|
814
|
+
REQUIRE(packet2->GetReferenceTimestampUs() == 1073741824000);
|
|
815
|
+
REQUIRE(packet3->GetReferenceTimestampUs() == 1073741888000);
|
|
816
|
+
|
|
817
|
+
REQUIRE(packet1->GetBaseDeltaUs(packet1->GetReferenceTimestampUs()) == 0);
|
|
818
|
+
REQUIRE(packet2->GetBaseDeltaUs(packet1->GetReferenceTimestampUs()) == 64000);
|
|
819
|
+
REQUIRE(packet3->GetBaseDeltaUs(packet2->GetReferenceTimestampUs()) == 64000);
|
|
820
|
+
REQUIRE(packet3->GetBaseDeltaUs(packet1->GetReferenceTimestampUs()) == 128000);
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
SECTION("SetBase() wraps the reference time over the whole period GetBaseDeltaUs() compensates for")
|
|
824
|
+
{
|
|
825
|
+
// Timestamp sitting on the last whole base time tick before the reference
|
|
826
|
+
// time wraps around.
|
|
827
|
+
static constexpr int64_t LastTickUs{ RTC::RTCP::FeedbackRtpTransportPacket::TimeWrapPeriodUs -
|
|
828
|
+
RTC::RTCP::FeedbackRtpTransportPacket::BaseTimeTickUs };
|
|
829
|
+
|
|
830
|
+
auto packet1 = std::make_unique<RTC::RTCP::FeedbackRtpTransportPacket>(senderSsrc, mediaSsrc);
|
|
831
|
+
auto packet2 = std::make_unique<RTC::RTCP::FeedbackRtpTransportPacket>(senderSsrc, mediaSsrc);
|
|
832
|
+
|
|
833
|
+
packet1->SetBase(1000, LastTickUs);
|
|
834
|
+
packet2->SetBase(1001, LastTickUs + RTC::RTCP::FeedbackRtpTransportPacket::BaseTimeTickUs);
|
|
802
835
|
|
|
803
|
-
REQUIRE(packet1->
|
|
804
|
-
REQUIRE(packet2->
|
|
805
|
-
|
|
806
|
-
|
|
836
|
+
REQUIRE(packet1->GetReferenceTime() == -1);
|
|
837
|
+
REQUIRE(packet2->GetReferenceTime() == 0);
|
|
838
|
+
|
|
839
|
+
// Both packets are a single tick apart, so the wrap around must be
|
|
840
|
+
// compensated. It would not be if the reference time wrapped sooner than
|
|
841
|
+
// the period GetBaseDeltaUs() knows about.
|
|
842
|
+
REQUIRE(
|
|
843
|
+
packet2->GetBaseDeltaUs(packet1->GetReferenceTimestampUs()) ==
|
|
844
|
+
RTC::RTCP::FeedbackRtpTransportPacket::BaseTimeTickUs);
|
|
807
845
|
}
|
|
808
846
|
}
|