mediasoup 3.19.21 → 3.19.22
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 -0
- package/node/lib/Worker.d.ts.map +1 -1
- package/node/lib/Worker.js +14 -0
- package/package.json +4 -2
- package/worker/fuzzer/src/RTC/FuzzerDtlsTransport.cpp +9 -3
- package/worker/fuzzer/src/RTC/RTP/FuzzerRtpStreamSend.cpp +9 -1
- package/worker/include/Channel/ChannelMessageRegistrator.hpp +39 -0
- package/worker/include/Channel/ChannelMessageRegistratorInterface.hpp +32 -0
- package/worker/include/Channel/ChannelSocket.hpp +1 -1
- package/worker/include/DepUsrSCTP.hpp +8 -7
- package/worker/include/RTC/ActiveSpeakerObserver.hpp +7 -7
- package/worker/include/RTC/AudioLevelObserver.hpp +7 -7
- package/worker/include/RTC/Consumer.hpp +3 -3
- package/worker/include/RTC/DataConsumer.hpp +3 -3
- package/worker/include/RTC/DataProducer.hpp +3 -3
- package/worker/include/RTC/DirectTransport.hpp +2 -2
- package/worker/include/RTC/DtlsTransport.hpp +8 -6
- package/worker/include/RTC/ICE/IceServer.hpp +8 -5
- package/worker/include/RTC/KeyFrameRequestManager.hpp +15 -12
- package/worker/include/RTC/NackGenerator.hpp +7 -6
- package/worker/include/RTC/PipeConsumer.hpp +1 -2
- package/worker/include/RTC/PipeTransport.hpp +2 -2
- package/worker/include/RTC/PlainTransport.hpp +2 -2
- package/worker/include/RTC/Producer.hpp +3 -3
- package/worker/include/RTC/RTP/RtpStream.hpp +7 -1
- package/worker/include/RTC/RTP/RtpStreamRecv.hpp +6 -5
- package/worker/include/RTC/RTP/RtpStreamSend.hpp +4 -1
- package/worker/include/RTC/Router.hpp +3 -3
- package/worker/include/RTC/RtpObserver.hpp +3 -3
- package/worker/include/RTC/SCTP/TODO_SCTP.md +18 -6
- package/worker/include/RTC/SCTP/association/Association.hpp +11 -8
- package/worker/include/RTC/SCTP/association/HeartbeatHandler.hpp +9 -6
- package/worker/include/RTC/SCTP/association/StreamResetHandler.hpp +37 -23
- package/worker/include/RTC/SCTP/association/TCBContext.hpp +3 -2
- package/worker/include/RTC/SCTP/association/TransmissionControlBlock.hpp +81 -8
- package/worker/include/RTC/SCTP/packet/UserData.hpp +36 -0
- package/worker/include/RTC/SCTP/packet/chunks/ForwardTsnChunk.hpp +1 -1
- package/worker/include/RTC/SCTP/packet/chunks/IForwardTsnChunk.hpp +1 -1
- package/worker/include/RTC/SCTP/public/SctpOptions.hpp +2 -1
- package/worker/include/RTC/SCTP/tx/OutstandingData.hpp +604 -0
- package/worker/include/RTC/SCTP/tx/RetransmissionQueue.hpp +336 -0
- package/worker/include/RTC/SCTP/tx/RetransmissionTimeout.hpp +5 -4
- package/worker/include/RTC/Serializable.hpp +8 -0
- package/worker/include/RTC/SimpleConsumer.hpp +1 -2
- package/worker/include/RTC/SimulcastConsumer.hpp +1 -2
- package/worker/include/RTC/SvcConsumer.hpp +1 -2
- package/worker/include/RTC/Transport.hpp +8 -8
- package/worker/include/RTC/TransportCongestionControlClient.hpp +8 -5
- package/worker/include/RTC/TransportCongestionControlServer.hpp +8 -5
- package/worker/include/RTC/WebRtcServer.hpp +3 -3
- package/worker/include/RTC/WebRtcTransport.hpp +3 -3
- package/worker/include/Shared.hpp +40 -0
- package/worker/include/SharedInterface.hpp +44 -0
- package/worker/include/Utils.hpp +6 -0
- package/worker/include/Worker.hpp +3 -3
- package/worker/include/common.hpp +1 -1
- package/worker/include/handles/BackoffTimerHandle.hpp +27 -65
- package/worker/include/handles/BackoffTimerHandleInterface.hpp +116 -0
- package/worker/include/handles/TimerHandle.hpp +36 -20
- package/worker/include/handles/TimerHandleInterface.hpp +43 -0
- package/worker/meson.build +21 -4
- package/worker/meson_options.txt +2 -1
- package/worker/mocks/include/Channel/MockChannelMessageRegistrator.hpp +45 -0
- package/worker/mocks/include/MockShared.hpp +43 -0
- package/worker/mocks/src/Channel/MockChannelMessageRegistrator.cpp +128 -0
- package/worker/mocks/src/MockShared.cpp +26 -0
- package/worker/scripts/clang-scripts.mjs +4 -1
- package/worker/src/Channel/ChannelMessageRegistrator.cpp +125 -0
- package/worker/src/Channel/ChannelSocket.cpp +1 -1
- package/worker/src/DepUsrSCTP.cpp +10 -4
- package/worker/src/RTC/ActiveSpeakerObserver.cpp +7 -7
- package/worker/src/RTC/AudioLevelObserver.cpp +12 -10
- package/worker/src/RTC/Consumer.cpp +23 -20
- package/worker/src/RTC/DataConsumer.cpp +11 -11
- package/worker/src/RTC/DataProducer.cpp +3 -3
- package/worker/src/RTC/DirectTransport.cpp +16 -16
- package/worker/src/RTC/DtlsTransport.cpp +4 -4
- package/worker/src/RTC/ICE/IceServer.cpp +4 -3
- package/worker/src/RTC/KeyFrameRequestManager.cpp +15 -15
- package/worker/src/RTC/NackGenerator.cpp +3 -3
- package/worker/src/RTC/PipeConsumer.cpp +5 -4
- package/worker/src/RTC/PipeTransport.cpp +3 -3
- package/worker/src/RTC/PlainTransport.cpp +10 -9
- package/worker/src/RTC/Producer.cpp +30 -28
- package/worker/src/RTC/RTCP/FeedbackPsRpsi.cpp +1 -2
- package/worker/src/RTC/RTP/RtpStream.cpp +9 -2
- package/worker/src/RTC/RTP/RtpStreamRecv.cpp +5 -4
- package/worker/src/RTC/RTP/RtpStreamSend.cpp +5 -2
- package/worker/src/RTC/Router.cpp +3 -3
- package/worker/src/RTC/RtpObserver.cpp +2 -1
- package/worker/src/RTC/SCTP/association/Association.cpp +94 -114
- package/worker/src/RTC/SCTP/association/HeartbeatHandler.cpp +27 -21
- package/worker/src/RTC/SCTP/association/StreamResetHandler.cpp +52 -55
- package/worker/src/RTC/SCTP/association/TransmissionControlBlock.cpp +144 -25
- package/worker/src/RTC/SCTP/packet/chunks/ForwardTsnChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/packet/chunks/IForwardTsnChunk.cpp +2 -2
- package/worker/src/RTC/SCTP/tx/OutstandingData.cpp +905 -0
- package/worker/src/RTC/SCTP/tx/RetransmissionQueue.cpp +799 -0
- package/worker/src/RTC/SCTP/tx/RetransmissionTimeout.cpp +1 -1
- package/worker/src/RTC/SctpAssociation.cpp +1 -1
- package/worker/src/RTC/SimpleConsumer.cpp +8 -7
- package/worker/src/RTC/SimulcastConsumer.cpp +11 -10
- package/worker/src/RTC/SvcConsumer.cpp +11 -10
- package/worker/src/RTC/Transport.cpp +36 -26
- package/worker/src/RTC/TransportCongestionControlClient.cpp +4 -2
- package/worker/src/RTC/TransportCongestionControlServer.cpp +4 -3
- package/worker/src/RTC/WebRtcServer.cpp +5 -4
- package/worker/src/RTC/WebRtcTransport.cpp +39 -26
- package/worker/src/Shared.cpp +35 -0
- package/worker/src/Worker.cpp +10 -23
- package/worker/src/handles/BackoffTimerHandle.cpp +11 -16
- package/worker/src/handles/TimerHandle.cpp +5 -4
- package/worker/src/lib.cpp +14 -1
- package/worker/tasks.py +1 -1
- package/worker/test/include/RTC/ICE/iceCommon.hpp +1 -0
- package/worker/test/include/RTC/RTP/rtpCommon.hpp +1 -0
- package/worker/test/include/RTC/SCTP/sctpCommon.hpp +6 -0
- package/worker/test/src/RTC/RTP/TestRtpStreamRecv.cpp +12 -5
- package/worker/test/src/RTC/RTP/TestRtpStreamSend.cpp +34 -23
- package/worker/test/src/RTC/SCTP/tx/TestOutstandingData.cpp +1196 -0
- package/worker/test/src/RTC/SCTP/tx/TestRetransmissionTimeout.cpp +33 -33
- package/worker/test/src/RTC/TestKeyFrameRequestManager.cpp +14 -6
- package/worker/test/src/RTC/TestNackGenerator.cpp +6 -2
- package/worker/test/src/RTC/TestSimpleConsumer.cpp +6 -10
- package/worker/test/src/RTC/TestTransportCongestionControlServer.cpp +9 -2
- package/worker/test/src/Utils/TestByte.cpp +98 -0
- package/worker/include/ChannelMessageRegistrator.hpp +0 -30
- package/worker/include/RTC/Shared.hpp +0 -23
- package/worker/src/ChannelMessageRegistrator.cpp +0 -119
- package/worker/src/RTC/Shared.cpp +0 -23
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
#define MS_RTC_NACK_GENERATOR_HPP
|
|
3
3
|
|
|
4
4
|
#include "common.hpp"
|
|
5
|
+
#include "SharedInterface.hpp"
|
|
5
6
|
#include "RTC/RTP/Packet.hpp"
|
|
6
7
|
#include "RTC/SeqManager.hpp"
|
|
7
|
-
#include "handles/
|
|
8
|
+
#include "handles/TimerHandleInterface.hpp"
|
|
8
9
|
#include <map>
|
|
9
10
|
#include <set>
|
|
10
11
|
#include <vector>
|
|
11
12
|
|
|
12
13
|
namespace RTC
|
|
13
14
|
{
|
|
14
|
-
class NackGenerator : public
|
|
15
|
+
class NackGenerator : public TimerHandleInterface::Listener
|
|
15
16
|
{
|
|
16
17
|
public:
|
|
17
18
|
class Listener
|
|
@@ -47,7 +48,7 @@ namespace RTC
|
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
public:
|
|
50
|
-
explicit NackGenerator(Listener* listener, unsigned int sendNackDelayMs);
|
|
51
|
+
explicit NackGenerator(Listener* listener, SharedInterface* shared, unsigned int sendNackDelayMs);
|
|
51
52
|
~NackGenerator() override;
|
|
52
53
|
|
|
53
54
|
bool ReceivePacket(const RTC::RTP::Packet* packet, bool isRecovered);
|
|
@@ -67,16 +68,16 @@ namespace RTC
|
|
|
67
68
|
std::vector<uint16_t> GetNackBatch(NackFilter filter);
|
|
68
69
|
void MayRunTimer() const;
|
|
69
70
|
|
|
70
|
-
/* Pure virtual methods inherited from
|
|
71
|
+
/* Pure virtual methods inherited from TimerHandleInterface::Listener. */
|
|
71
72
|
public:
|
|
72
|
-
void OnTimer(
|
|
73
|
+
void OnTimer(TimerHandleInterface* timer) override;
|
|
73
74
|
|
|
74
75
|
private:
|
|
75
76
|
// Passed by argument.
|
|
76
77
|
Listener* listener{ nullptr };
|
|
77
78
|
unsigned int sendNackDelayMs{ 0u };
|
|
78
79
|
// Allocated by this.
|
|
79
|
-
|
|
80
|
+
TimerHandleInterface* timer{ nullptr };
|
|
80
81
|
// Others.
|
|
81
82
|
std::map<uint16_t, NackInfo, RTC::SeqManager<uint16_t>::SeqLowerThan> nackList;
|
|
82
83
|
std::set<uint16_t, RTC::SeqManager<uint16_t>::SeqLowerThan> keyFrameList;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
#include "RTC/Consumer.hpp"
|
|
5
5
|
#include "RTC/SeqManager.hpp"
|
|
6
|
-
#include "RTC/Shared.hpp"
|
|
7
6
|
#include <map>
|
|
8
7
|
|
|
9
8
|
namespace RTC
|
|
@@ -19,7 +18,7 @@ namespace RTC
|
|
|
19
18
|
|
|
20
19
|
public:
|
|
21
20
|
PipeConsumer(
|
|
22
|
-
|
|
21
|
+
SharedInterface* shared,
|
|
23
22
|
const std::string& id,
|
|
24
23
|
const std::string& producerId,
|
|
25
24
|
RTC::Consumer::Listener* listener,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#ifndef MS_RTC_PIPE_TRANSPORT_HPP
|
|
2
2
|
#define MS_RTC_PIPE_TRANSPORT_HPP
|
|
3
3
|
|
|
4
|
+
#include "SharedInterface.hpp"
|
|
4
5
|
#include "FBS/pipeTransport.h"
|
|
5
|
-
#include "RTC/Shared.hpp"
|
|
6
6
|
#include "RTC/SrtpSession.hpp"
|
|
7
7
|
#include "RTC/Transport.hpp"
|
|
8
8
|
#include "RTC/TransportTuple.hpp"
|
|
@@ -19,7 +19,7 @@ namespace RTC
|
|
|
19
19
|
|
|
20
20
|
public:
|
|
21
21
|
PipeTransport(
|
|
22
|
-
|
|
22
|
+
SharedInterface* shared,
|
|
23
23
|
const std::string& id,
|
|
24
24
|
RTC::Transport::Listener* listener,
|
|
25
25
|
const FBS::PipeTransport::PipeTransportOptions* options);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#ifndef MS_RTC_PLAIN_TRANSPORT_HPP
|
|
2
2
|
#define MS_RTC_PLAIN_TRANSPORT_HPP
|
|
3
3
|
|
|
4
|
+
#include "SharedInterface.hpp"
|
|
4
5
|
#include "FBS/plainTransport.h"
|
|
5
|
-
#include "RTC/Shared.hpp"
|
|
6
6
|
#include "RTC/SrtpSession.hpp"
|
|
7
7
|
#include "RTC/Transport.hpp"
|
|
8
8
|
#include "RTC/TransportTuple.hpp"
|
|
@@ -15,7 +15,7 @@ namespace RTC
|
|
|
15
15
|
{
|
|
16
16
|
public:
|
|
17
17
|
PlainTransport(
|
|
18
|
-
|
|
18
|
+
SharedInterface* shared,
|
|
19
19
|
const std::string& id,
|
|
20
20
|
RTC::Transport::Listener* listener,
|
|
21
21
|
const FBS::PlainTransport::PlainTransportOptions* options);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#define MS_RTC_PRODUCER_HPP
|
|
3
3
|
|
|
4
4
|
#include "common.hpp"
|
|
5
|
+
#include "SharedInterface.hpp"
|
|
5
6
|
#include "Channel/ChannelRequest.hpp"
|
|
6
7
|
#include "Channel/ChannelSocket.hpp"
|
|
7
8
|
#include "RTC/KeyFrameRequestManager.hpp"
|
|
@@ -13,7 +14,6 @@
|
|
|
13
14
|
#include "RTC/RTP/Packet.hpp"
|
|
14
15
|
#include "RTC/RTP/RtpStreamRecv.hpp"
|
|
15
16
|
#include "RTC/RtpDictionaries.hpp"
|
|
16
|
-
#include "RTC/Shared.hpp"
|
|
17
17
|
#include <string>
|
|
18
18
|
#include <vector>
|
|
19
19
|
|
|
@@ -94,7 +94,7 @@ namespace RTC
|
|
|
94
94
|
|
|
95
95
|
public:
|
|
96
96
|
Producer(
|
|
97
|
-
|
|
97
|
+
SharedInterface* shared,
|
|
98
98
|
const std::string& id,
|
|
99
99
|
RTC::Producer::Listener* listener,
|
|
100
100
|
const FBS::Transport::ProduceRequest* data);
|
|
@@ -179,7 +179,7 @@ namespace RTC
|
|
|
179
179
|
|
|
180
180
|
private:
|
|
181
181
|
// Passed by argument.
|
|
182
|
-
|
|
182
|
+
SharedInterface* shared{ nullptr };
|
|
183
183
|
RTC::Producer::Listener* listener{ nullptr };
|
|
184
184
|
// Allocated by this.
|
|
185
185
|
absl::flat_hash_map<uint32_t, RTC::RTP::RtpStreamRecv*> mapSsrcRtpStream;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "common.hpp"
|
|
5
5
|
#include "DepLibUV.hpp"
|
|
6
|
+
#include "SharedInterface.hpp"
|
|
6
7
|
#include "FBS/rtpStream.h"
|
|
7
8
|
#include "RTC/RTCP/FeedbackPsFir.hpp" // IWYU pragma: export
|
|
8
9
|
#include "RTC/RTCP/FeedbackPsPli.hpp" // IWYU pragma: export
|
|
@@ -61,7 +62,11 @@ namespace RTC
|
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
public:
|
|
64
|
-
RtpStream(
|
|
65
|
+
RtpStream(
|
|
66
|
+
RTP::RtpStream::Listener* listener,
|
|
67
|
+
SharedInterface* shared,
|
|
68
|
+
RTP::RtpStream::Params& params,
|
|
69
|
+
uint8_t initialScore);
|
|
65
70
|
virtual ~RtpStream();
|
|
66
71
|
|
|
67
72
|
flatbuffers::Offset<FBS::RtpStream::Dump> FillBuffer(flatbuffers::FlatBufferBuilder& builder) const;
|
|
@@ -185,6 +190,7 @@ namespace RTC
|
|
|
185
190
|
protected:
|
|
186
191
|
// Given as argument.
|
|
187
192
|
RTP::RtpStream::Listener* listener{ nullptr };
|
|
193
|
+
SharedInterface* shared{ nullptr };
|
|
188
194
|
Params params;
|
|
189
195
|
// Others.
|
|
190
196
|
// https://tools.ietf.org/html/rfc3550#appendix-A.1 stuff.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
#include "RTC/RTCP/XrDelaySinceLastRr.hpp"
|
|
6
6
|
#include "RTC/RTP/RtpStream.hpp"
|
|
7
7
|
#include "RTC/RateCalculator.hpp"
|
|
8
|
-
#include "handles/
|
|
8
|
+
#include "handles/TimerHandleInterface.hpp"
|
|
9
9
|
#include <vector>
|
|
10
10
|
|
|
11
11
|
namespace RTC
|
|
@@ -14,7 +14,7 @@ namespace RTC
|
|
|
14
14
|
{
|
|
15
15
|
class RtpStreamRecv : public RTP::RtpStream,
|
|
16
16
|
public RTC::NackGenerator::Listener,
|
|
17
|
-
public
|
|
17
|
+
public TimerHandleInterface::Listener
|
|
18
18
|
{
|
|
19
19
|
public:
|
|
20
20
|
class Listener : public RTP::RtpStream::Listener
|
|
@@ -46,6 +46,7 @@ namespace RTC
|
|
|
46
46
|
public:
|
|
47
47
|
RtpStreamRecv(
|
|
48
48
|
RTP::RtpStreamRecv::Listener* listener,
|
|
49
|
+
SharedInterface* shared,
|
|
49
50
|
RTP::RtpStream::Params& params,
|
|
50
51
|
unsigned int sendNackDelayMs,
|
|
51
52
|
bool useRtpInactivityCheck);
|
|
@@ -92,9 +93,9 @@ namespace RTC
|
|
|
92
93
|
public:
|
|
93
94
|
void UserOnSequenceNumberReset() override;
|
|
94
95
|
|
|
95
|
-
/* Pure virtual methods inherited from
|
|
96
|
+
/* Pure virtual methods inherited from TimerHandleInterface. */
|
|
96
97
|
protected:
|
|
97
|
-
void OnTimer(
|
|
98
|
+
void OnTimer(TimerHandleInterface* timer) override;
|
|
98
99
|
|
|
99
100
|
/* Pure virtual methods inherited from RTC::NackGenerator. */
|
|
100
101
|
protected:
|
|
@@ -124,7 +125,7 @@ namespace RTC
|
|
|
124
125
|
uint8_t firSeqNumber{ 0u };
|
|
125
126
|
int32_t reportedPacketsLost{ 0 };
|
|
126
127
|
std::unique_ptr<RTC::NackGenerator> nackGenerator;
|
|
127
|
-
|
|
128
|
+
TimerHandleInterface* inactivityCheckPeriodicTimer{ nullptr };
|
|
128
129
|
bool inactive{ false };
|
|
129
130
|
// Valid media + valid RTX.
|
|
130
131
|
TransmissionCounter transmissionCounter;
|
|
@@ -36,7 +36,10 @@ namespace RTC
|
|
|
36
36
|
|
|
37
37
|
public:
|
|
38
38
|
RtpStreamSend(
|
|
39
|
-
RTP::RtpStreamSend::Listener* listener,
|
|
39
|
+
RTP::RtpStreamSend::Listener* listener,
|
|
40
|
+
SharedInterface* shared,
|
|
41
|
+
RTP::RtpStream::Params& params,
|
|
42
|
+
std::string& mid);
|
|
40
43
|
~RtpStreamSend() override;
|
|
41
44
|
|
|
42
45
|
flatbuffers::Offset<FBS::RtpStream::Stats> FillBufferStats(
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#define MS_RTC_ROUTER_HPP
|
|
3
3
|
|
|
4
4
|
#include "common.hpp"
|
|
5
|
+
#include "SharedInterface.hpp"
|
|
5
6
|
#include "Channel/ChannelRequest.hpp"
|
|
6
7
|
#include "RTC/Consumer.hpp"
|
|
7
8
|
#include "RTC/DataConsumer.hpp"
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
#include "RTC/RTP/Packet.hpp"
|
|
11
12
|
#include "RTC/RTP/RtpStreamRecv.hpp"
|
|
12
13
|
#include "RTC/RtpObserver.hpp"
|
|
13
|
-
#include "RTC/Shared.hpp"
|
|
14
14
|
#include "RTC/Transport.hpp"
|
|
15
15
|
#include "RTC/WebRtcServer.hpp"
|
|
16
16
|
#include <absl/container/flat_hash_map.h>
|
|
@@ -36,7 +36,7 @@ namespace RTC
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
public:
|
|
39
|
-
explicit Router(
|
|
39
|
+
explicit Router(SharedInterface* shared, const std::string& id, Listener* listener);
|
|
40
40
|
~Router() override;
|
|
41
41
|
|
|
42
42
|
public:
|
|
@@ -120,7 +120,7 @@ namespace RTC
|
|
|
120
120
|
|
|
121
121
|
private:
|
|
122
122
|
// Passed by argument.
|
|
123
|
-
|
|
123
|
+
SharedInterface* shared{ nullptr };
|
|
124
124
|
Listener* listener{ nullptr };
|
|
125
125
|
// Allocated by this.
|
|
126
126
|
absl::flat_hash_map<std::string, RTC::Transport*> mapTransports;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#ifndef MS_RTC_RTP_OBSERVER_HPP
|
|
2
2
|
#define MS_RTC_RTP_OBSERVER_HPP
|
|
3
3
|
|
|
4
|
+
#include "SharedInterface.hpp"
|
|
4
5
|
#include "RTC/Producer.hpp"
|
|
5
6
|
#include "RTC/RTP/Packet.hpp"
|
|
6
|
-
#include "RTC/Shared.hpp"
|
|
7
7
|
#include <string>
|
|
8
8
|
|
|
9
9
|
namespace RTC
|
|
@@ -25,7 +25,7 @@ namespace RTC
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
public:
|
|
28
|
-
RtpObserver(
|
|
28
|
+
RtpObserver(SharedInterface* shared, const std::string& id, RTC::RtpObserver::Listener* listener);
|
|
29
29
|
~RtpObserver() override;
|
|
30
30
|
|
|
31
31
|
public:
|
|
@@ -55,7 +55,7 @@ namespace RTC
|
|
|
55
55
|
|
|
56
56
|
protected:
|
|
57
57
|
// Passed by argument.
|
|
58
|
-
|
|
58
|
+
SharedInterface* shared{ nullptr };
|
|
59
59
|
|
|
60
60
|
private:
|
|
61
61
|
// Passed by argument.
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Related to mediasoup SCTP implementation
|
|
4
4
|
|
|
5
|
+
- `DataChunk`, IDataChunk`and`AnyDataChunk`: Add `SetUserData(UserData)`.
|
|
6
|
+
|
|
7
|
+
- Remove all default values of class memners in .hpp of all classes in case the constructor must give them initial value.
|
|
8
|
+
|
|
9
|
+
- Lot of stuff missing in `TransmissionControlBock` class and I forgot to add "TODO: SCTP" in them.
|
|
10
|
+
|
|
11
|
+
- dcsctp uses µs (webrtc::Timestamp::Micros()) internally, while mediasoup uses ms (`DepLibUV::GetTimeMs()`). When porting dcsctp timeout/duration logic, make sure to convert accordingly. Do not mix units in the same field.
|
|
12
|
+
|
|
5
13
|
- `Association`: When transitioning to CLOSED (due to failure while connecting or closure) we should emit a new event "stcpclosed" in all `DataProducers/Consumers`.
|
|
6
14
|
|
|
7
15
|
- When receiving SCTP RE-CONFIG, we should emit "streamclosed" in those `DataProducers/DataConsumers` whose stream ID have been closed.
|
|
@@ -19,6 +27,10 @@
|
|
|
19
27
|
- We must also remove `device.sctpCapabilities` getter from mediasoup-client because anyway we are making up those values!
|
|
20
28
|
- Also must update the website documentation.
|
|
21
29
|
|
|
30
|
+
- Replicate `retransmission_queue_test.cc` of dcsctp.
|
|
31
|
+
|
|
32
|
+
- When we invoke `close()` on a `DataProducer/Consumer` in server, we must end calling `sctpAssociation->ResetStream([streamId])` so it sends `ReConfig` to peer.
|
|
33
|
+
|
|
22
34
|
- In `transport.dump()` (maybe also in `getStats()`) we must properly obtain `OS` and `MIS` according to the number of SCTP streams negotiated via INIT + INIT_ACK. And if SCTP is not yet established, then... not sure.
|
|
23
35
|
- In `Association::FillBuffer()` we should not pass `this->sctpOptions.negotiatedMaxOutboundStreams/negotiatedMaxInboundStreams` but the current values.
|
|
24
36
|
|
|
@@ -34,10 +46,10 @@
|
|
|
34
46
|
|
|
35
47
|
- Look for "TODO: SCTP" everywhere.
|
|
36
48
|
|
|
37
|
-
- Test Chrome with I-DATA (message interleaving):
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
--
|
|
42
|
-
--
|
|
49
|
+
- Test Chrome/Canary with I-DATA (message interleaving):
|
|
50
|
+
```bash
|
|
51
|
+
/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary \
|
|
52
|
+
--force-fieldtrials="WebRTC-DataChannelMessageInterleaving/Enabled/" \
|
|
53
|
+
--enable-logging=stderr \
|
|
54
|
+
--v=1 \
|
|
43
55
|
```
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#define MS_RTC_SCTP_ASSOCIATION_HPP
|
|
3
3
|
|
|
4
4
|
#include "common.hpp"
|
|
5
|
+
#include "SharedInterface.hpp"
|
|
5
6
|
#include "RTC/SCTP/association/AssociationListenerDeferrer.hpp"
|
|
6
7
|
#include "RTC/SCTP/association/NegotiatedCapabilities.hpp"
|
|
7
8
|
#include "RTC/SCTP/association/PacketSender.hpp"
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
#include "RTC/SCTP/public/Message.hpp"
|
|
37
38
|
#include "RTC/SCTP/public/SctpOptions.hpp"
|
|
38
39
|
#include "RTC/SCTP/public/SctpTypes.hpp"
|
|
39
|
-
#include "handles/
|
|
40
|
+
#include "handles/BackoffTimerHandleInterface.hpp"
|
|
40
41
|
#include <FBS/sctpParameters.h>
|
|
41
42
|
#include <span>
|
|
42
43
|
#include <string_view>
|
|
@@ -51,7 +52,7 @@ namespace RTC
|
|
|
51
52
|
*/
|
|
52
53
|
class Association : public AssociationInterface,
|
|
53
54
|
public PacketSender::Listener,
|
|
54
|
-
public
|
|
55
|
+
public BackoffTimerHandleInterface::Listener
|
|
55
56
|
{
|
|
56
57
|
public:
|
|
57
58
|
/**
|
|
@@ -166,7 +167,8 @@ namespace RTC
|
|
|
166
167
|
};
|
|
167
168
|
|
|
168
169
|
public:
|
|
169
|
-
explicit Association(
|
|
170
|
+
explicit Association(
|
|
171
|
+
const SctpOptions& sctpOptions, AssociationListener* listener, SharedInterface* shared);
|
|
170
172
|
|
|
171
173
|
~Association() override;
|
|
172
174
|
|
|
@@ -460,9 +462,9 @@ namespace RTC
|
|
|
460
462
|
public:
|
|
461
463
|
void OnPacketSenderPacketSent(PacketSender* packetSender, const Packet* packet, bool sent) override;
|
|
462
464
|
|
|
463
|
-
/* Pure virtual methods inherited from
|
|
465
|
+
/* Pure virtual methods inherited from BackoffTimerHandleInterface::Listener. */
|
|
464
466
|
public:
|
|
465
|
-
void OnTimer(
|
|
467
|
+
void OnTimer(BackoffTimerHandleInterface* backoffTimer, uint64_t& baseTimeoutMs, bool& stop) override;
|
|
466
468
|
|
|
467
469
|
private:
|
|
468
470
|
// SCTP options given in the constructor.
|
|
@@ -470,6 +472,7 @@ namespace RTC
|
|
|
470
472
|
// Listener. It's not an `AssociationListener` but an
|
|
471
473
|
// `AssociationListenerDeferrer` which inherits from `AssociationListener`.
|
|
472
474
|
AssociationListenerDeferrer listener;
|
|
475
|
+
SharedInterface* shared;
|
|
473
476
|
// SCTP association internal state.
|
|
474
477
|
State state{ State::NEW };
|
|
475
478
|
// Packet sender.
|
|
@@ -487,11 +490,11 @@ namespace RTC
|
|
|
487
490
|
// Private metrics.
|
|
488
491
|
AssociationPrivateMetrics privateMetrics{};
|
|
489
492
|
// T1-init timer.
|
|
490
|
-
const std::unique_ptr<
|
|
493
|
+
const std::unique_ptr<BackoffTimerHandleInterface> t1InitTimer;
|
|
491
494
|
// T1-cookie timer.
|
|
492
|
-
const std::unique_ptr<
|
|
495
|
+
const std::unique_ptr<BackoffTimerHandleInterface> t1CookieTimer;
|
|
493
496
|
// T2-shutdown timer.
|
|
494
|
-
const std::unique_ptr<
|
|
497
|
+
const std::unique_ptr<BackoffTimerHandleInterface> t2ShutdownTimer;
|
|
495
498
|
};
|
|
496
499
|
} // namespace SCTP
|
|
497
500
|
} // namespace RTC
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
#define MS_RTC_SCTP_HEARTBEAT_HANDLER_HPP
|
|
3
3
|
|
|
4
4
|
#include "common.hpp"
|
|
5
|
+
#include "SharedInterface.hpp"
|
|
5
6
|
#include "RTC/SCTP/association/TCBContext.hpp"
|
|
6
7
|
#include "RTC/SCTP/packet/chunks/HeartbeatAckChunk.hpp"
|
|
7
8
|
#include "RTC/SCTP/packet/chunks/HeartbeatRequestChunk.hpp"
|
|
8
9
|
#include "RTC/SCTP/public/AssociationListener.hpp"
|
|
9
10
|
#include "RTC/SCTP/public/SctpOptions.hpp"
|
|
10
|
-
#include "handles/
|
|
11
|
+
#include "handles/BackoffTimerHandleInterface.hpp"
|
|
11
12
|
|
|
12
13
|
namespace RTC
|
|
13
14
|
{
|
|
@@ -21,12 +22,13 @@ namespace RTC
|
|
|
21
22
|
* still healthy and to measure the RTT. If a number of heartbeats time out,
|
|
22
23
|
* the connection will eventually be closed.
|
|
23
24
|
*/
|
|
24
|
-
class HeartbeatHandler : public
|
|
25
|
+
class HeartbeatHandler : public BackoffTimerHandleInterface::Listener
|
|
25
26
|
{
|
|
26
27
|
public:
|
|
27
28
|
HeartbeatHandler(
|
|
28
29
|
AssociationListener& associationListener,
|
|
29
30
|
const SctpOptions& sctpOptions,
|
|
31
|
+
SharedInterface* shared,
|
|
30
32
|
TCBContext* tcbContext);
|
|
31
33
|
|
|
32
34
|
~HeartbeatHandler() override;
|
|
@@ -55,21 +57,22 @@ namespace RTC
|
|
|
55
57
|
|
|
56
58
|
void OnTimeoutTimer(uint64_t& baseTimeoutMs, bool& stop);
|
|
57
59
|
|
|
58
|
-
/* Pure virtual methods inherited from
|
|
60
|
+
/* Pure virtual methods inherited from BackoffTimerHandleInterface::Listener. */
|
|
59
61
|
public:
|
|
60
|
-
void OnTimer(
|
|
62
|
+
void OnTimer(BackoffTimerHandleInterface* backoffTimer, uint64_t& baseTimeoutMs, bool& stop) override;
|
|
61
63
|
|
|
62
64
|
private:
|
|
63
65
|
AssociationListener& associationListener;
|
|
64
66
|
const SctpOptions sctpOptions;
|
|
67
|
+
SharedInterface* shared;
|
|
65
68
|
TCBContext* tcbContext{ nullptr };
|
|
66
69
|
// The time for a connection to be idle before a heartbeat is sent.
|
|
67
70
|
const uint64_t intervalDurationMs{ 0 };
|
|
68
71
|
// Adding RTT to the duration will add some jitter, which is good in
|
|
69
72
|
// production, but less good in unit tests, which is why it can be disabled.
|
|
70
73
|
const bool intervalDurationShouldIncludeRtt{ false };
|
|
71
|
-
const std::unique_ptr<
|
|
72
|
-
const std::unique_ptr<
|
|
74
|
+
const std::unique_ptr<BackoffTimerHandleInterface> intervalTimer;
|
|
75
|
+
const std::unique_ptr<BackoffTimerHandleInterface> timeoutTimer;
|
|
73
76
|
};
|
|
74
77
|
} // namespace SCTP
|
|
75
78
|
} // namespace RTC
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#define MS_RTC_SCTP_STREAM_RESET_HANDLER_HPP
|
|
3
3
|
|
|
4
4
|
#include "common.hpp"
|
|
5
|
+
#include "SharedInterface.hpp"
|
|
5
6
|
#include "RTC/SCTP/association/TCBContext.hpp"
|
|
6
7
|
#include "RTC/SCTP/common/UnwrappedSequenceNumber.hpp"
|
|
7
8
|
#include "RTC/SCTP/packet/Packet.hpp"
|
|
@@ -10,7 +11,8 @@
|
|
|
10
11
|
#include "RTC/SCTP/packet/parameters/OutgoingSsnResetRequestParameter.hpp"
|
|
11
12
|
#include "RTC/SCTP/packet/parameters/ReconfigurationResponseParameter.hpp"
|
|
12
13
|
#include "RTC/SCTP/public/AssociationListener.hpp"
|
|
13
|
-
#include "
|
|
14
|
+
#include "RTC/SCTP/tx/RetransmissionQueue.hpp"
|
|
15
|
+
#include "handles/BackoffTimerHandleInterface.hpp"
|
|
14
16
|
#include <span>
|
|
15
17
|
#include <vector>
|
|
16
18
|
|
|
@@ -49,7 +51,7 @@ namespace RTC
|
|
|
49
51
|
* not-yet-sent messages will be discarded, but that may change in the future.
|
|
50
52
|
* RFC8831 allows both behaviors.
|
|
51
53
|
*/
|
|
52
|
-
class StreamResetHandler : public
|
|
54
|
+
class StreamResetHandler : public BackoffTimerHandleInterface::Listener
|
|
53
55
|
{
|
|
54
56
|
private:
|
|
55
57
|
enum class ReqSeqNbrValidationResult : uint8_t
|
|
@@ -164,12 +166,13 @@ namespace RTC
|
|
|
164
166
|
|
|
165
167
|
public:
|
|
166
168
|
StreamResetHandler(
|
|
167
|
-
AssociationListener& associationListener,
|
|
169
|
+
AssociationListener& associationListener,
|
|
170
|
+
SharedInterface* shared,
|
|
171
|
+
TCBContext* tcbContext,
|
|
168
172
|
// TODO: SCTP: Implement
|
|
169
173
|
// DataTracker* dataTracker,
|
|
170
174
|
// ReassemblyQueue* reassemblyQueue,
|
|
171
|
-
|
|
172
|
-
);
|
|
175
|
+
RetransmissionQueue* retransmissionQueue);
|
|
173
176
|
|
|
174
177
|
~StreamResetHandler() override;
|
|
175
178
|
|
|
@@ -183,6 +186,23 @@ namespace RTC
|
|
|
183
186
|
*/
|
|
184
187
|
void ResetStreams(std::span<const uint16_t> outgoingStreamIds);
|
|
185
188
|
|
|
189
|
+
/**
|
|
190
|
+
* Whether a Reset Streams request should be send. Will return `false` if
|
|
191
|
+
* there is no need to create a request (no streams to reset) or if there
|
|
192
|
+
* already is an ongoing stream reset request that hasn't completed yet.
|
|
193
|
+
*/
|
|
194
|
+
bool ShouldCreateStreamResetRequest() const;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Creates a Reset Streams request that must be sent if returned. Will
|
|
198
|
+
* start the reconfig timer.
|
|
199
|
+
*
|
|
200
|
+
* @remarks
|
|
201
|
+
* - The caller must check `ShouldCreateStreamResetRequest()` first and
|
|
202
|
+
* only invoke this method if the former returns `true`.
|
|
203
|
+
*/
|
|
204
|
+
void CreateStreamResetRequest(Packet* packet);
|
|
205
|
+
|
|
186
206
|
/**
|
|
187
207
|
* Called when handling and incoming RE-CONFIG chunk. Processes a stream
|
|
188
208
|
* reconfiguration chunk and may send a RE-CONFIG back to the peer with
|
|
@@ -197,18 +217,10 @@ namespace RTC
|
|
|
197
217
|
bool ValidateReceivedReConfigChunk(const ReConfigChunk* receivedReConfigChunk);
|
|
198
218
|
|
|
199
219
|
/**
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* to create a request (no streams to reset) or if there already is an
|
|
203
|
-
* ongoing stream reset request that hasn't completed yet.
|
|
204
|
-
*/
|
|
205
|
-
ReConfigChunk* CreateStreamResetRequest();
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Creates the actual RE-CONFIG chunk. A request (which set
|
|
209
|
-
* `currentRequest`) must have been created prior.
|
|
220
|
+
* Adds the actual RE-CONFIG chunk to the given Packet. A request (which
|
|
221
|
+
* set `this->currentRequest`) must have been created prior.
|
|
210
222
|
*/
|
|
211
|
-
|
|
223
|
+
void CreateReConfigChunk(Packet* packet);
|
|
212
224
|
|
|
213
225
|
/**
|
|
214
226
|
* Called to validate the `reqSeqNbr`, that it's the next in sequence.
|
|
@@ -244,19 +256,21 @@ namespace RTC
|
|
|
244
256
|
|
|
245
257
|
void OnReConfigTimer(uint64_t& baseTimeoutMs, bool& stop);
|
|
246
258
|
|
|
247
|
-
/* Pure virtual methods inherited from
|
|
259
|
+
/* Pure virtual methods inherited from BackoffTimerHandleInterface::Listener. */
|
|
248
260
|
public:
|
|
249
|
-
void OnTimer(
|
|
261
|
+
void OnTimer(BackoffTimerHandleInterface* backoffTimer, uint64_t& baseTimeoutMs, bool& stop) override;
|
|
250
262
|
|
|
251
263
|
private:
|
|
252
264
|
AssociationListener& associationListener;
|
|
253
|
-
|
|
265
|
+
SharedInterface* shared;
|
|
266
|
+
TCBContext* tcbContext;
|
|
267
|
+
// TODO: SCTP: Implement
|
|
268
|
+
// DataTracker* dataTracker;,
|
|
254
269
|
// TODO: SCTP: Implement
|
|
255
|
-
//
|
|
256
|
-
|
|
257
|
-
// RetransmissionQueue* retransmissionQueue{ nullptr };
|
|
270
|
+
// ReassemblyQueue* reassemblyQueue;,
|
|
271
|
+
RetransmissionQueue* retransmissionQueue;
|
|
258
272
|
UnwrappedReConfigRequestSn::Unwrapper incomingReConfigRequestSnUnwrapper;
|
|
259
|
-
const std::unique_ptr<
|
|
273
|
+
const std::unique_ptr<BackoffTimerHandleInterface> reConfigTimer;
|
|
260
274
|
// The next sequence number for outgoing stream requests.
|
|
261
275
|
uint32_t nextOutgoingReqSeqNbr{ 0 };
|
|
262
276
|
// The current stream request operation.
|
|
@@ -32,9 +32,10 @@ namespace RTC
|
|
|
32
32
|
virtual uint32_t GetRemoteInitialTsn() const = 0;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* To be called when a RTT has been measured, to update the RTO
|
|
35
|
+
* To be called when a RTT (ms) has been measured, to update the RTO
|
|
36
|
+
* value.
|
|
36
37
|
*/
|
|
37
|
-
virtual void
|
|
38
|
+
virtual void ObserveRttMs(uint64_t rttMs) = 0;
|
|
38
39
|
|
|
39
40
|
/**
|
|
40
41
|
* Returns the Retransmission Timeout (RTO) value.
|