mediasoup 3.11.20 → 3.11.21

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.
@@ -90,7 +90,7 @@ class Worker extends EnhancedEventEmitter_1.EnhancedEventEmitter {
90
90
  // options
91
91
  {
92
92
  env: {
93
- MEDIASOUP_VERSION: '3.11.20',
93
+ MEDIASOUP_VERSION: '3.11.21',
94
94
  // Let the worker process inherit all environment variables, useful
95
95
  // if a custom and not in the path GCC is used so the user can set
96
96
  // LD_LIBRARY_PATH environment variable for runtime.
@@ -10,7 +10,7 @@ export { types };
10
10
  /**
11
11
  * Expose mediasoup version.
12
12
  */
13
- export declare const version = "3.11.20";
13
+ export declare const version = "3.11.21";
14
14
  /**
15
15
  * Expose parseScalabilityMode() function.
16
16
  */
package/node/lib/index.js CHANGED
@@ -11,7 +11,7 @@ exports.types = types;
11
11
  /**
12
12
  * Expose mediasoup version.
13
13
  */
14
- exports.version = '3.11.20';
14
+ exports.version = '3.11.21';
15
15
  /**
16
16
  * Expose parseScalabilityMode() function.
17
17
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediasoup",
3
- "version": "3.11.20",
3
+ "version": "3.11.21",
4
4
  "description": "Cutting Edge WebRTC Video Conferencing",
5
5
  "contributors": [
6
6
  "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
@@ -95,15 +95,15 @@
95
95
  "@types/jest": "^29.5.0",
96
96
  "@types/node": "^18.15.11",
97
97
  "@types/uuid": "^9.0.1",
98
- "@typescript-eslint/eslint-plugin": "^5.57.0",
99
- "@typescript-eslint/parser": "^5.57.0",
98
+ "@typescript-eslint/eslint-plugin": "^5.57.1",
99
+ "@typescript-eslint/parser": "^5.57.1",
100
100
  "eslint": "^8.37.0",
101
101
  "eslint-plugin-jest": "^27.2.1",
102
102
  "jest": "^29.5.0",
103
103
  "open-cli": "^7.2.0",
104
104
  "pick-port": "^1.0.1",
105
105
  "sctp": "^1.0.0",
106
- "ts-jest": "^29.0.5",
106
+ "ts-jest": "^29.1.0",
107
107
  "tsc-watch": "^6.0.0",
108
108
  "typescript": "^5.0.3"
109
109
  }
@@ -213,7 +213,8 @@ namespace RTC
213
213
 
214
214
  public:
215
215
  AddPacketResult AddPacket(uint16_t sequenceNumber, uint64_t timestamp, size_t maxRtcpPacketLen);
216
- void Finish(); // Just for locally generated packets.
216
+ // Just for locally generated packets.
217
+ void Finish();
217
218
  bool IsFull()
218
219
  {
219
220
  // NOTE: Since AddPendingChunks() is called at the end, we cannot track
@@ -315,13 +316,16 @@ namespace RTC
315
316
  private:
316
317
  uint16_t baseSequenceNumber{ 0u };
317
318
  uint32_t referenceTime{ 0 };
318
- uint16_t latestSequenceNumber{ 0u }; // Just for locally generated packets.
319
- uint64_t latestTimestamp{ 0u }; // Just for locally generated packets.
319
+ // Just for locally generated packets.
320
+ uint16_t latestSequenceNumber{ 0u };
321
+ // Just for locally generated packets.
322
+ uint64_t latestTimestamp{ 0u };
320
323
  uint16_t packetStatusCount{ 0u };
321
324
  uint8_t feedbackPacketCount{ 0u };
322
325
  std::vector<Chunk*> chunks;
323
326
  std::vector<int16_t> deltas;
324
- Context context; // Just for locally generated packets.
327
+ // Just for locally generated packets.
328
+ Context context;
325
329
  size_t deltasAndChunksSize{ 0u };
326
330
  size_t size{ 0 };
327
331
  bool isCorrect{ true };
@@ -48,7 +48,9 @@ namespace RTC
48
48
  new FeedbackRtpTransportPacket(commonHeader, len));
49
49
 
50
50
  if (!packet->IsCorrect())
51
+ {
51
52
  return nullptr;
53
+ }
52
54
 
53
55
  return packet.release();
54
56
  }
@@ -399,7 +401,9 @@ namespace RTC
399
401
  auto& packetResult = packetResults[idx];
400
402
 
401
403
  if (!packetResult.received)
404
+ {
402
405
  continue;
406
+ }
403
407
 
404
408
  currentReceivedAtMs += this->deltas.at(deltaIdx) / 4;
405
409
  packetResult.delta = this->deltas.at(deltaIdx);
@@ -418,7 +422,9 @@ namespace RTC
418
422
  uint16_t lost{ 0u };
419
423
 
420
424
  if (expected == 0u)
425
+ {
421
426
  return 0u;
427
+ }
422
428
 
423
429
  for (auto* chunk : this->chunks)
424
430
  {
@@ -428,7 +434,9 @@ namespace RTC
428
434
  // NOTE: If lost equals expected, the math below would produce 256, which
429
435
  // becomes 0 in uint8_t.
430
436
  if (lost == expected)
437
+ {
431
438
  return 255u;
439
+ }
432
440
 
433
441
  return (lost << 8) / expected;
434
442
  }
@@ -487,9 +495,13 @@ namespace RTC
487
495
  Status status;
488
496
 
489
497
  if (delta >= 0 && delta <= 255)
498
+ {
490
499
  status = Status::SmallDelta;
500
+ }
491
501
  else
502
+ {
492
503
  status = Status::LargeDelta;
504
+ }
493
505
 
494
506
  // Create a long run chunk before processing this packet, if needed.
495
507
  // clang-format off
@@ -576,7 +588,9 @@ namespace RTC
576
588
  {
577
589
  // No pending status packets.
578
590
  if (this->context.statuses.empty())
591
+ {
579
592
  return;
593
+ }
580
594
 
581
595
  if (this->context.allSameStatus)
582
596
  {
@@ -638,9 +652,13 @@ namespace RTC
638
652
  uint8_t symbolSize = data[0] & 0x40;
639
653
 
640
654
  if (symbolSize == 0)
655
+ {
641
656
  return new OneBitVectorChunk(bytes, count);
657
+ }
642
658
  else
659
+ {
643
660
  return new TwoBitVectorChunk(bytes, count);
661
+ }
644
662
  }
645
663
 
646
664
  return nullptr;
@@ -717,9 +735,13 @@ namespace RTC
717
735
  MS_TRACE();
718
736
 
719
737
  if (this->status == Status::SmallDelta || this->status == Status::LargeDelta)
738
+ {
720
739
  return this->count;
740
+ }
721
741
  else
742
+ {
722
743
  return 0u;
744
+ }
723
745
  }
724
746
 
725
747
  void FeedbackRtpTransportPacket::RunLengthChunk::FillResults(
@@ -837,7 +859,9 @@ namespace RTC
837
859
  for (auto status : this->statuses)
838
860
  {
839
861
  if (status == Status::SmallDelta || status == Status::LargeDelta)
862
+ {
840
863
  count++;
864
+ }
841
865
  }
842
866
 
843
867
  return count;
@@ -975,7 +999,9 @@ namespace RTC
975
999
  for (auto status : this->statuses)
976
1000
  {
977
1001
  if (status == Status::SmallDelta || status == Status::LargeDelta)
1002
+ {
978
1003
  count++;
1004
+ }
979
1005
  }
980
1006
 
981
1007
  return count;
@@ -215,14 +215,21 @@ namespace RTC
215
215
  MS_TRACE();
216
216
 
217
217
  // Update packet loss history.
218
- const size_t expected_packets = feedback->GetPacketStatusCount();
219
- size_t lost_packets = 0;
218
+ const size_t expectedPackets = feedback->GetPacketStatusCount();
219
+ size_t lostPackets = 0;
220
+
220
221
  for (const auto& result : feedback->GetPacketResults())
221
222
  {
222
223
  if (!result.received)
223
- lost_packets += 1;
224
+ {
225
+ lostPackets += 1;
226
+ }
227
+ }
228
+
229
+ if (expectedPackets > 0)
230
+ {
231
+ this->UpdatePacketLoss(static_cast<double>(lostPackets) / expectedPackets);
224
232
  }
225
- this->UpdatePacketLoss(static_cast<double>(lost_packets) / expected_packets);
226
233
 
227
234
  if (this->rtpTransportControllerSend == nullptr)
228
235
  {
@@ -236,7 +243,9 @@ namespace RTC
236
243
  {
237
244
  // Add the score into the histogram.
238
245
  if (this->packetLossHistory.size() == PacketLossHistogramLength)
246
+ {
239
247
  this->packetLossHistory.pop_front();
248
+ }
240
249
 
241
250
  this->packetLossHistory.push_back(packetLoss);
242
251
 
@@ -303,9 +312,13 @@ namespace RTC
303
312
  // Manage it via trending and increase it a bit to avoid immediate oscillations.
304
313
  #ifdef USE_TREND_CALCULATOR
305
314
  if (!force)
315
+ {
306
316
  this->desiredBitrateTrend.Update(desiredBitrate, nowMs);
317
+ }
307
318
  else
319
+ {
308
320
  this->desiredBitrateTrend.ForceUpdate(desiredBitrate, nowMs);
321
+ }
309
322
  #endif
310
323
 
311
324
  this->bitrates.desiredBitrate = desiredBitrate;
@@ -512,9 +525,13 @@ namespace RTC
512
525
  // Update availableBitrate.
513
526
  // NOTE: Just in case.
514
527
  if (targetTransferRate.target_rate.bps() > std::numeric_limits<uint32_t>::max())
528
+ {
515
529
  this->bitrates.availableBitrate = std::numeric_limits<uint32_t>::max();
530
+ }
516
531
  else
532
+ {
517
533
  this->bitrates.availableBitrate = static_cast<uint32_t>(targetTransferRate.target_rate.bps());
534
+ }
518
535
 
519
536
  MS_DEBUG_DEV("new available bitrate:%" PRIu32, this->bitrates.availableBitrate);
520
537
 
@@ -120,7 +120,9 @@ namespace RTC
120
120
  uint16_t wideSeqNumber;
121
121
 
122
122
  if (!packet->ReadTransportWideCc01(wideSeqNumber))
123
+ {
123
124
  break;
125
+ }
124
126
 
125
127
  // Update the RTCP media SSRC of the ongoing Transport-CC Feedback packet.
126
128
  this->transportCcFeedbackSenderSsrc = 0u;
@@ -186,7 +188,9 @@ namespace RTC
186
188
  uint32_t absSendTime;
187
189
 
188
190
  if (!packet->ReadAbsSendTime(absSendTime))
191
+ {
189
192
  break;
193
+ }
190
194
 
191
195
  // NOTE: nowMs is uint64_t but we need to "convert" it to int64_t before
192
196
  // we give it to libwebrtc lib (althought this is implicit in the
@@ -221,8 +225,12 @@ namespace RTC
221
225
  {
222
226
  MS_TRACE();
223
227
 
228
+ this->transportCcFeedbackPacket->Finish();
229
+
224
230
  if (!this->transportCcFeedbackPacket->IsSerializable())
231
+ {
225
232
  return;
233
+ }
226
234
 
227
235
  auto latestWideSeqNumber = this->transportCcFeedbackPacket->GetLatestSequenceNumber();
228
236
  auto latestTimestamp = this->transportCcFeedbackPacket->GetLatestTimestamp();
@@ -232,15 +240,21 @@ namespace RTC
232
240
  this, this->transportCcFeedbackPacket.get());
233
241
 
234
242
  // Update packet loss history.
235
- const size_t expected_packets = this->transportCcFeedbackPacket->GetPacketStatusCount();
236
- size_t lost_packets = 0;
243
+ const size_t expectedPackets = this->transportCcFeedbackPacket->GetPacketStatusCount();
244
+ size_t lostPackets = 0;
245
+
237
246
  for (const auto& result : this->transportCcFeedbackPacket->GetPacketResults())
238
247
  {
239
248
  if (!result.received)
240
- lost_packets += 1;
249
+ {
250
+ lostPackets += 1;
251
+ }
241
252
  }
242
253
 
243
- this->UpdatePacketLoss(static_cast<double>(lost_packets) / expected_packets);
254
+ if (expectedPackets > 0)
255
+ {
256
+ this->UpdatePacketLoss(static_cast<double>(lostPackets) / expectedPackets);
257
+ }
244
258
 
245
259
  // Create a new feedback packet.
246
260
  this->transportCcFeedbackPacket.reset(new RTC::RTCP::FeedbackRtpTransportPacket(
@@ -265,7 +279,9 @@ namespace RTC
265
279
 
266
280
  // May fix unlimitedRembCounter.
267
281
  if (this->unlimitedRembCounter > 0u && this->maxIncomingBitrate != 0u)
282
+ {
268
283
  this->unlimitedRembCounter = 0u;
284
+ }
269
285
 
270
286
  // In case this is the first unlimited REMB packet, send it fast.
271
287
  // clang-format off
@@ -295,7 +311,9 @@ namespace RTC
295
311
  this->limitationRembSentAtMs = nowMs;
296
312
 
297
313
  if (this->unlimitedRembCounter > 0u)
314
+ {
298
315
  this->unlimitedRembCounter--;
316
+ }
299
317
  }
300
318
  }
301
319
 
@@ -303,7 +321,9 @@ namespace RTC
303
321
  {
304
322
  // Add the score into the histogram.
305
323
  if (this->packetLossHistory.size() == PacketLossHistogramLength)
324
+ {
306
325
  this->packetLossHistory.pop_front();
326
+ }
307
327
 
308
328
  this->packetLossHistory.push_back(packetLoss);
309
329
 
@@ -334,7 +354,9 @@ namespace RTC
334
354
 
335
355
  // Limit announced bitrate if requested via API.
336
356
  if (this->maxIncomingBitrate != 0u)
357
+ {
337
358
  availableBitrate = std::min(availableBitrate, this->maxIncomingBitrate);
359
+ }
338
360
 
339
361
  #if MS_LOG_DEV_LEVEL == 3
340
362
  std::ostringstream ssrcsStream;
@@ -366,6 +388,8 @@ namespace RTC
366
388
  MS_TRACE();
367
389
 
368
390
  if (timer == this->transportCcFeedbackSendPeriodicTimer)
391
+ {
369
392
  SendTransportCcFeedback();
393
+ }
370
394
  }
371
395
  } // namespace RTC