mediasoup 3.14.2 → 3.14.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediasoup",
3
- "version": "3.14.2",
3
+ "version": "3.14.3",
4
4
  "description": "Cutting Edge WebRTC Video Conferencing",
5
5
  "contributors": [
6
6
  "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
@@ -113,11 +113,11 @@
113
113
  "@types/debug": "^4.1.12",
114
114
  "@types/jest": "^29.5.12",
115
115
  "@types/node": "^20.12.7",
116
- "@typescript-eslint/eslint-plugin": "^7.7.1",
117
- "@typescript-eslint/parser": "^7.7.1",
116
+ "@typescript-eslint/eslint-plugin": "^7.8.0",
117
+ "@typescript-eslint/parser": "^7.8.0",
118
118
  "eslint": "^8.57.0",
119
119
  "eslint-config-prettier": "^9.1.0",
120
- "eslint-plugin-jest": "^28.2.0",
120
+ "eslint-plugin-jest": "^28.3.0",
121
121
  "eslint-plugin-prettier": "^5.1.3",
122
122
  "jest": "^29.7.0",
123
123
  "marked": "^12.0.2",
@@ -310,7 +310,9 @@ namespace RTC
310
310
 
311
311
  // Check if there are too many missing packets.
312
312
  {
313
- auto missingPackets = sequenceNumber - (this->latestSequenceNumber + 1);
313
+ // NOTE: We CANNOT use auto here, we must use uint16_t. Otherwise this is a bug.
314
+ // https://github.com/versatica/mediasoup/issues/1385#issuecomment-2084982087
315
+ const uint16_t missingPackets = sequenceNumber - (this->latestSequenceNumber + 1);
314
316
 
315
317
  if (missingPackets > FeedbackRtpTransportPacket::maxMissingPackets)
316
318
  {
@@ -72,9 +72,9 @@ namespace RTC
72
72
  return nullptr;
73
73
  }
74
74
 
75
- const auto idx = static_cast<uint16_t>(seq - oldestItem->sequenceNumber);
75
+ const uint16_t idx = seq - oldestItem->sequenceNumber;
76
76
 
77
- if (idx > static_cast<uint16_t>(this->buffer.size() - 1))
77
+ if (static_cast<size_t>(idx) > this->buffer.size() - 1)
78
78
  {
79
79
  return nullptr;
80
80
  }
@@ -198,14 +198,13 @@ namespace RTC
198
198
 
199
199
  // Calculate how many blank slots it would be necessary to add when
200
200
  // pushing new item to the back of the buffer.
201
- auto numBlankSlots = static_cast<uint16_t>(seq - newestItem->sequenceNumber - 1);
201
+ uint16_t numBlankSlots = seq - newestItem->sequenceNumber - 1;
202
202
 
203
203
  // We may have to remove oldest items not to exceed the maximum size of
204
204
  // the buffer.
205
205
  if (this->buffer.size() + numBlankSlots + 1 > this->maxItems)
206
206
  {
207
- const auto numItemsToRemove =
208
- static_cast<uint16_t>(this->buffer.size() + numBlankSlots + 1 - this->maxItems);
207
+ const uint16_t numItemsToRemove = this->buffer.size() + numBlankSlots + 1 - this->maxItems;
209
208
 
210
209
  // If num of items to be removed exceed buffer size minus one (needed to
211
210
  // allocate current packet) then we must clear the entire buffer.
@@ -286,7 +285,7 @@ namespace RTC
286
285
 
287
286
  // Calculate how many blank slots it would be necessary to add when
288
287
  // pushing new item to the fton of the buffer.
289
- const auto numBlankSlots = static_cast<uint16_t>(oldestItem->sequenceNumber - seq - 1);
288
+ const uint16_t numBlankSlots = oldestItem->sequenceNumber - seq - 1;
290
289
 
291
290
  // If adding this packet (and needed blank slots) to the front makes the
292
291
  // buffer exceed its max size, discard this packet.
@@ -339,11 +338,11 @@ namespace RTC
339
338
  }
340
339
 
341
340
  // idx is the intended position of the received packet in the buffer.
342
- const auto idx = static_cast<uint16_t>(seq - oldestItem->sequenceNumber);
341
+ const uint16_t idx = seq - oldestItem->sequenceNumber;
343
342
 
344
343
  // Validate that packet timestamp is equal or higher than the timestamp of
345
344
  // the immediate older packet (if any).
346
- for (auto idx2 = static_cast<int32_t>(idx - 1); idx2 >= 0; --idx2)
345
+ for (int32_t idx2 = idx - 1; idx2 >= 0; --idx2)
347
346
  {
348
347
  const auto* olderItem = this->buffer.at(idx2);
349
348
 
@@ -374,7 +373,7 @@ namespace RTC
374
373
 
375
374
  // Validate that packet timestamp is equal or less than the timestamp of
376
375
  // the immediate newer packet (if any).
377
- for (auto idx2 = static_cast<size_t>(idx + 1); idx2 < this->buffer.size(); ++idx2)
376
+ for (size_t idx2 = idx + 1; idx2 < this->buffer.size(); ++idx2)
378
377
  {
379
378
  const auto* newerItem = this->buffer.at(idx2);
380
379
 
@@ -535,7 +534,7 @@ namespace RTC
535
534
  numItems,
536
535
  this->buffer.size());
537
536
 
538
- const auto intendedBufferSize = this->buffer.size() - numItems;
537
+ const size_t intendedBufferSize = this->buffer.size() - numItems;
539
538
 
540
539
  while (this->buffer.size() > intendedBufferSize)
541
540
  {
@@ -843,7 +843,8 @@ namespace RTC
843
843
  score);
844
844
  #endif
845
845
 
846
- RtpStream::UpdateScore(score);
846
+ // Call the parent method for update score.
847
+ RTC::RtpStream::UpdateScore(score);
847
848
  }
848
849
 
849
850
  void RtpStreamRecv::UserOnSequenceNumberReset()
@@ -637,7 +637,8 @@ namespace RTC
637
637
  score);
638
638
  #endif
639
639
 
640
- RtpStream::UpdateScore(score);
640
+ // Call the parent method for update score.
641
+ RTC::RtpStream::UpdateScore(score);
641
642
  }
642
643
 
643
644
  void RtpStreamSend::UserOnSequenceNumberReset()
@@ -137,7 +137,7 @@ namespace RTC
137
137
  if (this->lastSrReceived != 0)
138
138
  {
139
139
  // Get delay in milliseconds.
140
- auto delayMs = static_cast<uint32_t>(DepLibUV::GetTimeMs() - this->lastSrReceived);
140
+ const uint32_t delayMs = DepLibUV::GetTimeMs() - this->lastSrReceived;
141
141
  // Express delay in units of 1/65536 seconds.
142
142
  uint32_t dlsr = (delayMs / 1000) << 16;
143
143
 
@@ -338,8 +338,8 @@ namespace RTC
338
338
  // the condition is met.
339
339
  if (nowMs >= PacketArrivalTimestampWindow)
340
340
  {
341
- auto expiryTimestamp = nowMs - PacketArrivalTimestampWindow;
342
- auto it = this->mapPacketArrivalTimes.begin();
341
+ uint64_t expiryTimestamp = nowMs - PacketArrivalTimestampWindow;
342
+ auto it = this->mapPacketArrivalTimes.begin();
343
343
 
344
344
  while (it != this->mapPacketArrivalTimes.end() &&
345
345
  it->first != this->transportCcFeedbackWideSeqNumStart &&