mediasoup 3.20.4 → 3.20.5

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.20.4",
3
+ "version": "3.20.5",
4
4
  "description": "Cutting Edge WebRTC Video Conferencing",
5
5
  "contributors": [
6
6
  "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
@@ -3,7 +3,7 @@
3
3
 
4
4
  #include "common.hpp"
5
5
  #include <limits> // std::numeric_limits
6
- #include <set>
6
+ #include <vector>
7
7
 
8
8
  namespace RTC
9
9
  {
@@ -53,7 +53,7 @@ namespace RTC
53
53
  T maxInput{ 0 };
54
54
  T maxDropped{ 0 };
55
55
  T maxForwarded{ 0 };
56
- std::set<T, SeqLowerThan> dropped;
56
+ std::vector<T> dropped;
57
57
  };
58
58
  } // namespace RTC
59
59
 
@@ -1462,7 +1462,9 @@ namespace RTC
1462
1462
 
1463
1463
  case State::CLOSED:
1464
1464
  {
1465
- MS_WARN_TAG(sctp, "ignoring INIT chunk received in CLOSED state)");
1465
+ MS_WARN_TAG(sctp, "ignoring INIT chunk received in CLOSED state");
1466
+
1467
+ return;
1466
1468
  }
1467
1469
 
1468
1470
  // https://datatracker.ietf.org/doc/html/rfc9260#section-5.2.1
@@ -1812,7 +1814,7 @@ namespace RTC
1812
1814
  else if (
1813
1815
  receivedPacket->GetVerificationTag() != this->tcb->GetLocalVerificationTag() &&
1814
1816
  cookie->GetRemoteVerificationTag() == this->tcb->GetRemoteVerificationTag() &&
1815
- cookie->GetTieTag() == this->tcb->GetTieTag())
1817
+ cookie->GetTieTag() == 0)
1816
1818
  {
1817
1819
  MS_DEBUG_DEV("received COOKIE-ECHO indicating a late COOKIE-ECHO, discarding");
1818
1820
 
@@ -376,6 +376,10 @@ namespace RTC
376
376
  ReconfigurationResponseParameter::Result::SUCCESS_NOTHING_TO_DO);
377
377
 
378
378
  reconfigurationResponseParameter->Consolidate();
379
+
380
+ this->lastProcessedReqSeqNbr = requestSn;
381
+ this->lastProcessedReqResult =
382
+ ReconfigurationResponseParameter::Result::SUCCESS_NOTHING_TO_DO;
379
383
  }
380
384
  else
381
385
  {
@@ -268,7 +268,9 @@ namespace RTC
268
268
  {
269
269
  MS_TRACE();
270
270
 
271
- UpdateAckState(AckState::IMMEDIATE, "force immediate SACK");
271
+ // NOTE: Assign directly instead of going through UpdateAckState() to avoid
272
+ // its side effect of stopping the delayed-ack timer.
273
+ this->ackState = AckState::IMMEDIATE;
272
274
  }
273
275
 
274
276
  bool DataTracker::WillIncreaseCumAckTsn(uint32_t tsn) const
@@ -359,6 +361,7 @@ namespace RTC
359
361
  {
360
362
  this->delayedAckTimer->Start();
361
363
  }
364
+
362
365
  this->ackState = newAckState;
363
366
  }
364
367
  }
@@ -63,9 +63,15 @@ namespace RTC
63
63
  {
64
64
  this->maxInput = input;
65
65
  this->maxDropped = input;
66
- // Insert input in the last position.
67
- // Explicitly insert at the end, which is more performant.
68
- this->dropped.insert(this->dropped.end(), input);
66
+ // Insert input in sorted order, if not present.
67
+ const SeqLowerThan seqLowerThan;
68
+ const auto it =
69
+ std::lower_bound(this->dropped.begin(), this->dropped.end(), input, seqLowerThan);
70
+
71
+ if (it == this->dropped.end() || *it != input)
72
+ {
73
+ this->dropped.insert(it, input);
74
+ }
69
75
 
70
76
  ClearDropped();
71
77
  }
@@ -74,7 +80,15 @@ namespace RTC
74
80
  // Allows for properly accounting for out of order drops until an input is forwarded.
75
81
  else if (this->maxInput == this->maxDropped && SeqManager<T, N>::IsSeqHigherThan(input, this->maxForwarded))
76
82
  {
77
- this->dropped.insert(input);
83
+ // Insert input in sorted order, if not present.
84
+ const SeqLowerThan seqLowerThan;
85
+ const auto it =
86
+ std::lower_bound(this->dropped.begin(), this->dropped.end(), input, seqLowerThan);
87
+
88
+ if (it == this->dropped.end() || *it != input)
89
+ {
90
+ this->dropped.insert(it, input);
91
+ }
78
92
 
79
93
  ClearDropped();
80
94
  }
@@ -112,22 +126,24 @@ namespace RTC
112
126
  {
113
127
  goto done;
114
128
  }
115
- // This input was dropped.
116
- else if (this->dropped.find(input) != this->dropped.end())
117
- {
118
- MS_DEBUG_DEV("trying to send a dropped input");
119
-
120
- return false;
121
- }
122
- // There are dropped inputs, calculate 'base' for this input.
123
129
  else
124
130
  {
125
- auto droppedCount = this->dropped.size();
131
+ const SeqLowerThan seqLowerThan;
132
+ const auto it =
133
+ std::lower_bound(this->dropped.begin(), this->dropped.end(), input, seqLowerThan);
126
134
 
127
- // Get the first dropped input which is higher than or equal 'input'.
128
- auto it = this->dropped.lower_bound(input);
135
+ if (it != this->dropped.end() && *it == input)
136
+ {
137
+ MS_DEBUG_DEV("trying to send a dropped input");
138
+
139
+ return false;
140
+ }
141
+
142
+ // There are dropped inputs, calculate 'base' for this input.
143
+ auto droppedCount = std::distance(
144
+ this->dropped.begin(),
145
+ std::lower_bound(this->dropped.begin(), this->dropped.end(), input, SeqLowerThan()));
129
146
 
130
- droppedCount -= std::distance(it, this->dropped.end());
131
147
  base = (this->base - droppedCount) & SeqManager::MaxValue;
132
148
  }
133
149
 
@@ -191,19 +207,16 @@ namespace RTC
191
207
 
192
208
  const size_t previousDroppedSize = this->dropped.size();
193
209
 
194
- for (auto it = this->dropped.begin(); it != this->dropped.end();)
195
- {
196
- auto value = *it;
197
-
198
- if (SeqManager<T, N>::IsSeqHigherThan(value, this->maxInput))
199
- {
200
- it = this->dropped.erase(it);
201
- }
202
- else
203
- {
204
- break;
205
- }
206
- }
210
+ // Cleanup dropped values.
211
+ this->dropped.erase(
212
+ this->dropped.begin(),
213
+ std::find_if(
214
+ this->dropped.begin(),
215
+ this->dropped.end(),
216
+ [this](T value)
217
+ {
218
+ return !SeqManager<T, N>::IsSeqHigherThan(value, this->maxInput);
219
+ }));
207
220
 
208
221
  // Adapt base.
209
222
  this->base = (this->base - (previousDroppedSize - this->dropped.size())) & SeqManager::MaxValue;