mediasoup 3.16.2 → 3.16.4
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 +4 -4
- package/worker/include/RTC/RtpRetransmissionBuffer.hpp +1 -1
- package/worker/src/Channel/ChannelSocket.cpp +4 -4
- package/worker/src/RTC/PipeConsumer.cpp +18 -2
- package/worker/src/RTC/RtpRetransmissionBuffer.cpp +2 -2
- package/worker/src/RTC/RtpStreamSend.cpp +57 -41
- package/worker/src/RTC/SimpleConsumer.cpp +18 -2
- package/worker/src/RTC/SimulcastConsumer.cpp +18 -2
- package/worker/src/RTC/SvcConsumer.cpp +18 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mediasoup",
|
|
3
|
-
"version": "3.16.
|
|
3
|
+
"version": "3.16.4",
|
|
4
4
|
"description": "Cutting Edge WebRTC Video Conferencing",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
|
|
@@ -100,12 +100,12 @@
|
|
|
100
100
|
"tar": "^7.4.3"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
|
-
"@eslint/js": "^9.
|
|
103
|
+
"@eslint/js": "^9.30.0",
|
|
104
104
|
"@octokit/rest": "^22.0.0",
|
|
105
105
|
"@types/debug": "^4.1.12",
|
|
106
106
|
"@types/jest": "^30.0.0",
|
|
107
|
-
"@types/node": "^24.0.
|
|
108
|
-
"eslint": "^9.
|
|
107
|
+
"@types/node": "^24.0.7",
|
|
108
|
+
"eslint": "^9.30.0",
|
|
109
109
|
"eslint-config-prettier": "^10.1.5",
|
|
110
110
|
"eslint-plugin-jest": "^29.0.1",
|
|
111
111
|
"eslint-plugin-prettier": "^5.5.1",
|
|
@@ -20,7 +20,7 @@ namespace RTC
|
|
|
20
20
|
void Reset();
|
|
21
21
|
|
|
22
22
|
// Original packet.
|
|
23
|
-
std::shared_ptr<RTC::RtpPacket>
|
|
23
|
+
std::shared_ptr<RTC::RtpPacket> sharedPacket{ nullptr };
|
|
24
24
|
// Payload descriptor encoder.
|
|
25
25
|
std::unique_ptr<RTC::Codecs::PayloadDescriptor::Encoder> encoder{ nullptr };
|
|
26
26
|
// Correct SSRC since original packet may not have the same.
|
|
@@ -203,7 +203,7 @@ namespace Channel
|
|
|
203
203
|
|
|
204
204
|
if (message->data_type() == FBS::Message::Body::Request)
|
|
205
205
|
{
|
|
206
|
-
ChannelRequest* request;
|
|
206
|
+
ChannelRequest* request{ nullptr };
|
|
207
207
|
|
|
208
208
|
try
|
|
209
209
|
{
|
|
@@ -225,7 +225,7 @@ namespace Channel
|
|
|
225
225
|
}
|
|
226
226
|
else if (message->data_type() == FBS::Message::Body::Notification)
|
|
227
227
|
{
|
|
228
|
-
ChannelNotification* notification;
|
|
228
|
+
ChannelNotification* notification{ nullptr };
|
|
229
229
|
|
|
230
230
|
try
|
|
231
231
|
{
|
|
@@ -284,7 +284,7 @@ namespace Channel
|
|
|
284
284
|
|
|
285
285
|
if (message->data_type() == FBS::Message::Body::Request)
|
|
286
286
|
{
|
|
287
|
-
ChannelRequest* request;
|
|
287
|
+
ChannelRequest* request{ nullptr };
|
|
288
288
|
|
|
289
289
|
try
|
|
290
290
|
{
|
|
@@ -306,7 +306,7 @@ namespace Channel
|
|
|
306
306
|
}
|
|
307
307
|
else if (message->data_type() == FBS::Message::Body::Notification)
|
|
308
308
|
{
|
|
309
|
-
ChannelNotification* notification;
|
|
309
|
+
ChannelNotification* notification{ nullptr };
|
|
310
310
|
|
|
311
311
|
try
|
|
312
312
|
{
|
|
@@ -265,6 +265,7 @@ namespace RTC
|
|
|
265
265
|
|
|
266
266
|
// Store the packet for the scenario in which this packet is part of the
|
|
267
267
|
// key frame and it arrived before the first packet of the key frame.
|
|
268
|
+
//
|
|
268
269
|
// TODO: Uncomment once this issue is fixed:
|
|
269
270
|
// https://github.com/versatica/mediasoup/issues/1554
|
|
270
271
|
// StorePacketInTargetLayerRetransmissionBuffer(
|
|
@@ -409,12 +410,27 @@ namespace RTC
|
|
|
409
410
|
{
|
|
410
411
|
MS_DEBUG_DEV(
|
|
411
412
|
"sending packet buffered in the target layer retransmission buffer [ssrc:%" PRIu32
|
|
412
|
-
", seq:%" PRIu16 ", ts:%" PRIu32
|
|
413
|
+
", seq:%" PRIu16 ", ts:%" PRIu32
|
|
414
|
+
"] after sending first packet of the key frame [ssrc:%" PRIu32 ", seq:%" PRIu16
|
|
415
|
+
", ts:%" PRIu32 "]",
|
|
413
416
|
bufferedPacket->GetSsrc(),
|
|
414
417
|
bufferedPacket->GetSequenceNumber(),
|
|
415
|
-
bufferedPacket->GetTimestamp()
|
|
418
|
+
bufferedPacket->GetTimestamp(),
|
|
419
|
+
packet->GetSsrc(),
|
|
420
|
+
packet->GetSequenceNumber(),
|
|
421
|
+
packet->GetTimestamp());
|
|
416
422
|
|
|
417
423
|
SendRtpPacket(bufferedPacket, bufferedSharedPacket);
|
|
424
|
+
|
|
425
|
+
// Be sure that the target layer retransmission buffer has not been
|
|
426
|
+
// emptied as a result of sending this packet. If so, exit the loop.
|
|
427
|
+
if (targetLayerRetransmissionBuffer.size() == 0)
|
|
428
|
+
{
|
|
429
|
+
MS_DEBUG_DEV(
|
|
430
|
+
"target layer retransmission buffer emptied while iterating it, exiting the loop");
|
|
431
|
+
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
418
434
|
}
|
|
419
435
|
}
|
|
420
436
|
}
|
|
@@ -30,7 +30,7 @@ namespace RTC
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
// Store original packet and some extra info into the item.
|
|
33
|
-
item->
|
|
33
|
+
item->sharedPacket = sharedPacket;
|
|
34
34
|
item->encoder = packet->GetPayloadEncoder();
|
|
35
35
|
item->ssrc = packet->GetSsrc();
|
|
36
36
|
item->sequenceNumber = packet->GetSequenceNumber();
|
|
@@ -589,7 +589,7 @@ namespace RTC
|
|
|
589
589
|
{
|
|
590
590
|
MS_TRACE();
|
|
591
591
|
|
|
592
|
-
this->
|
|
592
|
+
this->sharedPacket.reset();
|
|
593
593
|
this->ssrc = 0u;
|
|
594
594
|
this->sequenceNumber = 0u;
|
|
595
595
|
this->timestamp = 0u;
|
|
@@ -151,28 +151,76 @@ namespace RTC
|
|
|
151
151
|
break;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
auto* packet = item->sharedPacket.get();
|
|
155
|
+
|
|
156
|
+
// Keep the values of the original packet received by the Consumer.
|
|
157
|
+
auto origSsrc = packet->GetSsrc();
|
|
158
|
+
auto origSeq = packet->GetSequenceNumber();
|
|
159
|
+
auto origTimestamp = packet->GetTimestamp();
|
|
160
|
+
std::string origMid;
|
|
161
|
+
|
|
162
|
+
// Put correct info into the packet.
|
|
163
|
+
packet->SetSsrc(item->ssrc);
|
|
164
|
+
packet->SetSequenceNumber(item->sequenceNumber);
|
|
165
|
+
packet->SetTimestamp(item->timestamp);
|
|
166
|
+
|
|
167
|
+
if (item->encoder != nullptr)
|
|
168
|
+
{
|
|
169
|
+
packet->EncodePayload(item->encoder.get());
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Update MID RTP extension value.
|
|
173
|
+
if (!this->mid.empty())
|
|
174
|
+
{
|
|
175
|
+
packet->ReadMid(origMid);
|
|
176
|
+
packet->UpdateMid(this->mid);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// If we use RTX, encode it.
|
|
180
|
+
if (HasRtx())
|
|
181
|
+
{
|
|
182
|
+
// Increment RTX seq.
|
|
183
|
+
this->rtxSeq++;
|
|
184
|
+
|
|
185
|
+
packet->RtxEncode(this->params.rtxPayloadType, this->params.rtxSsrc, this->rtxSeq);
|
|
186
|
+
}
|
|
157
187
|
|
|
158
188
|
// Retransmit the packet.
|
|
159
189
|
static_cast<RTC::RtpStreamSend::Listener*>(this->listener)
|
|
160
|
-
->OnRtpStreamRetransmitRtpPacket(this, packet
|
|
190
|
+
->OnRtpStreamRetransmitRtpPacket(this, packet);
|
|
161
191
|
|
|
162
192
|
// Mark the packet as retransmitted.
|
|
163
|
-
RTC::RtpStream::PacketRetransmitted(packet
|
|
193
|
+
RTC::RtpStream::PacketRetransmitted(packet);
|
|
164
194
|
|
|
165
195
|
// Mark the packet as repaired (only if this is the first retransmission).
|
|
166
196
|
if (item->sentTimes == 1)
|
|
167
197
|
{
|
|
168
|
-
RTC::RtpStream::PacketRepaired(packet
|
|
198
|
+
RTC::RtpStream::PacketRepaired(packet);
|
|
169
199
|
}
|
|
170
200
|
|
|
201
|
+
// If we use RTX, restore it.
|
|
171
202
|
if (HasRtx())
|
|
172
203
|
{
|
|
173
204
|
// Restore the packet.
|
|
174
205
|
packet->RtxDecode(RtpStream::GetPayloadType(), item->ssrc);
|
|
175
206
|
}
|
|
207
|
+
|
|
208
|
+
// Restore MID.
|
|
209
|
+
if (!this->mid.empty())
|
|
210
|
+
{
|
|
211
|
+
packet->UpdateMid(origMid);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Restore payload.
|
|
215
|
+
if (item->encoder != nullptr)
|
|
216
|
+
{
|
|
217
|
+
packet->RestorePayload();
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Restore RTP header fields.
|
|
221
|
+
packet->SetSsrc(origSsrc);
|
|
222
|
+
packet->SetSequenceNumber(origSeq);
|
|
223
|
+
packet->SetTimestamp(origTimestamp);
|
|
176
224
|
}
|
|
177
225
|
}
|
|
178
226
|
|
|
@@ -437,29 +485,6 @@ namespace RTC
|
|
|
437
485
|
if (requested)
|
|
438
486
|
{
|
|
439
487
|
auto* item = this->retransmissionBuffer->Get(currentSeq);
|
|
440
|
-
std::shared_ptr<RTC::RtpPacket> packet{ nullptr };
|
|
441
|
-
|
|
442
|
-
// Calculate the elapsed time between the max timestamp seen and the
|
|
443
|
-
// requested packet's timestamp (in ms).
|
|
444
|
-
if (item)
|
|
445
|
-
{
|
|
446
|
-
packet = item->packet;
|
|
447
|
-
// Put correct info into the packet.
|
|
448
|
-
packet->SetSsrc(item->ssrc);
|
|
449
|
-
packet->SetSequenceNumber(item->sequenceNumber);
|
|
450
|
-
packet->SetTimestamp(item->timestamp);
|
|
451
|
-
|
|
452
|
-
if (item->encoder != nullptr)
|
|
453
|
-
{
|
|
454
|
-
packet->EncodePayload(item->encoder.get());
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
// Update MID RTP extension value.
|
|
458
|
-
if (!this->mid.empty())
|
|
459
|
-
{
|
|
460
|
-
packet->UpdateMid(mid);
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
488
|
|
|
464
489
|
// Packet not found.
|
|
465
490
|
if (!item)
|
|
@@ -478,21 +503,12 @@ namespace RTC
|
|
|
478
503
|
rtx,
|
|
479
504
|
"ignoring retransmission for a packet already resent in the last RTT ms "
|
|
480
505
|
"[seq:%" PRIu16 ", rtt:%" PRIu16 "]",
|
|
481
|
-
|
|
506
|
+
item->sequenceNumber,
|
|
482
507
|
rtt);
|
|
483
508
|
}
|
|
484
509
|
// Stored packet is valid for retransmission. Resend it.
|
|
485
510
|
else
|
|
486
511
|
{
|
|
487
|
-
// If we use RTX and the packet has not yet been resent, encode it now.
|
|
488
|
-
if (HasRtx())
|
|
489
|
-
{
|
|
490
|
-
// Increment RTX seq.
|
|
491
|
-
++this->rtxSeq;
|
|
492
|
-
|
|
493
|
-
packet->RtxEncode(this->params.rtxPayloadType, this->params.rtxSsrc, this->rtxSeq);
|
|
494
|
-
}
|
|
495
|
-
|
|
496
512
|
// Save when this packet was resent.
|
|
497
513
|
item->resentAtMs = nowMs;
|
|
498
514
|
|
|
@@ -513,12 +529,12 @@ namespace RTC
|
|
|
513
529
|
|
|
514
530
|
requested = (bitmask & 1) != 0;
|
|
515
531
|
bitmask >>= 1;
|
|
516
|
-
|
|
532
|
+
currentSeq++;
|
|
517
533
|
|
|
518
534
|
if (!isFirstPacket)
|
|
519
535
|
{
|
|
520
536
|
sentBitmask |= (sent ? 1 : 0) << bitmaskCounter;
|
|
521
|
-
|
|
537
|
+
bitmaskCounter++;
|
|
522
538
|
}
|
|
523
539
|
else
|
|
524
540
|
{
|
|
@@ -347,6 +347,7 @@ namespace RTC
|
|
|
347
347
|
|
|
348
348
|
// Store the packet for the scenario in which this packet is part of the
|
|
349
349
|
// key frame and it arrived before the first packet of the key frame.
|
|
350
|
+
//
|
|
350
351
|
// TODO: Uncomment once this issue is fixed:
|
|
351
352
|
// https://github.com/versatica/mediasoup/issues/1554
|
|
352
353
|
// StorePacketInTargetLayerRetransmissionBuffer(packet, sharedPacket);
|
|
@@ -508,12 +509,27 @@ namespace RTC
|
|
|
508
509
|
{
|
|
509
510
|
MS_DEBUG_DEV(
|
|
510
511
|
"sending packet buffered in the target layer retransmission buffer [ssrc:%" PRIu32
|
|
511
|
-
", seq:%" PRIu16 ", ts:%" PRIu32
|
|
512
|
+
", seq:%" PRIu16 ", ts:%" PRIu32
|
|
513
|
+
"] after sending first packet of the key frame [ssrc:%" PRIu32 ", seq:%" PRIu16
|
|
514
|
+
", ts:%" PRIu32 "]",
|
|
512
515
|
bufferedPacket->GetSsrc(),
|
|
513
516
|
bufferedPacket->GetSequenceNumber(),
|
|
514
|
-
bufferedPacket->GetTimestamp()
|
|
517
|
+
bufferedPacket->GetTimestamp(),
|
|
518
|
+
packet->GetSsrc(),
|
|
519
|
+
packet->GetSequenceNumber(),
|
|
520
|
+
packet->GetTimestamp());
|
|
515
521
|
|
|
516
522
|
SendRtpPacket(bufferedPacket, bufferedSharedPacket);
|
|
523
|
+
|
|
524
|
+
// Be sure that the target layer retransmission buffer has not been
|
|
525
|
+
// emptied as a result of sending this packet. If so, exit the loop.
|
|
526
|
+
if (this->targetLayerRetransmissionBuffer.size() == 0)
|
|
527
|
+
{
|
|
528
|
+
MS_DEBUG_DEV(
|
|
529
|
+
"target layer retransmission buffer emptied while iterating it, exiting the loop");
|
|
530
|
+
|
|
531
|
+
break;
|
|
532
|
+
}
|
|
517
533
|
}
|
|
518
534
|
}
|
|
519
535
|
}
|
|
@@ -811,6 +811,7 @@ namespace RTC
|
|
|
811
811
|
|
|
812
812
|
// Store the packet for the scenario in which this packet is part of the
|
|
813
813
|
// key frame and it arrived before the first packet of the key frame.
|
|
814
|
+
//
|
|
814
815
|
// TODO: Uncomment once this issue is fixed:
|
|
815
816
|
// https://github.com/versatica/mediasoup/issues/1554
|
|
816
817
|
// StorePacketInTargetLayerRetransmissionBuffer(packet, sharedPacket);
|
|
@@ -1205,12 +1206,27 @@ namespace RTC
|
|
|
1205
1206
|
{
|
|
1206
1207
|
MS_DEBUG_DEV(
|
|
1207
1208
|
"sending packet buffered in the target layer retransmission buffer [ssrc:%" PRIu32
|
|
1208
|
-
", seq:%" PRIu16 ", ts:%" PRIu32
|
|
1209
|
+
", seq:%" PRIu16 ", ts:%" PRIu32
|
|
1210
|
+
"] after sending first packet of the key frame [ssrc:%" PRIu32 ", seq:%" PRIu16
|
|
1211
|
+
", ts:%" PRIu32 "]",
|
|
1209
1212
|
bufferedPacket->GetSsrc(),
|
|
1210
1213
|
bufferedPacket->GetSequenceNumber(),
|
|
1211
|
-
bufferedPacket->GetTimestamp()
|
|
1214
|
+
bufferedPacket->GetTimestamp(),
|
|
1215
|
+
packet->GetSsrc(),
|
|
1216
|
+
packet->GetSequenceNumber(),
|
|
1217
|
+
packet->GetTimestamp());
|
|
1212
1218
|
|
|
1213
1219
|
SendRtpPacket(bufferedPacket, bufferedSharedPacket);
|
|
1220
|
+
|
|
1221
|
+
// Be sure that the target layer retransmission buffer has not been
|
|
1222
|
+
// emptied as a result of sending this packet. If so, exit the loop.
|
|
1223
|
+
if (this->targetLayerRetransmissionBuffer.size() == 0)
|
|
1224
|
+
{
|
|
1225
|
+
MS_DEBUG_DEV(
|
|
1226
|
+
"target layer retransmission buffer emptied while iterating it, exiting the loop");
|
|
1227
|
+
|
|
1228
|
+
break;
|
|
1229
|
+
}
|
|
1214
1230
|
}
|
|
1215
1231
|
}
|
|
1216
1232
|
}
|
|
@@ -685,6 +685,7 @@ namespace RTC
|
|
|
685
685
|
|
|
686
686
|
// Store the packet for the scenario in which this packet is part of the
|
|
687
687
|
// key frame and it arrived before the first packet of the key frame.
|
|
688
|
+
//
|
|
688
689
|
// TODO: Uncomment once this issue is fixed:
|
|
689
690
|
// https://github.com/versatica/mediasoup/issues/1554
|
|
690
691
|
// StorePacketInTargetLayerRetransmissionBuffer(packet, sharedPacket);
|
|
@@ -865,12 +866,27 @@ namespace RTC
|
|
|
865
866
|
{
|
|
866
867
|
MS_DEBUG_DEV(
|
|
867
868
|
"sending packet buffered in the target layer retransmission buffer [ssrc:%" PRIu32
|
|
868
|
-
", seq:%" PRIu16 ", ts:%" PRIu32
|
|
869
|
+
", seq:%" PRIu16 ", ts:%" PRIu32
|
|
870
|
+
"] after sending first packet of the key frame [ssrc:%" PRIu32 ", seq:%" PRIu16
|
|
871
|
+
", ts:%" PRIu32 "]",
|
|
869
872
|
bufferedPacket->GetSsrc(),
|
|
870
873
|
bufferedPacket->GetSequenceNumber(),
|
|
871
|
-
bufferedPacket->GetTimestamp()
|
|
874
|
+
bufferedPacket->GetTimestamp(),
|
|
875
|
+
packet->GetSsrc(),
|
|
876
|
+
packet->GetSequenceNumber(),
|
|
877
|
+
packet->GetTimestamp());
|
|
872
878
|
|
|
873
879
|
SendRtpPacket(bufferedPacket, bufferedSharedPacket);
|
|
880
|
+
|
|
881
|
+
// Be sure that the target layer retransmission buffer has not been
|
|
882
|
+
// emptied as a result of sending this packet. If so, exit the loop.
|
|
883
|
+
if (this->targetLayerRetransmissionBuffer.size() == 0)
|
|
884
|
+
{
|
|
885
|
+
MS_DEBUG_DEV(
|
|
886
|
+
"target layer retransmission buffer emptied while iterating it, exiting the loop");
|
|
887
|
+
|
|
888
|
+
break;
|
|
889
|
+
}
|
|
874
890
|
}
|
|
875
891
|
}
|
|
876
892
|
}
|