mediasoup 3.20.5 → 3.20.7
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/Worker.d.ts +1 -1
- package/node/lib/Worker.d.ts.map +1 -1
- package/node/lib/Worker.js +1 -11
- package/node/lib/WorkerTypes.d.ts +0 -9
- package/node/lib/WorkerTypes.d.ts.map +1 -1
- package/node/lib/fbs/plain-transport/connect-response.d.ts.map +1 -1
- package/node/lib/fbs/plain-transport/connect-response.js +0 -1
- package/node/lib/fbs/worker/dump-response.d.ts +1 -5
- package/node/lib/fbs/worker/dump-response.d.ts.map +1 -1
- package/node/lib/fbs/worker/dump-response.js +3 -16
- package/node/lib/index.d.ts +1 -1
- package/node/lib/index.d.ts.map +1 -1
- package/node/lib/index.js +1 -2
- package/node/lib/test/test-PlainTransport.js +30 -0
- package/node/lib/test/test-Worker.js +0 -1
- package/npm-scripts.mjs +13 -8
- package/package.json +8 -8
- package/worker/fbs/meson.build +0 -1
- package/worker/fbs/plainTransport.fbs +1 -1
- package/worker/fbs/worker.fbs +0 -2
- package/worker/include/RTC/Consumer.hpp +80 -45
- package/worker/include/RTC/ICE/StunPacket.hpp +8 -9
- package/worker/include/RTC/PipeProducerStreamManager.hpp +78 -0
- package/worker/include/RTC/ProducerStreamManager.hpp +181 -0
- package/worker/include/RTC/RTP/Packet.hpp +1 -1
- package/worker/include/RTC/RTP/ProbationGenerator.hpp +1 -1
- package/worker/include/RTC/SCTP/association/Association.hpp +24 -0
- package/worker/include/RTC/SCTP/association/StateCookie.hpp +104 -11
- package/worker/include/RTC/SCTP/packet/Chunk.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/ErrorCause.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/Packet.hpp +1 -2
- package/worker/include/RTC/SCTP/packet/Parameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/TLV.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/chunks/DataChunk.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/chunks/ForwardTsnChunk.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/chunks/IDataChunk.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/chunks/IForwardTsnChunk.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/chunks/InitAckChunk.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/chunks/InitChunk.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/chunks/SackChunk.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/chunks/ShutdownChunk.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/errorCauses/InvalidStreamIdentifierErrorCause.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/errorCauses/MissingMandatoryParameterErrorCause.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/errorCauses/NoUserDataErrorCause.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/errorCauses/StaleCookieErrorCause.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/AddIncomingStreamsRequestParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/AddOutgoingStreamsRequestParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/CookiePreservativeParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/IPv4AddressParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/IPv6AddressParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/IncomingSsnResetRequestParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/OutgoingSsnResetRequestParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/ReconfigurationResponseParameter.hpp +2 -2
- package/worker/include/RTC/SCTP/packet/parameters/SsnTsnResetRequestParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/parameters/StateCookieParameter.hpp +4 -1
- package/worker/include/RTC/SCTP/packet/parameters/ZeroChecksumAcceptableParameter.hpp +1 -1
- package/worker/include/RTC/SCTP/public/SctpOptions.hpp +13 -0
- package/worker/include/RTC/SimpleProducerStreamManager.hpp +72 -0
- package/worker/include/RTC/SimulcastProducerStreamManager.hpp +93 -0
- package/worker/include/RTC/SvcProducerStreamManager.hpp +72 -0
- package/worker/include/RTC/Transport.hpp +7 -1
- package/worker/include/Settings.hpp +0 -1
- package/worker/include/handles/TcpConnectionHandle.hpp +0 -4
- package/worker/include/handles/UdpSocketHandle.hpp +0 -4
- package/worker/meson.build +9 -39
- package/worker/meson_options.txt +0 -1
- package/worker/src/RTC/Consumer.cpp +1404 -30
- package/worker/src/RTC/DirectTransport.cpp +4 -1
- package/worker/src/RTC/PipeProducerStreamManager.cpp +266 -0
- package/worker/src/RTC/PipeTransport.cpp +9 -6
- package/worker/src/RTC/PlainTransport.cpp +9 -6
- package/worker/src/RTC/RTP/Packet.cpp +0 -2
- package/worker/src/RTC/RTP/RtpStreamSend.cpp +0 -20
- package/worker/src/RTC/Router.cpp +0 -37
- package/worker/src/RTC/SCTP/association/Association.cpp +150 -8
- package/worker/src/RTC/SCTP/association/StateCookie.cpp +96 -31
- package/worker/src/RTC/SCTP/packet/Packet.cpp +1 -1
- package/worker/src/RTC/SCTP/packet/parameters/StateCookieParameter.cpp +12 -3
- package/worker/src/RTC/SCTP/public/SctpOptions.cpp +4 -0
- package/worker/src/RTC/SimpleProducerStreamManager.cpp +343 -0
- package/worker/src/RTC/SimulcastProducerStreamManager.cpp +1068 -0
- package/worker/src/RTC/SrtpSession.cpp +0 -24
- package/worker/src/RTC/SvcProducerStreamManager.cpp +664 -0
- package/worker/src/RTC/Transport.cpp +10 -66
- package/worker/src/RTC/WebRtcTransport.cpp +13 -7
- package/worker/src/Settings.cpp +0 -14
- package/worker/src/Utils/Crypto.cpp +3 -3
- package/worker/src/Utils/String.cpp +1 -1
- package/worker/src/Worker.cpp +5 -38
- package/worker/src/handles/TcpConnectionHandle.cpp +1 -42
- package/worker/src/handles/UdpSocketHandle.cpp +1 -42
- package/worker/src/lib.cpp +1 -10
- package/worker/test/include/RTC/SCTP/sctpCommon.hpp +1 -1
- package/worker/test/src/RTC/SCTP/association/TestAssociation.cpp +115 -0
- package/worker/test/src/RTC/SCTP/association/TestStateCookie.cpp +123 -0
- package/worker/test/src/RTC/SCTP/packet/TestPacket.cpp +4 -4
- package/worker/test/src/RTC/{TestSimpleConsumer.cpp → TestConsumer.cpp} +6 -7
- package/worker/test/src/RTC/TestPipeProducerStreamManager.cpp +471 -0
- package/worker/test/src/RTC/TestSimpleProducerStreamManager.cpp +531 -0
- package/worker/test/src/RTC/TestSimulcastProducerStreamManager.cpp +1040 -0
- package/worker/test/src/RTC/TestSvcProducerStreamManager.cpp +1278 -0
- package/worker/fbs/liburing.fbs +0 -7
- package/worker/include/DepLibUring.hpp +0 -143
- package/worker/include/RTC/PipeConsumer.hpp +0 -95
- package/worker/include/RTC/SimpleConsumer.hpp +0 -102
- package/worker/include/RTC/SimulcastConsumer.hpp +0 -141
- package/worker/include/RTC/SvcConsumer.hpp +0 -118
- package/worker/src/DepLibUring.cpp +0 -638
- package/worker/src/RTC/PipeConsumer.cpp +0 -874
- package/worker/src/RTC/SimpleConsumer.cpp +0 -882
- package/worker/src/RTC/SimulcastConsumer.cpp +0 -1887
- package/worker/src/RTC/SvcConsumer.cpp +0 -1384
- package/worker/subprojects/liburing.wrap +0 -14
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#ifndef MS_RTC_SVC_CONSUMER_STREAM_HPP
|
|
2
|
+
#define MS_RTC_SVC_CONSUMER_STREAM_HPP
|
|
3
|
+
|
|
4
|
+
#include "RTC/ProducerStreamManager.hpp"
|
|
5
|
+
|
|
6
|
+
namespace RTC
|
|
7
|
+
{
|
|
8
|
+
class SvcProducerStreamManager : public ProducerStreamManager
|
|
9
|
+
{
|
|
10
|
+
public:
|
|
11
|
+
SvcProducerStreamManager(
|
|
12
|
+
const std::vector<RTC::RtpEncodingParameters>& consumableRtpEncodings,
|
|
13
|
+
const RTC::ConsumerTypes::VideoLayers& preferredLayers,
|
|
14
|
+
std::unique_ptr<RTC::RTP::Codecs::EncodingContext> encodingContext,
|
|
15
|
+
RTC::Media::Kind kind,
|
|
16
|
+
bool keyFrameSupported,
|
|
17
|
+
Listener* listener,
|
|
18
|
+
SharedInterface* shared);
|
|
19
|
+
|
|
20
|
+
public:
|
|
21
|
+
RTC::ConsumerTypes::VideoLayers GetTargetLayers() const override
|
|
22
|
+
{
|
|
23
|
+
return this->encodingContext->GetTargetLayers();
|
|
24
|
+
}
|
|
25
|
+
int16_t GetCurrentSpatialLayer() const override
|
|
26
|
+
{
|
|
27
|
+
return this->encodingContext->GetCurrentSpatialLayer();
|
|
28
|
+
}
|
|
29
|
+
int16_t GetCurrentTemporalLayer() const override
|
|
30
|
+
{
|
|
31
|
+
return this->encodingContext->GetCurrentTemporalLayer();
|
|
32
|
+
}
|
|
33
|
+
RTC::RTP::RtpStreamRecv* GetProducerCurrentRtpStream() const override;
|
|
34
|
+
RTC::RTP::RtpStreamRecv* GetProducerTargetRtpStream() const override;
|
|
35
|
+
bool IsPacketForCurrentStream(const RTC::RTP::Packet* /*packet*/) const override
|
|
36
|
+
{
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
bool IsActive() const override;
|
|
40
|
+
void ProducerRtpStream(RTC::RTP::RtpStreamRecv* rtpStream, uint32_t mappedSsrc) override;
|
|
41
|
+
void ProducerNewRtpStream(RTC::RTP::RtpStreamRecv* rtpStream, uint32_t mappedSsrc) override;
|
|
42
|
+
void ProducerRtpStreamScore(
|
|
43
|
+
RTC::RTP::RtpStreamRecv* rtpStream, uint8_t score, uint8_t previousScore) override;
|
|
44
|
+
void ProducerRtcpSenderReport(RTC::RTP::RtpStreamRecv* rtpStream, bool first) override;
|
|
45
|
+
uint32_t IncreaseLayer(
|
|
46
|
+
uint32_t bitrate, bool considerLoss, float lossPercentage, uint64_t nowMs) override;
|
|
47
|
+
void ApplyLayers(uint64_t rtpStreamActiveMs) override;
|
|
48
|
+
uint32_t GetDesiredBitrate(uint64_t nowMs) const override;
|
|
49
|
+
RtpPacketProcessResult ProcessRtpPacket(
|
|
50
|
+
RTC::RTP::Packet* packet,
|
|
51
|
+
bool lastSentPacketHasMarker,
|
|
52
|
+
uint32_t clockRate,
|
|
53
|
+
uint32_t maxPacketTs) override;
|
|
54
|
+
void RequestKeyFrame() override;
|
|
55
|
+
void RequestKeyFrameForTargetSpatialLayer() override;
|
|
56
|
+
void RequestKeyFrameForCurrentSpatialLayer() override;
|
|
57
|
+
void UpdateTargetLayers(int16_t newTargetSpatialLayer, int16_t newTargetTemporalLayer) override;
|
|
58
|
+
bool RecalculateTargetLayers(RTC::ConsumerTypes::VideoLayers& newTargetLayers) const override;
|
|
59
|
+
void OnTransportConnected() override;
|
|
60
|
+
void OnTransportDisconnected() override;
|
|
61
|
+
void OnPaused() override;
|
|
62
|
+
void OnResumed() override;
|
|
63
|
+
|
|
64
|
+
private:
|
|
65
|
+
// Producer RTP stream (single stream for SVC).
|
|
66
|
+
RTC::RTP::RtpStreamRecv* producerRtpStream{ nullptr };
|
|
67
|
+
// BWE downgrade tracking.
|
|
68
|
+
uint64_t lastBweDowngradeAtMs{ 0u };
|
|
69
|
+
};
|
|
70
|
+
} // namespace RTC
|
|
71
|
+
|
|
72
|
+
#endif
|
|
@@ -154,7 +154,13 @@ namespace RTC
|
|
|
154
154
|
SharedInterface* shared,
|
|
155
155
|
const std::string& id,
|
|
156
156
|
RTC::Transport::Listener* listener,
|
|
157
|
-
const FBS::Transport::Options* options
|
|
157
|
+
const FBS::Transport::Options* options,
|
|
158
|
+
/**
|
|
159
|
+
* Whether the SCTP association (if enabled) must authenticate received
|
|
160
|
+
* State Cookies. This must be `true` for transports whose SCTP traffic
|
|
161
|
+
* is not protected by DTLS (PlainTransport and PipeTransport).
|
|
162
|
+
*/
|
|
163
|
+
bool requireSctpStateCookieAuthentication);
|
|
158
164
|
~Transport() override;
|
|
159
165
|
|
|
160
166
|
public:
|
|
@@ -143,10 +143,6 @@ private:
|
|
|
143
143
|
uv_tcp_t* uvHandle{ nullptr };
|
|
144
144
|
// Others.
|
|
145
145
|
struct sockaddr_storage* localAddr{ nullptr };
|
|
146
|
-
#ifdef MS_LIBURING_SUPPORTED
|
|
147
|
-
// Local file descriptor for io_uring.
|
|
148
|
-
uv_os_fd_t fd{ 0u };
|
|
149
|
-
#endif
|
|
150
146
|
bool closed{ false };
|
|
151
147
|
size_t recvBytes{ 0u };
|
|
152
148
|
size_t sentBytes{ 0u };
|
|
@@ -102,10 +102,6 @@ private:
|
|
|
102
102
|
// Allocated by this (may be passed by argument).
|
|
103
103
|
uv_udp_t* uvHandle{ nullptr };
|
|
104
104
|
// Others.
|
|
105
|
-
#ifdef MS_LIBURING_SUPPORTED
|
|
106
|
-
// Local file descriptor for io_uring.
|
|
107
|
-
uv_os_fd_t fd{ 0u };
|
|
108
|
-
#endif
|
|
109
105
|
bool closed{ false };
|
|
110
106
|
size_t recvBytes{ 0u };
|
|
111
107
|
size_t sentBytes{ 0u };
|
package/worker/meson.build
CHANGED
|
@@ -119,7 +119,6 @@ common_sources = [
|
|
|
119
119
|
'src/RTC/DtlsTransport.cpp',
|
|
120
120
|
'src/RTC/KeyFrameRequestManager.cpp',
|
|
121
121
|
'src/RTC/NackGenerator.cpp',
|
|
122
|
-
'src/RTC/PipeConsumer.cpp',
|
|
123
122
|
'src/RTC/PipeTransport.cpp',
|
|
124
123
|
'src/RTC/PlainTransport.cpp',
|
|
125
124
|
'src/RTC/PortManager.cpp',
|
|
@@ -133,10 +132,11 @@ common_sources = [
|
|
|
133
132
|
'src/RTC/SenderBandwidthEstimator.cpp',
|
|
134
133
|
'src/RTC/SeqManager.cpp',
|
|
135
134
|
'src/RTC/Serializable.cpp',
|
|
136
|
-
'src/RTC/
|
|
137
|
-
'src/RTC/
|
|
135
|
+
'src/RTC/PipeProducerStreamManager.cpp',
|
|
136
|
+
'src/RTC/SimpleProducerStreamManager.cpp',
|
|
137
|
+
'src/RTC/SimulcastProducerStreamManager.cpp',
|
|
138
138
|
'src/RTC/SrtpSession.cpp',
|
|
139
|
-
'src/RTC/
|
|
139
|
+
'src/RTC/SvcProducerStreamManager.cpp',
|
|
140
140
|
'src/RTC/TcpConnection.cpp',
|
|
141
141
|
'src/RTC/TcpServer.cpp',
|
|
142
142
|
'src/RTC/Transport.cpp',
|
|
@@ -368,40 +368,6 @@ if host_machine.system() == 'windows'
|
|
|
368
368
|
]
|
|
369
369
|
endif
|
|
370
370
|
|
|
371
|
-
if host_machine.system() == 'linux' and not get_option('ms_disable_liburing')
|
|
372
|
-
kernel_version = run_command('uname', '-r', check: true).stdout().strip()
|
|
373
|
-
|
|
374
|
-
# Enable liburing for kernel versions greather than or equal to 6.
|
|
375
|
-
if kernel_version[0].to_int() >= 6
|
|
376
|
-
liburing_proj = subproject(
|
|
377
|
-
'liburing',
|
|
378
|
-
default_options: [
|
|
379
|
-
'default_library=static',
|
|
380
|
-
# NOTE: We need to add this to disable ASAN in liburing, otherwise when
|
|
381
|
-
# building `mediasoup-test-asan-undefined` binary, liburing receives
|
|
382
|
-
# `use_ubsan: true` and tries to compile its `sanitize.c` file
|
|
383
|
-
# that contains references to `__asan_*` functions, but we don't enable
|
|
384
|
-
# ASAN (`-fsanitize=address) in that binaries so liburing fails to
|
|
385
|
-
# compile.
|
|
386
|
-
'b_sanitize=none',
|
|
387
|
-
],
|
|
388
|
-
)
|
|
389
|
-
|
|
390
|
-
dependencies += [
|
|
391
|
-
liburing_proj.get_variable('uring'),
|
|
392
|
-
]
|
|
393
|
-
link_whole += [
|
|
394
|
-
liburing_proj.get_variable('liburing')
|
|
395
|
-
]
|
|
396
|
-
common_sources += [
|
|
397
|
-
'src/DepLibUring.cpp',
|
|
398
|
-
]
|
|
399
|
-
cpp_args += [
|
|
400
|
-
'-DMS_LIBURING_SUPPORTED',
|
|
401
|
-
]
|
|
402
|
-
endif
|
|
403
|
-
endif
|
|
404
|
-
|
|
405
371
|
if get_option('ms_build_tests')
|
|
406
372
|
catch2_proj = subproject(
|
|
407
373
|
'catch2',
|
|
@@ -449,13 +415,17 @@ mock_sources = [
|
|
|
449
415
|
test_sources = [
|
|
450
416
|
'test/src/tests.cpp',
|
|
451
417
|
'test/src/testHelpers.cpp',
|
|
418
|
+
'test/src/RTC/TestConsumer.cpp',
|
|
419
|
+
'test/src/RTC/TestPipeProducerStreamManager.cpp',
|
|
420
|
+
'test/src/RTC/TestSimpleProducerStreamManager.cpp',
|
|
421
|
+
'test/src/RTC/TestSimulcastProducerStreamManager.cpp',
|
|
422
|
+
'test/src/RTC/TestSvcProducerStreamManager.cpp',
|
|
452
423
|
'test/src/RTC/TestKeyFrameRequestManager.cpp',
|
|
453
424
|
'test/src/RTC/TestNackGenerator.cpp',
|
|
454
425
|
'test/src/RTC/TestPortManager.cpp',
|
|
455
426
|
'test/src/RTC/TestRateCalculator.cpp',
|
|
456
427
|
'test/src/RTC/TestRtpEncodingParameters.cpp',
|
|
457
428
|
'test/src/RTC/TestSeqManager.cpp',
|
|
458
|
-
'test/src/RTC/TestSimpleConsumer.cpp',
|
|
459
429
|
'test/src/RTC/TestTransportCongestionControlServer.cpp',
|
|
460
430
|
'test/src/RTC/TestTransportTuple.cpp',
|
|
461
431
|
'test/src/RTC/TestTrendCalculator.cpp',
|
package/worker/meson_options.txt
CHANGED
|
@@ -3,6 +3,5 @@ option('ms_log_file_line', type: 'boolean', value: false, description: 'Logging
|
|
|
3
3
|
option('ms_rtc_logger_rtp', type: 'boolean', value: false, description: 'Prints a line with information for each processed RTP packet')
|
|
4
4
|
option('ms_dump_rtp_payload_descriptor', type: 'boolean', value: false, description: 'RTC::RTP::Packet::Dump() method also dumps payload descriptor details')
|
|
5
5
|
option('ms_dump_rtp_shared_packet_memory_usage', type: 'boolean', value: false, description: 'prints information about total memory allocated by RTC::RTP::SharedPacket instances')
|
|
6
|
-
option('ms_disable_liburing', type: 'boolean', value: false, description: 'When set to true, disables liburing integration despite current host supports it')
|
|
7
6
|
option('ms_build_tests', type: 'boolean', value: false, description: 'Must be enabled when building mediasoup worker tests')
|
|
8
7
|
option('ms_build_fuzzer', type: 'boolean', value: false, description: 'Must be enabled when building mediasoup worker fuzzer')
|