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
|
@@ -34,15 +34,15 @@ SCENARIO("SCTP RetransmissionTimeout", "[sctp][retransmissiontimeout]")
|
|
|
34
34
|
{
|
|
35
35
|
RTC::SCTP::RetransmissionTimeout rto(makeSctpOptions());
|
|
36
36
|
|
|
37
|
-
rto.
|
|
37
|
+
rto.ObserveRttMs(MaxRttMs + 100);
|
|
38
38
|
|
|
39
39
|
REQUIRE(rto.GetRtoMs() == InitialRtoMs);
|
|
40
40
|
|
|
41
|
-
rto.
|
|
41
|
+
rto.ObserveRttMs(124);
|
|
42
42
|
|
|
43
43
|
REQUIRE(rto.GetRtoMs() == 372);
|
|
44
44
|
|
|
45
|
-
rto.
|
|
45
|
+
rto.ObserveRttMs(MaxRttMs + 100);
|
|
46
46
|
|
|
47
47
|
REQUIRE(rto.GetRtoMs() == 372);
|
|
48
48
|
}
|
|
@@ -53,7 +53,7 @@ SCENARIO("SCTP RetransmissionTimeout", "[sctp][retransmissiontimeout]")
|
|
|
53
53
|
|
|
54
54
|
for (int i{ 0 }; i < 1000; ++i)
|
|
55
55
|
{
|
|
56
|
-
rto.
|
|
56
|
+
rto.ObserveRttMs(1);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
REQUIRE(rto.GetRtoMs() <= MinRtoMs);
|
|
@@ -65,9 +65,9 @@ SCENARIO("SCTP RetransmissionTimeout", "[sctp][retransmissiontimeout]")
|
|
|
65
65
|
|
|
66
66
|
for (int i{ 0 }; i < 1000; ++i)
|
|
67
67
|
{
|
|
68
|
-
rto.
|
|
68
|
+
rto.ObserveRttMs(MaxRttMs - 1);
|
|
69
69
|
// Adding jitter, which would make it RTO be well above RTT.
|
|
70
|
-
rto.
|
|
70
|
+
rto.ObserveRttMs(MaxRttMs - 100);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
REQUIRE(rto.GetRtoMs() >= MaxRtoMs);
|
|
@@ -77,26 +77,26 @@ SCENARIO("SCTP RetransmissionTimeout", "[sctp][retransmissiontimeout]")
|
|
|
77
77
|
{
|
|
78
78
|
RTC::SCTP::RetransmissionTimeout rto(makeSctpOptions());
|
|
79
79
|
|
|
80
|
-
rto.
|
|
80
|
+
rto.ObserveRttMs(124);
|
|
81
81
|
|
|
82
82
|
REQUIRE(rto.GetRtoMs() == 372);
|
|
83
83
|
|
|
84
|
-
rto.
|
|
84
|
+
rto.ObserveRttMs(128);
|
|
85
85
|
|
|
86
86
|
REQUIRE(rto.GetRtoMs() == 315);
|
|
87
87
|
|
|
88
|
-
rto.
|
|
88
|
+
rto.ObserveRttMs(123);
|
|
89
89
|
|
|
90
90
|
REQUIRE(rto.GetRtoMs() == 268);
|
|
91
91
|
|
|
92
|
-
rto.
|
|
92
|
+
rto.ObserveRttMs(125);
|
|
93
93
|
|
|
94
94
|
// NOTE: This should be 234 (as per same test in libwebrtc) but we are not
|
|
95
95
|
// that precise.
|
|
96
96
|
// REQUIRE(rto.GetRtoMs() == 234);
|
|
97
97
|
REQUIRE(rto.GetRtoMs() == 233);
|
|
98
98
|
|
|
99
|
-
rto.
|
|
99
|
+
rto.ObserveRttMs(127);
|
|
100
100
|
|
|
101
101
|
// NOTE: This should be 235 (as per same test in libwebrtc) but we are not
|
|
102
102
|
// that precise.
|
|
@@ -108,23 +108,23 @@ SCENARIO("SCTP RetransmissionTimeout", "[sctp][retransmissiontimeout]")
|
|
|
108
108
|
{
|
|
109
109
|
RTC::SCTP::RetransmissionTimeout rto(makeSctpOptions());
|
|
110
110
|
|
|
111
|
-
rto.
|
|
111
|
+
rto.ObserveRttMs(124);
|
|
112
112
|
|
|
113
113
|
REQUIRE(rto.GetRtoMs() == 372);
|
|
114
114
|
|
|
115
|
-
rto.
|
|
115
|
+
rto.ObserveRttMs(402);
|
|
116
116
|
|
|
117
117
|
REQUIRE(rto.GetRtoMs() == 623);
|
|
118
118
|
|
|
119
|
-
rto.
|
|
119
|
+
rto.ObserveRttMs(728);
|
|
120
120
|
|
|
121
121
|
REQUIRE(rto.GetRtoMs() == 800);
|
|
122
122
|
|
|
123
|
-
rto.
|
|
123
|
+
rto.ObserveRttMs(89);
|
|
124
124
|
|
|
125
125
|
REQUIRE(rto.GetRtoMs() == 800);
|
|
126
126
|
|
|
127
|
-
rto.
|
|
127
|
+
rto.ObserveRttMs(126);
|
|
128
128
|
|
|
129
129
|
REQUIRE(rto.GetRtoMs() == 800);
|
|
130
130
|
}
|
|
@@ -133,47 +133,47 @@ SCENARIO("SCTP RetransmissionTimeout", "[sctp][retransmissiontimeout]")
|
|
|
133
133
|
{
|
|
134
134
|
RTC::SCTP::RetransmissionTimeout rto(makeSctpOptions());
|
|
135
135
|
|
|
136
|
-
rto.
|
|
137
|
-
rto.
|
|
138
|
-
rto.
|
|
139
|
-
rto.
|
|
140
|
-
rto.
|
|
136
|
+
rto.ObserveRttMs(124);
|
|
137
|
+
rto.ObserveRttMs(402);
|
|
138
|
+
rto.ObserveRttMs(728);
|
|
139
|
+
rto.ObserveRttMs(89);
|
|
140
|
+
rto.ObserveRttMs(126);
|
|
141
141
|
|
|
142
142
|
REQUIRE(rto.GetRtoMs() == 800);
|
|
143
143
|
|
|
144
|
-
rto.
|
|
144
|
+
rto.ObserveRttMs(124);
|
|
145
145
|
|
|
146
146
|
REQUIRE(rto.GetRtoMs() == 800);
|
|
147
147
|
|
|
148
|
-
rto.
|
|
148
|
+
rto.ObserveRttMs(122);
|
|
149
149
|
|
|
150
150
|
REQUIRE(rto.GetRtoMs() == 709);
|
|
151
151
|
|
|
152
|
-
rto.
|
|
152
|
+
rto.ObserveRttMs(123);
|
|
153
153
|
|
|
154
154
|
REQUIRE(rto.GetRtoMs() == 630);
|
|
155
155
|
|
|
156
|
-
rto.
|
|
156
|
+
rto.ObserveRttMs(124);
|
|
157
157
|
|
|
158
158
|
REQUIRE(rto.GetRtoMs() == 562);
|
|
159
159
|
|
|
160
|
-
rto.
|
|
160
|
+
rto.ObserveRttMs(122);
|
|
161
161
|
|
|
162
162
|
REQUIRE(rto.GetRtoMs() == 505);
|
|
163
163
|
|
|
164
|
-
rto.
|
|
164
|
+
rto.ObserveRttMs(124);
|
|
165
165
|
|
|
166
166
|
REQUIRE(rto.GetRtoMs() == 454);
|
|
167
167
|
|
|
168
|
-
rto.
|
|
168
|
+
rto.ObserveRttMs(124);
|
|
169
169
|
|
|
170
170
|
REQUIRE(rto.GetRtoMs() == 410);
|
|
171
171
|
|
|
172
|
-
rto.
|
|
172
|
+
rto.ObserveRttMs(124);
|
|
173
173
|
|
|
174
174
|
REQUIRE(rto.GetRtoMs() == 372);
|
|
175
175
|
|
|
176
|
-
rto.
|
|
176
|
+
rto.ObserveRttMs(124);
|
|
177
177
|
|
|
178
178
|
REQUIRE(rto.GetRtoMs() == 340);
|
|
179
179
|
}
|
|
@@ -190,7 +190,7 @@ SCENARIO("SCTP RetransmissionTimeout", "[sctp][retransmissiontimeout]")
|
|
|
190
190
|
|
|
191
191
|
for (int i{ 0 }; i < 1000; ++i)
|
|
192
192
|
{
|
|
193
|
-
rto.
|
|
193
|
+
rto.ObserveRttMs(124);
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
// NOTE: This should be 234 (as per same test in libwebrtc) but we are not
|
|
@@ -209,7 +209,7 @@ SCENARIO("SCTP RetransmissionTimeout", "[sctp][retransmissiontimeout]")
|
|
|
209
209
|
|
|
210
210
|
for (int i{ 0 }; i < 1000; ++i)
|
|
211
211
|
{
|
|
212
|
-
rto.
|
|
212
|
+
rto.ObserveRttMs(124);
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
REQUIRE(rto.GetRtoMs() == 184);
|
|
@@ -225,7 +225,7 @@ SCENARIO("SCTP RetransmissionTimeout", "[sctp][retransmissiontimeout]")
|
|
|
225
225
|
|
|
226
226
|
for (int i{ 0 }; i < 1000; ++i)
|
|
227
227
|
{
|
|
228
|
-
rto.
|
|
228
|
+
rto.ObserveRttMs(124);
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
REQUIRE(rto.GetRtoMs() == 284);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#include "common.hpp"
|
|
2
2
|
#include "DepLibUV.hpp"
|
|
3
|
+
#include "mocks/include/MockShared.hpp"
|
|
3
4
|
#include "RTC/KeyFrameRequestManager.hpp"
|
|
4
5
|
#include <catch2/catch_test_macros.hpp>
|
|
6
|
+
#include <memory>
|
|
5
7
|
|
|
6
8
|
SCENARIO("KeyFrameRequestManager", "[rtp][keyframe]")
|
|
7
9
|
{
|
|
@@ -22,12 +24,14 @@ SCENARIO("KeyFrameRequestManager", "[rtp][keyframe]")
|
|
|
22
24
|
size_t onKeyFrameNeededTimesCalled{ 0 };
|
|
23
25
|
};
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
TestKeyFrameRequestManagerListener listener;
|
|
28
|
+
mocks::MockShared shared;
|
|
26
29
|
|
|
27
30
|
SECTION("key frame requested once, not received on time")
|
|
28
31
|
{
|
|
29
32
|
listener.Reset();
|
|
30
|
-
RTC::KeyFrameRequestManager keyFrameRequestManager(
|
|
33
|
+
RTC::KeyFrameRequestManager keyFrameRequestManager(
|
|
34
|
+
std::addressof(listener), std::addressof(shared), 1000);
|
|
31
35
|
|
|
32
36
|
keyFrameRequestManager.KeyFrameNeeded(1111);
|
|
33
37
|
|
|
@@ -40,7 +44,8 @@ SCENARIO("KeyFrameRequestManager", "[rtp][keyframe]")
|
|
|
40
44
|
SECTION("key frame requested many times, not received on time")
|
|
41
45
|
{
|
|
42
46
|
listener.Reset();
|
|
43
|
-
RTC::KeyFrameRequestManager keyFrameRequestManager(
|
|
47
|
+
RTC::KeyFrameRequestManager keyFrameRequestManager(
|
|
48
|
+
std::addressof(listener), std::addressof(shared), 500);
|
|
44
49
|
|
|
45
50
|
keyFrameRequestManager.KeyFrameNeeded(1111);
|
|
46
51
|
keyFrameRequestManager.KeyFrameNeeded(1111);
|
|
@@ -56,7 +61,8 @@ SCENARIO("KeyFrameRequestManager", "[rtp][keyframe]")
|
|
|
56
61
|
SECTION("key frame is received on time")
|
|
57
62
|
{
|
|
58
63
|
listener.Reset();
|
|
59
|
-
RTC::KeyFrameRequestManager keyFrameRequestManager(
|
|
64
|
+
RTC::KeyFrameRequestManager keyFrameRequestManager(
|
|
65
|
+
std::addressof(listener), std::addressof(shared), 500);
|
|
60
66
|
|
|
61
67
|
keyFrameRequestManager.KeyFrameNeeded(1111);
|
|
62
68
|
keyFrameRequestManager.KeyFrameReceived(1111);
|
|
@@ -70,7 +76,8 @@ SCENARIO("KeyFrameRequestManager", "[rtp][keyframe]")
|
|
|
70
76
|
SECTION("key frame is forced, no received on time")
|
|
71
77
|
{
|
|
72
78
|
listener.Reset();
|
|
73
|
-
RTC::KeyFrameRequestManager keyFrameRequestManager(
|
|
79
|
+
RTC::KeyFrameRequestManager keyFrameRequestManager(
|
|
80
|
+
std::addressof(listener), std::addressof(shared), 500);
|
|
74
81
|
|
|
75
82
|
keyFrameRequestManager.KeyFrameNeeded(1111);
|
|
76
83
|
keyFrameRequestManager.ForceKeyFrameNeeded(1111);
|
|
@@ -84,7 +91,8 @@ SCENARIO("KeyFrameRequestManager", "[rtp][keyframe]")
|
|
|
84
91
|
SECTION("key frame is forced, received on time")
|
|
85
92
|
{
|
|
86
93
|
listener.Reset();
|
|
87
|
-
RTC::KeyFrameRequestManager keyFrameRequestManager(
|
|
94
|
+
RTC::KeyFrameRequestManager keyFrameRequestManager(
|
|
95
|
+
std::addressof(listener), std::addressof(shared), 500);
|
|
88
96
|
|
|
89
97
|
keyFrameRequestManager.KeyFrameNeeded(1111);
|
|
90
98
|
keyFrameRequestManager.ForceKeyFrameNeeded(1111);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#include "common.hpp"
|
|
2
2
|
#include "DepLibUV.hpp"
|
|
3
|
+
#include "mocks/include/MockShared.hpp"
|
|
3
4
|
#include "RTC/NackGenerator.hpp"
|
|
4
5
|
#include "RTC/RTP/Codecs/PayloadDescriptorHandler.hpp"
|
|
5
6
|
#include "RTC/RTP/Packet.hpp"
|
|
@@ -126,11 +127,14 @@ SCENARIO("NACK generator", "[rtp][rtcp][nack]")
|
|
|
126
127
|
bool keyFrameRequiredTriggered{ false };
|
|
127
128
|
};
|
|
128
129
|
|
|
130
|
+
mocks::MockShared shared;
|
|
131
|
+
|
|
129
132
|
auto validate =
|
|
130
|
-
[](std::unique_ptr<RTC::RTP::Packet>& packet, std::vector<TestNackGeneratorInput>& inputs)
|
|
133
|
+
[&shared](std::unique_ptr<RTC::RTP::Packet>& packet, std::vector<TestNackGeneratorInput>& inputs)
|
|
131
134
|
{
|
|
132
135
|
TestNackGeneratorListener listener;
|
|
133
|
-
auto nackGenerator =
|
|
136
|
+
auto nackGenerator =
|
|
137
|
+
RTC::NackGenerator(std::addressof(listener), std::addressof(shared), SendNackDelay);
|
|
134
138
|
|
|
135
139
|
for (auto input : inputs)
|
|
136
140
|
{
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#include "flatbuffers/buffer.h"
|
|
2
|
-
#include "
|
|
3
|
-
#include "Channel/ChannelSocket.hpp"
|
|
2
|
+
#include "mocks/include/MockShared.hpp"
|
|
4
3
|
#include "FBS/rtpParameters.h"
|
|
5
4
|
#include "FBS/transport.h"
|
|
6
5
|
#include "RTC/RTP/Packet.hpp"
|
|
@@ -8,18 +7,14 @@
|
|
|
8
7
|
#include "RTC/RTP/RtpStreamRecv.hpp"
|
|
9
8
|
#include "RTC/RTP/SharedPacket.hpp"
|
|
10
9
|
#include "RTC/RtpDictionaries.hpp"
|
|
11
|
-
#include "RTC/Shared.hpp"
|
|
12
10
|
#include "RTC/SimpleConsumer.hpp"
|
|
13
11
|
#include <catch2/catch_test_macros.hpp>
|
|
14
12
|
|
|
15
13
|
namespace
|
|
16
14
|
{
|
|
17
15
|
// NOLINTBEGIN(readability-identifier-naming)
|
|
18
|
-
const uint8_t payloadType
|
|
19
|
-
|
|
20
|
-
auto* channelSocket = new Channel::ChannelSocket();
|
|
21
|
-
auto* channelNotifier = new Channel::ChannelNotifier(channelSocket);
|
|
22
|
-
auto shared = RTC::Shared(channelMessageRegistrator, channelNotifier);
|
|
16
|
+
const uint8_t payloadType = 111;
|
|
17
|
+
mocks::MockShared shared;
|
|
23
18
|
// NOLINTEND(readability-identifier-naming)
|
|
24
19
|
|
|
25
20
|
class RtpStreamRecvListener : public RTC::RTP::RtpStreamRecv::Listener
|
|
@@ -142,7 +137,7 @@ namespace
|
|
|
142
137
|
const auto* consumeRequest = flatbuffers::GetRoot<FBS::Transport::ConsumeRequest>(buf);
|
|
143
138
|
|
|
144
139
|
return std::make_unique<RTC::SimpleConsumer>(
|
|
145
|
-
|
|
140
|
+
std::addressof(shared),
|
|
146
141
|
consumeRequest->consumerId()->str(),
|
|
147
142
|
consumeRequest->producerId()->str(),
|
|
148
143
|
listener,
|
|
@@ -154,7 +149,8 @@ namespace
|
|
|
154
149
|
RtpStreamRecvListener streamRecvListener;
|
|
155
150
|
RTC::RTP::RtpStream::Params params;
|
|
156
151
|
|
|
157
|
-
return std::make_unique<RTC::RTP::RtpStreamRecv>(
|
|
152
|
+
return std::make_unique<RTC::RTP::RtpStreamRecv>(
|
|
153
|
+
&streamRecvListener, std::addressof(shared), params, 0u, false);
|
|
158
154
|
}
|
|
159
155
|
|
|
160
156
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#include "common.hpp"
|
|
2
2
|
#include "DepLibUV.hpp"
|
|
3
|
+
#include "mocks/include/MockShared.hpp"
|
|
3
4
|
#include "RTC/Consts.hpp"
|
|
4
5
|
#include "RTC/RTP/HeaderExtensionIds.hpp"
|
|
5
6
|
#include "RTC/RTP/Packet.hpp"
|
|
@@ -77,6 +78,8 @@ SCENARIO("TransportCongestionControlServer", "[rtp]")
|
|
|
77
78
|
TestResults results;
|
|
78
79
|
};
|
|
79
80
|
|
|
81
|
+
mocks::MockShared shared;
|
|
82
|
+
|
|
80
83
|
// clang-format off
|
|
81
84
|
alignas(4) uint8_t buffer[] =
|
|
82
85
|
{
|
|
@@ -89,11 +92,15 @@ SCENARIO("TransportCongestionControlServer", "[rtp]")
|
|
|
89
92
|
// clang-format on
|
|
90
93
|
|
|
91
94
|
auto validate =
|
|
92
|
-
[&buffer
|
|
95
|
+
[&buffer,
|
|
96
|
+
&shared](std::vector<TestTransportCongestionControlServerInput>& inputs, TestResults& results)
|
|
93
97
|
{
|
|
94
98
|
TestTransportCongestionControlServerListener listener;
|
|
95
99
|
auto tccServer = RTC::TransportCongestionControlServer(
|
|
96
|
-
|
|
100
|
+
std::addressof(listener),
|
|
101
|
+
std::addressof(shared),
|
|
102
|
+
RTC::BweType::TRANSPORT_CC,
|
|
103
|
+
RTC::Consts::MtuSize);
|
|
97
104
|
|
|
98
105
|
tccServer.SetMaxIncomingBitrate(150000);
|
|
99
106
|
tccServer.TransportConnected();
|
|
@@ -335,6 +335,104 @@ SCENARIO("Utils::Byte", "[utils][byte]")
|
|
|
335
335
|
#endif
|
|
336
336
|
}
|
|
337
337
|
|
|
338
|
+
SECTION("PadDownTo4Bytes()")
|
|
339
|
+
{
|
|
340
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint8_t{ 0u }) == 0u);
|
|
341
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint8_t{ 1u }) == 0u);
|
|
342
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint8_t{ 2u }) == 0u);
|
|
343
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint8_t{ 3u }) == 0u);
|
|
344
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint8_t{ 4u }) == 4u);
|
|
345
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint8_t{ 5u }) == 4u);
|
|
346
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint8_t{ 8u }) == 8u);
|
|
347
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint8_t{ 9u }) == 8u);
|
|
348
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint8_t{ 15u }) == 12u);
|
|
349
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint8_t{ 252u }) == 252u);
|
|
350
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint8_t{ 254u }) == 252u);
|
|
351
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint8_t{ 255u }) == 252u);
|
|
352
|
+
|
|
353
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint16_t{ 0u }) == 0u);
|
|
354
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint16_t{ 1u }) == 0u);
|
|
355
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint16_t{ 2u }) == 0u);
|
|
356
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint16_t{ 3u }) == 0u);
|
|
357
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint16_t{ 4u }) == 4u);
|
|
358
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint16_t{ 5u }) == 4u);
|
|
359
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint16_t{ 8u }) == 8u);
|
|
360
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint16_t{ 9u }) == 8u);
|
|
361
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint16_t{ 15u }) == 12u);
|
|
362
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint16_t{ 252u }) == 252u);
|
|
363
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint16_t{ 254u }) == 252u);
|
|
364
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint16_t{ 255u }) == 252u);
|
|
365
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint16_t{ 256u }) == 256u);
|
|
366
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint16_t{ 65532u }) == 65532u);
|
|
367
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint16_t{ 65535u }) == 65532u);
|
|
368
|
+
|
|
369
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 0u }) == 0u);
|
|
370
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 1u }) == 0u);
|
|
371
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 2u }) == 0u);
|
|
372
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 3u }) == 0u);
|
|
373
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 4u }) == 4u);
|
|
374
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 5u }) == 4u);
|
|
375
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 8u }) == 8u);
|
|
376
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 9u }) == 8u);
|
|
377
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 15u }) == 12u);
|
|
378
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 252u }) == 252u);
|
|
379
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 254u }) == 252u);
|
|
380
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 255u }) == 252u);
|
|
381
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 256u }) == 256u);
|
|
382
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 65532u }) == 65532u);
|
|
383
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 65535u }) == 65532u);
|
|
384
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 4294967288u }) == 4294967288u);
|
|
385
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 4294967292u }) == 4294967292u);
|
|
386
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint32_t{ 4294967295u }) == 4294967292u);
|
|
387
|
+
|
|
388
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 0u }) == 0u);
|
|
389
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 1u }) == 0u);
|
|
390
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 2u }) == 0u);
|
|
391
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 3u }) == 0u);
|
|
392
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 4u }) == 4u);
|
|
393
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 5u }) == 4u);
|
|
394
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 8u }) == 8u);
|
|
395
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 9u }) == 8u);
|
|
396
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 15u }) == 12u);
|
|
397
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 252u }) == 252u);
|
|
398
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 254u }) == 252u);
|
|
399
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 255u }) == 252u);
|
|
400
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 256u }) == 256u);
|
|
401
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 65532u }) == 65532u);
|
|
402
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 65535u }) == 65532u);
|
|
403
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 4294967288u }) == 4294967288u);
|
|
404
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 4294967292u }) == 4294967292u);
|
|
405
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 4294967295u }) == 4294967292u);
|
|
406
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 18446744073709551608u }) == 18446744073709551608u);
|
|
407
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 18446744073709551612u }) == 18446744073709551612u);
|
|
408
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(uint64_t{ 18446744073709551615u }) == 18446744073709551612u);
|
|
409
|
+
|
|
410
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 0u }) == 0u);
|
|
411
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 1u }) == 0u);
|
|
412
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 2u }) == 0u);
|
|
413
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 3u }) == 0u);
|
|
414
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 4u }) == 4u);
|
|
415
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 5u }) == 4u);
|
|
416
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 8u }) == 8u);
|
|
417
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 9u }) == 8u);
|
|
418
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 15u }) == 12u);
|
|
419
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 252u }) == 252u);
|
|
420
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 254u }) == 252u);
|
|
421
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 255u }) == 252u);
|
|
422
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 256u }) == 256u);
|
|
423
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 65532u }) == 65532u);
|
|
424
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 65535u }) == 65532u);
|
|
425
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 4294967288u }) == 4294967288u);
|
|
426
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 4294967292u }) == 4294967292u);
|
|
427
|
+
|
|
428
|
+
// Check if size_t in current host is 64 bits. Otherwise the test would fail.
|
|
429
|
+
#if SIZE_MAX == 0xFFFFFFFFFFFFFFFFu
|
|
430
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 18446744073709551608u }) == 18446744073709551608u);
|
|
431
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 18446744073709551612u }) == 18446744073709551612u);
|
|
432
|
+
REQUIRE(Utils::Byte::PadDownTo4Bytes(size_t{ 18446744073709551615u }) == 18446744073709551612u);
|
|
433
|
+
#endif
|
|
434
|
+
}
|
|
435
|
+
|
|
338
436
|
SECTION("PadTo8Bytes()")
|
|
339
437
|
{
|
|
340
438
|
REQUIRE(Utils::Byte::PadTo8Bytes(uint8_t{ 0u }) == 0u);
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#ifndef MS_CHANNEL_MESSAGE_REGISTRATOR_HPP
|
|
2
|
-
#define MS_CHANNEL_MESSAGE_REGISTRATOR_HPP
|
|
3
|
-
|
|
4
|
-
#include "Channel/ChannelSocket.hpp"
|
|
5
|
-
#include <absl/container/flat_hash_map.h>
|
|
6
|
-
#include <string>
|
|
7
|
-
|
|
8
|
-
class ChannelMessageRegistrator
|
|
9
|
-
{
|
|
10
|
-
public:
|
|
11
|
-
explicit ChannelMessageRegistrator();
|
|
12
|
-
~ChannelMessageRegistrator();
|
|
13
|
-
|
|
14
|
-
public:
|
|
15
|
-
flatbuffers::Offset<FBS::Worker::ChannelMessageHandlers> FillBuffer(
|
|
16
|
-
flatbuffers::FlatBufferBuilder& builder);
|
|
17
|
-
void RegisterHandler(
|
|
18
|
-
const std::string& id,
|
|
19
|
-
Channel::ChannelSocket::RequestHandler* channelRequestHandler,
|
|
20
|
-
Channel::ChannelSocket::NotificationHandler* channelNotificationHandler);
|
|
21
|
-
void UnregisterHandler(const std::string& id);
|
|
22
|
-
Channel::ChannelSocket::RequestHandler* GetChannelRequestHandler(const std::string& id);
|
|
23
|
-
Channel::ChannelSocket::NotificationHandler* GetChannelNotificationHandler(const std::string& id);
|
|
24
|
-
|
|
25
|
-
private:
|
|
26
|
-
absl::flat_hash_map<std::string, Channel::ChannelSocket::RequestHandler*> mapChannelRequestHandlers;
|
|
27
|
-
absl::flat_hash_map<std::string, Channel::ChannelSocket::NotificationHandler*> mapChannelNotificationHandlers;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
#endif
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#ifndef MS_RTC_SHARED_HPP
|
|
2
|
-
#define MS_RTC_SHARED_HPP
|
|
3
|
-
|
|
4
|
-
#include "ChannelMessageRegistrator.hpp"
|
|
5
|
-
#include "Channel/ChannelNotifier.hpp"
|
|
6
|
-
|
|
7
|
-
namespace RTC
|
|
8
|
-
{
|
|
9
|
-
class Shared
|
|
10
|
-
{
|
|
11
|
-
public:
|
|
12
|
-
explicit Shared(
|
|
13
|
-
ChannelMessageRegistrator* channelMessageRegistrator,
|
|
14
|
-
Channel::ChannelNotifier* channelNotifier);
|
|
15
|
-
~Shared();
|
|
16
|
-
|
|
17
|
-
public:
|
|
18
|
-
ChannelMessageRegistrator* channelMessageRegistrator{ nullptr };
|
|
19
|
-
Channel::ChannelNotifier* channelNotifier{ nullptr };
|
|
20
|
-
};
|
|
21
|
-
} // namespace RTC
|
|
22
|
-
|
|
23
|
-
#endif
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
#define MS_CLASS "ChannelMessageRegistrator"
|
|
2
|
-
// #define MS_LOG_DEV_LEVEL 3
|
|
3
|
-
|
|
4
|
-
#include "ChannelMessageRegistrator.hpp"
|
|
5
|
-
#include "Logger.hpp"
|
|
6
|
-
#include "MediaSoupErrors.hpp"
|
|
7
|
-
|
|
8
|
-
ChannelMessageRegistrator::ChannelMessageRegistrator()
|
|
9
|
-
{
|
|
10
|
-
MS_TRACE();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
ChannelMessageRegistrator::~ChannelMessageRegistrator()
|
|
14
|
-
{
|
|
15
|
-
MS_TRACE();
|
|
16
|
-
|
|
17
|
-
this->mapChannelRequestHandlers.clear();
|
|
18
|
-
this->mapChannelNotificationHandlers.clear();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
flatbuffers::Offset<FBS::Worker::ChannelMessageHandlers> ChannelMessageRegistrator::FillBuffer(
|
|
22
|
-
flatbuffers::FlatBufferBuilder& builder)
|
|
23
|
-
{
|
|
24
|
-
// Add channelRequestHandlerIds.
|
|
25
|
-
std::vector<flatbuffers::Offset<flatbuffers::String>> channelRequestHandlerIds;
|
|
26
|
-
for (const auto& kv : this->mapChannelRequestHandlers)
|
|
27
|
-
{
|
|
28
|
-
const auto& handlerId = kv.first;
|
|
29
|
-
|
|
30
|
-
channelRequestHandlerIds.push_back(builder.CreateString(handlerId));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Add channelNotificationHandlerIds.
|
|
34
|
-
std::vector<flatbuffers::Offset<flatbuffers::String>> channelNotificationHandlerIds;
|
|
35
|
-
for (const auto& kv : this->mapChannelNotificationHandlers)
|
|
36
|
-
{
|
|
37
|
-
const auto& handlerId = kv.first;
|
|
38
|
-
|
|
39
|
-
channelNotificationHandlerIds.push_back(builder.CreateString(handlerId));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return FBS::Worker::CreateChannelMessageHandlersDirect(
|
|
43
|
-
builder, &channelRequestHandlerIds, &channelNotificationHandlerIds);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
void ChannelMessageRegistrator::RegisterHandler(
|
|
47
|
-
const std::string& id,
|
|
48
|
-
Channel::ChannelSocket::RequestHandler* channelRequestHandler,
|
|
49
|
-
Channel::ChannelSocket::NotificationHandler* channelNotificationHandler)
|
|
50
|
-
{
|
|
51
|
-
MS_TRACE();
|
|
52
|
-
|
|
53
|
-
if (channelRequestHandler != nullptr)
|
|
54
|
-
{
|
|
55
|
-
if (this->mapChannelRequestHandlers.find(id) != this->mapChannelRequestHandlers.end())
|
|
56
|
-
{
|
|
57
|
-
MS_THROW_ERROR("Channel request handler with ID %s already exists", id.c_str());
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
this->mapChannelRequestHandlers[id] = channelRequestHandler;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (channelNotificationHandler != nullptr)
|
|
64
|
-
{
|
|
65
|
-
if (this->mapChannelNotificationHandlers.find(id) != this->mapChannelNotificationHandlers.end())
|
|
66
|
-
{
|
|
67
|
-
if (channelRequestHandler != nullptr)
|
|
68
|
-
{
|
|
69
|
-
this->mapChannelRequestHandlers.erase(id);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
MS_THROW_ERROR("Channel notification handler with ID %s already exists", id.c_str());
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
this->mapChannelNotificationHandlers[id] = channelNotificationHandler;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
void ChannelMessageRegistrator::UnregisterHandler(const std::string& id)
|
|
80
|
-
{
|
|
81
|
-
MS_TRACE();
|
|
82
|
-
|
|
83
|
-
this->mapChannelRequestHandlers.erase(id);
|
|
84
|
-
this->mapChannelNotificationHandlers.erase(id);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
Channel::ChannelSocket::RequestHandler* ChannelMessageRegistrator::GetChannelRequestHandler(
|
|
88
|
-
const std::string& id)
|
|
89
|
-
{
|
|
90
|
-
MS_TRACE();
|
|
91
|
-
|
|
92
|
-
auto it = this->mapChannelRequestHandlers.find(id);
|
|
93
|
-
|
|
94
|
-
if (it != this->mapChannelRequestHandlers.end())
|
|
95
|
-
{
|
|
96
|
-
return it->second;
|
|
97
|
-
}
|
|
98
|
-
else
|
|
99
|
-
{
|
|
100
|
-
return nullptr;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
Channel::ChannelSocket::NotificationHandler* ChannelMessageRegistrator::GetChannelNotificationHandler(
|
|
105
|
-
const std::string& id)
|
|
106
|
-
{
|
|
107
|
-
MS_TRACE();
|
|
108
|
-
|
|
109
|
-
auto it = this->mapChannelNotificationHandlers.find(id);
|
|
110
|
-
|
|
111
|
-
if (it != this->mapChannelNotificationHandlers.end())
|
|
112
|
-
{
|
|
113
|
-
return it->second;
|
|
114
|
-
}
|
|
115
|
-
else
|
|
116
|
-
{
|
|
117
|
-
return nullptr;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#define MS_CLASS "Shared"
|
|
2
|
-
// #define MS_LOG_DEV_LEVEL 3
|
|
3
|
-
|
|
4
|
-
#include "RTC/Shared.hpp"
|
|
5
|
-
#include "Logger.hpp"
|
|
6
|
-
|
|
7
|
-
namespace RTC
|
|
8
|
-
{
|
|
9
|
-
Shared::Shared(
|
|
10
|
-
ChannelMessageRegistrator* channelMessageRegistrator, Channel::ChannelNotifier* channelNotifier)
|
|
11
|
-
: channelMessageRegistrator(channelMessageRegistrator), channelNotifier(channelNotifier)
|
|
12
|
-
{
|
|
13
|
-
MS_TRACE();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
Shared::~Shared()
|
|
17
|
-
{
|
|
18
|
-
MS_TRACE();
|
|
19
|
-
|
|
20
|
-
delete this->channelMessageRegistrator;
|
|
21
|
-
delete this->channelNotifier;
|
|
22
|
-
}
|
|
23
|
-
} // namespace RTC
|