mediasoup 3.20.2 → 3.20.3

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/npm-scripts.mjs CHANGED
@@ -232,6 +232,12 @@ async function run() {
232
232
  break;
233
233
  }
234
234
 
235
+ case 'publish:dry-run': {
236
+ publishDryRun();
237
+
238
+ break;
239
+ }
240
+
235
241
  case 'release:check': {
236
242
  await checkRelease();
237
243
 
@@ -511,6 +517,23 @@ function installNodeDeps() {
511
517
  executeCmd('npm audit --prefix worker/scripts');
512
518
  }
513
519
 
520
+ function publishDryRun() {
521
+ logInfo('publishDryRun()');
522
+
523
+ // NOTE: We use `npm pack --dry-run` rather than `npm publish --dry-run`
524
+ // because the latter contacts the registry and fails with "You cannot
525
+ // publish over the previously published versions" whenever the version in
526
+ // package.json is already published (which is the usual state between
527
+ // releases), making it useless in CI.
528
+ //
529
+ // `npm pack --dry-run` still runs the `prepare` script (flatbuffers
530
+ // generation and TypeScript build) and assembles the tarball exactly as a
531
+ // real publish would, reporting its contents without writing any file or
532
+ // contacting the registry. Useful to validate the `files` list in
533
+ // package.json and that the package builds before tagging a release.
534
+ executeCmd('npm pack --dry-run');
535
+ }
536
+
514
537
  async function checkRelease() {
515
538
  logInfo('checkRelease()');
516
539
 
@@ -522,6 +545,9 @@ async function checkRelease() {
522
545
  lintWorker();
523
546
  testNode();
524
547
  testWorker();
548
+ // Validate packaging (the `files` list in package.json) before the
549
+ // irreversible release steps (git push, GitHub release, npm publish).
550
+ publishDryRun();
525
551
  }
526
552
 
527
553
  async function release() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediasoup",
3
- "version": "3.20.2",
3
+ "version": "3.20.3",
4
4
  "description": "Cutting Edge WebRTC Video Conferencing",
5
5
  "contributors": [
6
6
  "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
@@ -96,6 +96,7 @@
96
96
  "test:worker": "node npm-scripts.mjs test:worker",
97
97
  "coverage": "node npm-scripts.mjs coverage:node",
98
98
  "coverage:node": "node npm-scripts.mjs coverage:node",
99
+ "publish:dry-run": "node npm-scripts.mjs publish:dry-run",
99
100
  "release:check": "node npm-scripts.mjs release:check",
100
101
  "release": "node npm-scripts.mjs release"
101
102
  },
@@ -122,7 +123,7 @@
122
123
  "ini": "^6.0.0",
123
124
  "jest": "^30.4.2",
124
125
  "knip": "^6.15.0",
125
- "marked": "^18.0.4",
126
+ "marked": "^18.0.5",
126
127
  "open-cli": "^9.0.0",
127
128
  "pick-port": "^2.2.0",
128
129
  "prettier": "^3.8.3",
@@ -3,10 +3,10 @@
3
3
 
4
4
  #include "common.hpp"
5
5
  #include "handles/BackoffTimerHandleInterface.hpp"
6
+ #include "RTC/SCTP/association/AssociationListenerDeferrer.hpp"
6
7
  #include "RTC/SCTP/association/TransmissionControlBlockContextInterface.hpp"
7
8
  #include "RTC/SCTP/packet/chunks/HeartbeatAckChunk.hpp"
8
9
  #include "RTC/SCTP/packet/chunks/HeartbeatRequestChunk.hpp"
9
- #include "RTC/SCTP/public/AssociationListenerInterface.hpp"
10
10
  #include "RTC/SCTP/public/SctpOptions.hpp"
11
11
  #include "SharedInterface.hpp"
12
12
 
@@ -26,7 +26,7 @@ namespace RTC
26
26
  {
27
27
  public:
28
28
  HeartbeatHandler(
29
- AssociationListenerInterface& associationListener,
29
+ AssociationListenerDeferrer& associationListenerDeferrer,
30
30
  const SctpOptions& sctpOptions,
31
31
  SharedInterface* shared,
32
32
  TransmissionControlBlockContextInterface* tcbContext);
@@ -63,7 +63,7 @@ namespace RTC
63
63
  BackoffTimerHandleInterface* backoffTimer, uint64_t& baseTimeoutMs, bool& stop) override;
64
64
 
65
65
  private:
66
- AssociationListenerInterface& associationListener;
66
+ AssociationListenerDeferrer& associationListenerDeferrer;
67
67
  const SctpOptions sctpOptions;
68
68
  SharedInterface* shared;
69
69
  TransmissionControlBlockContextInterface* tcbContext;
@@ -4,13 +4,13 @@
4
4
  #include "common.hpp"
5
5
  #include "Utils/UnwrappedSequenceNumber.hpp"
6
6
  #include "handles/BackoffTimerHandleInterface.hpp"
7
+ #include "RTC/SCTP/association/AssociationListenerDeferrer.hpp"
7
8
  #include "RTC/SCTP/association/TransmissionControlBlockContextInterface.hpp"
8
9
  #include "RTC/SCTP/packet/Packet.hpp"
9
10
  #include "RTC/SCTP/packet/chunks/ReConfigChunk.hpp"
10
11
  #include "RTC/SCTP/packet/parameters/IncomingSsnResetRequestParameter.hpp"
11
12
  #include "RTC/SCTP/packet/parameters/OutgoingSsnResetRequestParameter.hpp"
12
13
  #include "RTC/SCTP/packet/parameters/ReconfigurationResponseParameter.hpp"
13
- #include "RTC/SCTP/public/AssociationListenerInterface.hpp"
14
14
  #include "RTC/SCTP/rx/DataTracker.hpp"
15
15
  #include "RTC/SCTP/rx/ReassemblyQueue.hpp"
16
16
  #include "RTC/SCTP/tx/RetransmissionQueue.hpp"
@@ -168,7 +168,7 @@ namespace RTC
168
168
 
169
169
  public:
170
170
  StreamResetHandler(
171
- AssociationListenerInterface& associationListener,
171
+ AssociationListenerDeferrer& associationListenerDeferrer,
172
172
  SharedInterface* shared,
173
173
  TransmissionControlBlockContextInterface* tcbContext,
174
174
  DataTracker* dataTracker,
@@ -263,7 +263,7 @@ namespace RTC
263
263
  BackoffTimerHandleInterface* backoffTimer, uint64_t& baseTimeoutMs, bool& stop) override;
264
264
 
265
265
  private:
266
- AssociationListenerInterface& associationListener;
266
+ AssociationListenerDeferrer& associationListenerDeferrer;
267
267
  SharedInterface* shared;
268
268
  TransmissionControlBlockContextInterface* tcbContext;
269
269
  DataTracker* dataTracker;
@@ -3,13 +3,13 @@
3
3
 
4
4
  #include "common.hpp"
5
5
  #include "handles/BackoffTimerHandleInterface.hpp"
6
+ #include "RTC/SCTP/association/AssociationListenerDeferrer.hpp"
6
7
  #include "RTC/SCTP/association/HeartbeatHandler.hpp"
7
8
  #include "RTC/SCTP/association/NegotiatedCapabilities.hpp"
8
9
  #include "RTC/SCTP/association/PacketSender.hpp"
9
10
  #include "RTC/SCTP/association/StreamResetHandler.hpp"
10
11
  #include "RTC/SCTP/association/TransmissionControlBlockContextInterface.hpp"
11
12
  #include "RTC/SCTP/packet/Packet.hpp"
12
- #include "RTC/SCTP/public/AssociationListenerInterface.hpp"
13
13
  #include "RTC/SCTP/public/SctpOptions.hpp"
14
14
  #include "RTC/SCTP/rx/DataTracker.hpp"
15
15
  #include "RTC/SCTP/rx/ReassemblyQueue.hpp"
@@ -37,7 +37,7 @@ namespace RTC
37
37
  {
38
38
  public:
39
39
  TransmissionControlBlock(
40
- AssociationListenerInterface& associationListener,
40
+ AssociationListenerDeferrer& associationListenerDeferrer,
41
41
  const SctpOptions& sctpOptions,
42
42
  SharedInterface* shared,
43
43
  SendQueueInterface& sendQueue,
@@ -288,7 +288,7 @@ namespace RTC
288
288
  BackoffTimerHandleInterface* backoffTimer, uint64_t& baseTimeoutMs, bool& stop) override;
289
289
 
290
290
  private:
291
- AssociationListenerInterface& associationListener;
291
+ AssociationListenerDeferrer& associationListenerDeferrer;
292
292
  const SctpOptions sctpOptions;
293
293
  SharedInterface* shared;
294
294
  PacketSender& packetSender;
@@ -19,11 +19,11 @@ namespace RTC
19
19
  /* Instance methods. */
20
20
 
21
21
  HeartbeatHandler::HeartbeatHandler(
22
- AssociationListenerInterface& associationListener,
22
+ AssociationListenerDeferrer& associationListenerDeferrer,
23
23
  const SctpOptions& sctpOptions,
24
24
  SharedInterface* shared,
25
25
  TransmissionControlBlockContextInterface* tcbContext)
26
- : associationListener(associationListener),
26
+ : associationListenerDeferrer(associationListenerDeferrer),
27
27
  sctpOptions(sctpOptions),
28
28
  shared(shared),
29
29
  tcbContext(tcbContext),
@@ -124,7 +124,7 @@ namespace RTC
124
124
 
125
125
  if (!heartbeatInfoParameter)
126
126
  {
127
- this->associationListener.OnAssociationError(
127
+ this->associationListenerDeferrer.OnAssociationError(
128
128
  Types::ErrorKind::PARSE_FAILED,
129
129
  "ignoring HEARTBEAT-ACK chunk without Heartbeat Info parameter");
130
130
 
@@ -136,14 +136,14 @@ namespace RTC
136
136
 
137
137
  if (!info)
138
138
  {
139
- this->associationListener.OnAssociationError(
139
+ this->associationListenerDeferrer.OnAssociationError(
140
140
  Types::ErrorKind::PARSE_FAILED, "ignoring Heartbeat Info parameter without info field");
141
141
 
142
142
  return;
143
143
  }
144
144
  else if (infoLen != HeartbeatInfoLength)
145
145
  {
146
- this->associationListener.OnAssociationError(
146
+ this->associationListenerDeferrer.OnAssociationError(
147
147
  Types::ErrorKind::PARSE_FAILED, "ignoring Heartbeat Info parameter with wrong length");
148
148
 
149
149
  return;
@@ -180,6 +180,11 @@ namespace RTC
180
180
  {
181
181
  MS_TRACE();
182
182
 
183
+ // This is a top-level timer entry point (invoked by libuv outside any other
184
+ // SCTP API call), so it must establish the deferrer scope itself, just like
185
+ // Association does in its own timer handlers.
186
+ const AssociationListenerDeferrer::ScopedDeferrer deferrer(this->associationListenerDeferrer);
187
+
183
188
  if (!this->tcbContext->IsAssociationEstablished())
184
189
  {
185
190
  MS_DEBUG_DEV("won't send HEARTBEAT-REQUEST when SCTP association is not established");
@@ -214,6 +219,11 @@ namespace RTC
214
219
  {
215
220
  MS_TRACE();
216
221
 
222
+ // This is a top-level timer entry point (invoked by libuv outside any other
223
+ // SCTP API call), so it must establish the deferrer scope itself, just like
224
+ // Association does in its own timer handlers.
225
+ const AssociationListenerDeferrer::ScopedDeferrer deferrer(this->associationListenerDeferrer);
226
+
217
227
  // Note that the timeout timer is not restarted. It will be started again when
218
228
  // the interval timer expires.
219
229
  MS_ASSERT(!this->timeoutTimer->IsRunning(), "timeout timer shouldn't be running");
@@ -13,13 +13,13 @@ namespace RTC
13
13
  /* Instance methods. */
14
14
 
15
15
  StreamResetHandler::StreamResetHandler(
16
- AssociationListenerInterface& associationListener,
16
+ AssociationListenerDeferrer& associationListenerDeferrer,
17
17
  SharedInterface* shared,
18
18
  TransmissionControlBlockContextInterface* tcbContext,
19
19
  DataTracker* dataTracker,
20
20
  ReassemblyQueue* reassemblyQueue,
21
21
  RetransmissionQueue* retransmissionQueue)
22
- : associationListener(associationListener),
22
+ : associationListenerDeferrer(associationListenerDeferrer),
23
23
  shared(shared),
24
24
  tcbContext(tcbContext),
25
25
  dataTracker(dataTracker),
@@ -89,7 +89,7 @@ namespace RTC
89
89
 
90
90
  if (!ValidateReceivedReConfigChunk(receivedReConfigChunk))
91
91
  {
92
- this->associationListener.OnAssociationError(
92
+ this->associationListenerDeferrer.OnAssociationError(
93
93
  Types::ErrorKind::PARSE_FAILED, "invalid RE-CONFIG command received");
94
94
 
95
95
  return;
@@ -334,7 +334,7 @@ namespace RTC
334
334
  this->reassemblyQueue->ResetStreamsAndLeaveDeferredReset(
335
335
  receivedOutgoingSsnResetRequestParameter->GetStreamIds());
336
336
 
337
- this->associationListener.OnAssociationInboundStreamsReset(
337
+ this->associationListenerDeferrer.OnAssociationInboundStreamsReset(
338
338
  receivedOutgoingSsnResetRequestParameter->GetStreamIds());
339
339
 
340
340
  this->lastProcessedReqResult = ReconfigurationResponseParameter::Result::SUCCESS_PERFORMED;
@@ -412,7 +412,7 @@ namespace RTC
412
412
  MS_DEBUG_DEV(
413
413
  "reset stream success [reqSeqNbr:%" PRIu32 "]", this->currentRequest->GetReqSeqNbr());
414
414
 
415
- this->associationListener.OnAssociationStreamsResetPerformed(
415
+ this->associationListenerDeferrer.OnAssociationStreamsResetPerformed(
416
416
  this->currentRequest->GetStreamIds());
417
417
 
418
418
  this->currentRequest = std::nullopt;
@@ -450,7 +450,7 @@ namespace RTC
450
450
  receivedReconfigurationResponseParameter->GetResult())
451
451
  .c_str());
452
452
 
453
- this->associationListener.OnAssociationStreamsResetFailed(
453
+ this->associationListenerDeferrer.OnAssociationStreamsResetFailed(
454
454
  this->currentRequest->GetStreamIds(),
455
455
  ReconfigurationResponseParameter::ResultToString(
456
456
  receivedReconfigurationResponseParameter->GetResult()));
@@ -469,6 +469,11 @@ namespace RTC
469
469
  {
470
470
  MS_TRACE();
471
471
 
472
+ // This is a top-level timer entry point (invoked by libuv outside any other
473
+ // SCTP API call), so it must establish the deferrer scope itself, just like
474
+ // Association does in its own timer handlers.
475
+ const AssociationListenerDeferrer::ScopedDeferrer deferrer(this->associationListenerDeferrer);
476
+
472
477
  if (this->currentRequest && this->currentRequest->HasBeenSent())
473
478
  {
474
479
  // The request was deferred (received "In Progress"). This is not a
@@ -21,7 +21,7 @@ namespace RTC
21
21
  /* Instance methods. */
22
22
 
23
23
  TransmissionControlBlock::TransmissionControlBlock(
24
- AssociationListenerInterface& associationListener,
24
+ AssociationListenerDeferrer& associationListenerDeferrer,
25
25
  const SctpOptions& sctpOptions,
26
26
  SharedInterface* shared,
27
27
  SendQueueInterface& sendQueue,
@@ -35,7 +35,7 @@ namespace RTC
35
35
  const NegotiatedCapabilities& negotiatedCapabilities,
36
36
  size_t maxPacketLength,
37
37
  std::function<bool()> isAssociationEstablished)
38
- : associationListener(associationListener),
38
+ : associationListenerDeferrer(associationListenerDeferrer),
39
39
  sctpOptions(sctpOptions),
40
40
  shared(shared),
41
41
  packetSender(packetSender),
@@ -71,7 +71,7 @@ namespace RTC
71
71
  sctpOptions.maxReceiverWindowBufferSize, negotiatedCapabilities.messageInterleaving),
72
72
  retransmissionQueue(
73
73
  this,
74
- this->associationListener,
74
+ this->associationListenerDeferrer,
75
75
  localInitialTsn,
76
76
  remoteAdvertisedReceiverWindowCredit,
77
77
  sendQueue,
@@ -80,13 +80,13 @@ namespace RTC
80
80
  negotiatedCapabilities.partialReliability,
81
81
  negotiatedCapabilities.messageInterleaving),
82
82
  streamResetHandler(
83
- this->associationListener,
83
+ this->associationListenerDeferrer,
84
84
  this->shared,
85
85
  this,
86
86
  std::addressof(this->dataTracker),
87
87
  std::addressof(this->reassemblyQueue),
88
88
  std::addressof(this->retransmissionQueue)),
89
- heartbeatHandler(this->associationListener, sctpOptions, this->shared, this)
89
+ heartbeatHandler(this->associationListenerDeferrer, sctpOptions, this->shared, this)
90
90
  {
91
91
  MS_TRACE();
92
92
 
@@ -411,6 +411,11 @@ namespace RTC
411
411
  {
412
412
  MS_TRACE();
413
413
 
414
+ // This is a top-level timer entry point (invoked by libuv outside any other
415
+ // SCTP API call), so it must establish the deferrer scope itself, just like
416
+ // Association does in its own timer handlers.
417
+ const AssociationListenerDeferrer::ScopedDeferrer deferrer(this->associationListenerDeferrer);
418
+
414
419
  // In the COOKIE-ECHO state, let the T1-COOKIE timer trigger
415
420
  // retransmissions, to avoid having two timers doing that.
416
421
  if (this->remoteStateCookie.has_value())
@@ -434,6 +439,11 @@ namespace RTC
434
439
  {
435
440
  MS_TRACE();
436
441
 
442
+ // This is a top-level timer entry point (invoked by libuv outside any other
443
+ // SCTP API call), so it must establish the deferrer scope itself, just like
444
+ // Association does in its own timer handlers.
445
+ const AssociationListenerDeferrer::ScopedDeferrer deferrer(this->associationListenerDeferrer);
446
+
437
447
  this->dataTracker.HandleDelayedAckTimerExpiry();
438
448
 
439
449
  MaySendSackChunk();
@@ -1,4 +1,5 @@
1
1
  #include "common.hpp"
2
+ #include "RTC/SCTP/association/AssociationListenerDeferrer.hpp"
2
3
  #include "RTC/SCTP/association/HeartbeatHandler.hpp"
3
4
  #include "RTC/SCTP/packet/Packet.hpp"
4
5
  #include "RTC/SCTP/packet/chunks/HeartbeatAckChunk.hpp"
@@ -38,7 +39,7 @@ SCENARIO("SCTP HeartbeatHandler", "[sctp][heartbeathandler]")
38
39
  return this->nowMs;
39
40
  }),
40
41
  heartbeatHandler(
41
- this->associationListener,
42
+ this->associationListenerDeferrer,
42
43
  this->sctpOptions,
43
44
  std::addressof(this->shared),
44
45
  std::addressof(this->tcbContext))
@@ -60,6 +61,8 @@ SCENARIO("SCTP HeartbeatHandler", "[sctp][heartbeathandler]")
60
61
  public:
61
62
  RTC::SCTP::SctpOptions sctpOptions;
62
63
  mocks::RTC::SCTP::MockAssociationListener associationListener;
64
+ RTC::SCTP::AssociationListenerDeferrer associationListenerDeferrer{ std::addressof(
65
+ this->associationListener) };
63
66
  mocks::RTC::SCTP::MockTransmissionControlBlockContext tcbContext;
64
67
  mocks::MockShared shared;
65
68
  RTC::SCTP::HeartbeatHandler heartbeatHandler;
@@ -1,5 +1,6 @@
1
1
  #include "common.hpp"
2
2
  #include "DepLibUV.hpp"
3
+ #include "RTC/SCTP/association/AssociationListenerDeferrer.hpp"
3
4
  #include "RTC/SCTP/association/NegotiatedCapabilities.hpp"
4
5
  #include "RTC/SCTP/association/PacketSender.hpp"
5
6
  #include "RTC/SCTP/association/TransmissionControlBlock.hpp"
@@ -32,6 +33,8 @@ SCENARIO("SCTP TransmissionControlBlock", "[sctp][transmissioncontrolblock]")
32
33
  const RTC::SCTP::SctpOptions sctpOptions;
33
34
 
34
35
  mocks::RTC::SCTP::MockAssociationListener associationListener;
36
+ RTC::SCTP::AssociationListenerDeferrer associationListenerDeferrer(
37
+ std::addressof(associationListener));
35
38
  mocks::MockShared shared(/*getTimeMs*/
36
39
  []()
37
40
  {
@@ -54,7 +57,7 @@ SCENARIO("SCTP TransmissionControlBlock", "[sctp][transmissioncontrolblock]")
54
57
  sendQueue.ExpectEnableMessageInterleavingCalledWith(false);
55
58
 
56
59
  const RTC::SCTP::TransmissionControlBlock tcb(
57
- associationListener,
60
+ associationListenerDeferrer,
58
61
  sctpOptions,
59
62
  std::addressof(shared),
60
63
  sendQueue,
@@ -79,7 +82,7 @@ SCENARIO("SCTP TransmissionControlBlock", "[sctp][transmissioncontrolblock]")
79
82
  sendQueue.ExpectEnableMessageInterleavingCalledWith(true);
80
83
 
81
84
  const RTC::SCTP::TransmissionControlBlock tcb(
82
- associationListener,
85
+ associationListenerDeferrer,
83
86
  sctpOptions,
84
87
  std::addressof(shared),
85
88
  sendQueue,