mediasoup 3.26.0 → 3.27.1
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 +16 -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/FBS/meson.build +25 -0
- package/worker/fbs/meson.build +15 -18
- 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/LossBasedController.hpp +520 -0
- package/worker/include/RTC/BWE/RobustThroughputEstimator.hpp +94 -0
- package/worker/include/RTC/BWE/SendPacketHistory.hpp +137 -0
- package/worker/include/RTC/BWE/TargetRateController.hpp +306 -0
- package/worker/include/RTC/BWE/TrendlineEstimator.hpp +143 -0
- package/worker/include/RTC/BWE/Utils.hpp +39 -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 +38 -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 +6 -6
- package/worker/include/RTC/SCTP/rx/ReassemblyQueue.hpp +10 -0
- 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 +87 -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/LossBasedController.cpp +1046 -0
- package/worker/src/RTC/BWE/RobustThroughputEstimator.cpp +245 -0
- package/worker/src/RTC/BWE/SendPacketHistory.cpp +184 -0
- package/worker/src/RTC/BWE/TargetRateController.cpp +435 -0
- package/worker/src/RTC/BWE/TrendlineEstimator.cpp +311 -0
- package/worker/src/RTC/BWE/Utils.cpp +54 -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 +146 -103
- 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 +122 -14
- 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 +2 -2
- 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 +266 -307
- 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 +197 -45
- 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/TestLossBasedController.cpp +1199 -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/TestTargetRateController.cpp +337 -0
- package/worker/test/src/RTC/BWE/TestTrendlineEstimator.cpp +182 -0
- package/worker/test/src/RTC/BWE/TestUtils.cpp +61 -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 +128 -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
|
@@ -3,15 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
#include "common.hpp"
|
|
5
5
|
#include "FBS/rtpStream.h"
|
|
6
|
-
#include "RTC/RTCP/FeedbackPsFir.hpp"
|
|
7
|
-
#include "RTC/RTCP/FeedbackPsPli.hpp"
|
|
8
|
-
#include "RTC/RTCP/FeedbackRtpNack.hpp"
|
|
9
|
-
#include "RTC/RTCP/Packet.hpp"
|
|
10
|
-
#include "RTC/RTCP/ReceiverReport.hpp"
|
|
11
|
-
#include "RTC/RTCP/Sdes.hpp"
|
|
12
|
-
#include "RTC/RTCP/SenderReport.hpp"
|
|
13
|
-
#include "RTC/RTCP/XrDelaySinceLastRr.hpp"
|
|
14
|
-
#include "RTC/RTCP/XrReceiverReferenceTime.hpp"
|
|
15
6
|
#include "RTC/RTP/Packet.hpp"
|
|
16
7
|
#include "RTC/RTP/RtxStream.hpp"
|
|
17
8
|
#include "RTC/RtpDictionaries.hpp"
|
|
@@ -42,22 +33,22 @@ namespace RTC
|
|
|
42
33
|
flatbuffers::Offset<FBS::RtpStream::Params> FillBuffer(
|
|
43
34
|
flatbuffers::FlatBufferBuilder& builder) const;
|
|
44
35
|
|
|
45
|
-
size_t encodingIdx{
|
|
46
|
-
uint32_t ssrc{
|
|
47
|
-
uint8_t payloadType{
|
|
36
|
+
size_t encodingIdx{ 0 };
|
|
37
|
+
uint32_t ssrc{ 0 };
|
|
38
|
+
uint8_t payloadType{ 0 };
|
|
48
39
|
RTC::RtpCodecMimeType mimeType;
|
|
49
|
-
uint32_t clockRate{
|
|
40
|
+
uint32_t clockRate{ 0 };
|
|
50
41
|
std::string rid;
|
|
51
42
|
std::string cname;
|
|
52
|
-
uint32_t rtxSsrc{
|
|
53
|
-
uint8_t rtxPayloadType{
|
|
43
|
+
uint32_t rtxSsrc{ 0 };
|
|
44
|
+
uint8_t rtxPayloadType{ 0 };
|
|
54
45
|
bool useNack{ false };
|
|
55
46
|
bool usePli{ false };
|
|
56
47
|
bool useFir{ false };
|
|
57
48
|
bool useInBandFec{ false };
|
|
58
49
|
bool useDtx{ false };
|
|
59
|
-
uint8_t spatialLayers{
|
|
60
|
-
uint8_t temporalLayers{
|
|
50
|
+
uint8_t spatialLayers{ 1 };
|
|
51
|
+
uint8_t temporalLayers{ 1 };
|
|
61
52
|
};
|
|
62
53
|
|
|
63
54
|
public:
|
|
@@ -68,9 +59,9 @@ namespace RTC
|
|
|
68
59
|
struct SenderReportMapping
|
|
69
60
|
{
|
|
70
61
|
/**
|
|
71
|
-
* NTP timestamp of the Sender Report (
|
|
62
|
+
* NTP timestamp of the Sender Report (us).
|
|
72
63
|
*/
|
|
73
|
-
|
|
64
|
+
int64_t ntpUs;
|
|
74
65
|
/**
|
|
75
66
|
* RTP timestamp the NTP timestamp above corresponds to.
|
|
76
67
|
*/
|
|
@@ -165,13 +156,13 @@ namespace RTC
|
|
|
165
156
|
|
|
166
157
|
virtual void Resume() = 0;
|
|
167
158
|
|
|
168
|
-
virtual
|
|
159
|
+
virtual int64_t GetBitrate(int64_t nowMs) = 0;
|
|
169
160
|
|
|
170
|
-
virtual
|
|
161
|
+
virtual int64_t GetBitrate(int64_t nowMs, uint8_t spatialLayer, uint8_t temporalLayer) = 0;
|
|
171
162
|
|
|
172
|
-
virtual
|
|
163
|
+
virtual int64_t GetSpatialLayerBitrate(int64_t nowMs, uint8_t spatialLayer) = 0;
|
|
173
164
|
|
|
174
|
-
virtual
|
|
165
|
+
virtual int64_t GetLayerBitrate(int64_t nowMs, uint8_t spatialLayer, uint8_t temporalLayer) = 0;
|
|
175
166
|
|
|
176
167
|
void ResetScore(uint8_t score, bool notify);
|
|
177
168
|
|
|
@@ -185,14 +176,9 @@ namespace RTC
|
|
|
185
176
|
return static_cast<float>(this->fractionLost) * 100 / 256;
|
|
186
177
|
}
|
|
187
178
|
|
|
188
|
-
float
|
|
179
|
+
float GetRttMs() const
|
|
189
180
|
{
|
|
190
|
-
return this->
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
uint64_t GetMaxPacketMs() const
|
|
194
|
-
{
|
|
195
|
-
return this->maxPacketMs;
|
|
181
|
+
return this->rttMs;
|
|
196
182
|
}
|
|
197
183
|
|
|
198
184
|
uint32_t GetMaxPacketTs() const
|
|
@@ -216,7 +202,7 @@ namespace RTC
|
|
|
216
202
|
return this->score;
|
|
217
203
|
}
|
|
218
204
|
|
|
219
|
-
|
|
205
|
+
int64_t GetActiveMs() const
|
|
220
206
|
{
|
|
221
207
|
return this->shared->GetTimeMs() - this->activeSinceMs;
|
|
222
208
|
}
|
|
@@ -250,55 +236,55 @@ namespace RTC
|
|
|
250
236
|
// Others.
|
|
251
237
|
// https://tools.ietf.org/html/rfc3550#appendix-A.1 stuff.
|
|
252
238
|
// Highest seq. number seen.
|
|
253
|
-
uint16_t maxSeq{
|
|
239
|
+
uint16_t maxSeq{ 0 };
|
|
254
240
|
// Shifted count of seq. number cycles.
|
|
255
|
-
uint32_t cycles{
|
|
241
|
+
uint32_t cycles{ 0 };
|
|
256
242
|
// Base seq number.
|
|
257
|
-
uint32_t baseSeq{
|
|
243
|
+
uint32_t baseSeq{ 0 };
|
|
258
244
|
// Last 'bad' seq number + 1.
|
|
259
|
-
uint32_t badSeq{
|
|
245
|
+
uint32_t badSeq{ 0 };
|
|
260
246
|
// Highest timestamp seen.
|
|
261
|
-
uint32_t maxPacketTs{
|
|
247
|
+
uint32_t maxPacketTs{ 0 };
|
|
262
248
|
// When the packet with highest timestammp was seen.
|
|
263
|
-
|
|
249
|
+
int64_t maxPacketAtUs{ 0 };
|
|
264
250
|
// When the media in the packet with highest timestamp was captured, in our own
|
|
265
251
|
// monotonic clock.
|
|
266
252
|
// NOTE: Only meaningful in a send stream, whose packets arrive already carrying
|
|
267
253
|
// their capture instant. In a receive stream it is the Producer that tells it,
|
|
268
254
|
// once this class has already seen the packet, so
|
|
269
255
|
// RtpStreamRecv::GetCaptureMapping() is what must be used there.
|
|
270
|
-
std::optional<
|
|
256
|
+
std::optional<int64_t> maxPacketCaptureAtUs;
|
|
271
257
|
int32_t packetsLost{ 0 };
|
|
272
|
-
uint8_t fractionLost{
|
|
258
|
+
uint8_t fractionLost{ 0 };
|
|
273
259
|
// Jitter in RTP timestamp units. As per spec it's kept as floating value
|
|
274
260
|
// although it's exposed as integer in the stats.
|
|
275
261
|
float jitter{ 0 };
|
|
276
|
-
size_t packetsDiscarded{
|
|
277
|
-
size_t packetsRetransmitted{
|
|
278
|
-
size_t packetsRepaired{
|
|
279
|
-
size_t nackCount{
|
|
280
|
-
size_t nackPacketCount{
|
|
281
|
-
size_t pliCount{
|
|
282
|
-
size_t firCount{
|
|
262
|
+
size_t packetsDiscarded{ 0 };
|
|
263
|
+
size_t packetsRetransmitted{ 0 };
|
|
264
|
+
size_t packetsRepaired{ 0 };
|
|
265
|
+
size_t nackCount{ 0 };
|
|
266
|
+
size_t nackPacketCount{ 0 };
|
|
267
|
+
size_t pliCount{ 0 };
|
|
268
|
+
size_t firCount{ 0 };
|
|
283
269
|
// Packets repaired at last interval for score calculation.
|
|
284
|
-
size_t repairedPriorScore{
|
|
270
|
+
size_t repairedPriorScore{ 0 };
|
|
285
271
|
// Packets retransmitted at last interval for score calculation.
|
|
286
|
-
size_t retransmittedPriorScore{
|
|
272
|
+
size_t retransmittedPriorScore{ 0 };
|
|
287
273
|
// Correspondence between wall clock and RTP timeline given by the last Sender
|
|
288
274
|
// Report.
|
|
289
275
|
std::optional<RTP::RtpStream::SenderReportMapping> lastSenderReportMapping;
|
|
290
|
-
float
|
|
276
|
+
float rttMs{ 0.0f };
|
|
291
277
|
// Instance of RtxStream.
|
|
292
278
|
RTP::RtxStream* rtxStream{ nullptr };
|
|
293
279
|
|
|
294
280
|
private:
|
|
295
281
|
// Score related.
|
|
296
|
-
uint8_t score{
|
|
282
|
+
uint8_t score{ 0 };
|
|
297
283
|
std::vector<uint8_t> scores;
|
|
298
284
|
// Whether at least a RTP packet has been received.
|
|
299
285
|
bool started{ false };
|
|
300
286
|
// Last time since the stream is active.
|
|
301
|
-
|
|
287
|
+
int64_t activeSinceMs{ 0 };
|
|
302
288
|
};
|
|
303
289
|
} // namespace RTP
|
|
304
290
|
} // namespace RTC
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
#include "handles/TimerHandleInterface.hpp"
|
|
5
5
|
#include "RTC/NackGenerator.hpp"
|
|
6
|
+
#include "RTC/RTCP/Packet.hpp"
|
|
7
|
+
#include "RTC/RTCP/ReceiverReport.hpp"
|
|
8
|
+
#include "RTC/RTCP/SenderReport.hpp"
|
|
6
9
|
#include "RTC/RTCP/XrDelaySinceLastRr.hpp"
|
|
7
10
|
#include "RTC/RTP/RtpStream.hpp"
|
|
8
11
|
#include "RTC/RateCalculator.hpp"
|
|
@@ -26,12 +29,12 @@ namespace RTC
|
|
|
26
29
|
* - Same value libwebrtc uses in `AbsoluteCaptureTimeInterpolator`, which
|
|
27
30
|
* pairs with senders emitting the extension at least once per second.
|
|
28
31
|
*/
|
|
29
|
-
static constexpr
|
|
32
|
+
static constexpr int64_t MaxAbsCaptureTimeInterpolationMs{ 5000 };
|
|
30
33
|
/**
|
|
31
34
|
* How far the RTP timestamp of a packet may be from the last received RTCP
|
|
32
35
|
* Sender Report for its capture instant to still be interpolated from it (ms).
|
|
33
36
|
*/
|
|
34
|
-
static constexpr
|
|
37
|
+
static constexpr int64_t MaxSenderReportInterpolationMs{ 10000 };
|
|
35
38
|
|
|
36
39
|
public:
|
|
37
40
|
class Listener : public RTP::RtpStream::Listener
|
|
@@ -44,6 +47,16 @@ namespace RTC
|
|
|
44
47
|
* streams consuming this RtpStreamRecv.
|
|
45
48
|
*/
|
|
46
49
|
virtual uint8_t OnRtpStreamNeedWorstRemoteFractionLost(RTP::RtpStreamRecv* rtpStream) = 0;
|
|
50
|
+
/**
|
|
51
|
+
* A spatial layer of this stream started or stopped carrying traffic, so
|
|
52
|
+
* whoever chose a target layer out of them must choose again.
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* - Only fired by streams with more than a spatial layer, which are those
|
|
56
|
+
* of a SVC sender.
|
|
57
|
+
*/
|
|
58
|
+
virtual void OnRtpStreamSpatialLayerActivityChanged(
|
|
59
|
+
RTP::RtpStreamRecv* rtpStream, uint8_t spatialLayer, bool isActive) = 0;
|
|
47
60
|
};
|
|
48
61
|
|
|
49
62
|
public:
|
|
@@ -51,18 +64,18 @@ namespace RTC
|
|
|
51
64
|
{
|
|
52
65
|
public:
|
|
53
66
|
TransmissionCounter(
|
|
54
|
-
SharedInterface* shared, uint8_t spatialLayers, uint8_t temporalLayers,
|
|
67
|
+
SharedInterface* shared, uint8_t spatialLayers, uint8_t temporalLayers, int64_t windowSizeMs);
|
|
55
68
|
|
|
56
69
|
public:
|
|
57
70
|
void Update(const RTP::Packet* packet);
|
|
58
71
|
|
|
59
|
-
|
|
72
|
+
int64_t GetBitrate(int64_t nowMs);
|
|
60
73
|
|
|
61
|
-
|
|
74
|
+
int64_t GetBitrate(int64_t nowMs, uint8_t spatialLayer, uint8_t temporalLayer);
|
|
62
75
|
|
|
63
|
-
|
|
76
|
+
int64_t GetSpatialLayerBitrate(int64_t nowMs, uint8_t spatialLayer);
|
|
64
77
|
|
|
65
|
-
|
|
78
|
+
int64_t GetLayerBitrate(int64_t nowMs, uint8_t spatialLayer, uint8_t temporalLayer);
|
|
66
79
|
|
|
67
80
|
size_t GetPacketCount() const;
|
|
68
81
|
|
|
@@ -81,9 +94,9 @@ namespace RTC
|
|
|
81
94
|
{
|
|
82
95
|
/**
|
|
83
96
|
* Capture instant of the media carried by the RTP timestamp below, in our own
|
|
84
|
-
* monotonic clock (
|
|
97
|
+
* monotonic clock (us).
|
|
85
98
|
*/
|
|
86
|
-
|
|
99
|
+
int64_t captureAtUs;
|
|
87
100
|
/**
|
|
88
101
|
* RTP timestamp the capture instant above refers to.
|
|
89
102
|
*/
|
|
@@ -104,7 +117,7 @@ namespace RTC
|
|
|
104
117
|
/**
|
|
105
118
|
* Local time at which the Sender Report arrived.
|
|
106
119
|
*/
|
|
107
|
-
|
|
120
|
+
int64_t receivedAtUs;
|
|
108
121
|
};
|
|
109
122
|
|
|
110
123
|
/**
|
|
@@ -118,9 +131,9 @@ namespace RTC
|
|
|
118
131
|
*/
|
|
119
132
|
uint32_t ts;
|
|
120
133
|
/**
|
|
121
|
-
* Capture instant in the remote sender's wall clock (
|
|
134
|
+
* Capture instant in the remote sender's wall clock (us).
|
|
122
135
|
*/
|
|
123
|
-
|
|
136
|
+
int64_t ntpUs;
|
|
124
137
|
};
|
|
125
138
|
|
|
126
139
|
public:
|
|
@@ -128,7 +141,7 @@ namespace RTC
|
|
|
128
141
|
RTP::RtpStreamRecv::Listener* listener,
|
|
129
142
|
SharedInterface* shared,
|
|
130
143
|
RTP::RtpStream::Params& params,
|
|
131
|
-
|
|
144
|
+
int64_t sendNackDelayMs,
|
|
132
145
|
bool useRtpInactivityCheck);
|
|
133
146
|
|
|
134
147
|
~RtpStreamRecv() override;
|
|
@@ -137,7 +150,7 @@ namespace RTC
|
|
|
137
150
|
flatbuffers::Offset<FBS::RtpStream::Stats> FillBufferStats(
|
|
138
151
|
flatbuffers::FlatBufferBuilder& builder) override;
|
|
139
152
|
|
|
140
|
-
bool ReceivePacket(RTP::Packet* packet);
|
|
153
|
+
bool ReceivePacket(RTP::Packet* packet, int64_t receivedAtUs);
|
|
141
154
|
|
|
142
155
|
bool ReceiveRtxPacket(RTP::Packet* packet);
|
|
143
156
|
|
|
@@ -145,25 +158,26 @@ namespace RTC
|
|
|
145
158
|
|
|
146
159
|
RTC::RTCP::ReceiverReport* GetRtxRtcpReceiverReport();
|
|
147
160
|
|
|
148
|
-
void ReceiveRtcpSenderReport(RTC::RTCP::SenderReport* report);
|
|
161
|
+
void ReceiveRtcpSenderReport(RTC::RTCP::SenderReport* report, int64_t receivedAtUs);
|
|
149
162
|
|
|
150
|
-
void ReceiveRtxRtcpSenderReport(RTC::RTCP::SenderReport* report);
|
|
163
|
+
void ReceiveRtxRtcpSenderReport(RTC::RTCP::SenderReport* report, int64_t receivedAtUs);
|
|
151
164
|
|
|
152
|
-
void ReceiveRtcpXrDelaySinceLastRr(
|
|
165
|
+
void ReceiveRtcpXrDelaySinceLastRr(
|
|
166
|
+
RTC::RTCP::DelaySinceLastRr::SsrcInfo* ssrcInfo, int64_t receivedAtUs);
|
|
153
167
|
|
|
154
168
|
/**
|
|
155
169
|
* Local time at which the last RTCP Sender Report arrived.
|
|
156
170
|
*
|
|
157
171
|
* @returns No value if no Sender Report has arrived yet.
|
|
158
172
|
*/
|
|
159
|
-
std::optional<
|
|
173
|
+
std::optional<int64_t> GetSenderReportReceivedAtUs() const
|
|
160
174
|
{
|
|
161
175
|
if (!this->lastSenderReportTiming.has_value())
|
|
162
176
|
{
|
|
163
177
|
return std::nullopt;
|
|
164
178
|
}
|
|
165
179
|
|
|
166
|
-
return this->lastSenderReportTiming.value().
|
|
180
|
+
return this->lastSenderReportTiming.value().receivedAtUs;
|
|
167
181
|
}
|
|
168
182
|
|
|
169
183
|
/**
|
|
@@ -175,14 +189,14 @@ namespace RTC
|
|
|
175
189
|
* remote sender into our own clock needs the whole set of streams of that
|
|
176
190
|
* sender.
|
|
177
191
|
*
|
|
178
|
-
* @param
|
|
192
|
+
* @param captureAtUs - Capture instant of `ts` in our own monotonic clock.
|
|
179
193
|
* @param ts - RTP timestamp the capture instant refers to.
|
|
180
194
|
*/
|
|
181
|
-
void SetCaptureMapping(
|
|
195
|
+
void SetCaptureMapping(int64_t captureAtUs, uint32_t ts)
|
|
182
196
|
{
|
|
183
197
|
this->lastCaptureMapping = RTP::RtpStreamRecv::CaptureMapping{
|
|
184
|
-
.
|
|
185
|
-
.ts
|
|
198
|
+
.captureAtUs = captureAtUs,
|
|
199
|
+
.ts = ts,
|
|
186
200
|
};
|
|
187
201
|
}
|
|
188
202
|
|
|
@@ -211,7 +225,7 @@ namespace RTC
|
|
|
211
225
|
* @returns No value if no such extension has been received, or if the given RTP
|
|
212
226
|
* timestamp is too far away from the one it referred to.
|
|
213
227
|
*/
|
|
214
|
-
std::optional<
|
|
228
|
+
std::optional<int64_t> GetRemoteCaptureAtUsFromAbsCaptureTime(uint32_t ts) const;
|
|
215
229
|
|
|
216
230
|
/**
|
|
217
231
|
* Capture instant of the given RTP timestamp, expressed in the remote sender's
|
|
@@ -222,7 +236,7 @@ namespace RTC
|
|
|
222
236
|
* @returns No value if no Sender Report has been received, or if the given RTP
|
|
223
237
|
* timestamp is too far away from the one it reported.
|
|
224
238
|
*/
|
|
225
|
-
std::optional<
|
|
239
|
+
std::optional<int64_t> GetRemoteCaptureAtUsFromSenderReport(uint32_t ts) const;
|
|
226
240
|
|
|
227
241
|
void RequestKeyFrame();
|
|
228
242
|
|
|
@@ -230,22 +244,22 @@ namespace RTC
|
|
|
230
244
|
|
|
231
245
|
void Resume() override;
|
|
232
246
|
|
|
233
|
-
|
|
247
|
+
int64_t GetBitrate(int64_t nowMs) override
|
|
234
248
|
{
|
|
235
249
|
return this->transmissionCounter.GetBitrate(nowMs);
|
|
236
250
|
}
|
|
237
251
|
|
|
238
|
-
|
|
252
|
+
int64_t GetBitrate(int64_t nowMs, uint8_t spatialLayer, uint8_t temporalLayer) override
|
|
239
253
|
{
|
|
240
254
|
return this->transmissionCounter.GetBitrate(nowMs, spatialLayer, temporalLayer);
|
|
241
255
|
}
|
|
242
256
|
|
|
243
|
-
|
|
257
|
+
int64_t GetSpatialLayerBitrate(int64_t nowMs, uint8_t spatialLayer) override
|
|
244
258
|
{
|
|
245
259
|
return this->transmissionCounter.GetSpatialLayerBitrate(nowMs, spatialLayer);
|
|
246
260
|
}
|
|
247
261
|
|
|
248
|
-
|
|
262
|
+
int64_t GetLayerBitrate(int64_t nowMs, uint8_t spatialLayer, uint8_t temporalLayer) override
|
|
249
263
|
{
|
|
250
264
|
return this->transmissionCounter.GetLayerBitrate(nowMs, spatialLayer, temporalLayer);
|
|
251
265
|
}
|
|
@@ -256,7 +270,7 @@ namespace RTC
|
|
|
256
270
|
}
|
|
257
271
|
|
|
258
272
|
private:
|
|
259
|
-
void CalculateJitter(uint32_t rtpTimestamp);
|
|
273
|
+
void CalculateJitter(uint32_t rtpTimestamp, int64_t receivedAtUs);
|
|
260
274
|
|
|
261
275
|
void UpdateScore();
|
|
262
276
|
|
|
@@ -264,13 +278,13 @@ namespace RTC
|
|
|
264
278
|
* Interpolate the capture instant of `ts` from a reference pair, all of them
|
|
265
279
|
* expressed in the remote sender's wall clock.
|
|
266
280
|
*
|
|
267
|
-
* @param
|
|
281
|
+
* @param referenceNtpUs - Capture instant of `referenceTs`.
|
|
268
282
|
* @param referenceTs - RTP timestamp the reference instant refers to.
|
|
269
283
|
* @param ts - RTP timestamp whose capture instant is wanted.
|
|
270
|
-
* @param
|
|
284
|
+
* @param maxDistanceUs - How far `ts` may be from `referenceTs`.
|
|
271
285
|
*/
|
|
272
|
-
std::optional<
|
|
273
|
-
|
|
286
|
+
std::optional<int64_t> InterpolateRemoteCaptureAtUs(
|
|
287
|
+
int64_t referenceNtpUs, uint32_t referenceTs, uint32_t ts, int64_t maxDistanceUs) const;
|
|
274
288
|
|
|
275
289
|
/* Pure virtual methods inherited from RTP::RtpStream. */
|
|
276
290
|
public:
|
|
@@ -288,17 +302,17 @@ namespace RTC
|
|
|
288
302
|
|
|
289
303
|
private:
|
|
290
304
|
// Passed by argument.
|
|
291
|
-
|
|
305
|
+
int64_t sendNackDelayMs{ 0 };
|
|
292
306
|
bool useRtpInactivityCheck{ false };
|
|
293
307
|
// Others.
|
|
294
308
|
// Packets expected at last interval.
|
|
295
|
-
uint32_t expectedPrior{
|
|
309
|
+
uint32_t expectedPrior{ 0 };
|
|
296
310
|
// Packets expected at last interval for score calculation.
|
|
297
|
-
uint32_t expectedPriorScore{
|
|
311
|
+
uint32_t expectedPriorScore{ 0 };
|
|
298
312
|
// Packets received at last interval.
|
|
299
|
-
uint32_t receivedPrior{
|
|
313
|
+
uint32_t receivedPrior{ 0 };
|
|
300
314
|
// Packets received at last interval for score calculation.
|
|
301
|
-
uint32_t receivedPriorScore{
|
|
315
|
+
uint32_t receivedPriorScore{ 0 };
|
|
302
316
|
// Timing data of the most recent Sender Report received.
|
|
303
317
|
std::optional<SenderReportTiming> lastSenderReportTiming;
|
|
304
318
|
// Most recent `abs-capture-time` RTP header extension received.
|
|
@@ -306,12 +320,16 @@ namespace RTC
|
|
|
306
320
|
// Most recent RTP timestamp whose capture instant could be told, along with it.
|
|
307
321
|
std::optional<CaptureMapping> lastCaptureMapping;
|
|
308
322
|
// Relative transit time for prev packet.
|
|
309
|
-
int32_t transit{
|
|
310
|
-
uint8_t firSeqNumber{
|
|
323
|
+
int32_t transit{ 0 };
|
|
324
|
+
uint8_t firSeqNumber{ 0 };
|
|
311
325
|
int32_t reportedPacketsLost{ 0 };
|
|
312
326
|
std::unique_ptr<RTC::NackGenerator> nackGenerator;
|
|
313
327
|
TimerHandleInterface* inactivityCheckPeriodicTimer{ nullptr };
|
|
314
328
|
bool inactive{ false };
|
|
329
|
+
TimerHandleInterface* spatialLayersActivityCheckPeriodicTimer{ nullptr };
|
|
330
|
+
// Whether each spatial layer was carrying traffic at the latest check.
|
|
331
|
+
// Empty unless this stream has more than a spatial layer.
|
|
332
|
+
std::vector<bool> spatialLayersActivity;
|
|
315
333
|
// Valid media + valid RTX.
|
|
316
334
|
TransmissionCounter transmissionCounter;
|
|
317
335
|
// Just valid media.
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
#ifndef MS_RTC_RTP_RTP_STREAM_SEND_HPP
|
|
2
2
|
#define MS_RTC_RTP_RTP_STREAM_SEND_HPP
|
|
3
3
|
|
|
4
|
+
#include "RTC/RTCP/FeedbackPs.hpp"
|
|
5
|
+
#include "RTC/RTCP/FeedbackRtpNack.hpp"
|
|
6
|
+
#include "RTC/RTCP/Sdes.hpp"
|
|
7
|
+
#include "RTC/RTCP/XrDelaySinceLastRr.hpp"
|
|
8
|
+
#include "RTC/RTCP/XrReceiverReferenceTime.hpp"
|
|
4
9
|
#include "RTC/RTP/RetransmissionBuffer.hpp"
|
|
5
10
|
#include "RTC/RTP/RtpStream.hpp"
|
|
6
11
|
#include "RTC/RTP/SharedPacket.hpp"
|
|
@@ -16,11 +21,11 @@ namespace RTC
|
|
|
16
21
|
/**
|
|
17
22
|
* Maximum retransmission buffer size for video (ms).
|
|
18
23
|
*/
|
|
19
|
-
static constexpr
|
|
24
|
+
static constexpr int64_t MaxRetransmissionDelayForVideoMs{ 2000 };
|
|
20
25
|
/**
|
|
21
26
|
* Maximum retransmission buffer size for audio (ms).
|
|
22
27
|
*/
|
|
23
|
-
static constexpr
|
|
28
|
+
static constexpr int64_t MaxRetransmissionDelayForAudioMs{ 1000 };
|
|
24
29
|
/**
|
|
25
30
|
* How old the last packet sent may be for a Sender Report to still be generated
|
|
26
31
|
* (ms).
|
|
@@ -30,7 +35,7 @@ namespace RTC
|
|
|
30
35
|
* with a 120 ms ptime and screen sharing at 1 fps, so that it only triggers on
|
|
31
36
|
* a stream that has really stopped sending.
|
|
32
37
|
*/
|
|
33
|
-
static constexpr
|
|
38
|
+
static constexpr int64_t MaxSenderReportReferenceAgeMs{ 2000 };
|
|
34
39
|
|
|
35
40
|
public:
|
|
36
41
|
enum class ReceivePacketResult : uint8_t
|
|
@@ -63,7 +68,7 @@ namespace RTC
|
|
|
63
68
|
/**
|
|
64
69
|
* Local time at which the Receiver Reference Time arrived.
|
|
65
70
|
*/
|
|
66
|
-
|
|
71
|
+
int64_t receivedAtUs;
|
|
67
72
|
};
|
|
68
73
|
|
|
69
74
|
public:
|
|
@@ -87,13 +92,14 @@ namespace RTC
|
|
|
87
92
|
|
|
88
93
|
void ReceiveKeyFrameRequest(RTC::RTCP::FeedbackPs::MessageType messageType);
|
|
89
94
|
|
|
90
|
-
void ReceiveRtcpReceiverReport(RTC::RTCP::ReceiverReport* report);
|
|
95
|
+
void ReceiveRtcpReceiverReport(RTC::RTCP::ReceiverReport* report, int64_t receivedAtUs);
|
|
91
96
|
|
|
92
|
-
void ReceiveRtcpXrReceiverReferenceTime(
|
|
97
|
+
void ReceiveRtcpXrReceiverReferenceTime(
|
|
98
|
+
RTC::RTCP::ReceiverReferenceTime* report, int64_t receivedAtUs);
|
|
93
99
|
|
|
94
|
-
RTC::RTCP::SenderReport* GetRtcpSenderReport(
|
|
100
|
+
RTC::RTCP::SenderReport* GetRtcpSenderReport(int64_t nowUs);
|
|
95
101
|
|
|
96
|
-
RTC::RTCP::DelaySinceLastRr::SsrcInfo* GetRtcpXrDelaySinceLastRrSsrcInfo(
|
|
102
|
+
RTC::RTCP::DelaySinceLastRr::SsrcInfo* GetRtcpXrDelaySinceLastRrSsrcInfo(int64_t nowUs);
|
|
97
103
|
|
|
98
104
|
RTC::RTCP::SdesChunk* GetRtcpSdesChunk();
|
|
99
105
|
|
|
@@ -101,16 +107,16 @@ namespace RTC
|
|
|
101
107
|
|
|
102
108
|
void Resume() override;
|
|
103
109
|
|
|
104
|
-
|
|
110
|
+
int64_t GetBitrate(int64_t nowMs) override
|
|
105
111
|
{
|
|
106
112
|
return this->transmissionCounter.GetBitrate(nowMs);
|
|
107
113
|
}
|
|
108
114
|
|
|
109
|
-
|
|
115
|
+
int64_t GetBitrate(int64_t nowMs, uint8_t spatialLayer, uint8_t temporalLayer) override;
|
|
110
116
|
|
|
111
|
-
|
|
117
|
+
int64_t GetSpatialLayerBitrate(int64_t nowMs, uint8_t spatialLayer) override;
|
|
112
118
|
|
|
113
|
-
|
|
119
|
+
int64_t GetLayerBitrate(int64_t nowMs, uint8_t spatialLayer, uint8_t temporalLayer) override;
|
|
114
120
|
|
|
115
121
|
private:
|
|
116
122
|
void FillRetransmissionContainer(uint16_t seq, uint16_t bitmask);
|
|
@@ -125,9 +131,9 @@ namespace RTC
|
|
|
125
131
|
// Packets lost at last interval for score calculation.
|
|
126
132
|
int32_t lostPriorScore{ 0 };
|
|
127
133
|
// Packets sent at last interval for score calculation.
|
|
128
|
-
uint32_t sentPriorScore{
|
|
134
|
+
uint32_t sentPriorScore{ 0 };
|
|
129
135
|
std::string mid;
|
|
130
|
-
uint16_t rtxSeq{
|
|
136
|
+
uint16_t rtxSeq{ 0 };
|
|
131
137
|
RTC::RtpDataCounter transmissionCounter;
|
|
132
138
|
RTP::RetransmissionBuffer* retransmissionBuffer{ nullptr };
|
|
133
139
|
// Timing data of the most recent Receiver Reference Time received.
|
|
@@ -44,7 +44,7 @@ namespace RTC
|
|
|
44
44
|
/**
|
|
45
45
|
* Local time at which the Sender Report arrived.
|
|
46
46
|
*/
|
|
47
|
-
|
|
47
|
+
int64_t receivedAtUs;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
public:
|
|
@@ -105,7 +105,7 @@ namespace RTC
|
|
|
105
105
|
|
|
106
106
|
RTC::RTCP::ReceiverReport* GetRtcpReceiverReport();
|
|
107
107
|
|
|
108
|
-
void ReceiveRtcpSenderReport(RTC::RTCP::SenderReport* report);
|
|
108
|
+
void ReceiveRtcpSenderReport(RTC::RTCP::SenderReport* report, int64_t receivedAtUs);
|
|
109
109
|
|
|
110
110
|
protected:
|
|
111
111
|
bool UpdateSeq(const RTP::Packet* packet);
|
|
@@ -124,23 +124,22 @@ namespace RTC
|
|
|
124
124
|
Params params;
|
|
125
125
|
// Others.
|
|
126
126
|
// https://tools.ietf.org/html/rfc3550#appendix-A.1 stuff.
|
|
127
|
-
uint16_t maxSeq{
|
|
128
|
-
uint32_t cycles{
|
|
129
|
-
uint32_t baseSeq{
|
|
130
|
-
uint32_t badSeq{
|
|
131
|
-
uint32_t maxPacketTs{
|
|
132
|
-
uint64_t maxPacketMs{ 0u }; // When the packet with highest timestammp was seen.
|
|
127
|
+
uint16_t maxSeq{ 0 }; // Highest seq. number seen.
|
|
128
|
+
uint32_t cycles{ 0 }; // Shifted count of seq. number cycles.
|
|
129
|
+
uint32_t baseSeq{ 0 }; // Base seq number.
|
|
130
|
+
uint32_t badSeq{ 0 }; // Last 'bad' seq number + 1.
|
|
131
|
+
uint32_t maxPacketTs{ 0 }; // Highest timestamp seen.
|
|
133
132
|
int32_t packetsLost{ 0 };
|
|
134
|
-
uint8_t fractionLost{
|
|
135
|
-
size_t packetsDiscarded{
|
|
136
|
-
size_t packetsCount{
|
|
133
|
+
uint8_t fractionLost{ 0 };
|
|
134
|
+
size_t packetsDiscarded{ 0 };
|
|
135
|
+
size_t packetsCount{ 0 };
|
|
137
136
|
|
|
138
137
|
private:
|
|
139
138
|
// Whether at least a RTP packet has been received.
|
|
140
139
|
bool started{ false };
|
|
141
140
|
// Fields for generating Receiver Reports.
|
|
142
|
-
uint32_t expectedPrior{
|
|
143
|
-
uint32_t receivedPrior{
|
|
141
|
+
uint32_t expectedPrior{ 0 };
|
|
142
|
+
uint32_t receivedPrior{ 0 };
|
|
144
143
|
// Timing data of the most recent Sender Report received.
|
|
145
144
|
std::optional<SenderReportTiming> lastSenderReportTiming;
|
|
146
145
|
int32_t reportedPacketsLost{ 0 };
|