mediasoup 3.20.6 → 3.20.8

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 (168) hide show
  1. package/node/lib/fbs/data-consumer/binary.d.ts +25 -0
  2. package/node/lib/fbs/data-consumer/binary.d.ts.map +1 -0
  3. package/node/lib/fbs/data-consumer/binary.js +110 -0
  4. package/node/lib/fbs/data-consumer/data.d.ts +10 -0
  5. package/node/lib/fbs/data-consumer/data.d.ts.map +1 -0
  6. package/node/lib/fbs/data-consumer/data.js +30 -0
  7. package/node/lib/fbs/data-consumer/string.d.ts +22 -0
  8. package/node/lib/fbs/data-consumer/string.d.ts.map +1 -0
  9. package/node/lib/fbs/{worker/close-notification.js → data-consumer/string.js} +34 -20
  10. package/node/lib/fbs/data-producer/binary.d.ts +25 -0
  11. package/node/lib/fbs/data-producer/binary.d.ts.map +1 -0
  12. package/node/lib/fbs/data-producer/binary.js +110 -0
  13. package/node/lib/fbs/data-producer/data.d.ts +10 -0
  14. package/node/lib/fbs/data-producer/data.d.ts.map +1 -0
  15. package/node/lib/fbs/data-producer/data.js +30 -0
  16. package/node/lib/fbs/data-producer/string.d.ts +22 -0
  17. package/node/lib/fbs/data-producer/string.d.ts.map +1 -0
  18. package/node/lib/fbs/data-producer/string.js +92 -0
  19. package/node/lib/fbs/message/type.d.ts +7 -0
  20. package/node/lib/fbs/message/type.d.ts.map +1 -0
  21. package/node/lib/fbs/message/type.js +11 -0
  22. package/node/lib/fbs/message-from-worker/body.d.ts +12 -0
  23. package/node/lib/fbs/message-from-worker/body.d.ts.map +1 -0
  24. package/node/lib/fbs/message-from-worker/body.js +34 -0
  25. package/node/lib/fbs/message-from-worker/message.d.ts +30 -0
  26. package/node/lib/fbs/message-from-worker/message.d.ts.map +1 -0
  27. package/node/lib/fbs/message-from-worker/message.js +122 -0
  28. package/node/lib/fbs/message-from-worker.d.ts +3 -0
  29. package/node/lib/fbs/message-from-worker.d.ts.map +1 -0
  30. package/node/lib/fbs/message-from-worker.js +9 -0
  31. package/node/lib/fbs/message-to-worker/body.d.ts +10 -0
  32. package/node/lib/fbs/message-to-worker/body.d.ts.map +1 -0
  33. package/node/lib/fbs/message-to-worker/body.js +30 -0
  34. package/node/lib/fbs/message-to-worker/message.d.ts +29 -0
  35. package/node/lib/fbs/message-to-worker/message.d.ts.map +1 -0
  36. package/node/lib/fbs/message-to-worker/message.js +122 -0
  37. package/node/lib/fbs/message-to-worker.d.ts +3 -0
  38. package/node/lib/fbs/message-to-worker.d.ts.map +1 -0
  39. package/node/lib/fbs/message-to-worker.js +9 -0
  40. package/node/lib/fbs/notification-from-worker/body.d.ts +44 -0
  41. package/node/lib/fbs/notification-from-worker/body.d.ts.map +1 -0
  42. package/node/lib/fbs/notification-from-worker/body.js +98 -0
  43. package/node/lib/fbs/notification-from-worker/event.d.ts +31 -0
  44. package/node/lib/fbs/notification-from-worker/event.d.ts.map +1 -0
  45. package/node/lib/fbs/notification-from-worker/event.js +35 -0
  46. package/node/lib/fbs/notification-from-worker/notification.d.ts +52 -0
  47. package/node/lib/fbs/notification-from-worker/notification.d.ts.map +1 -0
  48. package/node/lib/fbs/notification-from-worker/notification.js +140 -0
  49. package/node/lib/fbs/notification-from-worker.d.ts +4 -0
  50. package/node/lib/fbs/notification-from-worker.d.ts.map +1 -0
  51. package/node/lib/fbs/notification-from-worker.js +11 -0
  52. package/node/lib/fbs/notification-to-worker/body.d.ts +12 -0
  53. package/node/lib/fbs/notification-to-worker/body.d.ts.map +1 -0
  54. package/node/lib/fbs/notification-to-worker/body.js +34 -0
  55. package/node/lib/fbs/notification-to-worker/event.d.ts +6 -0
  56. package/node/lib/fbs/notification-to-worker/event.d.ts.map +1 -0
  57. package/node/lib/fbs/notification-to-worker/event.js +10 -0
  58. package/node/lib/fbs/notification-to-worker/notification.d.ts +36 -0
  59. package/node/lib/fbs/notification-to-worker/notification.d.ts.map +1 -0
  60. package/node/lib/fbs/notification-to-worker/notification.js +140 -0
  61. package/node/lib/fbs/notification-to-worker.d.ts +4 -0
  62. package/node/lib/fbs/notification-to-worker.d.ts.map +1 -0
  63. package/node/lib/fbs/notification-to-worker.js +11 -0
  64. package/node/lib/fbs/sctp-parameters/num-sctp-streams.d.ts.map +1 -1
  65. package/node/lib/fbs/sctp-parameters/num-sctp-streams.js +5 -5
  66. package/node/lib/fbs/trace-events/fir-trace-info.d.ts +21 -0
  67. package/node/lib/fbs/trace-events/fir-trace-info.d.ts.map +1 -0
  68. package/node/lib/fbs/{worker/close-request.js → trace-events/fir-trace-info.js} +32 -20
  69. package/node/lib/fbs/trace-events/key-frame-trace-info.d.ts +25 -0
  70. package/node/lib/fbs/trace-events/key-frame-trace-info.d.ts.map +1 -0
  71. package/node/lib/fbs/trace-events/key-frame-trace-info.js +104 -0
  72. package/node/lib/fbs/trace-events/pli-trace-info.d.ts +21 -0
  73. package/node/lib/fbs/trace-events/pli-trace-info.d.ts.map +1 -0
  74. package/node/lib/fbs/{worker/close-worker-notification.js → trace-events/pli-trace-info.js} +32 -20
  75. package/node/lib/fbs/trace-events/rtp-trace-info.d.ts +25 -0
  76. package/node/lib/fbs/trace-events/rtp-trace-info.d.ts.map +1 -0
  77. package/node/lib/fbs/{consumer/enable-delay-and-loss-request.js → trace-events/rtp-trace-info.js} +35 -33
  78. package/node/lib/fbs/trace-events/trace-event-type.d.ts +8 -0
  79. package/node/lib/fbs/trace-events/trace-event-type.d.ts.map +1 -0
  80. package/node/lib/fbs/trace-events/trace-event-type.js +12 -0
  81. package/node/lib/fbs/trace-events/trace-info.d.ts +14 -0
  82. package/node/lib/fbs/trace-events/trace-info.d.ts.map +1 -0
  83. package/node/lib/fbs/trace-events/trace-info.js +38 -0
  84. package/node/lib/fbs/trace-events.d.ts +7 -0
  85. package/node/lib/fbs/trace-events.d.ts.map +1 -0
  86. package/node/lib/fbs/trace-events.js +20 -0
  87. package/npm-scripts.mjs +13 -8
  88. package/package.json +6 -6
  89. package/worker/fbs/meson.build +0 -1
  90. package/worker/fbs/plainTransport.fbs +1 -1
  91. package/worker/fbs/worker.fbs +0 -2
  92. package/worker/include/RTC/ICE/StunPacket.hpp +8 -9
  93. package/worker/include/RTC/RTP/Packet.hpp +1 -1
  94. package/worker/include/RTC/RTP/ProbationGenerator.hpp +1 -1
  95. package/worker/include/RTC/SCTP/packet/Chunk.hpp +1 -1
  96. package/worker/include/RTC/SCTP/packet/ErrorCause.hpp +1 -1
  97. package/worker/include/RTC/SCTP/packet/Packet.hpp +1 -2
  98. package/worker/include/RTC/SCTP/packet/Parameter.hpp +1 -1
  99. package/worker/include/RTC/SCTP/packet/TLV.hpp +1 -1
  100. package/worker/include/RTC/SCTP/packet/chunks/DataChunk.hpp +1 -1
  101. package/worker/include/RTC/SCTP/packet/chunks/ForwardTsnChunk.hpp +1 -1
  102. package/worker/include/RTC/SCTP/packet/chunks/IDataChunk.hpp +1 -1
  103. package/worker/include/RTC/SCTP/packet/chunks/IForwardTsnChunk.hpp +1 -1
  104. package/worker/include/RTC/SCTP/packet/chunks/InitAckChunk.hpp +1 -1
  105. package/worker/include/RTC/SCTP/packet/chunks/InitChunk.hpp +1 -1
  106. package/worker/include/RTC/SCTP/packet/chunks/SackChunk.hpp +1 -1
  107. package/worker/include/RTC/SCTP/packet/chunks/ShutdownChunk.hpp +1 -1
  108. package/worker/include/RTC/SCTP/packet/errorCauses/InvalidStreamIdentifierErrorCause.hpp +1 -1
  109. package/worker/include/RTC/SCTP/packet/errorCauses/MissingMandatoryParameterErrorCause.hpp +1 -1
  110. package/worker/include/RTC/SCTP/packet/errorCauses/NoUserDataErrorCause.hpp +1 -1
  111. package/worker/include/RTC/SCTP/packet/errorCauses/StaleCookieErrorCause.hpp +1 -1
  112. package/worker/include/RTC/SCTP/packet/parameters/AddIncomingStreamsRequestParameter.hpp +1 -1
  113. package/worker/include/RTC/SCTP/packet/parameters/AddOutgoingStreamsRequestParameter.hpp +1 -1
  114. package/worker/include/RTC/SCTP/packet/parameters/CookiePreservativeParameter.hpp +1 -1
  115. package/worker/include/RTC/SCTP/packet/parameters/IPv4AddressParameter.hpp +1 -1
  116. package/worker/include/RTC/SCTP/packet/parameters/IPv6AddressParameter.hpp +1 -1
  117. package/worker/include/RTC/SCTP/packet/parameters/IncomingSsnResetRequestParameter.hpp +1 -1
  118. package/worker/include/RTC/SCTP/packet/parameters/OutgoingSsnResetRequestParameter.hpp +1 -1
  119. package/worker/include/RTC/SCTP/packet/parameters/ReconfigurationResponseParameter.hpp +2 -2
  120. package/worker/include/RTC/SCTP/packet/parameters/SsnTsnResetRequestParameter.hpp +1 -1
  121. package/worker/include/RTC/SCTP/packet/parameters/ZeroChecksumAcceptableParameter.hpp +1 -1
  122. package/worker/include/Settings.hpp +0 -1
  123. package/worker/include/handles/TcpConnectionHandle.hpp +0 -4
  124. package/worker/include/handles/UdpSocketHandle.hpp +0 -4
  125. package/worker/meson.build +0 -34
  126. package/worker/meson_options.txt +0 -1
  127. package/worker/src/RTC/PipeTransport.cpp +5 -5
  128. package/worker/src/RTC/PlainTransport.cpp +5 -5
  129. package/worker/src/RTC/RTP/Packet.cpp +0 -2
  130. package/worker/src/RTC/RTP/RtpStreamSend.cpp +0 -20
  131. package/worker/src/RTC/Router.cpp +0 -37
  132. package/worker/src/RTC/SCTP/association/Association.cpp +12 -7
  133. package/worker/src/RTC/SimpleProducerStreamManager.cpp +6 -3
  134. package/worker/src/RTC/SimulcastProducerStreamManager.cpp +2 -2
  135. package/worker/src/RTC/SrtpSession.cpp +0 -24
  136. package/worker/src/RTC/Transport.cpp +3 -22
  137. package/worker/src/RTC/WebRtcTransport.cpp +5 -5
  138. package/worker/src/Settings.cpp +0 -14
  139. package/worker/src/Utils/Crypto.cpp +3 -3
  140. package/worker/src/Utils/String.cpp +1 -1
  141. package/worker/src/Worker.cpp +5 -38
  142. package/worker/src/handles/TcpConnectionHandle.cpp +1 -42
  143. package/worker/src/handles/UdpSocketHandle.cpp +1 -42
  144. package/worker/src/lib.cpp +1 -10
  145. package/node/lib/fbs/consumer/degrade-request.d.ts +0 -30
  146. package/node/lib/fbs/consumer/degrade-request.d.ts.map +0 -1
  147. package/node/lib/fbs/consumer/degrade-request.js +0 -124
  148. package/node/lib/fbs/consumer/enable-delay-and-loss-request.d.ts +0 -24
  149. package/node/lib/fbs/consumer/enable-delay-and-loss-request.d.ts.map +0 -1
  150. package/node/lib/fbs/producer/degrade-request.d.ts +0 -30
  151. package/node/lib/fbs/producer/degrade-request.d.ts.map +0 -1
  152. package/node/lib/fbs/producer/degrade-request.js +0 -124
  153. package/node/lib/fbs/transport/sctp-negotiated-max-streams-notification.d.ts +0 -24
  154. package/node/lib/fbs/transport/sctp-negotiated-max-streams-notification.d.ts.map +0 -1
  155. package/node/lib/fbs/transport/sctp-negotiated-max-streams-notification.js +0 -102
  156. package/node/lib/fbs/transport/sctp-negotiated-options-notification.d.ts +0 -24
  157. package/node/lib/fbs/transport/sctp-negotiated-options-notification.d.ts.map +0 -1
  158. package/node/lib/fbs/transport/sctp-negotiated-options-notification.js +0 -102
  159. package/node/lib/fbs/worker/close-notification.d.ts +0 -18
  160. package/node/lib/fbs/worker/close-notification.d.ts.map +0 -1
  161. package/node/lib/fbs/worker/close-request.d.ts +0 -18
  162. package/node/lib/fbs/worker/close-request.d.ts.map +0 -1
  163. package/node/lib/fbs/worker/close-worker-notification.d.ts +0 -18
  164. package/node/lib/fbs/worker/close-worker-notification.d.ts.map +0 -1
  165. package/worker/fbs/liburing.fbs +0 -7
  166. package/worker/include/DepLibUring.hpp +0 -143
  167. package/worker/src/DepLibUring.cpp +0 -638
  168. package/worker/subprojects/liburing.wrap +0 -14
@@ -2,9 +2,6 @@
2
2
  // #define MS_LOG_DEV_LEVEL 3
3
3
 
4
4
  #include "RTC/Router.hpp"
5
- #ifdef MS_LIBURING_SUPPORTED
6
- #include "DepLibUring.hpp"
7
- #endif
8
5
  #include "Logger.hpp"
9
6
  #include "MediaSoupErrors.hpp"
10
7
  #include "RTC/ActiveSpeakerObserver.hpp"
@@ -667,14 +664,6 @@ namespace RTC
667
664
  // Clone only happens if needed and only once.
668
665
  RTC::RTP::SharedPacket sharedPacket;
669
666
 
670
- #ifdef MS_LIBURING_SUPPORTED
671
- if (DepLibUring::IsEnabled())
672
- {
673
- // Activate liburing usage.
674
- DepLibUring::SetActive();
675
- }
676
- #endif
677
-
678
667
  for (auto* consumer : consumers)
679
668
  {
680
669
  // Update MID RTP extension value.
@@ -694,14 +683,6 @@ namespace RTC
694
683
  sharedPacket.AssertSamePacket(packet);
695
684
  }
696
685
  }
697
-
698
- #ifdef MS_LIBURING_SUPPORTED
699
- if (DepLibUring::IsEnabled())
700
- {
701
- // Submit all prepared submission entries.
702
- DepLibUring::Submit();
703
- }
704
- #endif
705
686
  }
706
687
 
707
688
  auto it = this->mapProducerRtpObservers.find(producer);
@@ -934,16 +915,6 @@ namespace RTC
934
915
 
935
916
  if (!dataConsumers.empty())
936
917
  {
937
- #ifdef MS_LIBURING_SUPPORTED
938
- if (DepLibUring::IsEnabled())
939
- {
940
- // Activate liburing usage.
941
- // The effective sending could be synchronous, thus we would send those
942
- // messages within a single system call.
943
- DepLibUring::SetActive();
944
- }
945
- #endif
946
-
947
918
  const auto numDataConsumers = dataConsumers.size();
948
919
 
949
920
  for (auto* dataConsumer : dataConsumers)
@@ -978,14 +949,6 @@ namespace RTC
978
949
  dataConsumer->SendMessage(std::move(clonedMessage), subchannels, requiredSubchannel);
979
950
  }
980
951
  }
981
-
982
- #ifdef MS_LIBURING_SUPPORTED
983
- if (DepLibUring::IsEnabled())
984
- {
985
- // Submit all prepared submission entries.
986
- DepLibUring::Submit();
987
- }
988
- #endif
989
952
  }
990
953
  }
991
954
 
@@ -660,6 +660,8 @@ namespace RTC
660
660
 
661
661
  const auto prevState = this->state;
662
662
 
663
+ // Notice that, contrary to what happens in dcsctp, here the association
664
+ // never transitions back to NEW state.
663
665
  SetState(State::CLOSED, message);
664
666
 
665
667
  if (prevState == State::COOKIE_WAIT || prevState == State::COOKIE_ECHOED)
@@ -1149,7 +1151,7 @@ namespace RTC
1149
1151
  {
1150
1152
  MS_WARN_TAG(
1151
1153
  sctp,
1152
- "receievd ABORT chunk has invalid verification tag %" PRIu32 ", packet discarded",
1154
+ "received ABORT chunk has invalid verification tag %" PRIu32 ", packet discarded",
1153
1155
  receivedPacket->GetVerificationTag());
1154
1156
 
1155
1157
  this->associationListenerDeferrer.OnAssociationError(
@@ -2130,6 +2132,10 @@ namespace RTC
2130
2132
  errorCausesStr.append(errorCause->ToString());
2131
2133
  }
2132
2134
 
2135
+ // https://datatracker.ietf.org/doc/html/rfc9260#section-3.3.7
2136
+ //
2137
+ // "If an endpoint receives an ABORT with a format error or no TCB is
2138
+ // found, it MUST silently discard it."
2133
2139
  if (!this->tcb)
2134
2140
  {
2135
2141
  MS_DEBUG_TAG(
@@ -2140,7 +2146,7 @@ namespace RTC
2140
2146
  return;
2141
2147
  }
2142
2148
 
2143
- MS_WARN_TAG(sctp, "received ABORT chunk, closing association: %s", errorCausesStr.c_str());
2149
+ MS_DEBUG_TAG(sctp, "received ABORT chunk, closing association: %s", errorCausesStr.c_str());
2144
2150
 
2145
2151
  InternalClose(Types::ErrorKind::PEER_REPORTED, errorCausesStr);
2146
2152
  }
@@ -2363,11 +2369,11 @@ namespace RTC
2363
2369
  // to deliver messages.
2364
2370
  if (this->tcb->GetReassemblyQueue().IsAboveWatermark())
2365
2371
  {
2366
- MS_WARN_TAG(sctp, "reassembly queue is above watermark");
2372
+ MS_WARN_DEV("reassembly queue is above watermark");
2367
2373
 
2368
2374
  if (!this->tcb->GetDataTracker().WillIncreaseCumAckTsn(tsn))
2369
2375
  {
2370
- MS_WARN_TAG(sctp, "reassembly queue is above watermark");
2376
+ MS_WARN_TAG(sctp, "rejecting received data because reassembly queue is above watermark");
2371
2377
 
2372
2378
  this->tcb->GetDataTracker().ForceImmediateSack();
2373
2379
 
@@ -2377,7 +2383,7 @@ namespace RTC
2377
2383
 
2378
2384
  if (!this->tcb->GetDataTracker().IsTsnValid(tsn))
2379
2385
  {
2380
- MS_WARN_TAG(sctp, "data rejected because of failing TSN validity");
2386
+ MS_WARN_TAG(sctp, "rejecting received data because of failing TSN validity");
2381
2387
 
2382
2388
  return;
2383
2389
  }
@@ -2428,8 +2434,7 @@ namespace RTC
2428
2434
  }
2429
2435
  else
2430
2436
  {
2431
- MS_WARN_TAG(
2432
- sctp,
2437
+ MS_WARN_DEV(
2433
2438
  "dropping received out-of-order SACK [TSN:%" PRIu32 "]",
2434
2439
  receivedSackChunk->GetCumulativeTsnAck());
2435
2440
  }
@@ -97,7 +97,6 @@ namespace RTC
97
97
 
98
98
  MS_ASSERT(this->externallyManagedBitrate, "bitrate is not externally managed");
99
99
  MS_ASSERT(this->kind == RTC::Media::Kind::VIDEO, "should be video");
100
- MS_ASSERT(IsActive(), "should be active");
101
100
 
102
101
  // If this is not the first time this method is called within the same
103
102
  // iteration, return 0 since a video Simple consumer does not keep state
@@ -109,7 +108,12 @@ namespace RTC
109
108
 
110
109
  this->managingBitrate = true;
111
110
 
112
- if (!this->producerRtpStream)
111
+ // Do nothing if the producer stream is not active. NOTE: This may happen
112
+ // because Consumer::GetBitratePriority() does not account for the producer
113
+ // stream presence/score, so the Transport may still ask us to increase.
114
+ if (
115
+ !this->producerRtpStream || (this->producerRtpStream->GetScore() == 0u &&
116
+ this->producerRtpStream->HasRtpInactivityCheckEnabled()))
113
117
  {
114
118
  return 0u;
115
119
  }
@@ -134,7 +138,6 @@ namespace RTC
134
138
 
135
139
  MS_ASSERT(this->externallyManagedBitrate, "bitrate is not externally managed");
136
140
  MS_ASSERT(this->kind == RTC::Media::Kind::VIDEO, "should be video");
137
- MS_ASSERT(IsActive(), "should be active");
138
141
 
139
142
  this->managingBitrate = false;
140
143
 
@@ -636,11 +636,11 @@ namespace RTC
636
636
  {
637
637
  // Max delay in ms we allow for the stream when switching.
638
638
  // https://en.wikipedia.org/wiki/Audio-to-video_synchronization#Recommendations
639
- static const uint32_t MaxExtraOffsetMs{ 75u };
639
+ static constexpr uint32_t MaxExtraOffsetMs{ 75 };
640
640
 
641
641
  // Outgoing packet matches the highest timestamp seen in the previous
642
642
  // stream. Apply an expected offset for a new frame in a 30fps stream.
643
- static const uint8_t MsOffset{ 33u }; // (1 / 30 * 1000).
643
+ static constexpr uint8_t MsOffset{ 33 }; // (1 / 30 * 1000).
644
644
 
645
645
  const int64_t maxTsExtraOffset = MaxExtraOffsetMs * clockRate / 1000;
646
646
  uint32_t tsExtraOffset =
@@ -3,9 +3,6 @@
3
3
 
4
4
  #include "RTC/SrtpSession.hpp"
5
5
  #include "DepLibSRTP.hpp"
6
- #ifdef MS_LIBURING_SUPPORTED
7
- #include "DepLibUring.hpp"
8
- #endif
9
6
  #include "Logger.hpp"
10
7
  #include "MediaSoupErrors.hpp"
11
8
  #include <cstring> // std::memset()
@@ -251,27 +248,6 @@ namespace RTC
251
248
  uint8_t* encryptBuffer = EncryptBuffer;
252
249
  size_t encryptLen = EncryptBufferSize;
253
250
 
254
- #ifdef MS_LIBURING_SUPPORTED
255
- if (DepLibUring::IsEnabled())
256
- {
257
- if (!DepLibUring::IsActive())
258
- {
259
- goto protect;
260
- }
261
-
262
- // Use a preallocated buffer, if available.
263
- auto* sendBuffer = DepLibUring::GetSendBuffer();
264
-
265
- if (sendBuffer)
266
- {
267
- encryptBuffer = sendBuffer;
268
- encryptLen = DepLibUring::SendBufferSize;
269
- }
270
- }
271
-
272
- protect:
273
- #endif
274
-
275
251
  const srtp_err_status_t err = srtp_protect(
276
252
  /*srtp_t ctx*/ this->session,
277
253
  /*const uint8_t* rtp*/ *data,
@@ -2,14 +2,10 @@
2
2
  // #define MS_LOG_DEV_LEVEL 3
3
3
 
4
4
  #include "RTC/Transport.hpp"
5
- #include "Logger.hpp"
6
- #include "MediaSoupErrors.hpp"
7
- #include "Utils.hpp"
8
- #ifdef MS_LIBURING_SUPPORTED
9
- #include "DepLibUring.hpp"
10
- #endif
11
5
  #include "FBS/sctpAssociation.h"
12
6
  #include "FBS/transport.h"
7
+ #include "Logger.hpp"
8
+ #include "MediaSoupErrors.hpp"
13
9
  #include "RTC/BweType.hpp"
14
10
  #include "RTC/Consts.hpp"
15
11
  #include "RTC/Consumer.hpp"
@@ -22,6 +18,7 @@
22
18
  #include "RTC/RtpDictionaries.hpp"
23
19
  #include "RTC/SCTP/association/Association.hpp"
24
20
  #include "RTC/SCTP/public/SctpOptions.hpp"
21
+ #include "Utils.hpp"
25
22
  #ifdef MS_RTC_LOGGER_RTP
26
23
  #include "RTC/RtcLogger.hpp"
27
24
  #endif
@@ -2274,14 +2271,6 @@ namespace RTC
2274
2271
 
2275
2272
  std::unique_ptr<RTC::RTCP::CompoundPacket> packet{ new RTC::RTCP::CompoundPacket() };
2276
2273
 
2277
- #ifdef MS_LIBURING_SUPPORTED
2278
- if (DepLibUring::IsEnabled())
2279
- {
2280
- // Activate liburing usage.
2281
- DepLibUring::SetActive();
2282
- }
2283
- #endif
2284
-
2285
2274
  for (auto& kv : this->mapConsumers)
2286
2275
  {
2287
2276
  auto* consumer = kv.second;
@@ -2325,14 +2314,6 @@ namespace RTC
2325
2314
  {
2326
2315
  SendRtcpCompoundPacket(packet.get());
2327
2316
  }
2328
-
2329
- #ifdef MS_LIBURING_SUPPORTED
2330
- if (DepLibUring::IsEnabled())
2331
- {
2332
- // Submit all prepared submission entries.
2333
- DepLibUring::Submit();
2334
- }
2335
- #endif
2336
2317
  }
2337
2318
 
2338
2319
  void Transport::DistributeAvailableOutgoingBitrate()
@@ -785,7 +785,7 @@ namespace RTC
785
785
  const uint8_t* data = packet->GetBuffer();
786
786
  auto len = packet->GetLength();
787
787
 
788
- if (!this->srtpSendSession->EncryptRtp(&data, &len))
788
+ if (!this->srtpSendSession->EncryptRtp(&data, std::addressof(len)))
789
789
  {
790
790
  if (cb)
791
791
  {
@@ -822,7 +822,7 @@ namespace RTC
822
822
  return;
823
823
  }
824
824
 
825
- if (!this->srtpSendSession->EncryptRtcp(&data, &len))
825
+ if (!this->srtpSendSession->EncryptRtcp(&data, std::addressof(len)))
826
826
  {
827
827
  return;
828
828
  }
@@ -855,7 +855,7 @@ namespace RTC
855
855
  return;
856
856
  }
857
857
 
858
- if (!this->srtpSendSession->EncryptRtcp(&data, &len))
858
+ if (!this->srtpSendSession->EncryptRtcp(&data, std::addressof(len)))
859
859
  {
860
860
  return;
861
861
  }
@@ -1025,7 +1025,7 @@ namespace RTC
1025
1025
  }
1026
1026
 
1027
1027
  // Decrypt the SRTP packet.
1028
- if (!this->srtpRecvSession->DecryptSrtp(const_cast<uint8_t*>(data), &len))
1028
+ if (!this->srtpRecvSession->DecryptSrtp(const_cast<uint8_t*>(data), std::addressof(len)))
1029
1029
  {
1030
1030
  const auto* packet = RTC::RTP::Packet::Parse(data, len, bufferLen);
1031
1031
 
@@ -1094,7 +1094,7 @@ namespace RTC
1094
1094
  }
1095
1095
 
1096
1096
  // Decrypt the SRTCP packet.
1097
- if (!this->srtpRecvSession->DecryptSrtcp(const_cast<uint8_t*>(data), &len))
1097
+ if (!this->srtpRecvSession->DecryptSrtcp(const_cast<uint8_t*>(data), std::addressof(len)))
1098
1098
  {
1099
1099
  return;
1100
1100
  }
@@ -59,7 +59,6 @@ void Settings::SetConfiguration(int argc, char* argv[])
59
59
  { .name="dtlsCertificateFile", .has_arg=optional_argument, .flag=nullptr, .val='c' },
60
60
  { .name="dtlsPrivateKeyFile", .has_arg=optional_argument, .flag=nullptr, .val='p' },
61
61
  { .name="libwebrtcFieldTrials", .has_arg=optional_argument, .flag=nullptr, .val='W' },
62
- { .name="disableLiburing", .has_arg=optional_argument, .flag=nullptr, .val='d' },
63
62
  { .name=nullptr, .has_arg=0, .flag=nullptr, .val=0 }
64
63
  };
65
64
  // clang-format on
@@ -159,18 +158,6 @@ void Settings::SetConfiguration(int argc, char* argv[])
159
158
  break;
160
159
  }
161
160
 
162
- case 'd':
163
- {
164
- stringValue = std::string(optarg);
165
-
166
- if (stringValue == "true")
167
- {
168
- Settings::configuration.disableLiburing = true;
169
- }
170
-
171
- break;
172
- }
173
-
174
161
  // Invalid option.
175
162
  case '?':
176
163
  {
@@ -382,7 +369,6 @@ void Settings::PrintConfiguration()
382
369
  MS_DEBUG_TAG(
383
370
  info, " libwebrtcFieldTrials: %s", Settings::configuration.libwebrtcFieldTrials.c_str());
384
371
  }
385
- MS_DEBUG_TAG(info, " disableLiburing: %s", Settings::configuration.disableLiburing ? "yes" : "no");
386
372
 
387
373
  MS_DEBUG_TAG(info, "</configuration>");
388
374
  }
@@ -125,9 +125,9 @@ namespace Utils
125
125
  MS_TRACE();
126
126
 
127
127
  char buffer[64];
128
- static const char Chars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b',
129
- 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
130
- 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
128
+ static constexpr char Chars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b',
129
+ 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
130
+ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
131
131
 
132
132
  len = std::min<size_t>(len, 64);
133
133
 
@@ -20,7 +20,7 @@
20
20
 
21
21
  static constexpr size_t BufferOutSize{ 65536 };
22
22
  static thread_local uint8_t BufferOut[BufferOutSize];
23
- static const uint8_t Base64Table[65] =
23
+ static constexpr uint8_t Base64Table[65] =
24
24
  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
25
25
 
26
26
  namespace Utils
@@ -2,9 +2,6 @@
2
2
  // #define MS_LOG_DEV_LEVEL 3
3
3
 
4
4
  #include "Worker.hpp"
5
- #ifdef MS_LIBURING_SUPPORTED
6
- #include "DepLibUring.hpp"
7
- #endif
8
5
  #include "FBS/response.h"
9
6
  #include "FBS/worker.h"
10
7
  #include "DepLibUV.hpp"
@@ -33,14 +30,6 @@ Worker::Worker(::Channel::ChannelSocket* channel, SharedInterface* shared)
33
30
  }
34
31
  #endif
35
32
 
36
- #ifdef MS_LIBURING_SUPPORTED
37
- if (DepLibUring::IsEnabled())
38
- {
39
- // Start polling CQEs, which will create a uv_pool_t handle.
40
- DepLibUring::StartPollingCQEs();
41
- }
42
- #endif
43
-
44
33
  // Tell the Node process that we are running.
45
34
  this->shared->GetChannelNotifier()->Emit(
46
35
  std::to_string(Logger::Pid), FBS::Notification::Event::WORKER_RUNNING);
@@ -92,14 +81,6 @@ void Worker::Close()
92
81
  }
93
82
  this->mapWebRtcServers.clear();
94
83
 
95
- #ifdef MS_LIBURING_SUPPORTED
96
- if (DepLibUring::IsEnabled())
97
- {
98
- // Stop polling CQEs, which will close the uv_pool_t handle.
99
- DepLibUring::StopPollingCQEs();
100
- }
101
- #endif
102
-
103
84
  // Close the Channel.
104
85
  this->channel->Close();
105
86
  }
@@ -132,26 +113,12 @@ flatbuffers::Offset<FBS::Worker::DumpResponse> Worker::FillBuffer(
132
113
  // Add channelMessageHandlers.
133
114
  auto channelMessageHandlers = this->shared->GetChannelMessageRegistrator()->FillBuffer(builder);
134
115
 
135
- #ifdef MS_LIBURING_SUPPORTED
136
- if (DepLibUring::IsEnabled())
137
- {
138
- return FBS::Worker::CreateDumpResponseDirect(
139
- builder,
140
- Logger::Pid,
141
- &webRtcServerIds,
142
- &routerIds,
143
- channelMessageHandlers,
144
- DepLibUring::FillBuffer(builder));
145
- }
146
- else
147
- {
148
- return FBS::Worker::CreateDumpResponseDirect(
149
- builder, Logger::Pid, &webRtcServerIds, &routerIds, channelMessageHandlers);
150
- }
151
- #else
152
116
  return FBS::Worker::CreateDumpResponseDirect(
153
- builder, Logger::Pid, &webRtcServerIds, &routerIds, channelMessageHandlers);
154
- #endif
117
+ builder,
118
+ Logger::Pid,
119
+ std::addressof(webRtcServerIds),
120
+ std::addressof(routerIds),
121
+ channelMessageHandlers);
155
122
  }
156
123
 
157
124
  flatbuffers::Offset<FBS::Worker::ResourceUsageResponse> Worker::FillBufferResourceUsage(
@@ -3,9 +3,6 @@
3
3
 
4
4
  #include "handles/TcpConnectionHandle.hpp"
5
5
  #include "DepLibUV.hpp"
6
- #ifdef MS_LIBURING_SUPPORTED
7
- #include "DepLibUring.hpp"
8
- #endif
9
6
  #include "Logger.hpp"
10
7
  #include "MediaSoupErrors.hpp"
11
8
  #include "Utils.hpp"
@@ -151,7 +148,7 @@ void TcpConnectionHandle::Start()
151
148
  }
152
149
 
153
150
  // NOLINTNEXTLINE(misc-const-correctness)
154
- int err = uv_read_start(
151
+ const int err = uv_read_start(
155
152
  reinterpret_cast<uv_stream_t*>(this->uvHandle),
156
153
  static_cast<uv_alloc_cb>(onAlloc),
157
154
  static_cast<uv_read_cb>(onRead));
@@ -166,18 +163,6 @@ void TcpConnectionHandle::Start()
166
163
  {
167
164
  MS_THROW_ERROR("error setting peer IP and port");
168
165
  }
169
-
170
- #ifdef MS_LIBURING_SUPPORTED
171
- if (DepLibUring::IsEnabled())
172
- {
173
- err = uv_fileno(reinterpret_cast<uv_handle_t*>(this->uvHandle), std::addressof(this->fd));
174
-
175
- if (err != 0)
176
- {
177
- MS_THROW_ERROR("uv_fileno() failed: %s", uv_strerror(err));
178
- }
179
- }
180
- #endif
181
166
  }
182
167
 
183
168
  void TcpConnectionHandle::Write(
@@ -211,32 +196,6 @@ void TcpConnectionHandle::Write(
211
196
  return;
212
197
  }
213
198
 
214
- #ifdef MS_LIBURING_SUPPORTED
215
- if (DepLibUring::IsEnabled())
216
- {
217
- if (!DepLibUring::IsActive())
218
- {
219
- goto write_libuv;
220
- }
221
-
222
- // Prepare the data to be sent.
223
- // NOTE: If all SQEs are currently in use or no UserData entry is available we'll
224
- // fall back to libuv.
225
- auto prepared = DepLibUring::PrepareWrite(this->fd, data1, len1, data2, len2, cb);
226
-
227
- if (!prepared)
228
- {
229
- MS_DEBUG_DEV("cannot write via liburing, fallback to libuv");
230
-
231
- goto write_libuv;
232
- }
233
-
234
- return;
235
- }
236
-
237
- write_libuv:
238
- #endif
239
-
240
199
  // First try uv_try_write(). In case it can not directly write all the given
241
200
  // data then build a uv_req_t and use uv_write().
242
201
 
@@ -2,9 +2,6 @@
2
2
  // #define MS_LOG_DEV_LEVEL 3
3
3
 
4
4
  #include "handles/UdpSocketHandle.hpp"
5
- #ifdef MS_LIBURING_SUPPORTED
6
- #include "DepLibUring.hpp"
7
- #endif
8
5
  #include "Logger.hpp"
9
6
  #include "MediaSoupErrors.hpp"
10
7
  #include "Utils.hpp"
@@ -73,7 +70,7 @@ UdpSocketHandle::UdpSocketHandle(uv_udp_t* uvHandle) : uvHandle(uvHandle)
73
70
  this->uvHandle->data = static_cast<void*>(this);
74
71
 
75
72
  // NOLINTNEXTLINE(misc-const-correctness)
76
- int err = uv_udp_recv_start(
73
+ const int err = uv_udp_recv_start(
77
74
  this->uvHandle, static_cast<uv_alloc_cb>(onAlloc), static_cast<uv_udp_recv_cb>(onRecv));
78
75
 
79
76
  if (err != 0)
@@ -90,18 +87,6 @@ UdpSocketHandle::UdpSocketHandle(uv_udp_t* uvHandle) : uvHandle(uvHandle)
90
87
 
91
88
  MS_THROW_ERROR("error setting local IP and port");
92
89
  }
93
-
94
- #ifdef MS_LIBURING_SUPPORTED
95
- if (DepLibUring::IsEnabled())
96
- {
97
- err = uv_fileno(reinterpret_cast<uv_handle_t*>(this->uvHandle), std::addressof(this->fd));
98
-
99
- if (err != 0)
100
- {
101
- MS_THROW_ERROR("uv_fileno() failed: %s", uv_strerror(err));
102
- }
103
- }
104
- #endif
105
90
  }
106
91
 
107
92
  UdpSocketHandle::~UdpSocketHandle()
@@ -157,32 +142,6 @@ void UdpSocketHandle::Send(
157
142
  return;
158
143
  }
159
144
 
160
- #ifdef MS_LIBURING_SUPPORTED
161
- if (DepLibUring::IsEnabled())
162
- {
163
- if (!DepLibUring::IsActive())
164
- {
165
- goto send_libuv;
166
- }
167
-
168
- // Prepare the data to be sent.
169
- // NOTE: If all SQEs are currently in use or no UserData entry is available we'll
170
- // fall back to libuv.
171
- auto prepared = DepLibUring::PrepareSend(this->fd, data, len, addr, cb);
172
-
173
- if (!prepared)
174
- {
175
- MS_DEBUG_DEV("cannot send via liburing, fallback to libuv");
176
-
177
- goto send_libuv;
178
- }
179
-
180
- return;
181
- }
182
-
183
- send_libuv:
184
- #endif
185
-
186
145
  // First try uv_udp_try_send(). In case it can not directly send the datagram
187
146
  // then build a uv_req_t and use uv_udp_send().
188
147
 
@@ -3,13 +3,10 @@
3
3
 
4
4
  #include "lib.hpp"
5
5
  #include "common.hpp"
6
- #include "DepLibSRTP.hpp"
7
- #ifdef MS_LIBURING_SUPPORTED
8
- #include "DepLibUring.hpp"
9
- #endif
10
6
  #include "Channel/ChannelMessageRegistrator.hpp"
11
7
  #include "Channel/ChannelNotifier.hpp"
12
8
  #include "Channel/ChannelSocket.hpp"
9
+ #include "DepLibSRTP.hpp"
13
10
  #include "DepLibUV.hpp"
14
11
  #include "DepLibWebRTC.hpp"
15
12
  #include "DepOpenSSL.hpp"
@@ -153,9 +150,6 @@ extern "C" int mediasoup_worker_run(
153
150
  // Initialize static stuff.
154
151
  DepOpenSSL::ClassInit();
155
152
  DepLibSRTP::ClassInit();
156
- #ifdef MS_LIBURING_SUPPORTED
157
- DepLibUring::ClassInit();
158
- #endif
159
153
  DepLibWebRTC::ClassInit();
160
154
  Utils::Crypto::ClassInit();
161
155
  RTC::DtlsTransport::ClassInit();
@@ -175,9 +169,6 @@ extern "C" int mediasoup_worker_run(
175
169
  DepLibSRTP::ClassDestroy();
176
170
  Utils::Crypto::ClassDestroy();
177
171
  DepLibWebRTC::ClassDestroy();
178
- #ifdef MS_LIBURING_SUPPORTED
179
- DepLibUring::ClassDestroy();
180
- #endif
181
172
  RTC::DtlsTransport::ClassDestroy();
182
173
  DepLibUV::ClassDestroy();
183
174
 
@@ -1,30 +0,0 @@
1
- import * as flatbuffers from 'flatbuffers';
2
- export declare class DegradeRequest implements flatbuffers.IUnpackableObject<DegradeRequestT> {
3
- bb: flatbuffers.ByteBuffer | null;
4
- bb_pos: number;
5
- __init(i: number, bb: flatbuffers.ByteBuffer): DegradeRequest;
6
- static getRootAsDegradeRequest(bb: flatbuffers.ByteBuffer, obj?: DegradeRequest): DegradeRequest;
7
- static getSizePrefixedRootAsDegradeRequest(bb: flatbuffers.ByteBuffer, obj?: DegradeRequest): DegradeRequest;
8
- durationMs(): number;
9
- maxDelayMs(): number;
10
- delayPercent(): number;
11
- lossPercent(): number;
12
- static startDegradeRequest(builder: flatbuffers.Builder): void;
13
- static addDurationMs(builder: flatbuffers.Builder, durationMs: number): void;
14
- static addMaxDelayMs(builder: flatbuffers.Builder, maxDelayMs: number): void;
15
- static addDelayPercent(builder: flatbuffers.Builder, delayPercent: number): void;
16
- static addLossPercent(builder: flatbuffers.Builder, lossPercent: number): void;
17
- static endDegradeRequest(builder: flatbuffers.Builder): flatbuffers.Offset;
18
- static createDegradeRequest(builder: flatbuffers.Builder, durationMs: number, maxDelayMs: number, delayPercent: number, lossPercent: number): flatbuffers.Offset;
19
- unpack(): DegradeRequestT;
20
- unpackTo(_o: DegradeRequestT): void;
21
- }
22
- export declare class DegradeRequestT implements flatbuffers.IGeneratedObject {
23
- durationMs: number;
24
- maxDelayMs: number;
25
- delayPercent: number;
26
- lossPercent: number;
27
- constructor(durationMs?: number, maxDelayMs?: number, delayPercent?: number, lossPercent?: number);
28
- pack(builder: flatbuffers.Builder): flatbuffers.Offset;
29
- }
30
- //# sourceMappingURL=degrade-request.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"degrade-request.d.ts","sourceRoot":"","sources":["../../../src/fbs/consumer/degrade-request.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,WAAW,MAAM,aAAa,CAAC;AAI3C,qBAAa,cAAe,YAAW,WAAW,CAAC,iBAAiB,CAAC,eAAe,CAAC;IACnF,EAAE,EAAE,WAAW,CAAC,UAAU,GAAC,IAAI,CAAQ;IACvC,MAAM,SAAK;IACX,MAAM,CAAC,CAAC,EAAC,MAAM,EAAE,EAAE,EAAC,WAAW,CAAC,UAAU,GAAE,cAAc;IAM5D,MAAM,CAAC,uBAAuB,CAAC,EAAE,EAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,EAAC,cAAc,GAAE,cAAc;IAI7F,MAAM,CAAC,mCAAmC,CAAC,EAAE,EAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,EAAC,cAAc,GAAE,cAAc;IAKzG,UAAU,IAAG,MAAM;IAKnB,UAAU,IAAG,MAAM;IAKnB,YAAY,IAAG,MAAM;IAKrB,WAAW,IAAG,MAAM;IAKpB,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO;IAItD,MAAM,CAAC,aAAa,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,UAAU,EAAC,MAAM;IAInE,MAAM,CAAC,aAAa,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,UAAU,EAAC,MAAM;IAInE,MAAM,CAAC,eAAe,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,YAAY,EAAC,MAAM;IAIvE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,WAAW,EAAC,MAAM;IAIrE,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,GAAE,WAAW,CAAC,MAAM;IAKxE,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,UAAU,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,EAAE,YAAY,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,GAAE,WAAW,CAAC,MAAM;IAS1J,MAAM,IAAI,eAAe;IAUzB,QAAQ,CAAC,EAAE,EAAE,eAAe,GAAG,IAAI;CAMlC;AAED,qBAAa,eAAgB,YAAW,WAAW,CAAC,gBAAgB;IAE3D,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,MAAM;IAClB,YAAY,EAAE,MAAM;IACpB,WAAW,EAAE,MAAM;gBAHnB,UAAU,GAAE,MAAU,EACtB,UAAU,GAAE,MAAU,EACtB,YAAY,GAAE,MAAU,EACxB,WAAW,GAAE,MAAU;IAIhC,IAAI,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,MAAM;CAQpD"}