mediasoup 3.28.0 → 3.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/node/lib/PipeTransportTypes.d.ts +6 -1
- package/node/lib/PipeTransportTypes.d.ts.map +1 -1
- package/node/lib/PlainTransportTypes.d.ts +6 -1
- package/node/lib/PlainTransportTypes.d.ts.map +1 -1
- package/node/lib/Router.d.ts +4 -4
- package/node/lib/Router.d.ts.map +1 -1
- package/node/lib/Router.js +10 -7
- package/node/lib/RouterTypes.d.ts +7 -1
- package/node/lib/RouterTypes.d.ts.map +1 -1
- package/node/lib/Transport.d.ts +2 -1
- package/node/lib/Transport.d.ts.map +1 -1
- package/node/lib/Transport.js +17 -6
- package/node/lib/TransportTypes.d.ts +12 -2
- package/node/lib/TransportTypes.d.ts.map +1 -1
- package/node/lib/WebRtcTransportTypes.d.ts +6 -1
- package/node/lib/WebRtcTransportTypes.d.ts.map +1 -1
- package/node/lib/fbs/transport/options.d.ts +6 -2
- package/node/lib/fbs/transport/options.d.ts.map +1 -1
- package/node/lib/fbs/transport/options.js +19 -7
- package/node/lib/fbs/transport/sctp-zero-checksum.d.ts +6 -0
- package/node/lib/fbs/transport/sctp-zero-checksum.d.ts.map +1 -0
- package/node/lib/fbs/transport/sctp-zero-checksum.js +11 -0
- package/node/lib/fbs/transport/stats.d.ts +2 -8
- package/node/lib/fbs/transport/stats.d.ts.map +1 -1
- package/node/lib/fbs/transport/stats.js +5 -29
- package/node/lib/fbs/transport.d.ts +1 -0
- package/node/lib/fbs/transport.d.ts.map +1 -1
- package/node/lib/fbs/transport.js +4 -2
- package/npm-scripts.mjs +35 -44
- package/package.json +10 -6
- package/worker/fbs/transport.fbs +9 -2
- package/worker/fuzzer/src/RTC/RTP/FuzzerRetransmissionBuffer.cpp +14 -1
- package/worker/fuzzer/src/RTC/RTP/FuzzerRtpStreamSend.cpp +17 -4
- package/worker/include/RTC/BWE/AimdRateControl.hpp +9 -9
- package/worker/include/RTC/BWE/BweTypes.hpp +54 -17
- package/worker/include/RTC/BWE/DelayBasedBwe.hpp +3 -3
- package/worker/include/RTC/BWE/FeedbackAdapter.hpp +2 -2
- package/worker/include/RTC/BWE/LossBasedController.hpp +4 -4
- package/worker/include/RTC/BWE/OveruseDetector.hpp +5 -4
- package/worker/include/RTC/BWE/ProbeBitrateEstimator.hpp +1 -1
- package/worker/include/RTC/BWE/ProbeController.hpp +6 -6
- package/worker/include/RTC/BWE/ProbePacketGenerator.hpp +2 -6
- package/worker/include/RTC/BWE/ProbingScheduler.hpp +3 -7
- package/worker/include/RTC/BWE/ReceiverTransportCongestionController.hpp +148 -0
- package/worker/include/RTC/BWE/RembGenerator.hpp +4 -3
- package/worker/include/RTC/BWE/RemoteBitrateEstimatorAbsSendTime.hpp +1 -1
- package/worker/include/RTC/BWE/SenderTransportCongestionController.hpp +343 -0
- package/worker/include/RTC/BWE/TargetRateController.hpp +4 -1
- package/worker/include/RTC/BWE/TransportWideCcFeedbackGenerator.hpp +5 -4
- package/worker/include/RTC/BWE/TrendlineEstimator.hpp +3 -3
- package/worker/include/RTC/Consumer.hpp +8 -1
- package/worker/include/RTC/RTP/RetransmissionBuffer.hpp +36 -10
- package/worker/include/RTC/RTP/RtpStream.hpp +21 -0
- package/worker/include/RTC/RTP/RtpStreamRecv.hpp +1 -0
- package/worker/include/RTC/RTP/RtpStreamSend.hpp +122 -9
- package/worker/include/RTC/SCTP/packet/parameters/ZeroChecksumAcceptableParameter.hpp +12 -3
- package/worker/include/RTC/TransportCongestionControlClient.hpp +0 -5
- package/worker/include/RTC/TransportCongestionControlServer.hpp +0 -5
- package/worker/include/Utils.hpp +9 -2
- package/worker/meson.build +4 -0
- package/worker/src/RTC/BWE/AimdRateControl.cpp +22 -22
- package/worker/src/RTC/BWE/DelayBasedBwe.cpp +16 -20
- package/worker/src/RTC/BWE/FeedbackAdapter.cpp +1 -1
- package/worker/src/RTC/BWE/OveruseDetector.cpp +8 -8
- package/worker/src/RTC/BWE/ProbeBitrateEstimator.cpp +2 -2
- package/worker/src/RTC/BWE/ProbeController.cpp +1 -1
- package/worker/src/RTC/BWE/ProbePacketGenerator.cpp +1 -6
- package/worker/src/RTC/BWE/ProbingScheduler.cpp +2 -7
- package/worker/src/RTC/BWE/ReceiverTransportCongestionController.cpp +207 -0
- package/worker/src/RTC/BWE/RembGenerator.cpp +1 -1
- package/worker/src/RTC/BWE/RemoteBitrateEstimatorAbsSendTime.cpp +1 -1
- package/worker/src/RTC/BWE/SenderTransportCongestionController.cpp +599 -0
- package/worker/src/RTC/BWE/TransportWideCcFeedbackGenerator.cpp +2 -3
- package/worker/src/RTC/BWE/TrendlineEstimator.cpp +5 -5
- package/worker/src/RTC/Consumer.cpp +3 -2
- package/worker/src/RTC/DataConsumer.cpp +2 -2
- package/worker/src/RTC/RTP/RetransmissionBuffer.cpp +21 -8
- package/worker/src/RTC/RTP/RtpStream.cpp +0 -3
- package/worker/src/RTC/RTP/RtpStreamRecv.cpp +57 -71
- package/worker/src/RTC/RTP/RtpStreamSend.cpp +428 -244
- package/worker/src/RTC/RTP/RtxStream.cpp +14 -19
- package/worker/src/RTC/SCTP/association/Association.cpp +3 -2
- package/worker/src/RTC/SCTP/association/StateCookie.cpp +26 -6
- package/worker/src/RTC/SCTP/packet/parameters/ZeroChecksumAcceptableParameter.cpp +4 -3
- package/worker/src/RTC/SCTP/rx/ReassemblyQueue.cpp +2 -1
- package/worker/src/RTC/SCTP/tx/RetransmissionQueue.cpp +4 -2
- package/worker/src/RTC/Transport.cpp +49 -20
- package/worker/src/RTC/TransportCongestionControlClient.cpp +0 -66
- package/worker/src/RTC/TransportCongestionControlServer.cpp +0 -55
- package/worker/src/Utils/Crypto.cpp +114 -98
- package/worker/subprojects/catch2.wrap +6 -6
- package/worker/subprojects/openssl.wrap +11 -12
- package/worker/subprojects/packagefiles/ankerl-unordered-dense/meson.build +1 -1
- package/worker/subprojects/unordered-dense.wrap +4 -4
- package/worker/test/src/RTC/BWE/TestDelayBasedBwe.cpp +5 -5
- package/worker/test/src/RTC/BWE/TestFeedbackAdapter.cpp +26 -23
- package/worker/test/src/RTC/BWE/TestInterArrivalDelta.cpp +8 -8
- package/worker/test/src/RTC/BWE/TestOveruseDetector.cpp +4 -4
- package/worker/test/src/RTC/BWE/TestProbeController.cpp +35 -32
- package/worker/test/src/RTC/BWE/TestProbePacketGenerator.cpp +2 -17
- package/worker/test/src/RTC/BWE/TestProbingScheduler.cpp +1 -25
- package/worker/test/src/RTC/BWE/TestReceiverTransportCongestionController.cpp +346 -0
- package/worker/test/src/RTC/BWE/TestRembGenerator.cpp +1 -1
- package/worker/test/src/RTC/BWE/TestRemoteBitrateEstimatorAbsSendTime.cpp +9 -9
- package/worker/test/src/RTC/BWE/TestSenderTransportCongestionController.cpp +510 -0
- package/worker/test/src/RTC/BWE/TestTransportWideCcFeedbackGenerator.cpp +16 -14
- package/worker/test/src/RTC/BWE/TestTrendlineEstimator.cpp +6 -6
- package/worker/test/src/RTC/BWE/helpers/RemoteBitrateEstimatorAbsSendTimeTestHelper.cpp +1 -2
- package/worker/test/src/RTC/RTCP/TestBye.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackPsAfb.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackPsFir.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackPsLei.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackPsPli.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackPsRemb.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackPsRpsi.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackPsSli.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackPsTst.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackPsVbcm.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestFeedbackRtpEcn.cpp +1 -1
- 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/TestFeedbackRtpTransport.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestReceiverReport.cpp +1 -1
- package/worker/test/src/RTC/RTCP/TestSenderReport.cpp +1 -1
- package/worker/test/src/RTC/RTP/TestRetransmissionBuffer.cpp +60 -28
- package/worker/test/src/RTC/RTP/TestRtpStreamRecv.cpp +1 -1
- package/worker/test/src/RTC/RTP/TestRtpStreamSend.cpp +746 -24
- package/worker/test/src/RTC/RTP/TestSharedPacket.cpp +1 -1
- package/worker/test/src/RTC/SCTP/association/TestAssociation.cpp +42 -0
- package/worker/test/src/RTC/SCTP/association/TestNegotiatedCapabilities.cpp +54 -5
- package/worker/test/src/RTC/SCTP/association/TestStateCookie.cpp +80 -15
- package/worker/test/src/RTC/SCTP/association/TestStreamResetHandler.cpp +410 -3
- package/worker/test/src/RTC/SCTP/association/TestTransmissionControlBlock.cpp +1 -1
- package/worker/test/src/RTC/SCTP/packet/parameters/TestZeroChecksumAcceptableParameter.cpp +37 -5
- package/worker/test/src/RTC/SCTP/rx/TestDataTracker.cpp +5 -4
- package/worker/test/src/RTC/SCTP/rx/TestInterleavedReassemblyStreams.cpp +1 -1
- package/worker/test/src/RTC/SCTP/rx/TestReassemblyQueue.cpp +1 -1
- package/worker/test/src/RTC/SCTP/rx/TestTraditionalReassemblyStreams.cpp +1 -1
- package/worker/test/src/RTC/SCTP/tx/TestOutstandingData.cpp +1 -1
- package/worker/test/src/RTC/SCTP/tx/TestRetransmissionQueue.cpp +11 -10
- package/worker/test/src/RTC/SCTP/tx/TestRetransmissionTimeout.cpp +1 -1
- package/worker/test/src/RTC/TestNackGenerator.cpp +1 -1
- package/worker/test/src/RTC/TestPortManager.cpp +2 -2
- package/worker/test/src/RTC/TestRateCalculator.cpp +1 -1
- package/worker/test/src/RTC/TestRemoteCaptureTimeEstimator.cpp +21 -15
- package/worker/test/src/RTC/TestRemoteClockOffsetEstimator.cpp +13 -13
- package/worker/test/src/RTC/TestRtpEncodingParameters.cpp +1 -1
- package/worker/test/src/RTC/TestSubchannelsCodec.cpp +2 -2
- package/worker/test/src/RTC/TestTransportCongestionControlServer.cpp +1 -1
- package/worker/test/src/RTC/TestTransportTuple.cpp +3 -2
- package/worker/test/src/Utils/TestCrypto.cpp +71 -2
- package/worker/test/src/Utils/TestTime.cpp +2 -2
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "RTC/RTP/RtxStream.hpp"
|
|
5
5
|
#include "Logger.hpp"
|
|
6
|
+
#include "RTC/RTP/RtpStream.hpp"
|
|
6
7
|
#include "Utils.hpp"
|
|
7
8
|
#include <cmath> // std::round()
|
|
8
9
|
|
|
@@ -10,12 +11,6 @@ namespace RTC
|
|
|
10
11
|
{
|
|
11
12
|
namespace RTP
|
|
12
13
|
{
|
|
13
|
-
/* Static. */
|
|
14
|
-
|
|
15
|
-
static constexpr uint16_t MaxDropout{ 3000 };
|
|
16
|
-
static constexpr uint16_t MaxMisorder{ 1500 };
|
|
17
|
-
static constexpr uint32_t RtpSeqMod{ 1 << 16 };
|
|
18
|
-
|
|
19
14
|
/* Instance methods. */
|
|
20
15
|
|
|
21
16
|
RtxStream::RtxStream(SharedInterface* shared, RTP::RtxStream::Params& params)
|
|
@@ -94,32 +89,32 @@ namespace RTC
|
|
|
94
89
|
|
|
95
90
|
const int32_t prevPacketsLost = this->packetsLost;
|
|
96
91
|
|
|
97
|
-
// Calculate packets
|
|
98
|
-
auto
|
|
92
|
+
// Calculate packets expected and lost.
|
|
93
|
+
auto expectedPackets = GetExpectedPackets();
|
|
99
94
|
|
|
100
95
|
// NOTE: The expected count is the extended sequence number arithmetic of RFC
|
|
101
96
|
// 3550, so it wraps at 32 bits, whereas the received one does not wrap at
|
|
102
97
|
// all. Each subtraction below is therefore made in the width that keeps it
|
|
103
98
|
// right: this one truncates the received count so that both wrap together,
|
|
104
99
|
// and the interval further down is taken in full width, where it is exact.
|
|
105
|
-
const auto
|
|
100
|
+
const auto receivedPackets = static_cast<uint32_t>(this->packetsCount);
|
|
106
101
|
|
|
107
|
-
if (
|
|
102
|
+
if (expectedPackets > receivedPackets)
|
|
108
103
|
{
|
|
109
|
-
this->packetsLost = static_cast<int32_t>(
|
|
104
|
+
this->packetsLost = static_cast<int32_t>(expectedPackets - receivedPackets);
|
|
110
105
|
}
|
|
111
106
|
else
|
|
112
107
|
{
|
|
113
|
-
this->packetsLost =
|
|
108
|
+
this->packetsLost = 0;
|
|
114
109
|
}
|
|
115
110
|
|
|
116
111
|
// Calculate fraction lost.
|
|
117
112
|
//
|
|
118
113
|
// NOTE: Reading the difference of the expected count as signed makes a
|
|
119
114
|
// sequence number re-sync, which restarts the count, come out negative.
|
|
120
|
-
const int64_t expectedInterval = static_cast<int32_t>(
|
|
115
|
+
const int64_t expectedInterval = static_cast<int32_t>(expectedPackets - this->expectedPrior);
|
|
121
116
|
|
|
122
|
-
this->expectedPrior =
|
|
117
|
+
this->expectedPrior = expectedPackets;
|
|
123
118
|
|
|
124
119
|
const auto receivedInterval = static_cast<int64_t>(this->packetsCount - this->receivedPrior);
|
|
125
120
|
|
|
@@ -198,20 +193,20 @@ namespace RTC
|
|
|
198
193
|
// "so much bigger", accept it.
|
|
199
194
|
// NOTE: udelta also handles the case of a new cycle, this is:
|
|
200
195
|
// maxSeq:65536, seq:0 => udelta:1
|
|
201
|
-
if (udelta < MaxDropout)
|
|
196
|
+
if (udelta < RTP::RtpStream::MaxDropout)
|
|
202
197
|
{
|
|
203
198
|
// In order, with permissible gap.
|
|
204
199
|
if (seq < this->maxSeq)
|
|
205
200
|
{
|
|
206
201
|
// Sequence number wrapped: count another 64K cycle.
|
|
207
|
-
this->cycles += RtpSeqMod;
|
|
202
|
+
this->cycles += RTP::RtpStream::RtpSeqMod;
|
|
208
203
|
}
|
|
209
204
|
|
|
210
205
|
this->maxSeq = seq;
|
|
211
206
|
}
|
|
212
207
|
// Too old packet received (older than the allowed misorder).
|
|
213
208
|
// Or to new packet (more than acceptable dropout).
|
|
214
|
-
else if (udelta <= RtpSeqMod - MaxMisorder)
|
|
209
|
+
else if (udelta <= RTP::RtpStream::RtpSeqMod - RTP::RtpStream::MaxMisorder)
|
|
215
210
|
{
|
|
216
211
|
// The sequence number made a very large jump. If two sequential packets
|
|
217
212
|
// arrive, accept the latter.
|
|
@@ -237,7 +232,7 @@ namespace RTC
|
|
|
237
232
|
packet->GetSsrc(),
|
|
238
233
|
packet->GetSequenceNumber());
|
|
239
234
|
|
|
240
|
-
this->badSeq = (seq + 1) & (RtpSeqMod - 1);
|
|
235
|
+
this->badSeq = (seq + 1) & (RTP::RtpStream::RtpSeqMod - 1);
|
|
241
236
|
|
|
242
237
|
// Packet discarded due to late or early arriving.
|
|
243
238
|
this->packetsDiscarded++;
|
|
@@ -261,7 +256,7 @@ namespace RTC
|
|
|
261
256
|
// Initialize/reset RTP counters.
|
|
262
257
|
this->baseSeq = seq;
|
|
263
258
|
this->maxSeq = seq;
|
|
264
|
-
this->badSeq = RtpSeqMod + 1; // So seq == badSeq is false.
|
|
259
|
+
this->badSeq = RTP::RtpStream::RtpSeqMod + 1; // So seq == badSeq is false.
|
|
265
260
|
}
|
|
266
261
|
|
|
267
262
|
flatbuffers::Offset<FBS::RtxStream::Params> RtxStream::Params::FillBuffer(
|
|
@@ -119,7 +119,7 @@ namespace RTC
|
|
|
119
119
|
static_cast<int>(stateStringView.size()),
|
|
120
120
|
stateStringView.data());
|
|
121
121
|
|
|
122
|
-
this->sctpOptions.Dump();
|
|
122
|
+
this->sctpOptions.Dump(indentation + 1);
|
|
123
123
|
|
|
124
124
|
if (this->tcb)
|
|
125
125
|
{
|
|
@@ -995,8 +995,9 @@ namespace RTC
|
|
|
995
995
|
|
|
996
996
|
if (message->GetPayloadLength() > this->sctpOptions.maxReceiveMessageSize)
|
|
997
997
|
{
|
|
998
|
-
|
|
998
|
+
MS_WARN_2TAGS(
|
|
999
999
|
sctp,
|
|
1000
|
+
message,
|
|
1000
1001
|
"dropping too large received message [messageByteLength:%zu, maxReceiveMessageSize:%zu]",
|
|
1001
1002
|
message->GetPayloadLength(),
|
|
1002
1003
|
this->sctpOptions.maxReceiveMessageSize);
|
|
@@ -299,12 +299,32 @@ namespace RTC
|
|
|
299
299
|
const uint32_t zeroChecksumAlternateErrorDetectionMethod =
|
|
300
300
|
ntohl(remoteCapabilitiesField->zeroChecksumAlternateErrorDetectionMethod);
|
|
301
301
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
302
|
+
switch (zeroChecksumAlternateErrorDetectionMethod)
|
|
303
|
+
{
|
|
304
|
+
case static_cast<uint32_t>(
|
|
305
|
+
ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod::SCTP_OVER_DTLS):
|
|
306
|
+
{
|
|
307
|
+
remoteCapabilities.zeroChecksumAlternateErrorDetectionMethod =
|
|
308
|
+
ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod::SCTP_OVER_DTLS;
|
|
309
|
+
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
case static_cast<uint32_t>(
|
|
314
|
+
ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod::TRUSTED_NETWORK):
|
|
315
|
+
{
|
|
316
|
+
remoteCapabilities.zeroChecksumAlternateErrorDetectionMethod =
|
|
317
|
+
ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod::TRUSTED_NETWORK;
|
|
318
|
+
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
default:
|
|
323
|
+
{
|
|
324
|
+
remoteCapabilities.zeroChecksumAlternateErrorDetectionMethod =
|
|
325
|
+
ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod::NONE;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
308
328
|
|
|
309
329
|
// NOTE: No need to std::move(). Copy elision (RVO) is used for free in GCC
|
|
310
330
|
// and clang in C++17 or higher.
|
|
@@ -14,8 +14,9 @@ namespace RTC
|
|
|
14
14
|
// clang-format off
|
|
15
15
|
const ankerl::unordered_dense::map<ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod, std::string> ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod2String =
|
|
16
16
|
{
|
|
17
|
-
{ ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod::NONE,
|
|
18
|
-
{ ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod::SCTP_OVER_DTLS,
|
|
17
|
+
{ ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod::NONE, "NONE" },
|
|
18
|
+
{ ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod::SCTP_OVER_DTLS, "SCTP_OVER_DTLS" },
|
|
19
|
+
{ ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod::TRUSTED_NETWORK, "TRUSTED_NETWORK" },
|
|
19
20
|
};
|
|
20
21
|
// clang-format on
|
|
21
22
|
|
|
@@ -132,7 +133,7 @@ namespace RTC
|
|
|
132
133
|
DumpCommon(indentation);
|
|
133
134
|
MS_DUMP_CLEAN(
|
|
134
135
|
indentation,
|
|
135
|
-
" alternate error detection method: %"
|
|
136
|
+
" alternate error detection method: 0x%08" PRIX32 " (%s)",
|
|
136
137
|
static_cast<uint32_t>(GetAlternateErrorDetectionMethod()),
|
|
137
138
|
ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethodToString(
|
|
138
139
|
GetAlternateErrorDetectionMethod())
|
|
@@ -54,7 +54,8 @@ namespace RTC
|
|
|
54
54
|
if (
|
|
55
55
|
this->deferredResetStreams.has_value() &&
|
|
56
56
|
unwrappedTsn > this->deferredResetStreams->senderLastAssignedTsn &&
|
|
57
|
-
this->deferredResetStreams->streamIds.
|
|
57
|
+
(this->deferredResetStreams->streamIds.empty() ||
|
|
58
|
+
this->deferredResetStreams->streamIds.contains(data.GetStreamId())))
|
|
58
59
|
{
|
|
59
60
|
MS_DEBUG_DEV(
|
|
60
61
|
"deferrink chunk [tsn:%" PRIu32 ", streamId:%" PRIu16 "] until tsn %" PRIu32,
|
|
@@ -95,8 +95,9 @@ namespace RTC
|
|
|
95
95
|
// Add lifecycle events for delivered messages.
|
|
96
96
|
for (const uint64_t lifecycleId : ackInfo.ackedLifecycleIds)
|
|
97
97
|
{
|
|
98
|
-
|
|
98
|
+
MS_DEBUG_2TAGS(
|
|
99
99
|
sctp,
|
|
100
|
+
message,
|
|
100
101
|
"triggering OnAssociationLifecycleMessageDelivered() [lifecycleId:%" PRIu64 "]",
|
|
101
102
|
lifecycleId);
|
|
102
103
|
|
|
@@ -107,8 +108,9 @@ namespace RTC
|
|
|
107
108
|
// Add lifecycle events for abandoned messages.
|
|
108
109
|
for (const uint64_t lifecycleId : ackInfo.abandonedLifecycleIds)
|
|
109
110
|
{
|
|
110
|
-
|
|
111
|
+
MS_DEBUG_2TAGS(
|
|
111
112
|
sctp,
|
|
113
|
+
message,
|
|
112
114
|
"triggering OnLifecycleMessageExpired() [lifecycleId:%" PRIu64 ", maybeDelivered:true]",
|
|
113
115
|
lifecycleId);
|
|
114
116
|
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
#include "RTC/RTCP/XrDelaySinceLastRr.hpp"
|
|
19
19
|
#include "RTC/RtpDictionaries.hpp"
|
|
20
20
|
#include "RTC/SCTP/association/Association.hpp"
|
|
21
|
+
#include "RTC/SCTP/packet/parameters/ZeroChecksumAcceptableParameter.hpp"
|
|
21
22
|
#include "RTC/SCTP/public/SctpOptions.hpp"
|
|
22
23
|
#include "RTC/SubchannelsCodec.hpp"
|
|
23
24
|
#include "Utils.hpp"
|
|
@@ -93,6 +94,32 @@ namespace RTC
|
|
|
93
94
|
MS_THROW_TYPE_ERROR("cannot enable SCTP in a direct Transport");
|
|
94
95
|
}
|
|
95
96
|
|
|
97
|
+
RTC::SCTP::ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod
|
|
98
|
+
zeroChecksumAlternateErrorDetectionMethod{
|
|
99
|
+
RTC::SCTP::ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod::NONE
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
switch (options->sctpZeroChecksum())
|
|
103
|
+
{
|
|
104
|
+
case FBS::Transport::SctpZeroChecksum::SCTP_OVER_DTLS:
|
|
105
|
+
{
|
|
106
|
+
zeroChecksumAlternateErrorDetectionMethod =
|
|
107
|
+
RTC::SCTP::ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod::SCTP_OVER_DTLS;
|
|
108
|
+
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
case FBS::Transport::SctpZeroChecksum::TRUSTED_NETWORK:
|
|
113
|
+
{
|
|
114
|
+
zeroChecksumAlternateErrorDetectionMethod =
|
|
115
|
+
RTC::SCTP::ZeroChecksumAcceptableParameter::AlternateErrorDetectionMethod::TRUSTED_NETWORK;
|
|
116
|
+
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
default:;
|
|
121
|
+
}
|
|
122
|
+
|
|
96
123
|
const RTC::SCTP::SctpOptions sctpOptions = {
|
|
97
124
|
.mtu = RTC::Consts::MaxSafeMtuSizeForSctp,
|
|
98
125
|
.maxSendMessageSize = this->maxSendMessageSize,
|
|
@@ -102,7 +129,8 @@ namespace RTC
|
|
|
102
129
|
.maxReceiverWindowBufferSize = options->sctpMaxReceiverWindowBufferSize(),
|
|
103
130
|
.defaultStreamBufferedAmountLowThreshold =
|
|
104
131
|
options->sctpDefaultStreamBufferedAmountLowThreshold(),
|
|
105
|
-
.
|
|
132
|
+
.zeroChecksumAlternateErrorDetectionMethod = zeroChecksumAlternateErrorDetectionMethod,
|
|
133
|
+
.requireAuthenticatedCookie = requireSctpStateCookieAuthentication
|
|
106
134
|
};
|
|
107
135
|
|
|
108
136
|
this->sctpAssociation = std::make_unique<RTC::SCTP::Association>(
|
|
@@ -469,11 +497,9 @@ namespace RTC
|
|
|
469
497
|
}
|
|
470
498
|
|
|
471
499
|
#ifdef MS_USE_BUILTIN_BWE
|
|
472
|
-
// TODO: Take these from the built-in
|
|
500
|
+
// TODO: Take these from the built-in sender and receiver congestion control.
|
|
473
501
|
const flatbuffers::Optional<uint64_t> availableOutgoingBitrate{ flatbuffers::nullopt };
|
|
474
502
|
const flatbuffers::Optional<uint64_t> availableIncomingBitrate{ flatbuffers::nullopt };
|
|
475
|
-
const flatbuffers::Optional<double> rtpPacketLossReceived{ flatbuffers::nullopt };
|
|
476
|
-
const flatbuffers::Optional<double> rtpPacketLossSent{ flatbuffers::nullopt };
|
|
477
503
|
#else
|
|
478
504
|
const auto availableOutgoingBitrate =
|
|
479
505
|
this->tccClient ? flatbuffers::Optional<uint64_t>(
|
|
@@ -483,12 +509,6 @@ namespace RTC
|
|
|
483
509
|
this->tccServer ? flatbuffers::Optional<uint64_t>(
|
|
484
510
|
static_cast<uint64_t>(this->tccServer->GetAvailableBitrate()))
|
|
485
511
|
: flatbuffers::nullopt;
|
|
486
|
-
const auto rtpPacketLossReceived =
|
|
487
|
-
this->tccServer ? flatbuffers::Optional<double>(this->tccServer->GetPacketLoss())
|
|
488
|
-
: flatbuffers::nullopt;
|
|
489
|
-
const auto rtpPacketLossSent =
|
|
490
|
-
this->tccClient ? flatbuffers::Optional<double>(this->tccClient->GetPacketLoss())
|
|
491
|
-
: flatbuffers::nullopt;
|
|
492
512
|
#endif
|
|
493
513
|
|
|
494
514
|
return FBS::Transport::CreateStatsDirect(
|
|
@@ -543,11 +563,7 @@ namespace RTC
|
|
|
543
563
|
// minOutgoingBitrate.
|
|
544
564
|
this->minOutgoingBitrate > 0
|
|
545
565
|
? flatbuffers::Optional<uint64_t>(static_cast<uint64_t>(this->minOutgoingBitrate))
|
|
546
|
-
: flatbuffers::nullopt
|
|
547
|
-
// rtpPacketLossReceived.
|
|
548
|
-
rtpPacketLossReceived,
|
|
549
|
-
// rtpPacketLossSent.
|
|
550
|
-
rtpPacketLossSent);
|
|
566
|
+
: flatbuffers::nullopt);
|
|
551
567
|
}
|
|
552
568
|
|
|
553
569
|
void Transport::HandleRequest(Channel::ChannelRequest* request)
|
|
@@ -1355,6 +1371,8 @@ namespace RTC
|
|
|
1355
1371
|
|
|
1356
1372
|
// Tell the child class to clear associated SSRCs.
|
|
1357
1373
|
SendStreamClosed(ssrc);
|
|
1374
|
+
|
|
1375
|
+
// TODO: Tell the built-in sender congestion controller to forget this SSRC.
|
|
1358
1376
|
}
|
|
1359
1377
|
|
|
1360
1378
|
for (auto ssrc : consumer->GetRtxSsrcs())
|
|
@@ -1363,6 +1381,8 @@ namespace RTC
|
|
|
1363
1381
|
|
|
1364
1382
|
// Tell the child class to clear associated SSRCs.
|
|
1365
1383
|
SendStreamClosed(ssrc);
|
|
1384
|
+
|
|
1385
|
+
// TODO: Tell the built-in sender congestion controller to forget this SSRC.
|
|
1366
1386
|
}
|
|
1367
1387
|
|
|
1368
1388
|
// Notify the listener.
|
|
@@ -1757,8 +1777,9 @@ namespace RTC
|
|
|
1757
1777
|
{
|
|
1758
1778
|
const auto sendStatusStringView = RTC::SCTP::Types::sendMessageStatusToString(sendStatus);
|
|
1759
1779
|
|
|
1760
|
-
|
|
1780
|
+
MS_WARN_2TAGS(
|
|
1761
1781
|
sctp,
|
|
1782
|
+
message,
|
|
1762
1783
|
"failed to send SCTP message [sendStatus:%.*s]",
|
|
1763
1784
|
static_cast<int>(sendStatusStringView.size()),
|
|
1764
1785
|
sendStatusStringView.data());
|
|
@@ -1777,8 +1798,9 @@ namespace RTC
|
|
|
1777
1798
|
{
|
|
1778
1799
|
const auto sendStatusStringView = RTC::SCTP::Types::sendMessageStatusToString(sendStatus);
|
|
1779
1800
|
|
|
1780
|
-
|
|
1801
|
+
MS_WARN_2TAGS(
|
|
1781
1802
|
sctp,
|
|
1803
|
+
message,
|
|
1782
1804
|
"failed to send SCTP message [sendStatus:%.*s]",
|
|
1783
1805
|
static_cast<int>(sendStatusStringView.size()),
|
|
1784
1806
|
sendStatusStringView.data());
|
|
@@ -1995,7 +2017,8 @@ namespace RTC
|
|
|
1995
2017
|
}
|
|
1996
2018
|
|
|
1997
2019
|
#ifdef MS_USE_BUILTIN_BWE
|
|
1998
|
-
// TODO:
|
|
2020
|
+
// TODO: Add up what every Consumer returns from ReceiveRtcpReceiverReport()
|
|
2021
|
+
// above and hand the total to the built-in sender congestion controller.
|
|
1999
2022
|
#else
|
|
2000
2023
|
if (this->tccClient && !this->mapConsumers.empty())
|
|
2001
2024
|
{
|
|
@@ -2900,6 +2923,8 @@ namespace RTC
|
|
|
2900
2923
|
|
|
2901
2924
|
// Tell the child class to clear associated SSRCs.
|
|
2902
2925
|
SendStreamClosed(ssrc);
|
|
2926
|
+
|
|
2927
|
+
// TODO: Tell the built-in sender congestion controller to forget this SSRC.
|
|
2903
2928
|
}
|
|
2904
2929
|
|
|
2905
2930
|
for (auto ssrc : consumer->GetRtxSsrcs())
|
|
@@ -2908,6 +2933,8 @@ namespace RTC
|
|
|
2908
2933
|
|
|
2909
2934
|
// Tell the child class to clear associated SSRCs.
|
|
2910
2935
|
SendStreamClosed(ssrc);
|
|
2936
|
+
|
|
2937
|
+
// TODO: Tell the built-in sender congestion controller to forget this SSRC.
|
|
2911
2938
|
}
|
|
2912
2939
|
|
|
2913
2940
|
// Notify the listener.
|
|
@@ -3247,8 +3274,9 @@ namespace RTC
|
|
|
3247
3274
|
|
|
3248
3275
|
if (!dataProducer)
|
|
3249
3276
|
{
|
|
3250
|
-
|
|
3277
|
+
MS_WARN_2TAGS(
|
|
3251
3278
|
sctp,
|
|
3279
|
+
message,
|
|
3252
3280
|
"no suitable DataProducer for received SCTP message [streamId:%" PRIu16 "]",
|
|
3253
3281
|
message.GetStreamId());
|
|
3254
3282
|
|
|
@@ -3275,8 +3303,9 @@ namespace RTC
|
|
|
3275
3303
|
}
|
|
3276
3304
|
catch (std::exception& error)
|
|
3277
3305
|
{
|
|
3278
|
-
|
|
3306
|
+
MS_WARN_2TAGS(
|
|
3279
3307
|
sctp,
|
|
3308
|
+
message,
|
|
3280
3309
|
"DataProducer::ReceiveMessage() failed for received SCTP message [streamId:%" PRIu16 "]: %s",
|
|
3281
3310
|
message.GetStreamId(),
|
|
3282
3311
|
error.what());
|
|
@@ -18,7 +18,6 @@ namespace RTC
|
|
|
18
18
|
static constexpr double MaxBitrateIncrementFactor{ 1.35 };
|
|
19
19
|
static constexpr double MaxPaddingBitrateFactor{ 0.85 };
|
|
20
20
|
static constexpr int64_t AvailableBitrateEventIntervalMs{ 1000 };
|
|
21
|
-
static constexpr size_t PacketLossHistogramLength{ 24 };
|
|
22
21
|
|
|
23
22
|
/* Instance methods. */
|
|
24
23
|
|
|
@@ -232,23 +231,6 @@ namespace RTC
|
|
|
232
231
|
{
|
|
233
232
|
MS_TRACE();
|
|
234
233
|
|
|
235
|
-
// Update packet loss history.
|
|
236
|
-
const size_t expectedPackets = feedback->GetPacketStatusCount();
|
|
237
|
-
size_t lostPackets = 0;
|
|
238
|
-
|
|
239
|
-
for (const auto& packetStatus : feedback->GetPacketStatuses())
|
|
240
|
-
{
|
|
241
|
-
if (!packetStatus.received)
|
|
242
|
-
{
|
|
243
|
-
lostPackets += 1;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if (expectedPackets > 0)
|
|
248
|
-
{
|
|
249
|
-
this->UpdatePacketLoss(static_cast<double>(lostPackets) / expectedPackets);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
234
|
if (this->rtpTransportControllerSend == nullptr)
|
|
253
235
|
{
|
|
254
236
|
return;
|
|
@@ -257,47 +239,6 @@ namespace RTC
|
|
|
257
239
|
this->rtpTransportControllerSend->OnTransportFeedback(*feedback);
|
|
258
240
|
}
|
|
259
241
|
|
|
260
|
-
void TransportCongestionControlClient::UpdatePacketLoss(double packetLoss)
|
|
261
|
-
{
|
|
262
|
-
MS_TRACE();
|
|
263
|
-
|
|
264
|
-
// Add the lost into the histogram.
|
|
265
|
-
if (this->packetLossHistory.size() == PacketLossHistogramLength)
|
|
266
|
-
{
|
|
267
|
-
this->packetLossHistory.pop_front();
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
this->packetLossHistory.push_back(packetLoss);
|
|
271
|
-
|
|
272
|
-
/*
|
|
273
|
-
* Scoring mechanism is a weighted average.
|
|
274
|
-
*
|
|
275
|
-
* The more recent the score is, the more weight it has.
|
|
276
|
-
* The oldest score has a weight of 1 and subsequent scores weight is
|
|
277
|
-
* increased by one sequentially.
|
|
278
|
-
*
|
|
279
|
-
* Ie:
|
|
280
|
-
* - scores: [1,2,3,4]
|
|
281
|
-
* - this->scores = ((1) + (2+2) + (3+3+3) + (4+4+4+4)) / 10 = 2.8 => 3
|
|
282
|
-
*/
|
|
283
|
-
|
|
284
|
-
size_t weight{ 0 };
|
|
285
|
-
size_t samples{ 0 };
|
|
286
|
-
double totalPacketLoss{ 0 };
|
|
287
|
-
|
|
288
|
-
for (auto packetLossEntry : this->packetLossHistory)
|
|
289
|
-
{
|
|
290
|
-
weight++;
|
|
291
|
-
samples += weight;
|
|
292
|
-
totalPacketLoss += weight * packetLossEntry;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// clang-tidy "thinks" that this can lead to division by zero but we are
|
|
296
|
-
// smarter.
|
|
297
|
-
// NOLINTNEXTLINE(clang-analyzer-core.DivideZero)
|
|
298
|
-
this->packetLoss = totalPacketLoss / samples;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
242
|
void TransportCongestionControlClient::SetMaxOutgoingBitrate(int64_t maxBitrate)
|
|
302
243
|
{
|
|
303
244
|
MS_TRACE();
|
|
@@ -450,13 +391,6 @@ namespace RTC
|
|
|
450
391
|
return this->bitrates.availableBitrate;
|
|
451
392
|
}
|
|
452
393
|
|
|
453
|
-
double TransportCongestionControlClient::GetPacketLoss() const
|
|
454
|
-
{
|
|
455
|
-
MS_TRACE();
|
|
456
|
-
|
|
457
|
-
return this->packetLoss;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
394
|
void TransportCongestionControlClient::RescheduleNextAvailableBitrateEvent()
|
|
461
395
|
{
|
|
462
396
|
MS_TRACE();
|
|
@@ -13,7 +13,6 @@ namespace RTC
|
|
|
13
13
|
static constexpr int64_t LimitationRembIntervalMs{ 1500 };
|
|
14
14
|
static constexpr int64_t PacketArrivalTimestampWindowUs{ 500 * 1000 };
|
|
15
15
|
static constexpr uint8_t UnlimitedRembNumPackets{ 4u };
|
|
16
|
-
static constexpr size_t PacketLossHistogramLength{ 24 };
|
|
17
16
|
|
|
18
17
|
/* Instance methods. */
|
|
19
18
|
|
|
@@ -99,13 +98,6 @@ namespace RTC
|
|
|
99
98
|
}
|
|
100
99
|
}
|
|
101
100
|
|
|
102
|
-
double TransportCongestionControlServer::GetPacketLoss() const
|
|
103
|
-
{
|
|
104
|
-
MS_TRACE();
|
|
105
|
-
|
|
106
|
-
return this->packetLoss;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
101
|
void TransportCongestionControlServer::IncomingPacket(int64_t nowUs, const RTC::RTP::Packet* packet)
|
|
110
102
|
{
|
|
111
103
|
MS_TRACE();
|
|
@@ -309,23 +301,6 @@ namespace RTC
|
|
|
309
301
|
this->listener->OnTransportCongestionControlServerSendRtcpPacket(
|
|
310
302
|
this, this->transportCcFeedbackPacket.get());
|
|
311
303
|
|
|
312
|
-
// Update packet loss history.
|
|
313
|
-
const size_t expectedPackets = this->transportCcFeedbackPacket->GetPacketStatusCount();
|
|
314
|
-
size_t lostPackets = 0;
|
|
315
|
-
|
|
316
|
-
for (const auto& packetStatus : this->transportCcFeedbackPacket->GetPacketStatuses())
|
|
317
|
-
{
|
|
318
|
-
if (!packetStatus.received)
|
|
319
|
-
{
|
|
320
|
-
lostPackets += 1;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
if (expectedPackets > 0)
|
|
325
|
-
{
|
|
326
|
-
this->UpdatePacketLoss(static_cast<double>(lostPackets) / expectedPackets);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
304
|
this->transportCcFeedbackWideSeqNumStart = latestWideSeqNumber + 1;
|
|
330
305
|
|
|
331
306
|
return true;
|
|
@@ -390,36 +365,6 @@ namespace RTC
|
|
|
390
365
|
}
|
|
391
366
|
}
|
|
392
367
|
|
|
393
|
-
void TransportCongestionControlServer::UpdatePacketLoss(double packetLoss)
|
|
394
|
-
{
|
|
395
|
-
MS_TRACE();
|
|
396
|
-
|
|
397
|
-
// Add the lost into the histogram.
|
|
398
|
-
if (this->packetLossHistory.size() == PacketLossHistogramLength)
|
|
399
|
-
{
|
|
400
|
-
this->packetLossHistory.pop_front();
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
this->packetLossHistory.push_back(packetLoss);
|
|
404
|
-
|
|
405
|
-
// Calculate a weighted average
|
|
406
|
-
size_t weight{ 0 };
|
|
407
|
-
size_t samples{ 0 };
|
|
408
|
-
double totalPacketLoss{ 0 };
|
|
409
|
-
|
|
410
|
-
for (auto packetLossEntry : this->packetLossHistory)
|
|
411
|
-
{
|
|
412
|
-
weight++;
|
|
413
|
-
samples += weight;
|
|
414
|
-
totalPacketLoss += weight * packetLossEntry;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// clang-tidy "thinks" that this can lead to division by zero but we are
|
|
418
|
-
// smarter.
|
|
419
|
-
// NOLINTNEXTLINE(clang-analyzer-core.DivideZero)
|
|
420
|
-
this->packetLoss = totalPacketLoss / samples;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
368
|
void TransportCongestionControlServer::ResetTransportCcFeedback(uint8_t feedbackPacketCount)
|
|
424
369
|
{
|
|
425
370
|
MS_TRACE();
|