mediasoup 3.27.0 → 3.28.0
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/CHANGELOG.md +19 -0
- package/node/lib/Consumer.d.ts.map +1 -1
- package/node/lib/Consumer.js +4 -51
- package/node/lib/Producer.d.ts.map +1 -1
- package/node/lib/Producer.js +4 -8
- package/node/lib/ProducerTypes.d.ts +4 -2
- package/node/lib/ProducerTypes.d.ts.map +1 -1
- package/node/lib/Router.d.ts.map +1 -1
- package/node/lib/Router.js +4 -0
- package/node/lib/Transport.d.ts.map +1 -1
- package/node/lib/Transport.js +7 -10
- package/node/lib/fbs/rtp-parameters/rtp-header-extension-uri.d.ts +3 -4
- package/node/lib/fbs/rtp-parameters/rtp-header-extension-uri.d.ts.map +1 -1
- package/node/lib/fbs/rtp-parameters/rtp-header-extension-uri.js +3 -4
- package/node/lib/ortc.d.ts +0 -2
- package/node/lib/ortc.d.ts.map +1 -1
- package/node/lib/ortc.js +11 -21
- package/node/lib/rtpMappingFbsUtils.d.ts +6 -0
- package/node/lib/rtpMappingFbsUtils.d.ts.map +1 -0
- package/node/lib/rtpMappingFbsUtils.js +65 -0
- package/node/lib/rtpParametersFbsUtils.d.ts.map +1 -1
- package/node/lib/rtpParametersFbsUtils.js +0 -6
- package/node/lib/rtpParametersTypes.d.ts +1 -1
- package/node/lib/rtpParametersTypes.d.ts.map +1 -1
- package/node/lib/rtpStreamFbsUtils.d.ts +4 -0
- package/node/lib/rtpStreamFbsUtils.d.ts.map +1 -0
- package/node/lib/rtpStreamFbsUtils.js +51 -0
- package/node/lib/supportedRtpCapabilities.d.ts.map +1 -1
- package/node/lib/supportedRtpCapabilities.js +6 -13
- package/node/lib/test/test-Consumer.js +1 -13
- package/node/lib/test/test-DataConsumer.js +9 -0
- package/node/lib/test/test-DataProducer.js +38 -0
- package/node/lib/test/test-PipeTransport.js +27 -29
- package/node/lib/test/test-Producer.js +97 -0
- package/node/lib/test/test-ortc.js +34 -14
- package/package.json +10 -10
- package/worker/fbs/FBS/meson.build +25 -0
- package/worker/fbs/meson.build +15 -18
- package/worker/fbs/rtpParameters.fbs +0 -1
- package/worker/fuzzer/src/FuzzerUtils.cpp +5 -3
- package/worker/fuzzer/src/RTC/RTP/FuzzerPacket.cpp +16 -2
- package/worker/include/DepLibUV.hpp +13 -0
- package/worker/include/RTC/BWE/AlrDetector.hpp +97 -0
- package/worker/include/RTC/BWE/BitrateProber.hpp +217 -0
- package/worker/include/RTC/BWE/BitrateUtils.hpp +39 -0
- package/worker/include/RTC/BWE/BweTypes.hpp +171 -3
- package/worker/include/RTC/BWE/FeedbackAdapter.hpp +0 -14
- package/worker/include/RTC/BWE/InterArrival.hpp +117 -0
- package/worker/include/RTC/BWE/IntervalBudget.hpp +81 -0
- package/worker/include/RTC/BWE/LossBasedController.hpp +625 -0
- package/worker/include/RTC/BWE/OveruseDetector.hpp +71 -0
- package/worker/include/RTC/BWE/OveruseEstimator.hpp +115 -0
- package/worker/include/RTC/BWE/ProbeBitrateEstimator.hpp +84 -0
- package/worker/include/RTC/BWE/ProbeController.hpp +379 -0
- package/worker/include/RTC/BWE/ProbePacketGenerator.hpp +130 -0
- package/worker/include/RTC/BWE/ProbingScheduler.hpp +187 -0
- package/worker/include/RTC/BWE/RembGenerator.hpp +96 -0
- package/worker/include/RTC/BWE/RemoteBitrateEstimatorAbsSendTime.hpp +237 -0
- package/worker/include/RTC/BWE/RobustThroughputEstimator.hpp +26 -0
- package/worker/include/RTC/BWE/SendPacketHistory.hpp +161 -25
- package/worker/include/RTC/BWE/TargetRateController.hpp +306 -0
- package/worker/include/RTC/BWE/TransportWideCcFeedbackGenerator.hpp +146 -0
- package/worker/include/RTC/BWE/TrendlineEstimator.hpp +73 -16
- package/worker/include/RTC/Consts.hpp +70 -0
- package/worker/include/RTC/DataConsumer.hpp +3 -5
- package/worker/include/RTC/DirectTransport.hpp +4 -5
- package/worker/include/RTC/PipeTransport.hpp +4 -5
- package/worker/include/RTC/PlainTransport.hpp +4 -5
- package/worker/include/RTC/RTCP/FeedbackPsRemb.hpp +6 -7
- package/worker/include/RTC/RTCP/FeedbackRtpTransport.hpp +3 -1
- package/worker/include/RTC/RTP/Codecs/Tools.hpp +1 -1
- package/worker/include/RTC/RTP/HeaderExtensionIds.hpp +0 -1
- package/worker/include/RTC/RTP/Packet.hpp +16 -4
- package/worker/include/RTC/RTP/ProbationGenerator.hpp +0 -8
- package/worker/include/RTC/RTP/RtpStream.hpp +12 -9
- package/worker/include/RTC/RTP/RtpStreamRecv.hpp +22 -4
- package/worker/include/RTC/RTP/RtpStreamSend.hpp +4 -2
- package/worker/include/RTC/RTP/RtxStream.hpp +10 -4
- package/worker/include/RTC/RateCalculator.hpp +103 -24
- package/worker/include/RTC/RemoteCaptureTimeEstimator.hpp +33 -3
- package/worker/include/RTC/{RtcLogger.hpp → RtcLogger/RtpPacket.hpp} +5 -3
- package/worker/include/RTC/RtcLogger/SendBurst.hpp +88 -0
- package/worker/include/RTC/RtpDictionaries.hpp +3 -4
- package/worker/include/RTC/SCTP/association/Association.hpp +1 -1
- package/worker/include/RTC/SCTP/association/StreamResetHandler.hpp +36 -0
- package/worker/include/RTC/SCTP/public/AssociationMetrics.hpp +0 -1
- package/worker/include/RTC/SCTP/public/SctpTypes.hpp +9 -9
- package/worker/include/RTC/SCTP/rx/DataTracker.hpp +1 -1
- package/worker/include/RTC/SCTP/rx/ReassemblyQueue.hpp +11 -1
- package/worker/include/RTC/SctpDictionaries.hpp +2 -2
- package/worker/include/RTC/TcpConnection.hpp +2 -1
- package/worker/include/RTC/Transport.hpp +23 -8
- package/worker/include/RTC/TransportTuple.hpp +61 -6
- package/worker/include/RTC/WebRtcTransport.hpp +4 -5
- package/worker/include/Shared.hpp +5 -0
- package/worker/include/SharedInterface.hpp +10 -0
- package/worker/include/Utils.hpp +72 -3
- package/worker/include/common.hpp +12 -4
- package/worker/include/handles/SendCallbacks.hpp +34 -0
- package/worker/include/handles/TcpConnectionHandle.hpp +4 -12
- package/worker/include/handles/UdpSocketHandle.hpp +4 -8
- package/worker/meson.build +45 -1
- package/worker/meson_options.txt +1 -0
- package/worker/mocks/include/MockShared.hpp +16 -2
- package/worker/mocks/include/handles/MockBackoffTimerHandle.hpp +1 -1
- package/worker/scripts/package-lock.json +6 -6
- package/worker/src/RTC/BWE/AimdRateControl.cpp +4 -5
- package/worker/src/RTC/BWE/AlrDetector.cpp +80 -0
- package/worker/src/RTC/BWE/BitrateProber.cpp +256 -0
- package/worker/src/RTC/BWE/BitrateUtils.cpp +54 -0
- package/worker/src/RTC/BWE/DelayBasedBwe.cpp +2 -2
- package/worker/src/RTC/BWE/FeedbackAdapter.cpp +20 -37
- package/worker/src/RTC/BWE/InterArrival.cpp +216 -0
- package/worker/src/RTC/BWE/IntervalBudget.cpp +93 -0
- package/worker/src/RTC/BWE/LossBasedController.cpp +1194 -0
- package/worker/src/RTC/BWE/OveruseDetector.cpp +128 -0
- package/worker/src/RTC/BWE/OveruseEstimator.cpp +166 -0
- package/worker/src/RTC/BWE/ProbeBitrateEstimator.cpp +222 -0
- package/worker/src/RTC/BWE/ProbeController.cpp +645 -0
- package/worker/src/RTC/BWE/ProbePacketGenerator.cpp +140 -0
- package/worker/src/RTC/BWE/ProbingScheduler.cpp +196 -0
- package/worker/src/RTC/BWE/RembGenerator.cpp +169 -0
- package/worker/src/RTC/BWE/RemoteBitrateEstimatorAbsSendTime.cpp +497 -0
- package/worker/src/RTC/BWE/RobustThroughputEstimator.cpp +47 -0
- package/worker/src/RTC/BWE/SendPacketHistory.cpp +173 -50
- package/worker/src/RTC/BWE/TargetRateController.cpp +433 -0
- package/worker/src/RTC/BWE/TransportWideCcFeedbackGenerator.cpp +377 -0
- package/worker/src/RTC/BWE/TrendlineEstimator.cpp +102 -5
- package/worker/src/RTC/Consumer.cpp +7 -5
- package/worker/src/RTC/DataConsumer.cpp +8 -10
- package/worker/src/RTC/DirectTransport.cpp +14 -8
- package/worker/src/RTC/DtlsTransport.cpp +8 -8
- package/worker/src/RTC/ICE/IceCandidate.cpp +4 -4
- package/worker/src/RTC/ICE/IceServer.cpp +1 -1
- package/worker/src/RTC/PipeTransport.cpp +13 -8
- package/worker/src/RTC/PlainTransport.cpp +13 -8
- package/worker/src/RTC/Producer.cpp +14 -31
- package/worker/src/RTC/RTCP/Bye.cpp +1 -1
- package/worker/src/RTC/RTCP/FeedbackPsRemb.cpp +18 -0
- package/worker/src/RTC/RTCP/FeedbackPsRpsi.cpp +2 -2
- package/worker/src/RTC/RTCP/FeedbackPsVbcm.cpp +2 -1
- package/worker/src/RTC/RTCP/FeedbackRtpTransport.cpp +2 -2
- package/worker/src/RTC/RTCP/Sdes.cpp +1 -1
- package/worker/src/RTC/RTP/Codecs/DependencyDescriptor.cpp +2 -1
- package/worker/src/RTC/RTP/Packet.cpp +26 -11
- package/worker/src/RTC/RTP/ProbationGenerator.cpp +5 -6
- package/worker/src/RTC/RTP/RtpStream.cpp +1 -1
- package/worker/src/RTC/RTP/RtpStreamRecv.cpp +69 -48
- package/worker/src/RTC/RTP/RtpStreamSend.cpp +31 -31
- package/worker/src/RTC/RTP/RtxStream.cpp +22 -7
- package/worker/src/RTC/RateCalculator.cpp +133 -28
- package/worker/src/RTC/RemoteCaptureTimeEstimator.cpp +56 -1
- package/worker/src/RTC/{RtcLogger.cpp → RtcLogger/RtpPacket.cpp} +2 -2
- package/worker/src/RTC/RtcLogger/SendBurst.cpp +124 -0
- package/worker/src/RTC/RtpDictionaries/RtpHeaderExtensionUri.cpp +2 -12
- package/worker/src/RTC/RtpDictionaries/RtpParameters.cpp +1 -1
- package/worker/src/RTC/SCTP/association/Association.cpp +16 -2
- package/worker/src/RTC/SCTP/association/StreamResetHandler.cpp +106 -1
- package/worker/src/RTC/SCTP/public/AssociationMetrics.cpp +1 -1
- package/worker/src/RTC/SCTP/rx/InterleavedReassemblyStreams.cpp +3 -3
- package/worker/src/RTC/SCTP/rx/ReassemblyQueue.cpp +2 -1
- package/worker/src/RTC/SCTP/rx/TraditionalReassemblyStreams.cpp +4 -4
- package/worker/src/RTC/SCTP/tx/RetransmissionTimeout.cpp +4 -4
- package/worker/src/RTC/SctpDictionaries/SctpStreamParameters.cpp +6 -10
- package/worker/src/RTC/SimulcastProducerStreamManager.cpp +2 -2
- package/worker/src/RTC/SrtpSession.cpp +2 -2
- package/worker/src/RTC/SvcProducerStreamManager.cpp +2 -2
- package/worker/src/RTC/TcpConnection.cpp +2 -2
- package/worker/src/RTC/Transport.cpp +112 -75
- package/worker/src/RTC/TransportTuple.cpp +4 -4
- package/worker/src/RTC/WebRtcServer.cpp +4 -3
- package/worker/src/RTC/WebRtcTransport.cpp +20 -13
- package/worker/src/Utils/BitStream.cpp +24 -0
- package/worker/src/handles/BackoffTimerHandle.cpp +1 -1
- package/worker/src/handles/TcpConnectionHandle.cpp +13 -23
- package/worker/src/handles/UdpSocketHandle.cpp +14 -21
- package/worker/tasks.py +43 -18
- package/worker/test/include/RTC/BWE/helpers/LinkSimulator.hpp +68 -14
- package/worker/test/include/RTC/BWE/helpers/RemoteBitrateEstimatorAbsSendTimeTestHelper.hpp +125 -0
- package/worker/test/src/RTC/BWE/TestAlrDetector.cpp +110 -0
- package/worker/test/src/RTC/BWE/TestBitrateProber.cpp +418 -0
- package/worker/test/src/RTC/BWE/TestBitrateUtils.cpp +61 -0
- package/worker/test/src/RTC/BWE/TestDelayBasedBwe.cpp +4 -4
- package/worker/test/src/RTC/BWE/TestFeedbackAdapter.cpp +53 -37
- package/worker/test/src/RTC/BWE/TestInterArrival.cpp +643 -0
- package/worker/test/src/RTC/BWE/TestIntervalBudget.cpp +130 -0
- package/worker/test/src/RTC/BWE/TestLossBasedController.cpp +1199 -0
- package/worker/test/src/RTC/BWE/TestOveruseDetector.cpp +519 -0
- package/worker/test/src/RTC/BWE/TestProbeBitrateEstimator.cpp +266 -0
- package/worker/test/src/RTC/BWE/TestProbeController.cpp +1682 -0
- package/worker/test/src/RTC/BWE/TestProbePacketGenerator.cpp +265 -0
- package/worker/test/src/RTC/BWE/TestProbingScheduler.cpp +260 -0
- package/worker/test/src/RTC/BWE/TestRembGenerator.cpp +285 -0
- package/worker/test/src/RTC/BWE/TestRemoteBitrateEstimatorAbsSendTime.cpp +414 -0
- package/worker/test/src/RTC/BWE/TestSendPacketHistory.cpp +296 -77
- package/worker/test/src/RTC/BWE/TestTargetRateController.cpp +337 -0
- package/worker/test/src/RTC/BWE/TestTransportWideCcFeedbackGenerator.cpp +578 -0
- package/worker/test/src/RTC/BWE/TestTrendlineEstimator.cpp +45 -0
- package/worker/test/src/RTC/BWE/helpers/LinkSimulator.cpp +133 -29
- package/worker/test/src/RTC/BWE/helpers/RemoteBitrateEstimatorAbsSendTimeTestHelper.cpp +625 -0
- package/worker/test/src/RTC/RTCP/TestFeedbackPsRemb.cpp +19 -0
- package/worker/test/src/RTC/RTP/TestPacket.cpp +58 -4
- package/worker/test/src/RTC/RTP/TestProbationGenerator.cpp +3 -2
- package/worker/test/src/RTC/RTP/TestRtpStreamRecv.cpp +50 -0
- package/worker/test/src/RTC/RTP/TestRtpStreamSend.cpp +59 -0
- package/worker/test/src/RTC/SCTP/association/TestStreamResetHandler.cpp +111 -0
- package/worker/test/src/RTC/TestRateCalculator.cpp +322 -60
- package/worker/test/src/RTC/TestRemoteCaptureTimeEstimator.cpp +95 -7
- package/worker/test/src/RTC/TestSimpleProducerStreamManager.cpp +34 -16
- package/worker/test/src/RTC/TestSimulcastProducerStreamManager.cpp +31 -13
- package/worker/test/src/RTC/TestSvcProducerStreamManager.cpp +37 -19
- package/worker/test/src/RTC/TestTransportCongestionControlServer.cpp +10 -10
- package/worker/test/src/Utils/TestTime.cpp +120 -21
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
{ \
|
|
20
20
|
if (ERR_peek_error() == 0) \
|
|
21
21
|
{ \
|
|
22
|
-
|
|
22
|
+
MS_WARN_TAG(dtls, "OpenSSL error [desc:'%s']", desc); \
|
|
23
23
|
} \
|
|
24
24
|
else \
|
|
25
25
|
{ \
|
|
26
26
|
int64_t err; \
|
|
27
27
|
while ((err = ERR_get_error()) != 0) \
|
|
28
28
|
{ \
|
|
29
|
-
|
|
29
|
+
MS_WARN_TAG(dtls, "OpenSSL error [desc:'%s', error:'%s']", desc, ERR_error_string(err, nullptr)); \
|
|
30
30
|
} \
|
|
31
31
|
ERR_clear_error(); \
|
|
32
32
|
} \
|
|
@@ -225,7 +225,7 @@ namespace RTC
|
|
|
225
225
|
return DtlsTransport::Role::SERVER;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
|
|
228
|
+
NO_DEFAULT();
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
|
|
@@ -250,7 +250,7 @@ namespace RTC
|
|
|
250
250
|
return FBS::WebRtcTransport::DtlsRole::SERVER;
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
NO_DEFAULT();
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -285,7 +285,7 @@ namespace RTC
|
|
|
285
285
|
return FBS::WebRtcTransport::DtlsState::CLOSED;
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
|
|
288
|
+
NO_DEFAULT();
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
|
|
@@ -321,7 +321,7 @@ namespace RTC
|
|
|
321
321
|
return DtlsTransport::FingerprintAlgorithm::SHA512;
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
-
|
|
324
|
+
NO_DEFAULT();
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
|
|
@@ -357,7 +357,7 @@ namespace RTC
|
|
|
357
357
|
return FBS::WebRtcTransport::FingerprintAlgorithm::SHA512;
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
-
|
|
360
|
+
NO_DEFAULT();
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
363
|
|
|
@@ -1410,7 +1410,7 @@ namespace RTC
|
|
|
1410
1410
|
break;
|
|
1411
1411
|
}
|
|
1412
1412
|
|
|
1413
|
-
|
|
1413
|
+
NO_DEFAULT();
|
|
1414
1414
|
}
|
|
1415
1415
|
|
|
1416
1416
|
// Compare the remote fingerprint with the value given via signaling.
|
|
@@ -22,7 +22,7 @@ namespace RTC
|
|
|
22
22
|
return IceCandidate::CandidateType::HOST;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
NO_DEFAULT();
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -38,7 +38,7 @@ namespace RTC
|
|
|
38
38
|
return FBS::WebRtcTransport::IceCandidateType::HOST;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
NO_DEFAULT();
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -54,7 +54,7 @@ namespace RTC
|
|
|
54
54
|
return IceCandidate::TcpCandidateType::PASSIVE;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
NO_DEFAULT();
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -70,7 +70,7 @@ namespace RTC
|
|
|
70
70
|
return FBS::WebRtcTransport::IceCandidateTcpType::PASSIVE;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
NO_DEFAULT();
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -497,6 +497,13 @@ namespace RTC
|
|
|
497
497
|
return this->tuple ? true : false;
|
|
498
498
|
}
|
|
499
499
|
|
|
500
|
+
inline size_t PipeTransport::GetPacketOverhead() const
|
|
501
|
+
{
|
|
502
|
+
MS_TRACE();
|
|
503
|
+
|
|
504
|
+
return this->tuple ? this->tuple->GetPacketOverhead() : 0;
|
|
505
|
+
}
|
|
506
|
+
|
|
500
507
|
inline bool PipeTransport::HasSrtp() const
|
|
501
508
|
{
|
|
502
509
|
MS_TRACE();
|
|
@@ -505,7 +512,7 @@ namespace RTC
|
|
|
505
512
|
}
|
|
506
513
|
|
|
507
514
|
void PipeTransport::SendRtpPacket(
|
|
508
|
-
RTC::Consumer* /*consumer*/, RTC::RTP::Packet* packet,
|
|
515
|
+
RTC::Consumer* /*consumer*/, RTC::RTP::Packet* packet, onSendCallback cb)
|
|
509
516
|
{
|
|
510
517
|
MS_TRACE();
|
|
511
518
|
|
|
@@ -513,8 +520,7 @@ namespace RTC
|
|
|
513
520
|
{
|
|
514
521
|
if (cb)
|
|
515
522
|
{
|
|
516
|
-
|
|
517
|
-
delete cb;
|
|
523
|
+
cb(false);
|
|
518
524
|
}
|
|
519
525
|
|
|
520
526
|
return;
|
|
@@ -527,14 +533,13 @@ namespace RTC
|
|
|
527
533
|
{
|
|
528
534
|
if (cb)
|
|
529
535
|
{
|
|
530
|
-
|
|
531
|
-
delete cb;
|
|
536
|
+
cb(false);
|
|
532
537
|
}
|
|
533
538
|
|
|
534
539
|
return;
|
|
535
540
|
}
|
|
536
541
|
|
|
537
|
-
this->tuple->Send(data, len, cb);
|
|
542
|
+
this->tuple->Send(data, len, std::move(cb));
|
|
538
543
|
|
|
539
544
|
// Increase send transmission.
|
|
540
545
|
RTC::Transport::DataSent(len);
|
|
@@ -589,11 +594,11 @@ namespace RTC
|
|
|
589
594
|
}
|
|
590
595
|
|
|
591
596
|
void PipeTransport::SendMessage(
|
|
592
|
-
RTC::DataConsumer* dataConsumer, RTC::SCTP::Message message,
|
|
597
|
+
RTC::DataConsumer* dataConsumer, RTC::SCTP::Message message, onMessageQueuedCallback cb)
|
|
593
598
|
{
|
|
594
599
|
MS_TRACE();
|
|
595
600
|
|
|
596
|
-
SendSctpMessage(dataConsumer, std::move(message), cb);
|
|
601
|
+
SendSctpMessage(dataConsumer, std::move(message), std::move(cb));
|
|
597
602
|
}
|
|
598
603
|
|
|
599
604
|
bool PipeTransport::SendData(const uint8_t* data, size_t len)
|
|
@@ -804,6 +804,13 @@ namespace RTC
|
|
|
804
804
|
return this->tuple ? true : false;
|
|
805
805
|
}
|
|
806
806
|
|
|
807
|
+
inline size_t PlainTransport::GetPacketOverhead() const
|
|
808
|
+
{
|
|
809
|
+
MS_TRACE();
|
|
810
|
+
|
|
811
|
+
return this->tuple ? this->tuple->GetPacketOverhead() : 0;
|
|
812
|
+
}
|
|
813
|
+
|
|
807
814
|
inline bool PlainTransport::HasSrtp() const
|
|
808
815
|
{
|
|
809
816
|
MS_TRACE();
|
|
@@ -819,7 +826,7 @@ namespace RTC
|
|
|
819
826
|
}
|
|
820
827
|
|
|
821
828
|
void PlainTransport::SendRtpPacket(
|
|
822
|
-
RTC::Consumer* /*consumer*/, RTC::RTP::Packet* packet,
|
|
829
|
+
RTC::Consumer* /*consumer*/, RTC::RTP::Packet* packet, onSendCallback cb)
|
|
823
830
|
{
|
|
824
831
|
MS_TRACE();
|
|
825
832
|
|
|
@@ -827,8 +834,7 @@ namespace RTC
|
|
|
827
834
|
{
|
|
828
835
|
if (cb)
|
|
829
836
|
{
|
|
830
|
-
|
|
831
|
-
delete cb;
|
|
837
|
+
cb(false);
|
|
832
838
|
}
|
|
833
839
|
|
|
834
840
|
return;
|
|
@@ -841,14 +847,13 @@ namespace RTC
|
|
|
841
847
|
{
|
|
842
848
|
if (cb)
|
|
843
849
|
{
|
|
844
|
-
|
|
845
|
-
delete cb;
|
|
850
|
+
cb(false);
|
|
846
851
|
}
|
|
847
852
|
|
|
848
853
|
return;
|
|
849
854
|
}
|
|
850
855
|
|
|
851
|
-
this->tuple->Send(data, len, cb);
|
|
856
|
+
this->tuple->Send(data, len, std::move(cb));
|
|
852
857
|
|
|
853
858
|
// Increase send transmission.
|
|
854
859
|
RTC::Transport::DataSent(len);
|
|
@@ -917,11 +922,11 @@ namespace RTC
|
|
|
917
922
|
}
|
|
918
923
|
|
|
919
924
|
void PlainTransport::SendMessage(
|
|
920
|
-
RTC::DataConsumer* dataConsumer, RTC::SCTP::Message message,
|
|
925
|
+
RTC::DataConsumer* dataConsumer, RTC::SCTP::Message message, onMessageQueuedCallback cb)
|
|
921
926
|
{
|
|
922
927
|
MS_TRACE();
|
|
923
928
|
|
|
924
|
-
SendSctpMessage(dataConsumer, std::move(message), cb);
|
|
929
|
+
SendSctpMessage(dataConsumer, std::move(message), std::move(cb));
|
|
925
930
|
}
|
|
926
931
|
|
|
927
932
|
bool PlainTransport::SendData(const uint8_t* data, size_t len)
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#include "RTC/RTP/Codecs/Tools.hpp"
|
|
11
11
|
#include "Utils.hpp"
|
|
12
12
|
#ifdef MS_RTC_LOGGER_RTP
|
|
13
|
-
#include "RTC/RtcLogger.hpp"
|
|
13
|
+
#include "RTC/RtcLogger/RtpPacket.hpp"
|
|
14
14
|
#endif
|
|
15
15
|
#include <cstring> // std::memcpy()
|
|
16
16
|
|
|
@@ -83,18 +83,22 @@ namespace RTC
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
// rid is optional.
|
|
86
|
+
const bool hasRid =
|
|
87
|
+
flatbuffers::IsFieldPresent(encoding, FBS::RtpParameters::EncodingMapping::VT_RID);
|
|
88
|
+
|
|
89
|
+
if (hasRid)
|
|
90
|
+
{
|
|
91
|
+
encodingMapping.rid = encoding->rid()->str();
|
|
92
|
+
}
|
|
93
|
+
|
|
86
94
|
// However ssrc or rid must be present (if more than 1 encoding).
|
|
87
|
-
if (
|
|
88
|
-
encodings->size() > 1 && !encoding->ssrc().has_value() &&
|
|
89
|
-
!flatbuffers::IsFieldPresent(encoding, FBS::RtpParameters::EncodingMapping::VT_RID))
|
|
95
|
+
if (encodings->size() > 1 && !encoding->ssrc().has_value() && !hasRid)
|
|
90
96
|
{
|
|
91
97
|
MS_THROW_TYPE_ERROR("wrong entry in rtpMapping.encodings (missing ssrc or rid)");
|
|
92
98
|
}
|
|
93
99
|
|
|
94
100
|
// If there is no mid and a single encoding, ssrc or rid must be present.
|
|
95
|
-
if (
|
|
96
|
-
this->rtpParameters.mid.empty() && encodings->size() == 1 && !encoding->ssrc().has_value() &&
|
|
97
|
-
!flatbuffers::IsFieldPresent(encoding, FBS::RtpParameters::EncodingMapping::VT_RID))
|
|
101
|
+
if (this->rtpParameters.mid.empty() && encodings->size() == 1 && !encoding->ssrc().has_value() && !hasRid)
|
|
98
102
|
{
|
|
99
103
|
MS_THROW_TYPE_ERROR(
|
|
100
104
|
"wrong entry in rtpMapping.encodings (missing ssrc or rid, or rtpParameters.mid)");
|
|
@@ -171,11 +175,6 @@ namespace RTC
|
|
|
171
175
|
this->rtpHeaderExtensionIds.videoOrientation = exten.id;
|
|
172
176
|
}
|
|
173
177
|
|
|
174
|
-
if (this->rtpHeaderExtensionIds.timeOffset == 0u && exten.type == RTC::RtpHeaderExtensionUri::Type::TIME_OFFSET)
|
|
175
|
-
{
|
|
176
|
-
this->rtpHeaderExtensionIds.timeOffset = exten.id;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
178
|
if (this->rtpHeaderExtensionIds.absCaptureTime == 0u && exten.type == RTC::RtpHeaderExtensionUri::Type::ABS_CAPTURE_TIME)
|
|
180
179
|
{
|
|
181
180
|
this->rtpHeaderExtensionIds.absCaptureTime = exten.id;
|
|
@@ -268,7 +267,7 @@ namespace RTC
|
|
|
268
267
|
encodings.emplace_back(
|
|
269
268
|
FBS::RtpParameters::CreateEncodingMappingDirect(
|
|
270
269
|
builder,
|
|
271
|
-
encodingMapping.rid.c_str(),
|
|
270
|
+
encodingMapping.rid.empty() ? nullptr : encodingMapping.rid.c_str(),
|
|
272
271
|
encodingMapping.ssrc != 0u ? flatbuffers::Optional<uint32_t>(encodingMapping.ssrc)
|
|
273
272
|
: flatbuffers::nullopt,
|
|
274
273
|
encodingMapping.mappedSsrc));
|
|
@@ -776,7 +775,7 @@ namespace RTC
|
|
|
776
775
|
// Add a receiver reference time report if no present in the packet.
|
|
777
776
|
if (!packet->HasReceiverReferenceTime())
|
|
778
777
|
{
|
|
779
|
-
auto ntp = Utils::Time::
|
|
778
|
+
auto ntp = Utils::Time::TimeUsToNtp(nowUs + this->shared->GetNtpOffsetUs());
|
|
780
779
|
|
|
781
780
|
receiverReferenceTimeReport = new RTC::RTCP::ReceiverReferenceTime();
|
|
782
781
|
|
|
@@ -1259,7 +1258,7 @@ namespace RTC
|
|
|
1259
1258
|
// the most likely case rather than a wild guess.
|
|
1260
1259
|
const auto remoteClockOffsetUs = this->listener->OnProducerNeedRemoteClockOffsetUs(this);
|
|
1261
1260
|
const auto remoteClockOffsetQ32x32 =
|
|
1262
|
-
Utils::Time::
|
|
1261
|
+
Utils::Time::TimeUsToQ32x32(remoteClockOffsetUs.value_or(0));
|
|
1263
1262
|
|
|
1264
1263
|
// NOTE: An offset that does not fit in the extension means a sender whose clock
|
|
1265
1264
|
// is decades away from ours, and there is no value to write that would not be a
|
|
@@ -1402,22 +1401,6 @@ namespace RTC
|
|
|
1402
1401
|
|
|
1403
1402
|
bufferPtr += extenLen;
|
|
1404
1403
|
}
|
|
1405
|
-
|
|
1406
|
-
// Proxy urn:ietf:params:rtp-hdrext:toffset.
|
|
1407
|
-
extenValue = packet->GetExtensionValue(this->rtpHeaderExtensionIds.timeOffset, extenLen);
|
|
1408
|
-
|
|
1409
|
-
if (extenValue)
|
|
1410
|
-
{
|
|
1411
|
-
std::memcpy(bufferPtr, extenValue, extenLen);
|
|
1412
|
-
|
|
1413
|
-
extensions.emplace_back(
|
|
1414
|
-
/*type*/ RTC::RtpHeaderExtensionUri::Type::TIME_OFFSET,
|
|
1415
|
-
/*id*/ static_cast<uint8_t>(RTC::RtpHeaderExtensionUri::Type::TIME_OFFSET),
|
|
1416
|
-
/*len*/ extenLen,
|
|
1417
|
-
/*value*/ bufferPtr);
|
|
1418
|
-
|
|
1419
|
-
bufferPtr += extenLen;
|
|
1420
|
-
}
|
|
1421
1404
|
}
|
|
1422
1405
|
|
|
1423
1406
|
// Add urn:mediasoup:params:rtp-hdrext:packet-id.
|
|
@@ -115,6 +115,24 @@ namespace RTC
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
void FeedbackPsRembPacket::SetSsrcs(const std::vector<uint32_t>& ssrcs)
|
|
119
|
+
{
|
|
120
|
+
MS_TRACE();
|
|
121
|
+
|
|
122
|
+
this->ssrcs = ssrcs;
|
|
123
|
+
|
|
124
|
+
if (this->ssrcs.size() > FeedbackPsRembPacket::MaxNumberOfSsrcs)
|
|
125
|
+
{
|
|
126
|
+
MS_WARN_TAG(
|
|
127
|
+
rtcp,
|
|
128
|
+
"resizing ssrcs because they don't fit in a REMB [ssrcs:%zu, max:%zu]",
|
|
129
|
+
this->ssrcs.size(),
|
|
130
|
+
FeedbackPsRembPacket::MaxNumberOfSsrcs);
|
|
131
|
+
|
|
132
|
+
this->ssrcs.resize(FeedbackPsRembPacket::MaxNumberOfSsrcs);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
118
136
|
size_t FeedbackPsRembPacket::Serialize(uint8_t* buffer)
|
|
119
137
|
{
|
|
120
138
|
MS_TRACE();
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "RTC/RTCP/FeedbackPsRpsi.hpp"
|
|
5
5
|
#include "Logger.hpp"
|
|
6
|
+
#include "Utils.hpp"
|
|
6
7
|
#include <cstring>
|
|
7
8
|
|
|
8
9
|
namespace RTC
|
|
@@ -48,9 +49,8 @@ namespace RTC
|
|
|
48
49
|
|
|
49
50
|
this->header = reinterpret_cast<Header*>(this->raw);
|
|
50
51
|
|
|
51
|
-
// TODO: We should use Utils::Byte::PadTo4Bytes().
|
|
52
52
|
// 32 bits padding.
|
|
53
|
-
const
|
|
53
|
+
const auto padding = static_cast<uint8_t>(Utils::Byte::PadTo4Bytes(length) - length);
|
|
54
54
|
|
|
55
55
|
this->header->paddingBits = padding * 8;
|
|
56
56
|
this->header->zero = 0;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "RTC/RTCP/FeedbackPsVbcm.hpp"
|
|
5
5
|
#include "Logger.hpp"
|
|
6
|
+
#include "Utils.hpp"
|
|
6
7
|
#include <cstring> // std::memcpy
|
|
7
8
|
|
|
8
9
|
namespace RTC
|
|
@@ -38,7 +39,7 @@ namespace RTC
|
|
|
38
39
|
|
|
39
40
|
const size_t offset = 8 + GetLength();
|
|
40
41
|
// 32 bits padding.
|
|
41
|
-
const size_t padding = (
|
|
42
|
+
const size_t padding = Utils::Byte::PadTo4Bytes(offset) - offset;
|
|
42
43
|
|
|
43
44
|
for (size_t i{ 0 }; i < padding; ++i)
|
|
44
45
|
{
|
|
@@ -271,7 +271,7 @@ namespace RTC
|
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
// 32 bits padding.
|
|
274
|
-
const size_t padding = (
|
|
274
|
+
const size_t padding = Utils::Byte::PadTo4Bytes(offset) - offset;
|
|
275
275
|
|
|
276
276
|
for (size_t i{ 0u }; i < padding; ++i)
|
|
277
277
|
{
|
|
@@ -380,7 +380,7 @@ namespace RTC
|
|
|
380
380
|
size += 2u;
|
|
381
381
|
|
|
382
382
|
// 32 bits padding.
|
|
383
|
-
size
|
|
383
|
+
size = Utils::Byte::PadTo4Bytes(size);
|
|
384
384
|
|
|
385
385
|
if (size > maxRtcpPacketLen)
|
|
386
386
|
{
|
|
@@ -475,7 +475,8 @@ namespace RTC
|
|
|
475
475
|
WriteMandatoryDescriptorFields();
|
|
476
476
|
WriteExtendedDescriptorFields();
|
|
477
477
|
|
|
478
|
-
|
|
478
|
+
// The written bits rounded up to whole bytes.
|
|
479
|
+
len = static_cast<uint8_t>((this->bitStream.GetOffset() + 7) >> 3);
|
|
479
480
|
|
|
480
481
|
return this->bitStream.GetData();
|
|
481
482
|
}
|
|
@@ -818,12 +818,6 @@ namespace RTC
|
|
|
818
818
|
break;
|
|
819
819
|
}
|
|
820
820
|
|
|
821
|
-
case RTC::RtpHeaderExtensionUri::Type::TIME_OFFSET:
|
|
822
|
-
{
|
|
823
|
-
this->headerExtensionIds.timeOffset = extension.id;
|
|
824
|
-
break;
|
|
825
|
-
}
|
|
826
|
-
|
|
827
821
|
case RTC::RtpHeaderExtensionUri::Type::ABS_CAPTURE_TIME:
|
|
828
822
|
{
|
|
829
823
|
this->headerExtensionIds.absCaptureTime = extension.id;
|
|
@@ -962,7 +956,7 @@ namespace RTC
|
|
|
962
956
|
return true;
|
|
963
957
|
}
|
|
964
958
|
|
|
965
|
-
bool Packet::UpdateAbsSendTime(
|
|
959
|
+
bool Packet::UpdateAbsSendTime(uint32_t absSendTime) const
|
|
966
960
|
{
|
|
967
961
|
MS_TRACE();
|
|
968
962
|
|
|
@@ -974,8 +968,6 @@ namespace RTC
|
|
|
974
968
|
return false;
|
|
975
969
|
}
|
|
976
970
|
|
|
977
|
-
auto absSendTime = Utils::Time::TimeUsToAbsSendTime(sentAtUs);
|
|
978
|
-
|
|
979
971
|
Utils::Byte::Set3Bytes(extenValue, 0, absSendTime);
|
|
980
972
|
|
|
981
973
|
return true;
|
|
@@ -1201,6 +1193,25 @@ namespace RTC
|
|
|
1201
1193
|
return true;
|
|
1202
1194
|
}
|
|
1203
1195
|
|
|
1196
|
+
bool Packet::UpdateAbsCaptureTime(uint64_t absCaptureTimestamp) const
|
|
1197
|
+
{
|
|
1198
|
+
MS_TRACE();
|
|
1199
|
+
|
|
1200
|
+
uint8_t extenLen;
|
|
1201
|
+
uint8_t* extenValue = GetExtensionValue(this->headerExtensionIds.absCaptureTime, extenLen);
|
|
1202
|
+
|
|
1203
|
+
// Extension value can be 8 or 16 bytes depending on whether it contains
|
|
1204
|
+
// estimated capture clock offset or not.
|
|
1205
|
+
if (!extenValue || (extenLen != 8u && extenLen != 16u))
|
|
1206
|
+
{
|
|
1207
|
+
return false;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
Utils::Byte::Set8Bytes(extenValue, 0, absCaptureTimestamp);
|
|
1211
|
+
|
|
1212
|
+
return true;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1204
1215
|
bool Packet::ReadPlayoutDelay(uint16_t& minDelay, uint16_t& maxDelay) const
|
|
1205
1216
|
{
|
|
1206
1217
|
MS_TRACE();
|
|
@@ -1413,6 +1424,11 @@ namespace RTC
|
|
|
1413
1424
|
SetPaddingLength(0);
|
|
1414
1425
|
}
|
|
1415
1426
|
|
|
1427
|
+
// NOTE: Get the payload length before increasing the packet length,
|
|
1428
|
+
// otherwise the 2 bytes of the original sequence number would be
|
|
1429
|
+
// counted as payload and moved beyond the new end of the packet.
|
|
1430
|
+
const auto payloadLength = GetPayloadLength();
|
|
1431
|
+
|
|
1416
1432
|
// Update packet length.
|
|
1417
1433
|
// NOTE: This throws if given length is higher than buffer length.
|
|
1418
1434
|
SetLength(GetLength() + 2);
|
|
@@ -1423,8 +1439,7 @@ namespace RTC
|
|
|
1423
1439
|
// Rewrite the SSRC.
|
|
1424
1440
|
SetSsrc(ssrc);
|
|
1425
1441
|
|
|
1426
|
-
auto* payload
|
|
1427
|
-
const auto payloadLength = GetPayloadLength();
|
|
1442
|
+
auto* payload = GetPayloadPointer();
|
|
1428
1443
|
|
|
1429
1444
|
// Write the original sequence number at the begining of the payload.
|
|
1430
1445
|
std::memmove(payload + 2, payload, payloadLength);
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "RTC/RTP/ProbationGenerator.hpp"
|
|
5
5
|
#include "Logger.hpp"
|
|
6
|
+
#include "RTC/Consts.hpp"
|
|
6
7
|
#include "RTC/RtpDictionaries.hpp"
|
|
7
8
|
#include "Utils.hpp"
|
|
8
9
|
#include <cstring> // std::memcpy(), std::memset()
|
|
@@ -18,8 +19,6 @@ namespace RTC
|
|
|
18
19
|
static constexpr size_t ProbationPacketExtensionsBufferLength{ 200 };
|
|
19
20
|
alignas(4) static thread_local uint8_t
|
|
20
21
|
ProbationPacketExtensionsBuffer[ProbationPacketExtensionsBufferLength];
|
|
21
|
-
// 8 bytes, same as RTC::Consts::MidRtpExtensionMaxLength.
|
|
22
|
-
static const std::string MidValue{ "probator" };
|
|
23
22
|
|
|
24
23
|
/* Instance methods. */
|
|
25
24
|
|
|
@@ -42,10 +41,10 @@ namespace RTC
|
|
|
42
41
|
RTP::Packet::Factory(ProbationPacketBuffer, sizeof(ProbationPacketBuffer)));
|
|
43
42
|
|
|
44
43
|
// Sex fixed codec payload type.
|
|
45
|
-
this->probationPacket->SetPayloadType(
|
|
44
|
+
this->probationPacket->SetPayloadType(RTC::Consts::BweProbeRtpPayloadType);
|
|
46
45
|
|
|
47
46
|
// Set fixed SSRC.
|
|
48
|
-
this->probationPacket->SetSsrc(
|
|
47
|
+
this->probationPacket->SetSsrc(RTC::Consts::BweProbeRtpSsrc);
|
|
49
48
|
|
|
50
49
|
// Set random initial RTP seq number.
|
|
51
50
|
this->probationPacket->SetSequenceNumber(Utils::Crypto::GetRandomUInt<uint16_t>(0, 65535));
|
|
@@ -60,7 +59,7 @@ namespace RTC
|
|
|
60
59
|
|
|
61
60
|
// Add urn:ietf:params:rtp-hdrext:sdes:mid.
|
|
62
61
|
{
|
|
63
|
-
extenLen =
|
|
62
|
+
extenLen = RTC::Consts::BweProbeRtpMid.size();
|
|
64
63
|
|
|
65
64
|
extensions.emplace_back(
|
|
66
65
|
/*type*/ RTC::RtpHeaderExtensionUri::Type::MID,
|
|
@@ -68,7 +67,7 @@ namespace RTC
|
|
|
68
67
|
/*len*/ extenLen,
|
|
69
68
|
/*value*/ bufferPtr);
|
|
70
69
|
|
|
71
|
-
std::memcpy(bufferPtr,
|
|
70
|
+
std::memcpy(bufferPtr, RTC::Consts::BweProbeRtpMid.data(), extenLen);
|
|
72
71
|
|
|
73
72
|
bufferPtr += extenLen;
|
|
74
73
|
}
|