mediasoup 3.27.1 → 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 +14 -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/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/{Utils.hpp → BitrateUtils.hpp} +3 -3
- package/worker/include/RTC/BWE/BweTypes.hpp +170 -2
- 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 +105 -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/TransportWideCcFeedbackGenerator.hpp +146 -0
- package/worker/include/RTC/BWE/TrendlineEstimator.hpp +15 -0
- 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/public/AssociationMetrics.hpp +0 -1
- package/worker/include/RTC/SCTP/public/SctpTypes.hpp +4 -4
- package/worker/include/RTC/SCTP/rx/DataTracker.hpp +1 -1
- package/worker/include/RTC/SCTP/rx/ReassemblyQueue.hpp +1 -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 +41 -3
- 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/{Utils.cpp → BitrateUtils.cpp} +4 -4
- 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 +189 -41
- 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 +12 -14
- package/worker/src/RTC/BWE/TransportWideCcFeedbackGenerator.cpp +377 -0
- package/worker/src/RTC/BWE/TrendlineEstimator.cpp +19 -0
- 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 +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 +111 -93
- 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/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/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/TestTransportWideCcFeedbackGenerator.cpp +578 -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/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
- package/worker/test/src/RTC/BWE/TestUtils.cpp +0 -61
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
#ifndef MS_RTC_BWE_TRANSPORT_WIDE_CC_FEEDBACK_GENERATOR_HPP
|
|
2
|
+
#define MS_RTC_BWE_TRANSPORT_WIDE_CC_FEEDBACK_GENERATOR_HPP
|
|
3
|
+
|
|
4
|
+
#include "common.hpp"
|
|
5
|
+
#include "handles/TimerHandleInterface.hpp"
|
|
6
|
+
#include "RTC/RTCP/FeedbackRtpTransport.hpp"
|
|
7
|
+
#include "RTC/RTP/Packet.hpp"
|
|
8
|
+
#include "RTC/RateCalculator.hpp"
|
|
9
|
+
#include "RTC/SeqManager.hpp"
|
|
10
|
+
#include "SharedInterface.hpp"
|
|
11
|
+
#include <map>
|
|
12
|
+
|
|
13
|
+
namespace RTC
|
|
14
|
+
{
|
|
15
|
+
namespace BWE
|
|
16
|
+
{
|
|
17
|
+
/**
|
|
18
|
+
* Tells the remote sender when each of its packets arrived, which is what
|
|
19
|
+
* lets that sender estimate the link towards us.
|
|
20
|
+
*
|
|
21
|
+
* Nothing is estimated here. The arrival time of every packet carrying the
|
|
22
|
+
* transport wide sequence number is kept, and a feedback packet with as many
|
|
23
|
+
* of them as fit is emitted periodically. Turning those arrival times into a
|
|
24
|
+
* bitrate is the remote sender's job.
|
|
25
|
+
*
|
|
26
|
+
* How often the feedback is emitted follows the bitrate coming in, so that
|
|
27
|
+
* what reporting costs stays a small share of what is being reported on.
|
|
28
|
+
*/
|
|
29
|
+
class TransportWideCcFeedbackGenerator : public TimerHandleInterface::Listener
|
|
30
|
+
{
|
|
31
|
+
public:
|
|
32
|
+
class Listener
|
|
33
|
+
{
|
|
34
|
+
public:
|
|
35
|
+
virtual ~Listener() = default;
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* A feedback packet is ready for the remote sender.
|
|
40
|
+
*
|
|
41
|
+
* @param packet - Packet to send, only valid for the duration of this
|
|
42
|
+
* call.
|
|
43
|
+
*/
|
|
44
|
+
virtual void OnTransportWideCcFeedbackGeneratorSendRtcpPacket(
|
|
45
|
+
TransportWideCcFeedbackGenerator* transportWideCcFeedbackGenerator,
|
|
46
|
+
RTC::RTCP::FeedbackRtpTransportPacket* packet) = 0;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
TransportWideCcFeedbackGenerator(
|
|
51
|
+
Listener* listener, SharedInterface* shared, size_t maxRtcpPacketLen);
|
|
52
|
+
~TransportWideCcFeedbackGenerator() override = default;
|
|
53
|
+
|
|
54
|
+
TransportWideCcFeedbackGenerator(const TransportWideCcFeedbackGenerator&) = delete;
|
|
55
|
+
TransportWideCcFeedbackGenerator& operator=(const TransportWideCcFeedbackGenerator&) = delete;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Feed a received RTP packet, which is ignored unless it carries the
|
|
59
|
+
* transport wide sequence number extension.
|
|
60
|
+
*
|
|
61
|
+
* @param arrivalTimeUs - Instant the packet arrived.
|
|
62
|
+
*/
|
|
63
|
+
void IncomingPacket(int64_t arrivalTimeUs, const RTC::RTP::Packet* packet);
|
|
64
|
+
|
|
65
|
+
#ifdef MS_TEST
|
|
66
|
+
public:
|
|
67
|
+
#else
|
|
68
|
+
private:
|
|
69
|
+
#endif
|
|
70
|
+
/**
|
|
71
|
+
* Report everything received since the last time, in as many feedback
|
|
72
|
+
* packets as it takes.
|
|
73
|
+
*/
|
|
74
|
+
void FillAndSendFeedback();
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* How often feedback should be emitted (ms) to report on the given
|
|
78
|
+
* incoming bitrate (bps) without taking more than a small share of it.
|
|
79
|
+
*/
|
|
80
|
+
static int64_t ComputeSendIntervalMs(int64_t incomingBitrate);
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* How often feedback is being emitted right now (ms).
|
|
84
|
+
*/
|
|
85
|
+
int64_t GetSendIntervalMs() const
|
|
86
|
+
{
|
|
87
|
+
return this->sendIntervalMs;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
private:
|
|
91
|
+
/**
|
|
92
|
+
* Hand the feedback packet being filled to the listener.
|
|
93
|
+
*
|
|
94
|
+
* @returns Whether it was handed over, which does not happen when it holds
|
|
95
|
+
* nothing that can be put on the wire.
|
|
96
|
+
*/
|
|
97
|
+
bool SendFeedback();
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Forget the arrival times too old to be reported, keeping the one the
|
|
101
|
+
* next feedback starts at.
|
|
102
|
+
*/
|
|
103
|
+
void MayDropOldPacketArrivalTimes(uint16_t seqNum, int64_t arrivalTimeUs);
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Start a new feedback packet, carrying on the given count.
|
|
107
|
+
*/
|
|
108
|
+
void ResetFeedbackPacket(uint8_t feedbackPacketCount);
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Work out how often feedback should be emitted out of the bitrate coming
|
|
112
|
+
* in, and reprogram the timer if the answer changed.
|
|
113
|
+
*/
|
|
114
|
+
void MayUpdateSendInterval(int64_t nowMs);
|
|
115
|
+
|
|
116
|
+
/* Pure virtual methods inherited from TimerHandleInterface::Listener. */
|
|
117
|
+
public:
|
|
118
|
+
void OnTimer(TimerHandleInterface* timer) override;
|
|
119
|
+
|
|
120
|
+
private:
|
|
121
|
+
// Largest an RTCP packet may be on this transport (bytes).
|
|
122
|
+
const size_t maxRtcpPacketLen;
|
|
123
|
+
|
|
124
|
+
// Passed by argument.
|
|
125
|
+
Listener* listener{ nullptr };
|
|
126
|
+
SharedInterface* shared{ nullptr };
|
|
127
|
+
// Allocated by this.
|
|
128
|
+
const std::unique_ptr<TimerHandleInterface> sendPeriodicTimer;
|
|
129
|
+
std::unique_ptr<RTC::RTCP::FeedbackRtpTransportPacket> feedbackPacket;
|
|
130
|
+
// Bitrate coming in, which is what decides how often feedback is emitted.
|
|
131
|
+
RTC::RtpDataCounter incomingDataCounter;
|
|
132
|
+
// How often feedback is emitted (ms).
|
|
133
|
+
int64_t sendIntervalMs;
|
|
134
|
+
uint8_t feedbackPacketCount{ 0 };
|
|
135
|
+
uint32_t feedbackMediaSsrc{ 0 };
|
|
136
|
+
// Sequence number the next feedback starts reporting at, or no value
|
|
137
|
+
// until the first packet is seen.
|
|
138
|
+
std::optional<uint16_t> feedbackWideSeqNumStart;
|
|
139
|
+
// Instant each packet arrived (us), indexed by its transport wide
|
|
140
|
+
// sequence number.
|
|
141
|
+
std::map<uint16_t, int64_t, RTC::SeqManager<uint16_t>::SeqLowerThan> mapPacketArrivalTimes;
|
|
142
|
+
};
|
|
143
|
+
} // namespace BWE
|
|
144
|
+
} // namespace RTC
|
|
145
|
+
|
|
146
|
+
#endif
|
|
@@ -27,6 +27,13 @@ namespace RTC
|
|
|
27
27
|
class TrendlineEstimator
|
|
28
28
|
{
|
|
29
29
|
public:
|
|
30
|
+
/**
|
|
31
|
+
* @remarks
|
|
32
|
+
* - Every constraint documented below is checked by the constructor and
|
|
33
|
+
* aborts when it doesn't hold. These options are set from C++ alone,
|
|
34
|
+
* never from the network nor from the API, so breaking one of them is a
|
|
35
|
+
* programming error.
|
|
36
|
+
*/
|
|
30
37
|
struct TrendlineEstimatorOptions
|
|
31
38
|
{
|
|
32
39
|
/**
|
|
@@ -52,10 +59,18 @@ namespace RTC
|
|
|
52
59
|
bool enableCap{ false };
|
|
53
60
|
/**
|
|
54
61
|
* How many packets of the beginning of the window that cap looks at.
|
|
62
|
+
*
|
|
63
|
+
* @remarks
|
|
64
|
+
* - While `enableCap` is set it must be at least 1, and the two ends
|
|
65
|
+
* together must fit in `windowSize`, since the cap looks at both of
|
|
66
|
+
* them without them overlapping.
|
|
55
67
|
*/
|
|
56
68
|
size_t beginningPackets{ 7 };
|
|
57
69
|
/**
|
|
58
70
|
* How many packets of the end of the window that cap looks at.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* - The same constraints as `beginningPackets`.
|
|
59
74
|
*/
|
|
60
75
|
size_t endPackets{ 7 };
|
|
61
76
|
/**
|
|
@@ -2,11 +2,39 @@
|
|
|
2
2
|
#define MS_RTC_CONSTS_HPP
|
|
3
3
|
|
|
4
4
|
#include "common.hpp"
|
|
5
|
+
#include <string_view>
|
|
5
6
|
|
|
6
7
|
namespace RTC
|
|
7
8
|
{
|
|
8
9
|
namespace Consts
|
|
9
10
|
{
|
|
11
|
+
/**
|
|
12
|
+
* Bytes an IPv4 header takes, without options.
|
|
13
|
+
*/
|
|
14
|
+
constexpr size_t Ipv4HeaderSize{ 20 };
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Bytes an IPv6 header takes, without extension headers.
|
|
18
|
+
*/
|
|
19
|
+
constexpr size_t Ipv6HeaderSize{ 40 };
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Bytes a UDP header takes.
|
|
23
|
+
*/
|
|
24
|
+
constexpr size_t UdpHeaderSize{ 8 };
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Bytes a TCP header takes, without options.
|
|
28
|
+
*/
|
|
29
|
+
constexpr size_t TcpHeaderSize{ 20 };
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Bytes of the length field that frames every packet sent over TCP.
|
|
33
|
+
*
|
|
34
|
+
* @see https://datatracker.ietf.org/doc/html/rfc4571
|
|
35
|
+
*/
|
|
36
|
+
constexpr size_t TcpFramingSize{ 2 };
|
|
37
|
+
|
|
10
38
|
/**
|
|
11
39
|
* Max MTU size.
|
|
12
40
|
*/
|
|
@@ -39,6 +67,48 @@ namespace RTC
|
|
|
39
67
|
*/
|
|
40
68
|
constexpr uint8_t MidRtpExtensionMaxLength{ 8 };
|
|
41
69
|
|
|
70
|
+
/**
|
|
71
|
+
* SSRC of the RTP stream the probing packets are sent on.
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* - The receiver negotiates a stream with this very SSRC, so it cannot be
|
|
75
|
+
* changed without changing the client as well.
|
|
76
|
+
*/
|
|
77
|
+
constexpr uint32_t BweProbeRtpSsrc{ 1234 };
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Codec payload type of the RTP stream the probing packets are sent on.
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* - The receiver negotiates a stream with this very payload type, so it
|
|
84
|
+
* cannot be changed without changing the client as well.
|
|
85
|
+
*/
|
|
86
|
+
constexpr uint8_t BweProbeRtpPayloadType{ 127 };
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* MID of the RTP stream the probing packets are sent on, which is how the
|
|
90
|
+
* receiver tells it apart.
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* - The receiver negotiates a stream with this very MID, so it cannot be
|
|
94
|
+
* changed without changing the client as well.
|
|
95
|
+
*/
|
|
96
|
+
constexpr std::string_view BweProbeRtpMid{ "probator" };
|
|
97
|
+
|
|
98
|
+
static_assert(
|
|
99
|
+
BweProbeRtpMid.size() <= MidRtpExtensionMaxLength,
|
|
100
|
+
"the MID of the probing stream does not fit in a MID RTP header extension");
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Lowest bitrate the bandwidth estimation ever produces (bps), so 5 kbps.
|
|
104
|
+
*/
|
|
105
|
+
constexpr int64_t BweMinBitrate{ 5000 };
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Highest bitrate the bandwidth estimation ever deals in (bps), so 1 Gbps.
|
|
109
|
+
*/
|
|
110
|
+
constexpr int64_t BweMaxBitrate{ 1000000000 };
|
|
111
|
+
|
|
42
112
|
/**
|
|
43
113
|
* Largest safe SCTP packet. Starting from the minimum guaranteed MTU value
|
|
44
114
|
* of 1280 for IPv6 (which may not support fragmentation), take off 85
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
#include "common.hpp"
|
|
5
5
|
#include "Channel/ChannelRequest.hpp"
|
|
6
6
|
#include "Channel/ChannelSocket.hpp"
|
|
7
|
+
#include "handles/SendCallbacks.hpp"
|
|
7
8
|
#include "RTC/SCTP/public/Message.hpp"
|
|
8
9
|
#include "RTC/SctpDictionaries.hpp"
|
|
9
10
|
#include "SharedInterface.hpp"
|
|
@@ -14,9 +15,6 @@ namespace RTC
|
|
|
14
15
|
{
|
|
15
16
|
class DataConsumer : public Channel::ChannelSocket::RequestHandler
|
|
16
17
|
{
|
|
17
|
-
protected:
|
|
18
|
-
using onQueuedCallback = const std::function<void(bool queued, bool sctpSendBufferFull)>;
|
|
19
|
-
|
|
20
18
|
public:
|
|
21
19
|
class Listener
|
|
22
20
|
{
|
|
@@ -25,7 +23,7 @@ namespace RTC
|
|
|
25
23
|
|
|
26
24
|
public:
|
|
27
25
|
virtual void OnDataConsumerSendMessage(
|
|
28
|
-
RTC::DataConsumer* dataConsumer, RTC::SCTP::Message message,
|
|
26
|
+
RTC::DataConsumer* dataConsumer, RTC::SCTP::Message message, onMessageQueuedCallback cb) = 0;
|
|
29
27
|
virtual void OnDataConsumerNeedBufferedAmount(
|
|
30
28
|
const RTC::DataConsumer* dataConsumer, uint32_t& bufferedAmount) const = 0;
|
|
31
29
|
virtual void OnDataConsumerNeedBufferedAmountLowThreshold(
|
|
@@ -110,7 +108,7 @@ namespace RTC
|
|
|
110
108
|
std::vector<uint16_t>& subchannels,
|
|
111
109
|
std::optional<uint16_t> requiredSubchannel,
|
|
112
110
|
std::optional<uint16_t> ignoredSubchannel,
|
|
113
|
-
|
|
111
|
+
onMessageQueuedCallback cb = {});
|
|
114
112
|
|
|
115
113
|
/* Methods inherited from Channel::ChannelSocket::RequestHandler. */
|
|
116
114
|
public:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#ifndef MS_RTC_DIRECT_TRANSPORT_HPP
|
|
2
2
|
#define MS_RTC_DIRECT_TRANSPORT_HPP
|
|
3
3
|
|
|
4
|
+
#include "handles/SendCallbacks.hpp"
|
|
4
5
|
#include "RTC/Transport.hpp"
|
|
5
6
|
#include "SharedInterface.hpp"
|
|
6
7
|
|
|
@@ -24,16 +25,14 @@ namespace RTC
|
|
|
24
25
|
|
|
25
26
|
private:
|
|
26
27
|
bool IsConnected() const override;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
RTC::RTP::Packet* packet,
|
|
30
|
-
RTC::Transport::onSendCallback* cb = nullptr) override;
|
|
28
|
+
size_t GetPacketOverhead() const override;
|
|
29
|
+
void SendRtpPacket(RTC::Consumer* consumer, RTC::RTP::Packet* packet, onSendCallback cb = {}) override;
|
|
31
30
|
void SendRtcpPacket(RTC::RTCP::Packet* packet) override;
|
|
32
31
|
void SendRtcpCompoundPacket(RTC::RTCP::CompoundPacket* packet) override;
|
|
33
32
|
void SendMessage(
|
|
34
33
|
RTC::DataConsumer* dataConsumer,
|
|
35
34
|
RTC::SCTP::Message message,
|
|
36
|
-
|
|
35
|
+
onMessageQueuedCallback cb = {}) override;
|
|
37
36
|
bool SendData(const uint8_t* data, size_t len) override;
|
|
38
37
|
void RecvStreamClosed(uint32_t ssrc) override;
|
|
39
38
|
void SendStreamClosed(uint32_t ssrc) override;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#define MS_RTC_PIPE_TRANSPORT_HPP
|
|
3
3
|
|
|
4
4
|
#include "FBS/pipeTransport.h"
|
|
5
|
+
#include "handles/SendCallbacks.hpp"
|
|
5
6
|
#include "RTC/SrtpSession.hpp"
|
|
6
7
|
#include "RTC/Transport.hpp"
|
|
7
8
|
#include "RTC/TransportTuple.hpp"
|
|
@@ -45,17 +46,15 @@ namespace RTC
|
|
|
45
46
|
{
|
|
46
47
|
return true;
|
|
47
48
|
}
|
|
49
|
+
size_t GetPacketOverhead() const override;
|
|
48
50
|
bool HasSrtp() const;
|
|
49
|
-
void SendRtpPacket(
|
|
50
|
-
RTC::Consumer* consumer,
|
|
51
|
-
RTC::RTP::Packet* packet,
|
|
52
|
-
RTC::Transport::onSendCallback* cb = nullptr) override;
|
|
51
|
+
void SendRtpPacket(RTC::Consumer* consumer, RTC::RTP::Packet* packet, onSendCallback cb = {}) override;
|
|
53
52
|
void SendRtcpPacket(RTC::RTCP::Packet* packet) override;
|
|
54
53
|
void SendRtcpCompoundPacket(RTC::RTCP::CompoundPacket* packet) override;
|
|
55
54
|
void SendMessage(
|
|
56
55
|
RTC::DataConsumer* dataConsumer,
|
|
57
56
|
RTC::SCTP::Message message,
|
|
58
|
-
|
|
57
|
+
onMessageQueuedCallback cb = {}) override;
|
|
59
58
|
bool SendData(const uint8_t* data, size_t len) override;
|
|
60
59
|
void RecvStreamClosed(uint32_t ssrc) override;
|
|
61
60
|
void SendStreamClosed(uint32_t ssrc) override;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#define MS_RTC_PLAIN_TRANSPORT_HPP
|
|
3
3
|
|
|
4
4
|
#include "FBS/plainTransport.h"
|
|
5
|
+
#include "handles/SendCallbacks.hpp"
|
|
5
6
|
#include "RTC/SrtpSession.hpp"
|
|
6
7
|
#include "RTC/Transport.hpp"
|
|
7
8
|
#include "RTC/TransportTuple.hpp"
|
|
@@ -33,18 +34,16 @@ namespace RTC
|
|
|
33
34
|
|
|
34
35
|
private:
|
|
35
36
|
bool IsConnected() const override;
|
|
37
|
+
size_t GetPacketOverhead() const override;
|
|
36
38
|
bool HasSrtp() const;
|
|
37
39
|
bool IsSrtpReady() const;
|
|
38
|
-
void SendRtpPacket(
|
|
39
|
-
RTC::Consumer* consumer,
|
|
40
|
-
RTC::RTP::Packet* packet,
|
|
41
|
-
RTC::Transport::onSendCallback* cb = nullptr) override;
|
|
40
|
+
void SendRtpPacket(RTC::Consumer* consumer, RTC::RTP::Packet* packet, onSendCallback cb = {}) override;
|
|
42
41
|
void SendRtcpPacket(RTC::RTCP::Packet* packet) override;
|
|
43
42
|
void SendRtcpCompoundPacket(RTC::RTCP::CompoundPacket* packet) override;
|
|
44
43
|
void SendMessage(
|
|
45
44
|
RTC::DataConsumer* dataConsumer,
|
|
46
45
|
RTC::SCTP::Message message,
|
|
47
|
-
|
|
46
|
+
onMessageQueuedCallback cb = {}) override;
|
|
48
47
|
bool SendData(const uint8_t* data, size_t len) override;
|
|
49
48
|
void RecvStreamClosed(uint32_t ssrc) override;
|
|
50
49
|
void SendStreamClosed(uint32_t ssrc) override;
|
|
@@ -33,8 +33,10 @@ namespace RTC
|
|
|
33
33
|
{
|
|
34
34
|
public:
|
|
35
35
|
// 'R' 'E' 'M' 'B'.
|
|
36
|
-
static
|
|
37
|
-
static
|
|
36
|
+
static constexpr uint32_t UniqueIdentifier{ 0x52454D42 };
|
|
37
|
+
static constexpr size_t UniqueIdentifierSize{ 4 };
|
|
38
|
+
// Most SSRCs that fit, since the field that counts them is a single byte.
|
|
39
|
+
static constexpr size_t MaxNumberOfSsrcs{ 0xFF };
|
|
38
40
|
|
|
39
41
|
public:
|
|
40
42
|
static FeedbackPsRembPacket* Parse(const uint8_t* data, size_t len);
|
|
@@ -56,15 +58,12 @@ namespace RTC
|
|
|
56
58
|
{
|
|
57
59
|
this->bitrate = bitrate;
|
|
58
60
|
}
|
|
59
|
-
void SetSsrcs(const std::vector<uint32_t>& ssrcs)
|
|
60
|
-
{
|
|
61
|
-
this->ssrcs = ssrcs;
|
|
62
|
-
}
|
|
61
|
+
void SetSsrcs(const std::vector<uint32_t>& ssrcs);
|
|
63
62
|
int64_t GetBitrate() const
|
|
64
63
|
{
|
|
65
64
|
return this->bitrate;
|
|
66
65
|
}
|
|
67
|
-
const std::vector<uint32_t>& GetSsrcs()
|
|
66
|
+
const std::vector<uint32_t>& GetSsrcs() const
|
|
68
67
|
{
|
|
69
68
|
return this->ssrcs;
|
|
70
69
|
}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
#include "common.hpp"
|
|
5
5
|
#include "RTC/RTCP/Feedback.hpp"
|
|
6
|
+
#include "Utils.hpp"
|
|
7
|
+
#include <cstdlib> // std::abs()
|
|
6
8
|
#include <vector>
|
|
7
9
|
|
|
8
10
|
/* RTP extensions for Transport-wide Congestion Control
|
|
@@ -324,7 +326,7 @@ namespace RTC
|
|
|
324
326
|
size += this->deltasAndChunksSize;
|
|
325
327
|
|
|
326
328
|
// 32 bits padding.
|
|
327
|
-
size
|
|
329
|
+
size = Utils::Byte::PadTo4Bytes(size);
|
|
328
330
|
|
|
329
331
|
return size;
|
|
330
332
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#include "RTC/Serializable.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 <flatbuffers/flatbuffers.h>
|
|
16
16
|
#include <array>
|
|
@@ -527,10 +527,11 @@ namespace RTC
|
|
|
527
527
|
|
|
528
528
|
/**
|
|
529
529
|
* @remarks
|
|
530
|
-
* - `
|
|
531
|
-
*
|
|
530
|
+
* - `absSendTime` is the raw 3 bytes unsigned integer the extension
|
|
531
|
+
* carries, the same one `ReadAbsSendTime()` gives back. An instant is
|
|
532
|
+
* turned into it with `Utils::Time::TimeUsToAbsSendTime()`.
|
|
532
533
|
*/
|
|
533
|
-
bool UpdateAbsSendTime(
|
|
534
|
+
bool UpdateAbsSendTime(uint32_t absSendTime) const;
|
|
534
535
|
|
|
535
536
|
bool ReadTransportWideCc01(uint16_t& wideSeqNumber) const;
|
|
536
537
|
|
|
@@ -549,6 +550,17 @@ namespace RTC
|
|
|
549
550
|
|
|
550
551
|
bool ReadAbsCaptureTime(uint64_t& absCaptureTimestamp, int64_t& estimatedCaptureClockOffset) const;
|
|
551
552
|
|
|
553
|
+
/**
|
|
554
|
+
* @remarks
|
|
555
|
+
* - `absCaptureTimestamp` is the raw 8 bytes unsigned integer the extension
|
|
556
|
+
* carries, the same one `ReadAbsCaptureTime()` gives back, which is a
|
|
557
|
+
* capture instant in NTP format. An instant is turned into it with
|
|
558
|
+
* `Utils::Time::TimeUsToNtp()`.
|
|
559
|
+
* - The estimated capture clock offset the extension carries when it is 16
|
|
560
|
+
* bytes long is left untouched.
|
|
561
|
+
*/
|
|
562
|
+
bool UpdateAbsCaptureTime(uint64_t absCaptureTimestamp) const;
|
|
563
|
+
|
|
552
564
|
bool ReadPlayoutDelay(uint16_t& minDelay, uint16_t& maxDelay) const;
|
|
553
565
|
|
|
554
566
|
bool ReadMediasoupPacketId(uint32_t& mediasoupPacketId) const;
|
|
@@ -15,14 +15,6 @@ namespace RTC
|
|
|
15
15
|
* Maximum length of a probation RTP packet.
|
|
16
16
|
*/
|
|
17
17
|
static constexpr size_t ProbationPacketMaxLength{ 1400 };
|
|
18
|
-
/**
|
|
19
|
-
* SSRC of the probation RTP stream.
|
|
20
|
-
*/
|
|
21
|
-
static const uint32_t Ssrc{ 1234 };
|
|
22
|
-
/**
|
|
23
|
-
* Codec payload type of the probation RTP stream.
|
|
24
|
-
*/
|
|
25
|
-
static const uint8_t PayloadType{ 127 };
|
|
26
18
|
|
|
27
19
|
public:
|
|
28
20
|
explicit ProbationGenerator();
|
|
@@ -259,17 +259,20 @@ namespace RTC
|
|
|
259
259
|
// Jitter in RTP timestamp units. As per spec it's kept as floating value
|
|
260
260
|
// although it's exposed as integer in the stats.
|
|
261
261
|
float jitter{ 0 };
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
262
|
+
// NOTE: These counters are never reset and nothing bounds them, so they are
|
|
263
|
+
// as wide as the stats fields they end up in rather than as wide as a
|
|
264
|
+
// pointer.
|
|
265
|
+
uint64_t packetsDiscarded{ 0 };
|
|
266
|
+
uint64_t packetsRetransmitted{ 0 };
|
|
267
|
+
uint64_t packetsRepaired{ 0 };
|
|
268
|
+
uint64_t nackCount{ 0 };
|
|
269
|
+
uint64_t nackPacketCount{ 0 };
|
|
270
|
+
uint64_t pliCount{ 0 };
|
|
271
|
+
uint64_t firCount{ 0 };
|
|
269
272
|
// Packets repaired at last interval for score calculation.
|
|
270
|
-
|
|
273
|
+
uint64_t repairedPriorScore{ 0 };
|
|
271
274
|
// Packets retransmitted at last interval for score calculation.
|
|
272
|
-
|
|
275
|
+
uint64_t retransmittedPriorScore{ 0 };
|
|
273
276
|
// Correspondence between wall clock and RTP timeline given by the last Sender
|
|
274
277
|
// Report.
|
|
275
278
|
std::optional<RTP::RtpStream::SenderReportMapping> lastSenderReportMapping;
|
|
@@ -77,9 +77,9 @@ namespace RTC
|
|
|
77
77
|
|
|
78
78
|
int64_t GetLayerBitrate(int64_t nowMs, uint8_t spatialLayer, uint8_t temporalLayer);
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
uint64_t GetPacketCount() const;
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
uint64_t GetBytes() const;
|
|
83
83
|
|
|
84
84
|
private:
|
|
85
85
|
std::vector<std::vector<RTC::RtpDataCounter>> spatialLayerCounters;
|
|
@@ -227,6 +227,20 @@ namespace RTC
|
|
|
227
227
|
*/
|
|
228
228
|
std::optional<int64_t> GetRemoteCaptureAtUsFromAbsCaptureTime(uint32_t ts) const;
|
|
229
229
|
|
|
230
|
+
/**
|
|
231
|
+
* Whether the 'abs-capture-time' RTP header extension has ever been received
|
|
232
|
+
* on this stream.
|
|
233
|
+
*
|
|
234
|
+
* @remarks
|
|
235
|
+
* - It is not the same as being able to tell a capture instant from it, which
|
|
236
|
+
* also depends on how far the wanted RTP timestamp falls from the one it
|
|
237
|
+
* referred to.
|
|
238
|
+
*/
|
|
239
|
+
bool HasAbsCaptureTime() const
|
|
240
|
+
{
|
|
241
|
+
return this->lastAbsCaptureTime.has_value();
|
|
242
|
+
}
|
|
243
|
+
|
|
230
244
|
/**
|
|
231
245
|
* Capture instant of the given RTP timestamp, expressed in the remote sender's
|
|
232
246
|
* wall clock, interpolated from the last received RTCP Sender Report.
|
|
@@ -306,13 +320,17 @@ namespace RTC
|
|
|
306
320
|
bool useRtpInactivityCheck{ false };
|
|
307
321
|
// Others.
|
|
308
322
|
// Packets expected at last interval.
|
|
323
|
+
// NOTE: As wide as GetExpectedPackets(), which wraps with the sequence
|
|
324
|
+
// number, so that the difference against it is taken in its own width.
|
|
309
325
|
uint32_t expectedPrior{ 0 };
|
|
310
326
|
// Packets expected at last interval for score calculation.
|
|
311
327
|
uint32_t expectedPriorScore{ 0 };
|
|
312
328
|
// Packets received at last interval.
|
|
313
|
-
|
|
329
|
+
// NOTE: As wide as the counter it snapshots, which does not wrap, so that
|
|
330
|
+
// the difference against it stays exact however long the stream runs.
|
|
331
|
+
uint64_t receivedPrior{ 0 };
|
|
314
332
|
// Packets received at last interval for score calculation.
|
|
315
|
-
|
|
333
|
+
uint64_t receivedPriorScore{ 0 };
|
|
316
334
|
// Timing data of the most recent Sender Report received.
|
|
317
335
|
std::optional<SenderReportTiming> lastSenderReportTiming;
|
|
318
336
|
// Most recent `abs-capture-time` RTP header extension received.
|
|
@@ -109,7 +109,7 @@ namespace RTC
|
|
|
109
109
|
|
|
110
110
|
int64_t GetBitrate(int64_t nowMs) override
|
|
111
111
|
{
|
|
112
|
-
return this->transmissionCounter.GetBitrate(nowMs);
|
|
112
|
+
return this->transmissionCounter.GetBitrate(nowMs).value_or(0);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
int64_t GetBitrate(int64_t nowMs, uint8_t spatialLayer, uint8_t temporalLayer) override;
|
|
@@ -131,7 +131,9 @@ namespace RTC
|
|
|
131
131
|
// Packets lost at last interval for score calculation.
|
|
132
132
|
int32_t lostPriorScore{ 0 };
|
|
133
133
|
// Packets sent at last interval for score calculation.
|
|
134
|
-
|
|
134
|
+
// NOTE: As wide as the counter it snapshots, which does not wrap, so that
|
|
135
|
+
// the difference against it stays exact however long the stream runs.
|
|
136
|
+
uint64_t sentPriorScore{ 0 };
|
|
135
137
|
std::string mid;
|
|
136
138
|
uint16_t rtxSeq{ 0 };
|
|
137
139
|
RTC::RtpDataCounter transmissionCounter;
|
|
@@ -96,7 +96,7 @@ namespace RTC
|
|
|
96
96
|
return static_cast<float>(this->fractionLost) * 100 / 256;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
uint64_t GetPacketsDiscarded() const
|
|
100
100
|
{
|
|
101
101
|
return this->packetsDiscarded;
|
|
102
102
|
}
|
|
@@ -131,15 +131,21 @@ namespace RTC
|
|
|
131
131
|
uint32_t maxPacketTs{ 0 }; // Highest timestamp seen.
|
|
132
132
|
int32_t packetsLost{ 0 };
|
|
133
133
|
uint8_t fractionLost{ 0 };
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
// NOTE: These counters are never reset and nothing bounds them, so they are
|
|
135
|
+
// as wide as the stats fields they end up in rather than as wide as a
|
|
136
|
+
// pointer.
|
|
137
|
+
uint64_t packetsDiscarded{ 0 };
|
|
138
|
+
uint64_t packetsCount{ 0 };
|
|
136
139
|
|
|
137
140
|
private:
|
|
138
141
|
// Whether at least a RTP packet has been received.
|
|
139
142
|
bool started{ false };
|
|
140
143
|
// Fields for generating Receiver Reports.
|
|
144
|
+
// NOTE: Each one is as wide as the counter it snapshots, so that the
|
|
145
|
+
// expected one follows the wrap of the sequence number while the received
|
|
146
|
+
// one, which does not wrap, stays exact however long the stream runs.
|
|
141
147
|
uint32_t expectedPrior{ 0 };
|
|
142
|
-
|
|
148
|
+
uint64_t receivedPrior{ 0 };
|
|
143
149
|
// Timing data of the most recent Sender Report received.
|
|
144
150
|
std::optional<SenderReportTiming> lastSenderReportTiming;
|
|
145
151
|
int32_t reportedPacketsLost{ 0 };
|