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
|
@@ -20,7 +20,7 @@ namespace RTC
|
|
|
20
20
|
|
|
21
21
|
static constexpr size_t ProducerSendBufferSize{ 65536 };
|
|
22
22
|
static thread_local uint8_t ProducerSendBuffer[ProducerSendBufferSize];
|
|
23
|
-
static constexpr
|
|
23
|
+
static constexpr int64_t SendNackDelayMs{ 10 };
|
|
24
24
|
|
|
25
25
|
/* Instance methods. */
|
|
26
26
|
|
|
@@ -195,20 +195,20 @@ namespace RTC
|
|
|
195
195
|
// Set the RTCP report generation interval.
|
|
196
196
|
if (this->kind == RTC::Media::Kind::AUDIO)
|
|
197
197
|
{
|
|
198
|
-
this->
|
|
198
|
+
this->maxRtcpIntervalMs = RTC::RTCP::MaxAudioIntervalMs;
|
|
199
199
|
}
|
|
200
200
|
else
|
|
201
201
|
{
|
|
202
|
-
this->
|
|
202
|
+
this->maxRtcpIntervalMs = RTC::RTCP::MaxVideoIntervalMs;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
// Create a KeyFrameRequestManager.
|
|
206
206
|
if (this->kind == RTC::Media::Kind::VIDEO)
|
|
207
207
|
{
|
|
208
|
-
|
|
208
|
+
const int64_t keyFrameRequestDelayMs = data->keyFrameRequestDelay();
|
|
209
209
|
|
|
210
210
|
this->keyFrameRequestManager =
|
|
211
|
-
new RTC::KeyFrameRequestManager(this, this->shared,
|
|
211
|
+
new RTC::KeyFrameRequestManager(this, this->shared, keyFrameRequestDelayMs);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
// NOTE: This may throw.
|
|
@@ -270,8 +270,7 @@ namespace RTC
|
|
|
270
270
|
builder,
|
|
271
271
|
encodingMapping.rid.c_str(),
|
|
272
272
|
encodingMapping.ssrc != 0u ? flatbuffers::Optional<uint32_t>(encodingMapping.ssrc)
|
|
273
|
-
|
|
274
|
-
nullptr, /* capability mode. NOTE: Present in NODE*/
|
|
273
|
+
: flatbuffers::nullopt,
|
|
275
274
|
encodingMapping.mappedSsrc));
|
|
276
275
|
}
|
|
277
276
|
|
|
@@ -319,7 +318,7 @@ namespace RTC
|
|
|
319
318
|
builder,
|
|
320
319
|
this->id.c_str(),
|
|
321
320
|
this->kind == RTC::Media::Kind::AUDIO ? FBS::RtpParameters::MediaKind::AUDIO
|
|
322
|
-
|
|
321
|
+
: FBS::RtpParameters::MediaKind::VIDEO,
|
|
323
322
|
RTC::RtpParameters::TypeToFbs(this->type),
|
|
324
323
|
rtpParameters,
|
|
325
324
|
rtpMapping,
|
|
@@ -509,7 +508,7 @@ namespace RTC
|
|
|
509
508
|
{
|
|
510
509
|
MS_TRACE();
|
|
511
510
|
|
|
512
|
-
switch (notification->event)
|
|
511
|
+
switch (notification->data->event())
|
|
513
512
|
{
|
|
514
513
|
case Channel::ChannelNotification::Event::PRODUCER_SEND:
|
|
515
514
|
{
|
|
@@ -539,7 +538,7 @@ namespace RTC
|
|
|
539
538
|
}
|
|
540
539
|
|
|
541
540
|
// Pass the packet to the parent transport.
|
|
542
|
-
this->listener->OnProducerReceiveRtpPacket(this, packet);
|
|
541
|
+
this->listener->OnProducerReceiveRtpPacket(this, packet, notification->receivedAtUs);
|
|
543
542
|
|
|
544
543
|
break;
|
|
545
544
|
}
|
|
@@ -551,7 +550,8 @@ namespace RTC
|
|
|
551
550
|
}
|
|
552
551
|
}
|
|
553
552
|
|
|
554
|
-
Producer::ReceiveRtpPacketResult Producer::ReceiveRtpPacket(
|
|
553
|
+
Producer::ReceiveRtpPacketResult Producer::ReceiveRtpPacket(
|
|
554
|
+
RTC::RTP::Packet* packet, int64_t receivedAtUs)
|
|
555
555
|
{
|
|
556
556
|
MS_TRACE();
|
|
557
557
|
|
|
@@ -590,7 +590,7 @@ namespace RTC
|
|
|
590
590
|
result = ReceiveRtpPacketResult::MEDIA;
|
|
591
591
|
|
|
592
592
|
// Process the packet.
|
|
593
|
-
if (!rtpStream->ReceivePacket(packet))
|
|
593
|
+
if (!rtpStream->ReceivePacket(packet, receivedAtUs))
|
|
594
594
|
{
|
|
595
595
|
// May have to announce a new RTP stream to the listener.
|
|
596
596
|
if (this->mapSsrcRtpStream.size() > numRtpStreamsBefore)
|
|
@@ -688,7 +688,7 @@ namespace RTC
|
|
|
688
688
|
return result;
|
|
689
689
|
}
|
|
690
690
|
|
|
691
|
-
void Producer::ReceiveRtcpSenderReport(RTC::RTCP::SenderReport* report)
|
|
691
|
+
void Producer::ReceiveRtcpSenderReport(RTC::RTCP::SenderReport* report, int64_t receivedAtUs)
|
|
692
692
|
{
|
|
693
693
|
MS_TRACE();
|
|
694
694
|
|
|
@@ -699,7 +699,7 @@ namespace RTC
|
|
|
699
699
|
auto* rtpStream = it->second;
|
|
700
700
|
const bool first = !rtpStream->GetSenderReportMapping().has_value();
|
|
701
701
|
|
|
702
|
-
rtpStream->ReceiveRtcpSenderReport(report);
|
|
702
|
+
rtpStream->ReceiveRtcpSenderReport(report, receivedAtUs);
|
|
703
703
|
|
|
704
704
|
this->listener->OnProducerRtcpSenderReport(this, rtpStream, first);
|
|
705
705
|
|
|
@@ -715,7 +715,7 @@ namespace RTC
|
|
|
715
715
|
{
|
|
716
716
|
auto* rtpStream = it2->second;
|
|
717
717
|
|
|
718
|
-
rtpStream->ReceiveRtxRtcpSenderReport(report);
|
|
718
|
+
rtpStream->ReceiveRtxRtcpSenderReport(report, receivedAtUs);
|
|
719
719
|
|
|
720
720
|
return;
|
|
721
721
|
}
|
|
@@ -723,7 +723,8 @@ namespace RTC
|
|
|
723
723
|
MS_DEBUG_TAG(rtcp, "RtpStream not found [ssrc:%" PRIu32 "]", report->GetSsrc());
|
|
724
724
|
}
|
|
725
725
|
|
|
726
|
-
void Producer::ReceiveRtcpXrDelaySinceLastRr(
|
|
726
|
+
void Producer::ReceiveRtcpXrDelaySinceLastRr(
|
|
727
|
+
RTC::RTCP::DelaySinceLastRr::SsrcInfo* ssrcInfo, int64_t receivedAtUs)
|
|
727
728
|
{
|
|
728
729
|
MS_TRACE();
|
|
729
730
|
|
|
@@ -738,14 +739,18 @@ namespace RTC
|
|
|
738
739
|
|
|
739
740
|
auto* rtpStream = it->second;
|
|
740
741
|
|
|
741
|
-
rtpStream->ReceiveRtcpXrDelaySinceLastRr(ssrcInfo);
|
|
742
|
+
rtpStream->ReceiveRtcpXrDelaySinceLastRr(ssrcInfo, receivedAtUs);
|
|
742
743
|
}
|
|
743
744
|
|
|
744
|
-
bool Producer::GetRtcp(RTC::RTCP::CompoundPacket* packet,
|
|
745
|
+
bool Producer::GetRtcp(RTC::RTCP::CompoundPacket* packet, int64_t nowUs)
|
|
745
746
|
{
|
|
746
747
|
MS_TRACE();
|
|
747
748
|
|
|
748
|
-
|
|
749
|
+
// NOTE: The interval is in milliseconds, being it given to a timer, so the
|
|
750
|
+
// elapsed time is truncated here.
|
|
751
|
+
const int64_t elapsedMs = (nowUs - this->lastRtcpSentAtUs) / 1000;
|
|
752
|
+
|
|
753
|
+
if (static_cast<float>(elapsedMs * 1.15) < this->maxRtcpIntervalMs)
|
|
749
754
|
{
|
|
750
755
|
return true;
|
|
751
756
|
}
|
|
@@ -771,7 +776,7 @@ namespace RTC
|
|
|
771
776
|
// Add a receiver reference time report if no present in the packet.
|
|
772
777
|
if (!packet->HasReceiverReferenceTime())
|
|
773
778
|
{
|
|
774
|
-
auto ntp = Utils::Time::
|
|
779
|
+
auto ntp = Utils::Time::TimeUs2Ntp(nowUs + this->shared->GetNtpOffsetUs());
|
|
775
780
|
|
|
776
781
|
receiverReferenceTimeReport = new RTC::RTCP::ReceiverReferenceTime();
|
|
777
782
|
|
|
@@ -785,7 +790,7 @@ namespace RTC
|
|
|
785
790
|
return false;
|
|
786
791
|
}
|
|
787
792
|
|
|
788
|
-
this->
|
|
793
|
+
this->lastRtcpSentAtUs = nowUs;
|
|
789
794
|
|
|
790
795
|
return true;
|
|
791
796
|
}
|
|
@@ -1137,8 +1142,8 @@ namespace RTC
|
|
|
1137
1142
|
this->type == RtpParameters::Type::SIMULCAST && this->rtpMapping.encodings.size() > 1;
|
|
1138
1143
|
|
|
1139
1144
|
// Create a RtpStreamRecv for receiving a media stream.
|
|
1140
|
-
auto* rtpStream =
|
|
1141
|
-
|
|
1145
|
+
auto* rtpStream = new RTC::RTP::RtpStreamRecv(
|
|
1146
|
+
this, this->shared, params, SendNackDelayMs, useRtpInactivityCheck);
|
|
1142
1147
|
|
|
1143
1148
|
// Insert into the maps.
|
|
1144
1149
|
this->mapSsrcRtpStream[ssrc] = rtpStream;
|
|
@@ -1252,9 +1257,9 @@ namespace RTC
|
|
|
1252
1257
|
// RTCP at all, both clocks are taken to be the same. Our own clock is real NTP
|
|
1253
1258
|
// and so is the one of any sender that fills this extension, so no offset is
|
|
1254
1259
|
// the most likely case rather than a wild guess.
|
|
1255
|
-
const auto
|
|
1260
|
+
const auto remoteClockOffsetUs = this->listener->OnProducerNeedRemoteClockOffsetUs(this);
|
|
1256
1261
|
const auto remoteClockOffsetQ32x32 =
|
|
1257
|
-
Utils::Time::
|
|
1262
|
+
Utils::Time::TimeUs2Q32x32(remoteClockOffsetUs.value_or(0));
|
|
1258
1263
|
|
|
1259
1264
|
// NOTE: An offset that does not fit in the extension means a sender whose clock
|
|
1260
1265
|
// is decades away from ours, and there is no value to write that would not be a
|
|
@@ -1470,16 +1475,16 @@ namespace RTC
|
|
|
1470
1475
|
// stream, which is the one the Sender Reports we send are built upon.
|
|
1471
1476
|
if (maxPacketTsChanged)
|
|
1472
1477
|
{
|
|
1473
|
-
const auto
|
|
1474
|
-
this->listener->
|
|
1478
|
+
const auto captureAtUs =
|
|
1479
|
+
this->listener->OnProducerNeedLocalCaptureAtUs(this, rtpStream, packet->GetTimestamp());
|
|
1475
1480
|
|
|
1476
|
-
if (
|
|
1481
|
+
if (captureAtUs.has_value())
|
|
1477
1482
|
{
|
|
1478
|
-
packet->
|
|
1483
|
+
packet->SetCaptureAtUs(captureAtUs.value());
|
|
1479
1484
|
|
|
1480
1485
|
// Also let the stream remember it, since this is the only place where the
|
|
1481
1486
|
// capture instant of a received packet can be told.
|
|
1482
|
-
rtpStream->SetCaptureMapping(
|
|
1487
|
+
rtpStream->SetCaptureMapping(captureAtUs.value(), packet->GetTimestamp());
|
|
1483
1488
|
}
|
|
1484
1489
|
}
|
|
1485
1490
|
|
|
@@ -1563,7 +1568,7 @@ namespace RTC
|
|
|
1563
1568
|
auto notification = FBS::Producer::CreateTraceNotification(
|
|
1564
1569
|
this->shared->GetChannelNotifier()->GetBufferBuilder(),
|
|
1565
1570
|
FBS::Producer::TraceEventType::KEYFRAME,
|
|
1566
|
-
this->shared->GetTimeMs(),
|
|
1571
|
+
static_cast<uint64_t>(this->shared->GetTimeMs()),
|
|
1567
1572
|
FBS::Common::TraceDirection::DIRECTION_IN,
|
|
1568
1573
|
FBS::Producer::TraceInfo::KeyFrameTraceInfo,
|
|
1569
1574
|
traceInfo.Union());
|
|
@@ -1579,7 +1584,7 @@ namespace RTC
|
|
|
1579
1584
|
auto notification = FBS::Producer::CreateTraceNotification(
|
|
1580
1585
|
this->shared->GetChannelNotifier()->GetBufferBuilder(),
|
|
1581
1586
|
FBS::Producer::TraceEventType::RTP,
|
|
1582
|
-
this->shared->GetTimeMs(),
|
|
1587
|
+
static_cast<uint64_t>(this->shared->GetTimeMs()),
|
|
1583
1588
|
FBS::Common::TraceDirection::DIRECTION_IN,
|
|
1584
1589
|
FBS::Producer::TraceInfo::RtpTraceInfo,
|
|
1585
1590
|
traceInfo.Union());
|
|
@@ -1603,7 +1608,7 @@ namespace RTC
|
|
|
1603
1608
|
auto notification = FBS::Producer::CreateTraceNotification(
|
|
1604
1609
|
this->shared->GetChannelNotifier()->GetBufferBuilder(),
|
|
1605
1610
|
FBS::Producer::TraceEventType::PLI,
|
|
1606
|
-
this->shared->GetTimeMs(),
|
|
1611
|
+
static_cast<uint64_t>(this->shared->GetTimeMs()),
|
|
1607
1612
|
FBS::Common::TraceDirection::DIRECTION_OUT,
|
|
1608
1613
|
FBS::Producer::TraceInfo::PliTraceInfo,
|
|
1609
1614
|
traceInfo.Union());
|
|
@@ -1626,7 +1631,7 @@ namespace RTC
|
|
|
1626
1631
|
auto notification = FBS::Producer::CreateTraceNotification(
|
|
1627
1632
|
this->shared->GetChannelNotifier()->GetBufferBuilder(),
|
|
1628
1633
|
FBS::Producer::TraceEventType::FIR,
|
|
1629
|
-
this->shared->GetTimeMs(),
|
|
1634
|
+
static_cast<uint64_t>(this->shared->GetTimeMs()),
|
|
1630
1635
|
FBS::Common::TraceDirection::DIRECTION_OUT,
|
|
1631
1636
|
FBS::Producer::TraceInfo::FirTraceInfo,
|
|
1632
1637
|
traceInfo.Union());
|
|
@@ -1646,7 +1651,7 @@ namespace RTC
|
|
|
1646
1651
|
auto notification = FBS::Producer::CreateTraceNotification(
|
|
1647
1652
|
this->shared->GetChannelNotifier()->GetBufferBuilder(),
|
|
1648
1653
|
FBS::Producer::TraceEventType::NACK,
|
|
1649
|
-
this->shared->GetTimeMs(),
|
|
1654
|
+
static_cast<uint64_t>(this->shared->GetTimeMs()),
|
|
1650
1655
|
FBS::Common::TraceDirection::DIRECTION_OUT);
|
|
1651
1656
|
|
|
1652
1657
|
EmitTraceEvent(notification);
|
|
@@ -1673,7 +1678,7 @@ namespace RTC
|
|
|
1673
1678
|
auto notification = FBS::Producer::CreateTraceNotification(
|
|
1674
1679
|
this->shared->GetChannelNotifier()->GetBufferBuilder(),
|
|
1675
1680
|
FBS::Producer::TraceEventType::SR,
|
|
1676
|
-
this->shared->GetTimeMs(),
|
|
1681
|
+
static_cast<uint64_t>(this->shared->GetTimeMs()),
|
|
1677
1682
|
FBS::Common::TraceDirection::DIRECTION_IN,
|
|
1678
1683
|
FBS::Producer::TraceInfo::SrTraceInfo,
|
|
1679
1684
|
traceInfo.Union());
|
|
@@ -1777,6 +1782,15 @@ namespace RTC
|
|
|
1777
1782
|
return this->listener->OnProducerNeedWorstRemoteFractionLost(this, mappedSsrc);
|
|
1778
1783
|
}
|
|
1779
1784
|
|
|
1785
|
+
inline void Producer::OnRtpStreamSpatialLayerActivityChanged(
|
|
1786
|
+
RTC::RTP::RtpStreamRecv* rtpStream, uint8_t spatialLayer, bool isActive)
|
|
1787
|
+
{
|
|
1788
|
+
MS_TRACE();
|
|
1789
|
+
|
|
1790
|
+
// Notify the listener.
|
|
1791
|
+
this->listener->OnProducerSpatialLayerActivityChanged(this, rtpStream, spatialLayer, isActive);
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1780
1794
|
inline void Producer::OnKeyFrameNeeded(
|
|
1781
1795
|
RTC::KeyFrameRequestManager* /*keyFrameRequestManager*/, uint32_t ssrc)
|
|
1782
1796
|
{
|
|
@@ -85,9 +85,14 @@ namespace RTC
|
|
|
85
85
|
const uint64_t mantissa =
|
|
86
86
|
(static_cast<uint32_t>(data[5] & 0x03) << 16) | Utils::Byte::Get2Bytes(data, 6);
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
// NOTE: The exponent is 6 bits wide, so a remote endpoint can craft a shift
|
|
89
|
+
// that overflows. The checks below reject both an overflowing shift and a
|
|
90
|
+
// value that does not fit in the signed 64 bits bitrate.
|
|
91
|
+
const uint64_t rawBitrate = (mantissa << exponent);
|
|
92
|
+
|
|
93
|
+
if (
|
|
94
|
+
(rawBitrate >> exponent) != mantissa ||
|
|
95
|
+
rawBitrate > static_cast<uint64_t>(std::numeric_limits<int64_t>::max()))
|
|
91
96
|
{
|
|
92
97
|
MS_WARN_TAG(rtcp, "invalid REMB bitrate value: %" PRIu64 " *2^%u", mantissa, exponent);
|
|
93
98
|
|
|
@@ -96,6 +101,8 @@ namespace RTC
|
|
|
96
101
|
return;
|
|
97
102
|
}
|
|
98
103
|
|
|
104
|
+
this->bitrate = static_cast<int64_t>(rawBitrate);
|
|
105
|
+
|
|
99
106
|
// Make index point to the first SSRC feedback item.
|
|
100
107
|
size_t index{ 8 };
|
|
101
108
|
|
|
@@ -113,8 +120,8 @@ namespace RTC
|
|
|
113
120
|
MS_TRACE();
|
|
114
121
|
|
|
115
122
|
// NOLINTNEXTLINE(bugprone-parent-virtual-call)
|
|
116
|
-
size_t offset
|
|
117
|
-
|
|
123
|
+
size_t offset = FeedbackPsPacket::Serialize(buffer);
|
|
124
|
+
auto mantissa = static_cast<uint64_t>(std::max<int64_t>(this->bitrate, 0));
|
|
118
125
|
uint8_t exponent{ 0u };
|
|
119
126
|
|
|
120
127
|
while (mantissa > 0x3FFFF /* max mantissa (18 bits) */)
|
|
@@ -151,7 +158,7 @@ namespace RTC
|
|
|
151
158
|
MS_DUMP_CLEAN(indentation, "<FeedbackPsRembPacket>");
|
|
152
159
|
// NOLINTNEXTLINE(bugprone-parent-virtual-call)
|
|
153
160
|
FeedbackPsPacket::Dump();
|
|
154
|
-
MS_DUMP_CLEAN(indentation, " bitrate (bps): %"
|
|
161
|
+
MS_DUMP_CLEAN(indentation, " bitrate (bps): %" PRIi64, this->bitrate);
|
|
155
162
|
for (auto ssrc : this->ssrcs)
|
|
156
163
|
{
|
|
157
164
|
MS_DUMP_CLEAN(indentation, " ssrc: %" PRIu32, ssrc);
|
|
@@ -32,14 +32,23 @@ namespace RTC
|
|
|
32
32
|
|
|
33
33
|
this->overhead = compact & 0x1ff; // 9 bits.
|
|
34
34
|
// Get the bitrate out of exponent and mantissa.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
// NOTE: The exponent is 6 bits wide, so a remote endpoint can craft a shift
|
|
36
|
+
// that overflows. The checks below reject both an overflowing shift and a
|
|
37
|
+
// value that does not fit in the signed 64 bits bitrate.
|
|
38
|
+
const uint64_t rawBitrate = (mantissa << exponent);
|
|
39
|
+
|
|
40
|
+
if (
|
|
41
|
+
(rawBitrate >> exponent) != mantissa ||
|
|
42
|
+
rawBitrate > static_cast<uint64_t>(std::numeric_limits<int64_t>::max()))
|
|
38
43
|
{
|
|
39
44
|
MS_WARN_TAG(rtcp, "invalid TMMB bitrate value : %" PRIu64 " x 2^%" PRIu8, mantissa, exponent);
|
|
40
45
|
|
|
41
46
|
this->isCorrect = false;
|
|
47
|
+
|
|
48
|
+
return;
|
|
42
49
|
}
|
|
50
|
+
|
|
51
|
+
this->bitrate = static_cast<int64_t>(rawBitrate);
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
template<typename T>
|
|
@@ -49,7 +58,7 @@ namespace RTC
|
|
|
49
58
|
|
|
50
59
|
static constexpr uint32_t MaxMantissa{ 0x1ffff }; // 17 bits.
|
|
51
60
|
|
|
52
|
-
|
|
61
|
+
auto mantissa = static_cast<uint64_t>(std::max<int64_t>(this->bitrate, 0));
|
|
53
62
|
uint32_t exponent{ 0 };
|
|
54
63
|
|
|
55
64
|
while (mantissa > MaxMantissa)
|
|
@@ -74,7 +83,7 @@ namespace RTC
|
|
|
74
83
|
|
|
75
84
|
MS_DUMP_CLEAN(indentation, "<FeedbackRtpTmmbItem>");
|
|
76
85
|
MS_DUMP_CLEAN(indentation, " ssrc: %" PRIu32, this->GetSsrc());
|
|
77
|
-
MS_DUMP_CLEAN(indentation, " bitrate: %"
|
|
86
|
+
MS_DUMP_CLEAN(indentation, " bitrate: %" PRIi64, this->GetBitrate());
|
|
78
87
|
MS_DUMP_CLEAN(indentation, " overhead: %" PRIu16, this->GetOverhead());
|
|
79
88
|
MS_DUMP_CLEAN(indentation, "</FeedbackRtpTmmbItem>");
|
|
80
89
|
}
|
|
@@ -54,6 +54,16 @@ namespace RTC
|
|
|
54
54
|
return packet.release();
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
int32_t FeedbackRtpTransportPacket::TicksToReferenceTime(int64_t baseTimeTicks)
|
|
58
|
+
{
|
|
59
|
+
MS_TRACE();
|
|
60
|
+
|
|
61
|
+
const int64_t maskedBaseTimeTicks = baseTimeTicks & 0xFFFFFF;
|
|
62
|
+
|
|
63
|
+
return static_cast<int32_t>(
|
|
64
|
+
maskedBaseTimeTicks >= (1 << 23) ? maskedBaseTimeTicks - (1 << 24) : maskedBaseTimeTicks);
|
|
65
|
+
}
|
|
66
|
+
|
|
57
67
|
/* Instance methods. */
|
|
58
68
|
|
|
59
69
|
FeedbackRtpTransportPacket::FeedbackRtpTransportPacket(CommonHeader* commonHeader, size_t availableLen)
|
|
@@ -190,33 +200,27 @@ namespace RTC
|
|
|
190
200
|
chunk->Dump(indentation + 1);
|
|
191
201
|
}
|
|
192
202
|
|
|
193
|
-
|
|
194
|
-
for (auto delta : this->deltas)
|
|
195
|
-
{
|
|
196
|
-
MS_DUMP_CLEAN(indentation + 1, " %" PRIi16 " ms", static_cast<int16_t>(delta / 4));
|
|
197
|
-
}
|
|
198
|
-
MS_DUMP_CLEAN(indentation + 1, "</Deltas>");
|
|
199
|
-
|
|
200
|
-
auto packetResults = GetPacketResults();
|
|
203
|
+
auto packetStatuses = GetPacketStatuses();
|
|
201
204
|
|
|
202
|
-
MS_DUMP_CLEAN(indentation + 1, "<
|
|
203
|
-
for (auto&
|
|
205
|
+
MS_DUMP_CLEAN(indentation + 1, "<PacketStatuses>");
|
|
206
|
+
for (auto& packetStatus : packetStatuses)
|
|
204
207
|
{
|
|
205
|
-
if (
|
|
208
|
+
if (packetStatus.received)
|
|
206
209
|
{
|
|
207
210
|
MS_DUMP_CLEAN(
|
|
208
211
|
indentation + 1,
|
|
209
|
-
" seq:%" PRIu16 ", received:yes,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
+
" seq:%" PRIu16 ", received:yes, delta:%" PRIi64 " us, receivedAtUs:%" PRIi64,
|
|
213
|
+
packetStatus.sequenceNumber,
|
|
214
|
+
static_cast<int64_t>(packetStatus.delta) * DeltaTickUs,
|
|
215
|
+
packetStatus.receivedAtUs);
|
|
212
216
|
}
|
|
213
217
|
else
|
|
214
218
|
{
|
|
215
219
|
MS_DUMP_CLEAN(
|
|
216
|
-
indentation + 1, " seq:%" PRIu16 ", received:no",
|
|
220
|
+
indentation + 1, " seq:%" PRIu16 ", received:no", packetStatus.sequenceNumber);
|
|
217
221
|
}
|
|
218
222
|
}
|
|
219
|
-
MS_DUMP_CLEAN(indentation + 1, "</
|
|
223
|
+
MS_DUMP_CLEAN(indentation + 1, "</PacketStatuses>");
|
|
220
224
|
MS_DUMP_CLEAN(indentation, "</FeedbackRtpTransportPacket>");
|
|
221
225
|
}
|
|
222
226
|
|
|
@@ -279,21 +283,38 @@ namespace RTC
|
|
|
279
283
|
return offset;
|
|
280
284
|
}
|
|
281
285
|
|
|
282
|
-
void FeedbackRtpTransportPacket::SetBase(uint16_t sequenceNumber,
|
|
286
|
+
void FeedbackRtpTransportPacket::SetBase(uint16_t sequenceNumber, int64_t timestampUs)
|
|
283
287
|
{
|
|
284
288
|
MS_TRACE();
|
|
285
289
|
|
|
286
290
|
MS_ASSERT(!this->baseSet, "base already set");
|
|
287
291
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
292
|
+
// Number of whole base time ticks elapsed.
|
|
293
|
+
const int64_t baseTimeTicks = timestampUs / BaseTimeTickUs;
|
|
294
|
+
|
|
295
|
+
this->baseSet = true;
|
|
296
|
+
this->baseSequenceNumber = sequenceNumber;
|
|
297
|
+
// NOTE: The reference time is a 24 bits field that wraps around, which is
|
|
298
|
+
// what GetBaseDeltaUs() compensates for. Keeping fewer bits than that
|
|
299
|
+
// would make it wrap sooner than the compensation expects.
|
|
300
|
+
this->referenceTime = TicksToReferenceTime(baseTimeTicks);
|
|
291
301
|
this->latestSequenceNumber = sequenceNumber - 1;
|
|
292
|
-
|
|
302
|
+
// IMPORTANT: The reference time only carries whole base time ticks, so
|
|
303
|
+
// the remainder is lost here and recovered by the delta of the first
|
|
304
|
+
// added packet.
|
|
305
|
+
this->latestTimestampUs = baseTimeTicks * BaseTimeTickUs;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
void FeedbackRtpTransportPacket::SetReferenceTimeUs(int64_t referenceTimeUs)
|
|
309
|
+
{
|
|
310
|
+
MS_TRACE();
|
|
311
|
+
|
|
312
|
+
this->referenceTime =
|
|
313
|
+
TicksToReferenceTime((referenceTimeUs % TimeWrapPeriodUs) / BaseTimeTickUs);
|
|
293
314
|
}
|
|
294
315
|
|
|
295
316
|
FeedbackRtpTransportPacket::AddPacketResult FeedbackRtpTransportPacket::AddPacket(
|
|
296
|
-
uint16_t sequenceNumber,
|
|
317
|
+
uint16_t sequenceNumber, int64_t timestampUs, size_t maxRtcpPacketLen)
|
|
297
318
|
{
|
|
298
319
|
MS_TRACE();
|
|
299
320
|
|
|
@@ -323,24 +344,27 @@ namespace RTC
|
|
|
323
344
|
}
|
|
324
345
|
}
|
|
325
346
|
|
|
326
|
-
// Deltas are represented as multiples of
|
|
347
|
+
// Deltas are represented as multiples of DeltaTickUs, rounded to the
|
|
348
|
+
// nearest tick.
|
|
327
349
|
// NOTE: Read it as int 64 to detect long elapsed times.
|
|
328
|
-
const int64_t
|
|
350
|
+
const int64_t elapsedUs = timestampUs - this->latestTimestampUs;
|
|
351
|
+
const int64_t delta64 = elapsedUs >= 0 ? (elapsedUs + (DeltaTickUs / 2)) / DeltaTickUs
|
|
352
|
+
: (elapsedUs - (DeltaTickUs / 2)) / DeltaTickUs;
|
|
329
353
|
|
|
330
354
|
if (
|
|
331
355
|
delta64 > FeedbackRtpTransportPacket::maxPacketDelta ||
|
|
332
356
|
delta64 < -1 * static_cast<int64_t>(FeedbackRtpTransportPacket::maxPacketDelta))
|
|
333
357
|
{
|
|
334
358
|
MS_WARN_DEV(
|
|
335
|
-
"RTP packet delta exceeded [
|
|
336
|
-
this->
|
|
337
|
-
|
|
359
|
+
"RTP packet delta exceeded [latestTimestampUs:%" PRIi64 ", timestampUs:%" PRIi64 "]",
|
|
360
|
+
this->latestTimestampUs,
|
|
361
|
+
timestampUs);
|
|
338
362
|
|
|
339
363
|
return AddPacketResult::FATAL;
|
|
340
364
|
}
|
|
341
365
|
|
|
342
366
|
// Delta in 16 bits signed.
|
|
343
|
-
auto delta = static_cast<int16_t>(delta64);
|
|
367
|
+
const auto delta = static_cast<int16_t>(delta64);
|
|
344
368
|
|
|
345
369
|
// Check whether another chunks and corresponding delta infos could be
|
|
346
370
|
// added.
|
|
@@ -370,8 +394,11 @@ namespace RTC
|
|
|
370
394
|
FillChunk(this->latestSequenceNumber, sequenceNumber, delta);
|
|
371
395
|
|
|
372
396
|
// Update latest seen sequence number and timestamp.
|
|
397
|
+
// NOTE: The timestamp is advanced by the quantized delta rather than set
|
|
398
|
+
// to the given one so that the rounding above doesn't accumulate along
|
|
399
|
+
// the packet.
|
|
373
400
|
this->latestSequenceNumber = sequenceNumber;
|
|
374
|
-
this->
|
|
401
|
+
this->latestTimestampUs += delta * DeltaTickUs;
|
|
375
402
|
|
|
376
403
|
return AddPacketResult::SUCCESS;
|
|
377
404
|
}
|
|
@@ -383,39 +410,38 @@ namespace RTC
|
|
|
383
410
|
AddPendingChunks();
|
|
384
411
|
}
|
|
385
412
|
|
|
386
|
-
std::vector<struct FeedbackRtpTransportPacket::
|
|
413
|
+
std::vector<struct FeedbackRtpTransportPacket::PacketStatus> FeedbackRtpTransportPacket::GetPacketStatuses() const
|
|
387
414
|
{
|
|
388
415
|
MS_TRACE();
|
|
389
416
|
|
|
390
|
-
std::vector<struct
|
|
417
|
+
std::vector<struct PacketStatus> packetStatuses;
|
|
391
418
|
|
|
392
419
|
uint16_t currentSequenceNumber = this->baseSequenceNumber - 1;
|
|
393
420
|
|
|
394
421
|
for (auto* chunk : this->chunks)
|
|
395
422
|
{
|
|
396
|
-
chunk->
|
|
423
|
+
chunk->FillStatuses(packetStatuses, currentSequenceNumber);
|
|
397
424
|
}
|
|
398
425
|
|
|
399
426
|
size_t deltaIdx{ 0u };
|
|
400
|
-
|
|
401
|
-
auto currentReceivedAtMs = static_cast<int64_t>(this->referenceTime * 64);
|
|
427
|
+
auto currentReceivedAtUs = GetReferenceTimestampUs();
|
|
402
428
|
|
|
403
|
-
for (size_t idx{ 0u }; idx <
|
|
429
|
+
for (size_t idx{ 0u }; idx < packetStatuses.size(); ++idx)
|
|
404
430
|
{
|
|
405
|
-
auto&
|
|
431
|
+
auto& packetStatus = packetStatuses[idx];
|
|
406
432
|
|
|
407
|
-
if (!
|
|
433
|
+
if (!packetStatus.received)
|
|
408
434
|
{
|
|
409
435
|
continue;
|
|
410
436
|
}
|
|
411
437
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
438
|
+
currentReceivedAtUs += this->deltas.at(deltaIdx) * DeltaTickUs;
|
|
439
|
+
packetStatus.delta = this->deltas.at(deltaIdx);
|
|
440
|
+
packetStatus.receivedAtUs = currentReceivedAtUs;
|
|
415
441
|
deltaIdx++;
|
|
416
442
|
}
|
|
417
443
|
|
|
418
|
-
return
|
|
444
|
+
return packetStatuses;
|
|
419
445
|
}
|
|
420
446
|
|
|
421
447
|
uint8_t FeedbackRtpTransportPacket::GetPacketFractionLost() const
|
|
@@ -752,8 +778,8 @@ namespace RTC
|
|
|
752
778
|
}
|
|
753
779
|
}
|
|
754
780
|
|
|
755
|
-
void FeedbackRtpTransportPacket::RunLengthChunk::
|
|
756
|
-
std::vector<struct FeedbackRtpTransportPacket::
|
|
781
|
+
void FeedbackRtpTransportPacket::RunLengthChunk::FillStatuses(
|
|
782
|
+
std::vector<struct FeedbackRtpTransportPacket::PacketStatus>& packetStatuses,
|
|
757
783
|
uint16_t& currentSequenceNumber) const
|
|
758
784
|
{
|
|
759
785
|
MS_TRACE();
|
|
@@ -763,7 +789,7 @@ namespace RTC
|
|
|
763
789
|
|
|
764
790
|
for (uint16_t count{ 1u }; count <= this->count; ++count)
|
|
765
791
|
{
|
|
766
|
-
|
|
792
|
+
packetStatuses.emplace_back(++currentSequenceNumber, received);
|
|
767
793
|
}
|
|
768
794
|
}
|
|
769
795
|
|
|
@@ -876,8 +902,8 @@ namespace RTC
|
|
|
876
902
|
return count;
|
|
877
903
|
}
|
|
878
904
|
|
|
879
|
-
void FeedbackRtpTransportPacket::OneBitVectorChunk::
|
|
880
|
-
std::vector<struct FeedbackRtpTransportPacket::
|
|
905
|
+
void FeedbackRtpTransportPacket::OneBitVectorChunk::FillStatuses(
|
|
906
|
+
std::vector<struct FeedbackRtpTransportPacket::PacketStatus>& packetStatuses,
|
|
881
907
|
uint16_t& currentSequenceNumber) const
|
|
882
908
|
{
|
|
883
909
|
MS_TRACE();
|
|
@@ -886,7 +912,7 @@ namespace RTC
|
|
|
886
912
|
{
|
|
887
913
|
const bool received = (status == Status::SmallDelta || status == Status::LargeDelta);
|
|
888
914
|
|
|
889
|
-
|
|
915
|
+
packetStatuses.emplace_back(++currentSequenceNumber, received);
|
|
890
916
|
}
|
|
891
917
|
}
|
|
892
918
|
|
|
@@ -1016,8 +1042,8 @@ namespace RTC
|
|
|
1016
1042
|
return count;
|
|
1017
1043
|
}
|
|
1018
1044
|
|
|
1019
|
-
void FeedbackRtpTransportPacket::TwoBitVectorChunk::
|
|
1020
|
-
std::vector<struct FeedbackRtpTransportPacket::
|
|
1045
|
+
void FeedbackRtpTransportPacket::TwoBitVectorChunk::FillStatuses(
|
|
1046
|
+
std::vector<struct FeedbackRtpTransportPacket::PacketStatus>& packetStatuses,
|
|
1021
1047
|
uint16_t& currentSequenceNumber) const
|
|
1022
1048
|
{
|
|
1023
1049
|
MS_TRACE();
|
|
@@ -1026,7 +1052,7 @@ namespace RTC
|
|
|
1026
1052
|
{
|
|
1027
1053
|
const bool received = (status == Status::SmallDelta || status == Status::LargeDelta);
|
|
1028
1054
|
|
|
1029
|
-
|
|
1055
|
+
packetStatuses.emplace_back(++currentSequenceNumber, received);
|
|
1030
1056
|
}
|
|
1031
1057
|
}
|
|
1032
1058
|
|
|
@@ -316,7 +316,7 @@ namespace RTC
|
|
|
316
316
|
if (
|
|
317
317
|
this->payloadDescriptor->tlIndex > context->GetTargetTemporalLayer() ||
|
|
318
318
|
(this->payloadDescriptor->tlIndex > context->GetCurrentTemporalLayer() &&
|
|
319
|
-
|
|
319
|
+
!this->payloadDescriptor->y))
|
|
320
320
|
{
|
|
321
321
|
context->pictureIdManager.Drop(this->payloadDescriptor->pictureId);
|
|
322
322
|
|
|
@@ -215,7 +215,7 @@ namespace RTC
|
|
|
215
215
|
|
|
216
216
|
const bool isOldPacket =
|
|
217
217
|
(this->payloadDescriptor->hasPictureId &&
|
|
218
|
-
|
|
218
|
+
RTC::SeqManager<uint16_t, 15>::IsSeqLowerThan(
|
|
219
219
|
this->payloadDescriptor->pictureId, context->pictureIdManager.GetMaxInput()));
|
|
220
220
|
|
|
221
221
|
if (!isOldPacket)
|
|
@@ -283,12 +283,12 @@ namespace RTC
|
|
|
283
283
|
// (interframe p bit = 1)
|
|
284
284
|
const uint16_t spatialLayerForPictureId =
|
|
285
285
|
isOldPacket ? context->GetSpatialLayerForPictureId(this->payloadDescriptor->pictureId)
|
|
286
|
-
|
|
286
|
+
: tmpSpatialLayer;
|
|
287
287
|
|
|
288
288
|
if (
|
|
289
289
|
packetSpatialLayer > spatialLayerForPictureId ||
|
|
290
290
|
(context->IsKSvc() && this->payloadDescriptor->p &&
|
|
291
|
-
|
|
291
|
+
packetSpatialLayer != spatialLayerForPictureId))
|
|
292
292
|
{
|
|
293
293
|
return false;
|
|
294
294
|
}
|
|
@@ -336,7 +336,7 @@ namespace RTC
|
|
|
336
336
|
// Filter temporal layers higher than current one.
|
|
337
337
|
const uint16_t temporalLayerForPictureId =
|
|
338
338
|
isOldPacket ? context->GetTemporalLayerForPictureId(this->payloadDescriptor->pictureId)
|
|
339
|
-
|
|
339
|
+
: tmpTemporalLayer;
|
|
340
340
|
|
|
341
341
|
if (packetTemporalLayer > temporalLayerForPictureId)
|
|
342
342
|
{
|