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.
Files changed (130) hide show
  1. package/node/lib/Worker.d.ts +1 -0
  2. package/node/lib/Worker.d.ts.map +1 -1
  3. package/node/lib/Worker.js +14 -0
  4. package/package.json +4 -2
  5. package/worker/fuzzer/src/RTC/FuzzerDtlsTransport.cpp +9 -3
  6. package/worker/fuzzer/src/RTC/RTP/FuzzerRtpStreamSend.cpp +9 -1
  7. package/worker/include/Channel/ChannelMessageRegistrator.hpp +39 -0
  8. package/worker/include/Channel/ChannelMessageRegistratorInterface.hpp +32 -0
  9. package/worker/include/Channel/ChannelSocket.hpp +1 -1
  10. package/worker/include/DepUsrSCTP.hpp +8 -7
  11. package/worker/include/RTC/ActiveSpeakerObserver.hpp +7 -7
  12. package/worker/include/RTC/AudioLevelObserver.hpp +7 -7
  13. package/worker/include/RTC/Consumer.hpp +3 -3
  14. package/worker/include/RTC/DataConsumer.hpp +3 -3
  15. package/worker/include/RTC/DataProducer.hpp +3 -3
  16. package/worker/include/RTC/DirectTransport.hpp +2 -2
  17. package/worker/include/RTC/DtlsTransport.hpp +8 -6
  18. package/worker/include/RTC/ICE/IceServer.hpp +8 -5
  19. package/worker/include/RTC/KeyFrameRequestManager.hpp +15 -12
  20. package/worker/include/RTC/NackGenerator.hpp +7 -6
  21. package/worker/include/RTC/PipeConsumer.hpp +1 -2
  22. package/worker/include/RTC/PipeTransport.hpp +2 -2
  23. package/worker/include/RTC/PlainTransport.hpp +2 -2
  24. package/worker/include/RTC/Producer.hpp +3 -3
  25. package/worker/include/RTC/RTP/RtpStream.hpp +7 -1
  26. package/worker/include/RTC/RTP/RtpStreamRecv.hpp +6 -5
  27. package/worker/include/RTC/RTP/RtpStreamSend.hpp +4 -1
  28. package/worker/include/RTC/Router.hpp +3 -3
  29. package/worker/include/RTC/RtpObserver.hpp +3 -3
  30. package/worker/include/RTC/SCTP/TODO_SCTP.md +18 -6
  31. package/worker/include/RTC/SCTP/association/Association.hpp +11 -8
  32. package/worker/include/RTC/SCTP/association/HeartbeatHandler.hpp +9 -6
  33. package/worker/include/RTC/SCTP/association/StreamResetHandler.hpp +37 -23
  34. package/worker/include/RTC/SCTP/association/TCBContext.hpp +3 -2
  35. package/worker/include/RTC/SCTP/association/TransmissionControlBlock.hpp +81 -8
  36. package/worker/include/RTC/SCTP/packet/UserData.hpp +36 -0
  37. package/worker/include/RTC/SCTP/packet/chunks/ForwardTsnChunk.hpp +1 -1
  38. package/worker/include/RTC/SCTP/packet/chunks/IForwardTsnChunk.hpp +1 -1
  39. package/worker/include/RTC/SCTP/public/SctpOptions.hpp +2 -1
  40. package/worker/include/RTC/SCTP/tx/OutstandingData.hpp +604 -0
  41. package/worker/include/RTC/SCTP/tx/RetransmissionQueue.hpp +336 -0
  42. package/worker/include/RTC/SCTP/tx/RetransmissionTimeout.hpp +5 -4
  43. package/worker/include/RTC/Serializable.hpp +8 -0
  44. package/worker/include/RTC/SimpleConsumer.hpp +1 -2
  45. package/worker/include/RTC/SimulcastConsumer.hpp +1 -2
  46. package/worker/include/RTC/SvcConsumer.hpp +1 -2
  47. package/worker/include/RTC/Transport.hpp +8 -8
  48. package/worker/include/RTC/TransportCongestionControlClient.hpp +8 -5
  49. package/worker/include/RTC/TransportCongestionControlServer.hpp +8 -5
  50. package/worker/include/RTC/WebRtcServer.hpp +3 -3
  51. package/worker/include/RTC/WebRtcTransport.hpp +3 -3
  52. package/worker/include/Shared.hpp +40 -0
  53. package/worker/include/SharedInterface.hpp +44 -0
  54. package/worker/include/Utils.hpp +6 -0
  55. package/worker/include/Worker.hpp +3 -3
  56. package/worker/include/common.hpp +1 -1
  57. package/worker/include/handles/BackoffTimerHandle.hpp +27 -65
  58. package/worker/include/handles/BackoffTimerHandleInterface.hpp +116 -0
  59. package/worker/include/handles/TimerHandle.hpp +36 -20
  60. package/worker/include/handles/TimerHandleInterface.hpp +43 -0
  61. package/worker/meson.build +21 -4
  62. package/worker/meson_options.txt +2 -1
  63. package/worker/mocks/include/Channel/MockChannelMessageRegistrator.hpp +45 -0
  64. package/worker/mocks/include/MockShared.hpp +43 -0
  65. package/worker/mocks/src/Channel/MockChannelMessageRegistrator.cpp +128 -0
  66. package/worker/mocks/src/MockShared.cpp +26 -0
  67. package/worker/scripts/clang-scripts.mjs +4 -1
  68. package/worker/src/Channel/ChannelMessageRegistrator.cpp +125 -0
  69. package/worker/src/Channel/ChannelSocket.cpp +1 -1
  70. package/worker/src/DepUsrSCTP.cpp +10 -4
  71. package/worker/src/RTC/ActiveSpeakerObserver.cpp +7 -7
  72. package/worker/src/RTC/AudioLevelObserver.cpp +12 -10
  73. package/worker/src/RTC/Consumer.cpp +23 -20
  74. package/worker/src/RTC/DataConsumer.cpp +11 -11
  75. package/worker/src/RTC/DataProducer.cpp +3 -3
  76. package/worker/src/RTC/DirectTransport.cpp +16 -16
  77. package/worker/src/RTC/DtlsTransport.cpp +4 -4
  78. package/worker/src/RTC/ICE/IceServer.cpp +4 -3
  79. package/worker/src/RTC/KeyFrameRequestManager.cpp +15 -15
  80. package/worker/src/RTC/NackGenerator.cpp +3 -3
  81. package/worker/src/RTC/PipeConsumer.cpp +5 -4
  82. package/worker/src/RTC/PipeTransport.cpp +3 -3
  83. package/worker/src/RTC/PlainTransport.cpp +10 -9
  84. package/worker/src/RTC/Producer.cpp +30 -28
  85. package/worker/src/RTC/RTCP/FeedbackPsRpsi.cpp +1 -2
  86. package/worker/src/RTC/RTP/RtpStream.cpp +9 -2
  87. package/worker/src/RTC/RTP/RtpStreamRecv.cpp +5 -4
  88. package/worker/src/RTC/RTP/RtpStreamSend.cpp +5 -2
  89. package/worker/src/RTC/Router.cpp +3 -3
  90. package/worker/src/RTC/RtpObserver.cpp +2 -1
  91. package/worker/src/RTC/SCTP/association/Association.cpp +94 -114
  92. package/worker/src/RTC/SCTP/association/HeartbeatHandler.cpp +27 -21
  93. package/worker/src/RTC/SCTP/association/StreamResetHandler.cpp +52 -55
  94. package/worker/src/RTC/SCTP/association/TransmissionControlBlock.cpp +144 -25
  95. package/worker/src/RTC/SCTP/packet/chunks/ForwardTsnChunk.cpp +2 -2
  96. package/worker/src/RTC/SCTP/packet/chunks/IForwardTsnChunk.cpp +2 -2
  97. package/worker/src/RTC/SCTP/tx/OutstandingData.cpp +905 -0
  98. package/worker/src/RTC/SCTP/tx/RetransmissionQueue.cpp +799 -0
  99. package/worker/src/RTC/SCTP/tx/RetransmissionTimeout.cpp +1 -1
  100. package/worker/src/RTC/SctpAssociation.cpp +1 -1
  101. package/worker/src/RTC/SimpleConsumer.cpp +8 -7
  102. package/worker/src/RTC/SimulcastConsumer.cpp +11 -10
  103. package/worker/src/RTC/SvcConsumer.cpp +11 -10
  104. package/worker/src/RTC/Transport.cpp +36 -26
  105. package/worker/src/RTC/TransportCongestionControlClient.cpp +4 -2
  106. package/worker/src/RTC/TransportCongestionControlServer.cpp +4 -3
  107. package/worker/src/RTC/WebRtcServer.cpp +5 -4
  108. package/worker/src/RTC/WebRtcTransport.cpp +39 -26
  109. package/worker/src/Shared.cpp +35 -0
  110. package/worker/src/Worker.cpp +10 -23
  111. package/worker/src/handles/BackoffTimerHandle.cpp +11 -16
  112. package/worker/src/handles/TimerHandle.cpp +5 -4
  113. package/worker/src/lib.cpp +14 -1
  114. package/worker/tasks.py +1 -1
  115. package/worker/test/include/RTC/ICE/iceCommon.hpp +1 -0
  116. package/worker/test/include/RTC/RTP/rtpCommon.hpp +1 -0
  117. package/worker/test/include/RTC/SCTP/sctpCommon.hpp +6 -0
  118. package/worker/test/src/RTC/RTP/TestRtpStreamRecv.cpp +12 -5
  119. package/worker/test/src/RTC/RTP/TestRtpStreamSend.cpp +34 -23
  120. package/worker/test/src/RTC/SCTP/tx/TestOutstandingData.cpp +1196 -0
  121. package/worker/test/src/RTC/SCTP/tx/TestRetransmissionTimeout.cpp +33 -33
  122. package/worker/test/src/RTC/TestKeyFrameRequestManager.cpp +14 -6
  123. package/worker/test/src/RTC/TestNackGenerator.cpp +6 -2
  124. package/worker/test/src/RTC/TestSimpleConsumer.cpp +6 -10
  125. package/worker/test/src/RTC/TestTransportCongestionControlServer.cpp +9 -2
  126. package/worker/test/src/Utils/TestByte.cpp +98 -0
  127. package/worker/include/ChannelMessageRegistrator.hpp +0 -30
  128. package/worker/include/RTC/Shared.hpp +0 -23
  129. package/worker/src/ChannelMessageRegistrator.cpp +0 -119
  130. package/worker/src/RTC/Shared.cpp +0 -23
@@ -1,4 +1,5 @@
1
1
  #include "common.hpp"
2
+ #include "mocks/include/MockShared.hpp"
2
3
  #include "RTC/RTCP/FeedbackRtpNack.hpp"
3
4
  #include "RTC/RTP/Codecs/AV1.hpp"
4
5
  #include "RTC/RTP/Codecs/PayloadDescriptorHandler.hpp"
@@ -10,6 +11,7 @@
10
11
  #include "RTC/RTP/SharedPacket.hpp"
11
12
  #include <catch2/catch_test_macros.hpp>
12
13
  #include <cstring> // std::memcpy()
14
+ #include <memory>
13
15
  #include <vector>
14
16
 
15
17
  // #define PERFORMANCE_TEST 1
@@ -104,6 +106,8 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
104
106
  packet->SetPayloadDescriptorHandler(payloadDescriptorHandler);
105
107
  };
106
108
 
109
+ mocks::MockShared shared;
110
+
107
111
  // clang-format off
108
112
  uint8_t rtpBuffer1[] =
109
113
  {
@@ -149,7 +153,8 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
149
153
  params.mimeType.type = RTC::RtpCodecMimeType::Type::VIDEO;
150
154
 
151
155
  std::string mid;
152
- auto stream = std::make_unique<RTC::RTP::RtpStreamSend>(&testRtpStreamListener, params, mid);
156
+ auto stream = std::make_unique<RTC::RTP::RtpStreamSend>(
157
+ std::addressof(testRtpStreamListener), std::addressof(shared), params, mid);
153
158
 
154
159
  // Receive all the packets (some of them not in order and/or duplicated).
155
160
  sendRtpPacket(
@@ -240,7 +245,8 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
240
245
  params.mimeType.type = RTC::RtpCodecMimeType::Type::VIDEO;
241
246
 
242
247
  std::string mid;
243
- auto stream = std::make_unique<RTC::RTP::RtpStreamSend>(&testRtpStreamListener, params, mid);
248
+ auto stream = std::make_unique<RTC::RTP::RtpStreamSend>(
249
+ std::addressof(testRtpStreamListener), std::addressof(shared), params, mid);
244
250
 
245
251
  // Receive all the packets (some of them not in order and/or duplicated).
246
252
  sendRtpPacket(
@@ -319,7 +325,8 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
319
325
  params.mimeType.type = RTC::RtpCodecMimeType::Type::AUDIO;
320
326
 
321
327
  std::string mid;
322
- auto stream = std::make_unique<RTC::RTP::RtpStreamSend>(&testRtpStreamListener, params, mid);
328
+ auto stream = std::make_unique<RTC::RTP::RtpStreamSend>(
329
+ std::addressof(testRtpStreamListener), std::addressof(shared), params, mid);
323
330
 
324
331
  // Receive all the packets (some of them not in order and/or duplicated).
325
332
  sendRtpPacket(
@@ -393,8 +400,8 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
393
400
  params1.mimeType.type = RTC::RtpCodecMimeType::Type::VIDEO;
394
401
 
395
402
  std::string mid;
396
- std::unique_ptr<RTC::RTP::RtpStreamSend> stream1(
397
- new RTC::RTP::RtpStreamSend(&testRtpStreamListener1, params1, mid));
403
+ std::unique_ptr<RTC::RTP::RtpStreamSend> stream1(new RTC::RTP::RtpStreamSend(
404
+ std::addressof(testRtpStreamListener1), std::addressof(shared), params1, mid));
398
405
 
399
406
  RTC::RTP::RtpStream::Params params2;
400
407
 
@@ -403,8 +410,8 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
403
410
  params2.useNack = true;
404
411
  params2.mimeType.type = RTC::RtpCodecMimeType::Type::VIDEO;
405
412
 
406
- std::unique_ptr<RTC::RTP::RtpStreamSend> stream2(
407
- new RTC::RTP::RtpStreamSend(&testRtpStreamListener2, params2, mid));
413
+ std::unique_ptr<RTC::RTP::RtpStreamSend> stream2(new RTC::RTP::RtpStreamSend(
414
+ std::addressof(testRtpStreamListener2), std::addressof(shared), params2, mid));
408
415
 
409
416
  // Receive all the packets in both streams.
410
417
  sendRtpPacket(
@@ -504,8 +511,8 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
504
511
  params1.mimeType.type = RTC::RtpCodecMimeType::Type::VIDEO;
505
512
 
506
513
  std::string mid;
507
- std::unique_ptr<RTC::RTP::RtpStreamSend> stream1(
508
- new RTC::RTP::RtpStreamSend(&testRtpStreamListener1, params1, mid));
514
+ std::unique_ptr<RTC::RTP::RtpStreamSend> stream1(new RTC::RTP::RtpStreamSend(
515
+ std::addressof(testRtpStreamListener1), std::addressof(shared), params1, mid));
509
516
 
510
517
  RTC::RTP::RtpStream::Params params2;
511
518
 
@@ -514,8 +521,8 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
514
521
  params2.useNack = true;
515
522
  params2.mimeType.type = RTC::RtpCodecMimeType::Type::VIDEO;
516
523
 
517
- std::unique_ptr<RTC::RTP::RtpStreamSend> stream2(
518
- new RTC::RTP::RtpStreamSend(&testRtpStreamListener2, params2, mid));
524
+ std::unique_ptr<RTC::RTP::RtpStreamSend> stream2(new RTC::RTP::RtpStreamSend(
525
+ std::addressof(testRtpStreamListener2), std::addressof(shared), params2, mid));
519
526
 
520
527
  // Create two VP8 encoding contexts.
521
528
  RTC::RTP::Codecs::EncodingContext::Params params;
@@ -776,8 +783,8 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
776
783
  params1.mimeType.type = RTC::RtpCodecMimeType::Type::VIDEO;
777
784
 
778
785
  std::string mid;
779
- std::unique_ptr<RTC::RTP::RtpStreamSend> stream1(
780
- new RTC::RTP::RtpStreamSend(&testRtpStreamListener1, params1, mid));
786
+ std::unique_ptr<RTC::RTP::RtpStreamSend> stream1(new RTC::RTP::RtpStreamSend(
787
+ std::addressof(testRtpStreamListener1), std::addressof(shared), params1, mid));
781
788
 
782
789
  RTC::RTP::RtpStream::Params params2;
783
790
 
@@ -786,8 +793,8 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
786
793
  params2.useNack = true;
787
794
  params2.mimeType.type = RTC::RtpCodecMimeType::Type::VIDEO;
788
795
 
789
- std::unique_ptr<RTC::RTP::RtpStreamSend> stream2(
790
- new RTC::RTP::RtpStreamSend(&testRtpStreamListener2, params2, mid));
796
+ std::unique_ptr<RTC::RTP::RtpStreamSend> stream2(new RTC::RTP::RtpStreamSend(
797
+ std::addressof(testRtpStreamListener2), std::addressof(shared), params2, mid));
791
798
 
792
799
  // Create two AV1 encoding contexts.
793
800
  RTC::RTP::Codecs::EncodingContext::Params params;
@@ -920,7 +927,8 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
920
927
  params1.mimeType.type = RTC::RtpCodecMimeType::Type::VIDEO;
921
928
 
922
929
  std::string mid;
923
- auto stream = std::make_unique<RTC::RTP::RtpStreamSend>(&testRtpStreamListener, params1, mid);
930
+ auto stream = std::make_unique<RTC::RTP::RtpStreamSend>(
931
+ std::addressof(testRtpStreamListener), std::addressof(shared), params1, mid);
924
932
 
925
933
  // Receive all the packets.
926
934
  sendRtpPacket(
@@ -983,7 +991,8 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
983
991
  params1.mimeType.type = RTC::RtpCodecMimeType::Type::VIDEO;
984
992
 
985
993
  std::string mid;
986
- auto stream = std::make_unique<RTC::RTP::RtpStreamSend>(&testRtpStreamListener, params1, mid);
994
+ auto stream = std::make_unique<RTC::RTP::RtpStreamSend>(
995
+ std::addressof(testRtpStreamListener), std::addressof(shared), params1, mid);
987
996
 
988
997
  // Receive all the packets.
989
998
  sendRtpPacket(
@@ -1047,7 +1056,8 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
1047
1056
  params1.mimeType.type = RTC::RtpCodecMimeType::Type::VIDEO;
1048
1057
 
1049
1058
  std::string mid;
1050
- auto stream = std::make_unique<RTC::RTP::RtpStreamSend>(&testRtpStreamListener, params1, mid);
1059
+ auto stream = std::make_unique<RTC::RTP::RtpStreamSend>(
1060
+ std::addressof(testRtpStreamListener), std::addressof(shared), params1, mid);
1051
1061
 
1052
1062
  sendRtpPacket(
1053
1063
  {
@@ -1097,7 +1107,8 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
1097
1107
  params.mimeType.type = RTC::RtpCodecMimeType::Type::VIDEO;
1098
1108
 
1099
1109
  std::string mid;
1100
- auto stream = std::make_unique<RTC::RTP::RtpStreamSend>(&testRtpStreamListener, params, mid);
1110
+ auto stream = std::make_unique<RTC::RTP::RtpStreamSend>(
1111
+ std::addressof(testRtpStreamListener), std::addressof(shared), params, mid);
1101
1112
 
1102
1113
  const RTC::RTP::SharedPacket sharedPacket;
1103
1114
 
@@ -1124,8 +1135,8 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
1124
1135
  params.mimeType.type = RTC::RtpCodecMimeType::Type::VIDEO;
1125
1136
 
1126
1137
  std::string mid;
1127
- std::unique_ptr<RTC::RTP::RtpStreamSend> stream1(
1128
- new RTC::RTP::RtpStreamSend(&testRtpStreamListener, params, mid));
1138
+ std::unique_ptr<RTC::RTP::RtpStreamSend> stream1(new RTC::RTP::RtpStreamSend(
1139
+ std::addressof(testRtpStreamListener), std::addressof(shared), params, mid));
1129
1140
 
1130
1141
  size_t iterations = 10000000;
1131
1142
 
@@ -1146,8 +1157,8 @@ SCENARIO("RtpStreamSend", "[rtp][rtcp][nack][rtpstream][rtpstreamsend]")
1146
1157
  std::cout << "nullptr && initialized shared_ptr: \t" << dur.count() << " seconds" << std::endl;
1147
1158
 
1148
1159
  params.mimeType.type = RTC::RtpCodecMimeType::Type::AUDIO;
1149
- std::unique_ptr<RTC::RTP::RtpStreamSend> stream2(
1150
- new RTC::RTP::RtpStreamSend(&testRtpStreamListener, params, mid));
1160
+ std::unique_ptr<RTC::RTP::RtpStreamSend> stream2(new RTC::RTP::RtpStreamSend(
1161
+ std::addressof(testRtpStreamListener), std::addressof(shared), params, mid));
1151
1162
 
1152
1163
  start = std::chrono::system_clock::now();
1153
1164