mediasoup 3.20.0 → 3.20.2
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/node/lib/Consumer.d.ts.map +1 -1
- package/node/lib/Consumer.js +5 -4
- package/node/lib/DataConsumer.d.ts +2 -3
- package/node/lib/DataConsumer.d.ts.map +1 -1
- package/node/lib/DataConsumer.js +10 -7
- package/node/lib/DataConsumerTypes.d.ts +5 -4
- package/node/lib/DataConsumerTypes.d.ts.map +1 -1
- package/node/lib/DataProducer.d.ts.map +1 -1
- package/node/lib/DataProducer.js +2 -1
- package/node/lib/PipeTransport.d.ts.map +1 -1
- package/node/lib/PipeTransport.js +5 -4
- package/node/lib/PlainTransport.d.ts.map +1 -1
- package/node/lib/PlainTransport.js +6 -5
- package/node/lib/Producer.d.ts.map +1 -1
- package/node/lib/Producer.js +4 -3
- package/node/lib/Router.js +1 -1
- package/node/lib/WebRtcTransport.d.ts.map +1 -1
- package/node/lib/WebRtcTransport.js +6 -5
- package/node/lib/fbs/consumer/degrade-request.d.ts +30 -0
- package/node/lib/fbs/consumer/degrade-request.d.ts.map +1 -0
- package/node/lib/fbs/consumer/degrade-request.js +124 -0
- package/node/lib/fbs/consumer/enable-delay-and-loss-request.d.ts +24 -0
- package/node/lib/fbs/consumer/enable-delay-and-loss-request.d.ts.map +1 -0
- package/node/lib/fbs/consumer/enable-delay-and-loss-request.js +102 -0
- package/node/lib/fbs/data-consumer/send-response.d.ts +21 -0
- package/node/lib/fbs/data-consumer/send-response.d.ts.map +1 -0
- package/node/lib/fbs/data-consumer/send-response.js +91 -0
- package/node/lib/fbs/data-consumer.d.ts +1 -0
- package/node/lib/fbs/data-consumer.d.ts.map +1 -1
- package/node/lib/fbs/data-consumer.js +4 -1
- package/node/lib/fbs/producer/degrade-request.d.ts +30 -0
- package/node/lib/fbs/producer/degrade-request.d.ts.map +1 -0
- package/node/lib/fbs/producer/degrade-request.js +124 -0
- package/node/lib/fbs/response/body.d.ts +7 -5
- package/node/lib/fbs/response/body.d.ts.map +1 -1
- package/node/lib/fbs/response/body.js +7 -3
- package/node/lib/fbs/response/response.d.ts +3 -2
- package/node/lib/fbs/response/response.d.ts.map +1 -1
- package/node/lib/fbs/sctp-parameters/num-sctp-streams.d.ts.map +1 -1
- package/node/lib/fbs/sctp-parameters/num-sctp-streams.js +5 -5
- package/node/lib/fbs/transport/sctp-negotiated-max-streams-notification.d.ts +24 -0
- package/node/lib/fbs/transport/sctp-negotiated-max-streams-notification.d.ts.map +1 -0
- package/node/lib/fbs/transport/sctp-negotiated-max-streams-notification.js +102 -0
- package/node/lib/fbs/transport/sctp-negotiated-options-notification.d.ts +24 -0
- package/node/lib/fbs/transport/sctp-negotiated-options-notification.d.ts.map +1 -0
- package/node/lib/fbs/transport/sctp-negotiated-options-notification.js +102 -0
- package/node/lib/fbs/worker/close-notification.d.ts +18 -0
- package/node/lib/fbs/worker/close-notification.d.ts.map +1 -0
- package/node/lib/fbs/worker/close-notification.js +78 -0
- package/node/lib/fbs/worker/close-request.d.ts +18 -0
- package/node/lib/fbs/worker/close-request.d.ts.map +1 -0
- package/node/lib/fbs/worker/close-request.js +78 -0
- package/node/lib/fbs/worker/close-worker-notification.d.ts +18 -0
- package/node/lib/fbs/worker/close-worker-notification.d.ts.map +1 -0
- package/node/lib/fbs/worker/close-worker-notification.js +78 -0
- package/node/lib/sctpParametersTypes.d.ts +23 -0
- package/node/lib/sctpParametersTypes.d.ts.map +1 -1
- package/node/lib/test/test-Consumer.js +194 -0
- package/node/lib/test/test-DataConsumer.js +6 -0
- package/node/lib/test/test-Router.js +11 -0
- package/node/lib/test/test-werift-sctp.js +7 -0
- package/npm-scripts.mjs +2 -2
- package/package.json +7 -6
- package/worker/Makefile +5 -1
- package/worker/deps/libwebrtc/meson.build +5 -1
- package/worker/fbs/dataConsumer.fbs +4 -0
- package/worker/fbs/response.fbs +1 -0
- package/worker/fuzzer/src/RTC/RTP/FuzzerPacket.cpp +2 -2
- package/worker/include/Channel/ChannelMessageRegistrator.hpp +4 -3
- package/worker/include/Channel/ChannelNotification.hpp +0 -4
- package/worker/include/Channel/ChannelRequest.hpp +3 -4
- package/worker/include/DepLibSRTP.hpp +2 -2
- package/worker/include/RTC/ActiveSpeakerObserver.hpp +2 -2
- package/worker/include/RTC/AudioLevelObserver.hpp +2 -2
- package/worker/include/RTC/Consumer.hpp +1 -1
- package/worker/include/RTC/DataConsumer.hpp +2 -2
- package/worker/include/RTC/DtlsTransport.hpp +4 -4
- package/worker/include/RTC/ICE/IceServer.hpp +2 -2
- package/worker/include/RTC/ICE/StunPacket.hpp +34 -34
- package/worker/include/RTC/KeyFrameRequestManager.hpp +3 -3
- package/worker/include/RTC/Parameters.hpp +2 -2
- package/worker/include/RTC/PipeConsumer.hpp +6 -5
- package/worker/include/RTC/PlainTransport.hpp +0 -1
- package/worker/include/RTC/PortManager.hpp +92 -12
- package/worker/include/RTC/Producer.hpp +7 -6
- package/worker/include/RTC/RTCP/Feedback.hpp +1 -2
- package/worker/include/RTC/RTCP/FeedbackRtpTransport.hpp +2 -2
- package/worker/include/RTC/RTCP/Packet.hpp +2 -2
- package/worker/include/RTC/RTCP/Sdes.hpp +1 -1
- package/worker/include/RTC/RTP/Codecs/DependencyDescriptor.hpp +2 -1
- package/worker/include/RTC/RTP/Packet.hpp +57 -57
- package/worker/include/RTC/RTP/ProbationGenerator.hpp +2 -2
- package/worker/include/RTC/RTP/SharedPacket.hpp +4 -4
- package/worker/include/RTC/Router.hpp +12 -11
- package/worker/include/RTC/RtcLogger.hpp +2 -2
- package/worker/include/RTC/RtpDictionaries.hpp +6 -6
- package/worker/include/RTC/RtpListener.hpp +4 -4
- package/worker/include/RTC/SCTP/association/Association.hpp +13 -13
- package/worker/include/RTC/SCTP/association/HeartbeatHandler.hpp +2 -2
- package/worker/include/RTC/SCTP/association/NegotiatedCapabilities.hpp +2 -2
- package/worker/include/RTC/SCTP/association/PacketSender.hpp +3 -3
- package/worker/include/RTC/SCTP/association/StateCookie.hpp +9 -9
- package/worker/include/RTC/SCTP/association/StreamResetHandler.hpp +4 -4
- package/worker/include/RTC/SCTP/association/TransmissionControlBlock.hpp +24 -24
- package/worker/include/RTC/SCTP/association/TransmissionControlBlockContextInterface.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/Chunk.hpp +86 -86
- package/worker/include/RTC/SCTP/packet/ErrorCause.hpp +18 -18
- package/worker/include/RTC/SCTP/packet/Packet.hpp +33 -33
- package/worker/include/RTC/SCTP/packet/Parameter.hpp +24 -24
- package/worker/include/RTC/SCTP/packet/TLV.hpp +13 -13
- package/worker/include/RTC/SCTP/packet/UserData.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/chunks/AbortAssociationChunk.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/chunks/AnyDataChunk.hpp +9 -9
- package/worker/include/RTC/SCTP/packet/chunks/AnyForwardTsnChunk.hpp +3 -3
- package/worker/include/RTC/SCTP/packet/chunks/CookieAckChunk.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/chunks/CookieEchoChunk.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/chunks/DataChunk.hpp +11 -11
- package/worker/include/RTC/SCTP/packet/chunks/ForwardTsnChunk.hpp +6 -6
- package/worker/include/RTC/SCTP/packet/chunks/HeartbeatAckChunk.hpp +6 -6
- package/worker/include/RTC/SCTP/packet/chunks/HeartbeatRequestChunk.hpp +6 -6
- package/worker/include/RTC/SCTP/packet/chunks/IDataChunk.hpp +6 -6
- package/worker/include/RTC/SCTP/packet/chunks/IForwardTsnChunk.hpp +7 -7
- package/worker/include/RTC/SCTP/packet/chunks/InitAckChunk.hpp +10 -10
- package/worker/include/RTC/SCTP/packet/chunks/InitChunk.hpp +8 -8
- package/worker/include/RTC/SCTP/packet/chunks/OperationErrorChunk.hpp +6 -6
- package/worker/include/RTC/SCTP/packet/chunks/ReConfigChunk.hpp +10 -10
- package/worker/include/RTC/SCTP/packet/chunks/SackChunk.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/chunks/ShutdownAckChunk.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/chunks/ShutdownChunk.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/chunks/ShutdownCompleteChunk.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/chunks/UnknownChunk.hpp +2 -2
- package/worker/include/RTC/SCTP/packet/errorCauses/CookieReceivedWhileShuttingDownErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/errorCauses/InvalidMandatoryParameterErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/errorCauses/InvalidStreamIdentifierErrorCause.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/errorCauses/MissingMandatoryParameterErrorCause.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/errorCauses/NoUserDataErrorCause.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/errorCauses/OutOfResourceErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/errorCauses/ProtocolViolationErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/errorCauses/RestartOfAnAssociationWithNewAddressesErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/errorCauses/StaleCookieErrorCause.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/errorCauses/UnknownErrorCause.hpp +2 -2
- package/worker/include/RTC/SCTP/packet/errorCauses/UnrecognizedChunkTypeErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/errorCauses/UnrecognizedParametersErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/errorCauses/UnresolvableAddressErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/errorCauses/UserInitiatedAbortErrorCause.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/parameters/AddIncomingStreamsRequestParameter.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/parameters/AddOutgoingStreamsRequestParameter.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/parameters/CookiePreservativeParameter.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/parameters/ForwardTsnSupportedParameter.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/parameters/HeartbeatInfoParameter.hpp +3 -3
- package/worker/include/RTC/SCTP/packet/parameters/IPv4AddressParameter.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/parameters/IPv6AddressParameter.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/parameters/IncomingSsnResetRequestParameter.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/parameters/OutgoingSsnResetRequestParameter.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/parameters/ReconfigurationResponseParameter.hpp +7 -7
- package/worker/include/RTC/SCTP/packet/parameters/SsnTsnResetRequestParameter.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/parameters/StateCookieParameter.hpp +5 -5
- package/worker/include/RTC/SCTP/packet/parameters/SupportedAddressTypesParameter.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/parameters/SupportedExtensionsParameter.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/parameters/UnknownParameter.hpp +2 -2
- package/worker/include/RTC/SCTP/packet/parameters/UnrecognizedParameterParameter.hpp +4 -4
- package/worker/include/RTC/SCTP/packet/parameters/ZeroChecksumAcceptableParameter.hpp +7 -7
- package/worker/include/RTC/SCTP/public/AssociationInterface.hpp +7 -7
- package/worker/include/RTC/SCTP/public/AssociationListenerInterface.hpp +26 -26
- package/worker/include/RTC/SCTP/public/AssociationMetrics.hpp +7 -7
- package/worker/include/RTC/SCTP/public/Message.hpp +1 -1
- package/worker/include/RTC/SCTP/public/SctpOptions.hpp +4 -4
- package/worker/include/RTC/SCTP/public/SctpTypes.hpp +10 -10
- package/worker/include/RTC/SCTP/rx/DataTracker.hpp +1 -1
- package/worker/include/RTC/SCTP/rx/ReassemblyStreamsInterface.hpp +1 -1
- package/worker/include/RTC/SCTP/tx/OutstandingData.hpp +39 -39
- package/worker/include/RTC/SCTP/tx/RetransmissionErrorCounter.hpp +1 -1
- package/worker/include/RTC/SCTP/tx/RetransmissionQueue.hpp +14 -14
- package/worker/include/RTC/SCTP/tx/RoundRobinSendQueue.hpp +1 -1
- package/worker/include/RTC/SctpListener.hpp +2 -2
- package/worker/include/RTC/SimulcastConsumer.hpp +2 -1
- package/worker/include/RTC/TcpServer.hpp +3 -2
- package/worker/include/RTC/Transport.hpp +8 -8
- package/worker/include/RTC/UdpSocket.hpp +3 -2
- package/worker/include/RTC/WebRtcServer.hpp +4 -5
- package/worker/include/RTC/WebRtcTransport.hpp +2 -2
- package/worker/include/Settings.hpp +3 -3
- package/worker/include/Worker.hpp +3 -3
- package/worker/include/handles/TcpServerHandle.hpp +2 -2
- package/worker/meson.build +9 -4
- package/worker/mocks/include/Channel/MockChannelMessageRegistrator.hpp +4 -3
- package/worker/src/Channel/ChannelNotification.cpp +5 -4
- package/worker/src/Channel/ChannelRequest.cpp +9 -6
- package/worker/src/DepLibSRTP.cpp +1 -1
- package/worker/src/RTC/AudioLevelObserver.cpp +2 -2
- package/worker/src/RTC/DataConsumer.cpp +13 -3
- package/worker/src/RTC/DataProducer.cpp +1 -1
- package/worker/src/RTC/DtlsTransport.cpp +3 -3
- package/worker/src/RTC/ICE/IceServer.cpp +1 -1
- package/worker/src/RTC/ICE/StunPacket.cpp +77 -77
- package/worker/src/RTC/PipeTransport.cpp +5 -4
- package/worker/src/RTC/PlainTransport.cpp +9 -8
- package/worker/src/RTC/PortManager.cpp +174 -114
- package/worker/src/RTC/Producer.cpp +0 -1
- package/worker/src/RTC/RTCP/Feedback.cpp +6 -6
- package/worker/src/RTC/RTCP/FeedbackPs.cpp +1 -1
- package/worker/src/RTC/RTCP/FeedbackPsAfb.cpp +1 -1
- package/worker/src/RTC/RTCP/FeedbackPsPli.cpp +1 -1
- package/worker/src/RTC/RTCP/FeedbackPsRemb.cpp +2 -2
- package/worker/src/RTC/RTCP/FeedbackRtp.cpp +1 -1
- package/worker/src/RTC/RTCP/FeedbackRtpSrReq.cpp +1 -1
- package/worker/src/RTC/RTCP/FeedbackRtpTransport.cpp +2 -2
- package/worker/src/RTC/RTCP/Packet.cpp +2 -2
- package/worker/src/RTC/RTCP/Sdes.cpp +1 -1
- package/worker/src/RTC/RTP/Codecs/DependencyDescriptor.cpp +2 -1
- package/worker/src/RTC/RTP/Packet.cpp +68 -68
- package/worker/src/RTC/RTP/ProbationGenerator.cpp +3 -3
- package/worker/src/RTC/RTP/RtpStreamRecv.cpp +3 -3
- package/worker/src/RTC/RTP/RtxStream.cpp +2 -2
- package/worker/src/RTC/RTP/SharedPacket.cpp +4 -4
- package/worker/src/RTC/Router.cpp +5 -5
- package/worker/src/RTC/RtcLogger.cpp +1 -1
- package/worker/src/RTC/RtpDictionaries/RtpCodecMimeType.cpp +4 -4
- package/worker/src/RTC/RtpDictionaries/RtpParameters.cpp +2 -3
- package/worker/src/RTC/SCTP/association/Association.cpp +100 -97
- package/worker/src/RTC/SCTP/association/HeartbeatHandler.cpp +6 -6
- package/worker/src/RTC/SCTP/association/NegotiatedCapabilities.cpp +3 -3
- package/worker/src/RTC/SCTP/association/PacketSender.cpp +1 -1
- package/worker/src/RTC/SCTP/association/StreamResetHandler.cpp +2 -2
- package/worker/src/RTC/SCTP/association/TransmissionControlBlock.cpp +5 -5
- package/worker/src/RTC/SCTP/packet/Chunk.cpp +52 -52
- package/worker/src/RTC/SCTP/packet/ErrorCause.cpp +14 -14
- package/worker/src/RTC/SCTP/packet/Packet.cpp +17 -17
- package/worker/src/RTC/SCTP/packet/Parameter.cpp +17 -17
- package/worker/src/RTC/SCTP/packet/TLV.cpp +8 -8
- package/worker/src/RTC/SCTP/packet/chunks/AbortAssociationChunk.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/chunks/CookieAckChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/chunks/CookieEchoChunk.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/chunks/DataChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/chunks/ForwardTsnChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/chunks/HeartbeatAckChunk.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/chunks/HeartbeatRequestChunk.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/chunks/IDataChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/chunks/IForwardTsnChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/chunks/InitAckChunk.cpp +4 -4
- package/worker/src/RTC/SCTP/packet/chunks/InitChunk.cpp +4 -4
- package/worker/src/RTC/SCTP/packet/chunks/OperationErrorChunk.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/chunks/ReConfigChunk.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/chunks/SackChunk.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/chunks/ShutdownAckChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/chunks/ShutdownChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/chunks/ShutdownCompleteChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/errorCauses/CookieReceivedWhileShuttingDownErrorCause.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/errorCauses/InvalidMandatoryParameterErrorCause.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/errorCauses/InvalidStreamIdentifierErrorCause.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/errorCauses/MissingMandatoryParameterErrorCause.cpp +4 -4
- package/worker/src/RTC/SCTP/packet/errorCauses/NoUserDataErrorCause.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/errorCauses/OutOfResourceErrorCause.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/errorCauses/ProtocolViolationErrorCause.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/errorCauses/RestartOfAnAssociationWithNewAddressesErrorCause.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/errorCauses/StaleCookieErrorCause.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/errorCauses/UnrecognizedChunkTypeErrorCause.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/errorCauses/UnrecognizedParametersErrorCause.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/errorCauses/UnresolvableAddressErrorCause.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/errorCauses/UserInitiatedAbortErrorCause.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/parameters/AddIncomingStreamsRequestParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/AddOutgoingStreamsRequestParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/CookiePreservativeParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/ForwardTsnSupportedParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/HeartbeatInfoParameter.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/parameters/IPv4AddressParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/IPv6AddressParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/IncomingSsnResetRequestParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/OutgoingSsnResetRequestParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/ReconfigurationResponseParameter.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/parameters/SsnTsnResetRequestParameter.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/parameters/StateCookieParameter.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/parameters/SupportedAddressTypesParameter.cpp +3 -3
- package/worker/src/RTC/SCTP/packet/parameters/SupportedExtensionsParameter.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/parameters/UnrecognizedParameterParameter.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/parameters/ZeroChecksumAcceptableParameter.cpp +3 -3
- package/worker/src/RTC/SCTP/rx/InterleavedReassemblyStreams.cpp +1 -0
- package/worker/src/RTC/SCTP/rx/TraditionalReassemblyStreams.cpp +1 -0
- package/worker/src/RTC/SCTP/tx/OutstandingData.cpp +8 -8
- package/worker/src/RTC/SCTP/tx/RoundRobinSendQueue.cpp +1 -1
- package/worker/src/RTC/SvcConsumer.cpp +6 -2
- package/worker/src/RTC/TcpServer.cpp +4 -4
- package/worker/src/RTC/Transport.cpp +42 -19
- package/worker/src/RTC/UdpSocket.cpp +4 -4
- package/worker/src/RTC/WebRtcServer.cpp +8 -8
- package/worker/src/RTC/WebRtcTransport.cpp +9 -8
- package/worker/src/Settings.cpp +2 -2
- package/worker/src/lib.cpp +1 -2
- package/worker/subprojects/packagefiles/ankerl-unordered-dense/meson.build +5 -0
- package/worker/subprojects/unordered-dense.wrap +9 -0
- package/worker/tasks.py +293 -196
- package/worker/test/src/RTC/ICE/TestStunPacket.cpp +22 -22
- package/worker/test/src/RTC/ICE/iceCommon.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackRtpEcn.cpp +8 -8
- package/worker/test/src/RTC/RTCP/TestFeedbackRtpNack.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackRtpSrReq.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackRtpTllei.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackRtpTmmb.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestSenderReport.cpp +1 -1
- package/worker/test/src/RTC/RTP/TestPacket.cpp +26 -26
- package/worker/test/src/RTC/RTP/TestSharedPacket.cpp +1 -1
- package/worker/test/src/RTC/RTP/rtpCommon.cpp +1 -1
- package/worker/test/src/RTC/SCTP/association/TestNegotiatedCapabilities.cpp +4 -4
- package/worker/test/src/RTC/SCTP/packet/TestPacket.cpp +14 -14
- package/worker/test/src/RTC/SCTP/packet/chunks/TestAbortAssociationChunk.cpp +4 -4
- package/worker/test/src/RTC/SCTP/packet/chunks/TestCookieAckChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestCookieEchoChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestForwardTsnChunk.cpp +3 -3
- package/worker/test/src/RTC/SCTP/packet/chunks/TestHeartbeatAckChunk.cpp +3 -3
- package/worker/test/src/RTC/SCTP/packet/chunks/TestHeartbeatRequestChunk.cpp +9 -9
- package/worker/test/src/RTC/SCTP/packet/chunks/TestIDataChunk.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/chunks/TestIForwardTsnChunk.cpp +3 -3
- package/worker/test/src/RTC/SCTP/packet/chunks/TestInitAckChunk.cpp +3 -3
- package/worker/test/src/RTC/SCTP/packet/chunks/TestInitChunk.cpp +8 -8
- package/worker/test/src/RTC/SCTP/packet/chunks/TestOperationErrorChunk.cpp +7 -7
- package/worker/test/src/RTC/SCTP/packet/chunks/TestReConfigChunk.cpp +6 -6
- package/worker/test/src/RTC/SCTP/packet/chunks/TestSackChunk.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/chunks/TestShutdownAckChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestShutdownCompleteChunk.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/chunks/TestUnknownChunk.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestCookieReceivedWhileShuttingDownErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestInvalidMandatoryParameterErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestInvalidStreamIdentifierErrorCause.cpp +6 -6
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestMissingMandatoryParameterErrorCause.cpp +11 -11
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestNoUserDataErrorCause.cpp +6 -6
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestOutOfResourceErrorCause.cpp +5 -5
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestProtocolViolationErrorCause.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestRestartOfAnAssociationWithNewAddressesErrorCause.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestStaleCookieErrorCause.cpp +6 -6
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestUnknownErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestUnrecognizedChunkTypeErrorCause.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestUnrecognizedParametersErrorCause.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestUnresolvableAddressErrorCause.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/errorCauses/TestUserInitiatedAbortErrorCause.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/parameters/TestAddIncomingStreamsRequestParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestAddOutgoingStreamsRequestParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestCookiePreservativeParameter.cpp +7 -7
- package/worker/test/src/RTC/SCTP/packet/parameters/TestForwardTsnSupportedParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestHeartbeatInfoParameter.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/parameters/TestIPv4AddressParameter.cpp +7 -7
- package/worker/test/src/RTC/SCTP/packet/parameters/TestIPv6AddressParameter.cpp +7 -7
- package/worker/test/src/RTC/SCTP/packet/parameters/TestIncomingSsnResetRequestParameter.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/parameters/TestOutgoingSsnResetRequestParameter.cpp +2 -2
- package/worker/test/src/RTC/SCTP/packet/parameters/TestReconfigurationResponseParameter.cpp +5 -5
- package/worker/test/src/RTC/SCTP/packet/parameters/TestSsnTsnResetRequestParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestStateCookieParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestSupportedAddressTypesParameter.cpp +6 -6
- package/worker/test/src/RTC/SCTP/packet/parameters/TestSupportedExtensionsParameter.cpp +3 -3
- package/worker/test/src/RTC/SCTP/packet/parameters/TestUnknownParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestUnrecognizedParameterParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestZeroChecksumAcceptableParameter.cpp +1 -1
- package/worker/test/src/RTC/SCTP/sctpCommon.cpp +1 -1
- package/worker/test/src/RTC/SCTP/tx/TestOutstandingData.cpp +3 -3
- package/worker/test/src/RTC/SCTP/tx/TestRetransmissionQueue.cpp +1 -1
- package/worker/test/src/RTC/TestNackGenerator.cpp +1 -1
- package/worker/test/src/RTC/TestPortManager.cpp +126 -0
- package/worker/test/src/RTC/TestTransportCongestionControlServer.cpp +2 -2
- package/worker/test/src/RTC/TestTransportTuple.cpp +3 -2
- package/worker/test/src/Utils/TestCrypto.cpp +3 -3
- package/worker/test/src/Utils/TestString.cpp +1 -1
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
#include "Logger.hpp"
|
|
7
7
|
#include "MediaSoupErrors.hpp"
|
|
8
8
|
#include "Utils.hpp"
|
|
9
|
-
#include <
|
|
9
|
+
#include <cstring> // std::memcmp(), std::memset()
|
|
10
|
+
#include <tuple> // std::make_tuple()
|
|
10
11
|
|
|
11
12
|
/* Static methods for UV callbacks. */
|
|
12
13
|
|
|
@@ -31,9 +32,11 @@ namespace RTC
|
|
|
31
32
|
{
|
|
32
33
|
/* Class variables. */
|
|
33
34
|
|
|
34
|
-
thread_local
|
|
35
|
+
thread_local ankerl::unordered_dense::
|
|
36
|
+
map<PortManager::PortRangeKey, PortManager::PortRange, PortManager::PortRangeKeyHash>
|
|
37
|
+
PortManager::mapPortRanges;
|
|
35
38
|
|
|
36
|
-
/*
|
|
39
|
+
/* PortManager class methods. */
|
|
37
40
|
|
|
38
41
|
uv_handle_t* PortManager::Bind(
|
|
39
42
|
Protocol protocol, std::string& ip, uint16_t port, RTC::Transport::SocketFlags& flags)
|
|
@@ -71,7 +74,8 @@ namespace RTC
|
|
|
71
74
|
{
|
|
72
75
|
case AF_INET:
|
|
73
76
|
{
|
|
74
|
-
err = uv_ip4_addr(
|
|
77
|
+
err = uv_ip4_addr(
|
|
78
|
+
ip.c_str(), 0, reinterpret_cast<struct sockaddr_in*>(std::addressof(bindAddr)));
|
|
75
79
|
|
|
76
80
|
if (err != 0)
|
|
77
81
|
{
|
|
@@ -83,7 +87,8 @@ namespace RTC
|
|
|
83
87
|
|
|
84
88
|
case AF_INET6:
|
|
85
89
|
{
|
|
86
|
-
err = uv_ip6_addr(
|
|
90
|
+
err = uv_ip6_addr(
|
|
91
|
+
ip.c_str(), 0, reinterpret_cast<struct sockaddr_in6*>(std::addressof(bindAddr)));
|
|
87
92
|
|
|
88
93
|
if (err != 0)
|
|
89
94
|
{
|
|
@@ -105,14 +110,14 @@ namespace RTC
|
|
|
105
110
|
{
|
|
106
111
|
case AF_INET:
|
|
107
112
|
{
|
|
108
|
-
(reinterpret_cast<struct sockaddr_in*>(
|
|
113
|
+
(reinterpret_cast<struct sockaddr_in*>(std::addressof(bindAddr)))->sin_port = htons(port);
|
|
109
114
|
|
|
110
115
|
break;
|
|
111
116
|
}
|
|
112
117
|
|
|
113
118
|
case AF_INET6:
|
|
114
119
|
{
|
|
115
|
-
(reinterpret_cast<struct sockaddr_in6*>(
|
|
120
|
+
(reinterpret_cast<struct sockaddr_in6*>(std::addressof(bindAddr)))->sin6_port = htons(port);
|
|
116
121
|
|
|
117
122
|
break;
|
|
118
123
|
}
|
|
@@ -175,7 +180,7 @@ namespace RTC
|
|
|
175
180
|
{
|
|
176
181
|
err = uv_udp_bind(
|
|
177
182
|
reinterpret_cast<uv_udp_t*>(uvHandle),
|
|
178
|
-
reinterpret_cast<const struct sockaddr*>(
|
|
183
|
+
reinterpret_cast<const struct sockaddr*>(std::addressof(bindAddr)),
|
|
179
184
|
bitFlags);
|
|
180
185
|
|
|
181
186
|
if (err != 0)
|
|
@@ -198,7 +203,7 @@ namespace RTC
|
|
|
198
203
|
{
|
|
199
204
|
err = uv_tcp_bind(
|
|
200
205
|
reinterpret_cast<uv_tcp_t*>(uvHandle),
|
|
201
|
-
reinterpret_cast<const struct sockaddr*>(
|
|
206
|
+
reinterpret_cast<const struct sockaddr*>(std::addressof(bindAddr)),
|
|
202
207
|
bitFlags);
|
|
203
208
|
|
|
204
209
|
if (err != 0)
|
|
@@ -250,7 +255,7 @@ namespace RTC
|
|
|
250
255
|
uint16_t minPort,
|
|
251
256
|
uint16_t maxPort,
|
|
252
257
|
RTC::Transport::SocketFlags& flags,
|
|
253
|
-
|
|
258
|
+
PortRangeKey& key)
|
|
254
259
|
{
|
|
255
260
|
MS_TRACE();
|
|
256
261
|
|
|
@@ -288,7 +293,8 @@ namespace RTC
|
|
|
288
293
|
{
|
|
289
294
|
case AF_INET:
|
|
290
295
|
{
|
|
291
|
-
err = uv_ip4_addr(
|
|
296
|
+
err = uv_ip4_addr(
|
|
297
|
+
ip.c_str(), 0, reinterpret_cast<struct sockaddr_in*>(std::addressof(bindAddr)));
|
|
292
298
|
|
|
293
299
|
if (err != 0)
|
|
294
300
|
{
|
|
@@ -300,7 +306,8 @@ namespace RTC
|
|
|
300
306
|
|
|
301
307
|
case AF_INET6:
|
|
302
308
|
{
|
|
303
|
-
err = uv_ip6_addr(
|
|
309
|
+
err = uv_ip6_addr(
|
|
310
|
+
ip.c_str(), 0, reinterpret_cast<struct sockaddr_in6*>(std::addressof(bindAddr)));
|
|
304
311
|
|
|
305
312
|
if (err != 0)
|
|
306
313
|
{
|
|
@@ -317,9 +324,9 @@ namespace RTC
|
|
|
317
324
|
}
|
|
318
325
|
}
|
|
319
326
|
|
|
320
|
-
|
|
327
|
+
key = PortRangeKey(protocol, bindAddr, minPort, maxPort);
|
|
321
328
|
|
|
322
|
-
auto& portRange = PortManager::GetOrCreatePortRange(
|
|
329
|
+
auto& portRange = PortManager::GetOrCreatePortRange(key, minPort, maxPort);
|
|
323
330
|
const size_t numPorts = portRange.ports.size();
|
|
324
331
|
const size_t numAttempts = numPorts;
|
|
325
332
|
size_t attempt{ 0u };
|
|
@@ -385,14 +392,14 @@ namespace RTC
|
|
|
385
392
|
{
|
|
386
393
|
case AF_INET:
|
|
387
394
|
{
|
|
388
|
-
(reinterpret_cast<struct sockaddr_in*>(
|
|
395
|
+
(reinterpret_cast<struct sockaddr_in*>(std::addressof(bindAddr)))->sin_port = htons(port);
|
|
389
396
|
|
|
390
397
|
break;
|
|
391
398
|
}
|
|
392
399
|
|
|
393
400
|
case AF_INET6:
|
|
394
401
|
{
|
|
395
|
-
(reinterpret_cast<struct sockaddr_in6*>(
|
|
402
|
+
(reinterpret_cast<struct sockaddr_in6*>(std::addressof(bindAddr)))->sin6_port = htons(port);
|
|
396
403
|
|
|
397
404
|
break;
|
|
398
405
|
}
|
|
@@ -455,7 +462,7 @@ namespace RTC
|
|
|
455
462
|
{
|
|
456
463
|
err = uv_udp_bind(
|
|
457
464
|
reinterpret_cast<uv_udp_t*>(uvHandle),
|
|
458
|
-
reinterpret_cast<const struct sockaddr*>(
|
|
465
|
+
reinterpret_cast<const struct sockaddr*>(std::addressof(bindAddr)),
|
|
459
466
|
bitFlags);
|
|
460
467
|
|
|
461
468
|
if (err != 0)
|
|
@@ -477,7 +484,7 @@ namespace RTC
|
|
|
477
484
|
{
|
|
478
485
|
err = uv_tcp_bind(
|
|
479
486
|
reinterpret_cast<uv_tcp_t*>(uvHandle),
|
|
480
|
-
reinterpret_cast<const struct sockaddr*>(
|
|
487
|
+
reinterpret_cast<const struct sockaddr*>(std::addressof(bindAddr)),
|
|
481
488
|
bitFlags);
|
|
482
489
|
|
|
483
490
|
if (err != 0)
|
|
@@ -595,16 +602,19 @@ namespace RTC
|
|
|
595
602
|
return uvHandle;
|
|
596
603
|
}
|
|
597
604
|
|
|
598
|
-
void PortManager::Unbind(
|
|
605
|
+
void PortManager::Unbind(const PortRangeKey& key, uint16_t port)
|
|
599
606
|
{
|
|
600
607
|
MS_TRACE();
|
|
601
608
|
|
|
602
|
-
auto it = PortManager::mapPortRanges.find(
|
|
609
|
+
auto it = PortManager::mapPortRanges.find(key);
|
|
603
610
|
|
|
604
611
|
// This should not happen.
|
|
605
612
|
if (it == PortManager::mapPortRanges.end())
|
|
606
613
|
{
|
|
607
|
-
MS_ERROR(
|
|
614
|
+
MS_ERROR(
|
|
615
|
+
"port range key [minPort:%" PRIu16 ", maxPort:%" PRIu16 "] doesn't exist in the map",
|
|
616
|
+
key.minPort,
|
|
617
|
+
key.maxPort);
|
|
608
618
|
|
|
609
619
|
return;
|
|
610
620
|
}
|
|
@@ -633,13 +643,15 @@ namespace RTC
|
|
|
633
643
|
{
|
|
634
644
|
MS_DUMP_CLEAN(indentation, "<PortManager>");
|
|
635
645
|
|
|
636
|
-
for (auto& kv : PortManager::mapPortRanges)
|
|
646
|
+
for (const auto& kv : PortManager::mapPortRanges)
|
|
637
647
|
{
|
|
638
|
-
auto
|
|
639
|
-
auto portRange
|
|
648
|
+
const auto& key = kv.first;
|
|
649
|
+
const auto& portRange = kv.second;
|
|
650
|
+
const char* protocolStr = (key.protocol == Protocol::UDP) ? "udp" : "tcp";
|
|
640
651
|
|
|
641
652
|
MS_DUMP_CLEAN(indentation + 1, "<PortRange>");
|
|
642
|
-
MS_DUMP_CLEAN(indentation + 1, "
|
|
653
|
+
MS_DUMP_CLEAN(indentation + 1, " protocol: %s", protocolStr);
|
|
654
|
+
MS_DUMP_CLEAN(indentation + 1, " family: %d", key.bindAddr.ss_family);
|
|
643
655
|
MS_DUMP_CLEAN(indentation + 1, " minPort: %" PRIu16, portRange.minPort);
|
|
644
656
|
MS_DUMP_CLEAN(indentation + 1, " maxPort: %zu", portRange.minPort + portRange.ports.size() - 1);
|
|
645
657
|
MS_DUMP_CLEAN(indentation + 1, " numUsedPorts: %" PRIu16, portRange.numUsedPorts);
|
|
@@ -649,95 +661,14 @@ namespace RTC
|
|
|
649
661
|
MS_DUMP_CLEAN(indentation, "</PortManager>");
|
|
650
662
|
}
|
|
651
663
|
|
|
652
|
-
/*
|
|
653
|
-
* Hash for IPv4.
|
|
654
|
-
*
|
|
655
|
-
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
656
|
-
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
657
|
-
* | MIN PORT | MAX PORT |
|
|
658
|
-
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
659
|
-
* | IP | IP >> 2 |F|P|
|
|
660
|
-
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
661
|
-
*
|
|
662
|
-
* Hash for IPv6.
|
|
663
|
-
*
|
|
664
|
-
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
665
|
-
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
666
|
-
* | MIN PORT | MAX PORT |
|
|
667
|
-
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
668
|
-
* |IP[0] ^ IP[1] ^ IP[2] ^ IP[3] | same >> 2 |F|P|
|
|
669
|
-
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
670
|
-
*/
|
|
671
|
-
uint64_t PortManager::GeneratePortRangeHash(
|
|
672
|
-
Protocol protocol, sockaddr_storage* bindAddr, uint16_t minPort, uint16_t maxPort)
|
|
673
|
-
{
|
|
674
|
-
MS_TRACE();
|
|
675
|
-
|
|
676
|
-
uint64_t hash{ 0u };
|
|
677
|
-
|
|
678
|
-
switch (bindAddr->ss_family)
|
|
679
|
-
{
|
|
680
|
-
case AF_INET:
|
|
681
|
-
{
|
|
682
|
-
auto* bindAddrIn = reinterpret_cast<struct sockaddr_in*>(bindAddr);
|
|
683
|
-
|
|
684
|
-
// We want it in network order.
|
|
685
|
-
const uint64_t address = bindAddrIn->sin_addr.s_addr;
|
|
686
|
-
|
|
687
|
-
hash |= static_cast<uint64_t>(minPort) << 48;
|
|
688
|
-
hash |= static_cast<uint64_t>(maxPort) << 32;
|
|
689
|
-
hash |= (address >> 2) << 2;
|
|
690
|
-
hash |= 0x0000; // AF_INET.
|
|
691
|
-
|
|
692
|
-
break;
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
case AF_INET6:
|
|
696
|
-
{
|
|
697
|
-
auto* bindAddrIn6 = reinterpret_cast<struct sockaddr_in6*>(bindAddr);
|
|
698
|
-
auto* a = reinterpret_cast<uint32_t*>(std::addressof(bindAddrIn6->sin6_addr));
|
|
699
|
-
|
|
700
|
-
const auto address = a[0] ^ a[1] ^ a[2] ^ a[3];
|
|
701
|
-
|
|
702
|
-
hash |= static_cast<uint64_t>(minPort) << 48;
|
|
703
|
-
hash |= static_cast<uint64_t>(maxPort) << 32;
|
|
704
|
-
hash |= static_cast<uint64_t>(address) << 16;
|
|
705
|
-
hash |= (static_cast<uint64_t>(address) >> 2) << 2;
|
|
706
|
-
hash |= 0x0002; // AF_INET6.
|
|
707
|
-
|
|
708
|
-
break;
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
// This cannot happen.
|
|
712
|
-
default:
|
|
713
|
-
{
|
|
714
|
-
MS_THROW_ERROR("unknown IP family");
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
// Override least significant bit with protocol information:
|
|
719
|
-
// - If UDP, start with 0.
|
|
720
|
-
// - If TCP, start with 1.
|
|
721
|
-
if (protocol == Protocol::UDP)
|
|
722
|
-
{
|
|
723
|
-
hash |= 0x0000;
|
|
724
|
-
}
|
|
725
|
-
else
|
|
726
|
-
{
|
|
727
|
-
hash |= 0x0001;
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
return hash;
|
|
731
|
-
}
|
|
732
|
-
|
|
733
664
|
PortManager::PortRange& PortManager::GetOrCreatePortRange(
|
|
734
|
-
|
|
665
|
+
const PortRangeKey& key, uint16_t minPort, uint16_t maxPort)
|
|
735
666
|
{
|
|
736
667
|
MS_TRACE();
|
|
737
668
|
|
|
738
|
-
auto it = PortManager::mapPortRanges.find(
|
|
669
|
+
const auto it = PortManager::mapPortRanges.find(key);
|
|
739
670
|
|
|
740
|
-
// If the
|
|
671
|
+
// If the key is already handled, return its port range.
|
|
741
672
|
if (it != PortManager::mapPortRanges.end())
|
|
742
673
|
{
|
|
743
674
|
auto& portRange = it->second;
|
|
@@ -747,10 +678,10 @@ namespace RTC
|
|
|
747
678
|
|
|
748
679
|
const uint16_t numPorts = maxPort - minPort + 1;
|
|
749
680
|
|
|
750
|
-
// Emplace a new vector filled with numPorts false values, meaning that
|
|
681
|
+
// Emplace a new vector filled with `numPorts` false values, meaning that
|
|
751
682
|
// all ports are available.
|
|
752
|
-
auto pair = PortManager::mapPortRanges.emplace(
|
|
753
|
-
std::piecewise_construct, std::
|
|
683
|
+
const auto pair = PortManager::mapPortRanges.emplace(
|
|
684
|
+
std::piecewise_construct, std::forward_as_tuple(key), std::forward_as_tuple(numPorts, minPort));
|
|
754
685
|
|
|
755
686
|
// pair.first is an iterator to the inserted value.
|
|
756
687
|
auto& portRange = pair.first->second;
|
|
@@ -764,7 +695,7 @@ namespace RTC
|
|
|
764
695
|
|
|
765
696
|
uint8_t bitFlags{ 0b00000000 };
|
|
766
697
|
|
|
767
|
-
// Ignore ipv6Only in IPv4, otherwise libuv will throw.
|
|
698
|
+
// Ignore `ipv6Only` in IPv4, otherwise libuv will throw.
|
|
768
699
|
if (flags.ipv6Only && family == AF_INET6)
|
|
769
700
|
{
|
|
770
701
|
switch (protocol)
|
|
@@ -785,7 +716,7 @@ namespace RTC
|
|
|
785
716
|
}
|
|
786
717
|
}
|
|
787
718
|
|
|
788
|
-
// Ignore udpReusePort in TCP, otherwise libuv will throw.
|
|
719
|
+
// Ignore `udpReusePort` in TCP, otherwise libuv will throw.
|
|
789
720
|
if (flags.udpReusePort && protocol == Protocol::UDP)
|
|
790
721
|
{
|
|
791
722
|
bitFlags |= UV_UDP_REUSEADDR;
|
|
@@ -793,4 +724,133 @@ namespace RTC
|
|
|
793
724
|
|
|
794
725
|
return bitFlags;
|
|
795
726
|
}
|
|
727
|
+
|
|
728
|
+
/* PortRangeKey instance methods. */
|
|
729
|
+
|
|
730
|
+
PortManager::PortRangeKey::PortRangeKey(
|
|
731
|
+
Protocol protocol, const sockaddr_storage& bindAddr, uint16_t minPort, uint16_t maxPort)
|
|
732
|
+
: protocol(protocol), bindAddr(bindAddr), minPort(minPort), maxPort(maxPort)
|
|
733
|
+
{
|
|
734
|
+
MS_TRACE();
|
|
735
|
+
|
|
736
|
+
// `sockaddr_storage` is padded; the unused tail bytes are caller-controlled.
|
|
737
|
+
// `operator==` inspects only the meaningful address bytes (`sin_addr` /
|
|
738
|
+
// `sin6_addr`) so padding does not affect equality, and the hash function
|
|
739
|
+
// hashes the same exact fields, so two structurally-equal keys always
|
|
740
|
+
// produce the same hash regardless of how the caller zero-initialized.
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
bool PortManager::PortRangeKey::operator==(const PortRangeKey& other) const noexcept
|
|
744
|
+
{
|
|
745
|
+
MS_TRACE();
|
|
746
|
+
|
|
747
|
+
if (this->protocol != other.protocol)
|
|
748
|
+
{
|
|
749
|
+
return false;
|
|
750
|
+
}
|
|
751
|
+
else if (this->minPort != other.minPort)
|
|
752
|
+
{
|
|
753
|
+
return false;
|
|
754
|
+
}
|
|
755
|
+
else if (this->maxPort != other.maxPort)
|
|
756
|
+
{
|
|
757
|
+
return false;
|
|
758
|
+
}
|
|
759
|
+
else if (this->bindAddr.ss_family != other.bindAddr.ss_family)
|
|
760
|
+
{
|
|
761
|
+
return false;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
switch (this->bindAddr.ss_family)
|
|
765
|
+
{
|
|
766
|
+
case AF_INET:
|
|
767
|
+
{
|
|
768
|
+
const auto* a = reinterpret_cast<const sockaddr_in*>(std::addressof(this->bindAddr));
|
|
769
|
+
const auto* b = reinterpret_cast<const sockaddr_in*>(std::addressof(other.bindAddr));
|
|
770
|
+
|
|
771
|
+
return a->sin_addr.s_addr == b->sin_addr.s_addr;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
case AF_INET6:
|
|
775
|
+
{
|
|
776
|
+
const auto* a = reinterpret_cast<const sockaddr_in6*>(std::addressof(this->bindAddr));
|
|
777
|
+
const auto* b = reinterpret_cast<const sockaddr_in6*>(std::addressof(other.bindAddr));
|
|
778
|
+
|
|
779
|
+
return std::memcmp(
|
|
780
|
+
std::addressof(a->sin6_addr), std::addressof(b->sin6_addr), sizeof(in6_addr)) == 0;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
default:
|
|
784
|
+
{
|
|
785
|
+
// Unknown family; treat as not equal to avoid accidental merge.
|
|
786
|
+
return false;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/* PortRangeKeyHash instance methods. */
|
|
792
|
+
|
|
793
|
+
size_t PortManager::PortRangeKeyHash::operator()(const PortRangeKey& key) const noexcept
|
|
794
|
+
{
|
|
795
|
+
MS_TRACE();
|
|
796
|
+
|
|
797
|
+
const auto protocolBits = static_cast<uint8_t>(key.protocol);
|
|
798
|
+
const auto familyBits = static_cast<uint16_t>(key.bindAddr.ss_family);
|
|
799
|
+
|
|
800
|
+
auto hashCombine = [](size_t& seed, size_t value)
|
|
801
|
+
{
|
|
802
|
+
seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
|
803
|
+
};
|
|
804
|
+
|
|
805
|
+
size_t seed = 0;
|
|
806
|
+
|
|
807
|
+
switch (key.bindAddr.ss_family)
|
|
808
|
+
{
|
|
809
|
+
case AF_INET:
|
|
810
|
+
{
|
|
811
|
+
const auto* in = reinterpret_cast<const sockaddr_in*>(std::addressof(key.bindAddr));
|
|
812
|
+
|
|
813
|
+
hashCombine(seed, ankerl::unordered_dense::hash<uint8_t>{}(protocolBits));
|
|
814
|
+
hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(familyBits));
|
|
815
|
+
hashCombine(seed, ankerl::unordered_dense::hash<uint32_t>{}(in->sin_addr.s_addr));
|
|
816
|
+
hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.minPort));
|
|
817
|
+
hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.maxPort));
|
|
818
|
+
|
|
819
|
+
break;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
case AF_INET6:
|
|
823
|
+
{
|
|
824
|
+
const auto* in6 = reinterpret_cast<const sockaddr_in6*>(std::addressof(key.bindAddr));
|
|
825
|
+
const auto* addr = in6->sin6_addr.s6_addr;
|
|
826
|
+
|
|
827
|
+
uint64_t hi;
|
|
828
|
+
uint64_t lo;
|
|
829
|
+
|
|
830
|
+
std::memcpy(std::addressof(hi), addr, sizeof(uint64_t));
|
|
831
|
+
std::memcpy(std::addressof(lo), addr + sizeof(uint64_t), sizeof(uint64_t));
|
|
832
|
+
|
|
833
|
+
hashCombine(seed, ankerl::unordered_dense::hash<uint8_t>{}(protocolBits));
|
|
834
|
+
hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(familyBits));
|
|
835
|
+
hashCombine(seed, ankerl::unordered_dense::hash<uint64_t>{}(hi));
|
|
836
|
+
hashCombine(seed, ankerl::unordered_dense::hash<uint64_t>{}(lo));
|
|
837
|
+
hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.minPort));
|
|
838
|
+
hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.maxPort));
|
|
839
|
+
|
|
840
|
+
break;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
default:
|
|
844
|
+
{
|
|
845
|
+
hashCombine(seed, ankerl::unordered_dense::hash<uint8_t>{}(protocolBits));
|
|
846
|
+
hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(familyBits));
|
|
847
|
+
hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.minPort));
|
|
848
|
+
hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.maxPort));
|
|
849
|
+
|
|
850
|
+
break;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
return seed;
|
|
855
|
+
}
|
|
796
856
|
} // namespace RTC
|
|
@@ -99,7 +99,7 @@ namespace RTC
|
|
|
99
99
|
|
|
100
100
|
// clang-format off
|
|
101
101
|
template<>
|
|
102
|
-
const
|
|
102
|
+
const ankerl::unordered_dense::map<FeedbackPs::MessageType, std::string> FeedbackPacket<FeedbackPs>::MessageType2String =
|
|
103
103
|
{
|
|
104
104
|
{ FeedbackPs::MessageType::PLI, "PLI" },
|
|
105
105
|
{ FeedbackPs::MessageType::SLI, "SLI" },
|
|
@@ -122,7 +122,7 @@ namespace RTC
|
|
|
122
122
|
|
|
123
123
|
if (len < Packet::CommonHeaderSize + FeedbackPacket::HeaderSize)
|
|
124
124
|
{
|
|
125
|
-
MS_WARN_TAG(rtcp, "not enough space for
|
|
125
|
+
MS_WARN_TAG(rtcp, "not enough space for feedback packet, discarded");
|
|
126
126
|
|
|
127
127
|
return nullptr;
|
|
128
128
|
}
|
|
@@ -176,7 +176,7 @@ namespace RTC
|
|
|
176
176
|
|
|
177
177
|
default:
|
|
178
178
|
MS_WARN_TAG(
|
|
179
|
-
rtcp, "unknown RTCP PS
|
|
179
|
+
rtcp, "unknown RTCP PS feedback message type [packetType:%" PRIu8 "]", commonHeader->count);
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
return packet;
|
|
@@ -189,7 +189,7 @@ namespace RTC
|
|
|
189
189
|
|
|
190
190
|
// clang-format off
|
|
191
191
|
template<>
|
|
192
|
-
const
|
|
192
|
+
const ankerl::unordered_dense::map<FeedbackRtp::MessageType, std::string> FeedbackPacket<FeedbackRtp>::MessageType2String =
|
|
193
193
|
{
|
|
194
194
|
{ FeedbackRtp::MessageType::NACK, "NACK" },
|
|
195
195
|
{ FeedbackRtp::MessageType::TMMBR, "TMMBR" },
|
|
@@ -213,7 +213,7 @@ namespace RTC
|
|
|
213
213
|
|
|
214
214
|
if (len < Packet::CommonHeaderSize + FeedbackPacket::HeaderSize)
|
|
215
215
|
{
|
|
216
|
-
MS_WARN_TAG(rtcp, "not enough space for
|
|
216
|
+
MS_WARN_TAG(rtcp, "not enough space for feedback packet, discarded");
|
|
217
217
|
|
|
218
218
|
return nullptr;
|
|
219
219
|
}
|
|
@@ -262,7 +262,7 @@ namespace RTC
|
|
|
262
262
|
default:
|
|
263
263
|
MS_WARN_TAG(
|
|
264
264
|
rtcp,
|
|
265
|
-
"unknown RTCP RTP
|
|
265
|
+
"unknown RTCP RTP feedback message type [packetType:%" PRIu8 "]",
|
|
266
266
|
commonHeader->count);
|
|
267
267
|
}
|
|
268
268
|
|
|
@@ -24,7 +24,7 @@ namespace RTC
|
|
|
24
24
|
|
|
25
25
|
if (len < Packet::CommonHeaderSize + FeedbackPacket::HeaderSize)
|
|
26
26
|
{
|
|
27
|
-
MS_WARN_TAG(rtcp, "not enough space for
|
|
27
|
+
MS_WARN_TAG(rtcp, "not enough space for feedback packet, discarded");
|
|
28
28
|
|
|
29
29
|
return nullptr;
|
|
30
30
|
}
|
|
@@ -19,7 +19,7 @@ namespace RTC
|
|
|
19
19
|
|
|
20
20
|
if (len < Packet::CommonHeaderSize + FeedbackPacket::HeaderSize)
|
|
21
21
|
{
|
|
22
|
-
MS_WARN_TAG(rtcp, "not enough space for
|
|
22
|
+
MS_WARN_TAG(rtcp, "not enough space for feedback packet, discarded");
|
|
23
23
|
|
|
24
24
|
return nullptr;
|
|
25
25
|
}
|
|
@@ -16,7 +16,7 @@ namespace RTC
|
|
|
16
16
|
|
|
17
17
|
if (len < Packet::CommonHeaderSize + FeedbackPacket::HeaderSize)
|
|
18
18
|
{
|
|
19
|
-
MS_WARN_TAG(rtcp, "not enough space for
|
|
19
|
+
MS_WARN_TAG(rtcp, "not enough space for feedback packet, discarded");
|
|
20
20
|
|
|
21
21
|
return nullptr;
|
|
22
22
|
}
|
|
@@ -18,10 +18,10 @@ namespace RTC
|
|
|
18
18
|
|
|
19
19
|
// Check that there is space for the REMB unique identifier and basic fields.
|
|
20
20
|
// NOTE: Feedback.cpp already checked that there is space for CommonHeader and
|
|
21
|
-
//
|
|
21
|
+
// feedback header.
|
|
22
22
|
if (len < Packet::CommonHeaderSize + FeedbackPacket::HeaderSize + 8u)
|
|
23
23
|
{
|
|
24
|
-
MS_WARN_TAG(rtcp, "not enough space for
|
|
24
|
+
MS_WARN_TAG(rtcp, "not enough space for feedback packet, discarded");
|
|
25
25
|
|
|
26
26
|
return nullptr;
|
|
27
27
|
}
|
|
@@ -21,7 +21,7 @@ namespace RTC
|
|
|
21
21
|
|
|
22
22
|
if (len < Packet::CommonHeaderSize + FeedbackPacket::HeaderSize)
|
|
23
23
|
{
|
|
24
|
-
MS_WARN_TAG(rtcp, "not enough space for
|
|
24
|
+
MS_WARN_TAG(rtcp, "not enough space for feedback packet, discarded");
|
|
25
25
|
|
|
26
26
|
return nullptr;
|
|
27
27
|
}
|
|
@@ -16,7 +16,7 @@ namespace RTC
|
|
|
16
16
|
|
|
17
17
|
if (len < Packet::CommonHeaderSize + FeedbackPacket::HeaderSize)
|
|
18
18
|
{
|
|
19
|
-
MS_WARN_TAG(rtcp, "not enough space for
|
|
19
|
+
MS_WARN_TAG(rtcp, "not enough space for feedback packet, discarded");
|
|
20
20
|
|
|
21
21
|
return nullptr;
|
|
22
22
|
}
|
|
@@ -19,7 +19,7 @@ namespace RTC
|
|
|
19
19
|
int16_t FeedbackRtpTransportPacket::maxPacketDelta{ 0x7FFF };
|
|
20
20
|
|
|
21
21
|
// clang-format off
|
|
22
|
-
const
|
|
22
|
+
const ankerl::unordered_dense::map<FeedbackRtpTransportPacket::Status, std::string> FeedbackRtpTransportPacket::Status2String =
|
|
23
23
|
{
|
|
24
24
|
{ FeedbackRtpTransportPacket::Status::NotReceived, "NR" },
|
|
25
25
|
{ FeedbackRtpTransportPacket::Status::SmallDelta, "SD" },
|
|
@@ -35,7 +35,7 @@ namespace RTC
|
|
|
35
35
|
|
|
36
36
|
if (len < Packet::CommonHeaderSize + FeedbackPacket::HeaderSize + FeedbackRtpTransportPacket::fixedHeaderSize)
|
|
37
37
|
{
|
|
38
|
-
MS_WARN_TAG(rtcp, "not enough space for
|
|
38
|
+
MS_WARN_TAG(rtcp, "not enough space for feedback packet, discarded");
|
|
39
39
|
|
|
40
40
|
return nullptr;
|
|
41
41
|
}
|
|
@@ -21,7 +21,7 @@ namespace RTC
|
|
|
21
21
|
/* Class variables. */
|
|
22
22
|
|
|
23
23
|
// clang-format off
|
|
24
|
-
const
|
|
24
|
+
const ankerl::unordered_dense::map<Type, std::string> Packet::Type2String =
|
|
25
25
|
{
|
|
26
26
|
{ Type::SR, "SR" },
|
|
27
27
|
{ Type::RR, "RR" },
|
|
@@ -167,7 +167,7 @@ namespace RTC
|
|
|
167
167
|
" " + FeedbackRtpPacket::MessageTypeToString(FeedbackRtp::MessageType(header->count));
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
MS_WARN_TAG(rtcp, "error parsing %s
|
|
170
|
+
MS_WARN_TAG(rtcp, "error parsing %s packet", packetType.c_str());
|
|
171
171
|
|
|
172
172
|
return first;
|
|
173
173
|
}
|
|
@@ -13,7 +13,7 @@ namespace RTC
|
|
|
13
13
|
/* Item Class variables. */
|
|
14
14
|
|
|
15
15
|
// clang-format off
|
|
16
|
-
const
|
|
16
|
+
const ankerl::unordered_dense::map<SdesItem::Type, std::string> SdesItem::Type2String =
|
|
17
17
|
{
|
|
18
18
|
{ SdesItem::Type::END, "END" },
|
|
19
19
|
{ SdesItem::Type::CNAME, "CNAME" },
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "RTC/RTP/Codecs/DependencyDescriptor.hpp"
|
|
5
5
|
#include "Logger.hpp"
|
|
6
|
+
#include <bitset>
|
|
6
7
|
#include <string>
|
|
7
8
|
#include <vector>
|
|
8
9
|
|
|
@@ -15,7 +16,7 @@ namespace RTC
|
|
|
15
16
|
/* Static members. */
|
|
16
17
|
|
|
17
18
|
// clang-format off
|
|
18
|
-
|
|
19
|
+
ankerl::unordered_dense::map<DependencyDescriptor::DecodeTargetIndication, std::string> DependencyDescriptor::dtiToString =
|
|
19
20
|
{
|
|
20
21
|
{ DependencyDescriptor::DecodeTargetIndication::NOT_PRESENT, "-" },
|
|
21
22
|
{ DependencyDescriptor::DecodeTargetIndication::DISCARDABLE, "D" },
|