Use backticks not vertical bars to denote variables in comments for /modules/rtp_rtcp
Bug: webrtc:12338 Change-Id: I52eb3b6675c4705e22f51b70799ed6139a3b46bc Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227164 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34686}
This commit is contained in:
parent
7f9ab1aa1b
commit
913cfa76ec
@ -29,7 +29,7 @@ class ReceiveStatisticsProvider {
|
||||
public:
|
||||
virtual ~ReceiveStatisticsProvider() = default;
|
||||
// Collects receive statistic in a form of rtcp report blocks.
|
||||
// Returns at most |max_blocks| report blocks.
|
||||
// Returns at most `max_blocks` report blocks.
|
||||
virtual std::vector<rtcp::ReportBlock> RtcpReportBlocks(
|
||||
size_t max_blocks) = 0;
|
||||
};
|
||||
|
||||
@ -25,21 +25,21 @@ class Clock;
|
||||
// RemoteNtpTimeEstimator can be used to estimate a given RTP timestamp's NTP
|
||||
// time in local timebase.
|
||||
// Note that it needs to be trained with at least 2 RTCP SR (by calling
|
||||
// |UpdateRtcpTimestamp|) before it can be used.
|
||||
// `UpdateRtcpTimestamp`) before it can be used.
|
||||
class RemoteNtpTimeEstimator {
|
||||
public:
|
||||
explicit RemoteNtpTimeEstimator(Clock* clock);
|
||||
|
||||
~RemoteNtpTimeEstimator();
|
||||
|
||||
// Updates the estimator with round trip time |rtt|, NTP seconds |ntp_secs|,
|
||||
// NTP fraction |ntp_frac| and RTP timestamp |rtp_timestamp|.
|
||||
// Updates the estimator with round trip time `rtt`, NTP seconds `ntp_secs`,
|
||||
// NTP fraction `ntp_frac` and RTP timestamp `rtp_timestamp`.
|
||||
bool UpdateRtcpTimestamp(int64_t rtt,
|
||||
uint32_t ntp_secs,
|
||||
uint32_t ntp_frac,
|
||||
uint32_t rtp_timestamp);
|
||||
|
||||
// Estimates the NTP timestamp in local timebase from |rtp_timestamp|.
|
||||
// Estimates the NTP timestamp in local timebase from `rtp_timestamp`.
|
||||
// Returns the NTP timestamp in ms when success. -1 if failed.
|
||||
int64_t Estimate(uint32_t rtp_timestamp);
|
||||
|
||||
|
||||
@ -212,7 +212,7 @@ class RtcpBandwidthObserver {
|
||||
virtual ~RtcpBandwidthObserver() {}
|
||||
};
|
||||
|
||||
// NOTE! |kNumMediaTypes| must be kept in sync with RtpPacketMediaType!
|
||||
// NOTE! `kNumMediaTypes` must be kept in sync with RtpPacketMediaType!
|
||||
static constexpr size_t kNumMediaTypes = 5;
|
||||
enum class RtpPacketMediaType : size_t {
|
||||
kAudio, // Audio media packets.
|
||||
@ -220,7 +220,7 @@ enum class RtpPacketMediaType : size_t {
|
||||
kRetransmission, // Retransmisions, sent as response to NACK.
|
||||
kForwardErrorCorrection, // FEC packets.
|
||||
kPadding = kNumMediaTypes - 1, // RTX or plain padding sent to maintain BWE.
|
||||
// Again, don't forget to udate |kNumMediaTypes| if you add another value!
|
||||
// Again, don't forget to udate `kNumMediaTypes` if you add another value!
|
||||
};
|
||||
|
||||
struct RtpPacketSendInfo {
|
||||
@ -231,7 +231,7 @@ struct RtpPacketSendInfo {
|
||||
// TODO(bugs.webrtc.org/12713): Remove once downstream usage is gone.
|
||||
uint32_t ssrc = 0;
|
||||
absl::optional<uint32_t> media_ssrc;
|
||||
uint16_t rtp_sequence_number = 0; // Only valid if |media_ssrc| is set.
|
||||
uint16_t rtp_sequence_number = 0; // Only valid if `media_ssrc` is set.
|
||||
uint32_t rtp_timestamp = 0;
|
||||
size_t length = 0;
|
||||
absl::optional<RtpPacketMediaType> packet_type;
|
||||
@ -271,7 +271,7 @@ class StreamFeedbackObserver {
|
||||
struct StreamPacketInfo {
|
||||
bool received;
|
||||
|
||||
// |rtp_sequence_number| and |is_retransmission| are only valid if |ssrc|
|
||||
// `rtp_sequence_number` and `is_retransmission` are only valid if `ssrc`
|
||||
// is populated.
|
||||
absl::optional<uint32_t> ssrc;
|
||||
uint16_t rtp_sequence_number;
|
||||
@ -434,7 +434,7 @@ class StreamDataCountersCallback {
|
||||
|
||||
// Information exposed through the GetStats api.
|
||||
struct RtpReceiveStats {
|
||||
// |packets_lost| and |jitter| are defined by RFC 3550, and exposed in the
|
||||
// `packets_lost` and `jitter` are defined by RFC 3550, and exposed in the
|
||||
// RTCReceivedRtpStreamStats dictionary, see
|
||||
// https://w3c.github.io/webrtc-stats/#receivedrtpstats-dict*
|
||||
int32_t packets_lost = 0;
|
||||
|
||||
@ -42,7 +42,7 @@ class UlpfecReceiver {
|
||||
// Takes a RED packet, strips the RED header, and adds the resulting
|
||||
// "virtual" RTP packet(s) into the internal buffer.
|
||||
//
|
||||
// TODO(brandtr): Set |ulpfec_payload_type| during constructor call,
|
||||
// TODO(brandtr): Set `ulpfec_payload_type` during constructor call,
|
||||
// rather than as a parameter here.
|
||||
virtual bool AddReceivedRedPacket(const RtpPacketReceived& rtp_packet,
|
||||
uint8_t ulpfec_payload_type) = 0;
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
namespace webrtc {
|
||||
|
||||
//
|
||||
// Helper class for interpolating the |AbsoluteCaptureTime| header extension.
|
||||
// Helper class for interpolating the `AbsoluteCaptureTime` header extension.
|
||||
//
|
||||
// Supports the "timestamp interpolation" optimization:
|
||||
// A receiver SHOULD memorize the capture system (i.e. CSRC/SSRC), capture
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
namespace webrtc {
|
||||
|
||||
//
|
||||
// Helper class for sending the |AbsoluteCaptureTime| header extension.
|
||||
// Helper class for sending the `AbsoluteCaptureTime` header extension.
|
||||
//
|
||||
// Supports the "timestamp interpolation" optimization:
|
||||
// A sender SHOULD save bandwidth by not sending abs-capture-time with every
|
||||
|
||||
@ -69,7 +69,7 @@ class DEPRECATED_RtpSenderEgress {
|
||||
void SetMediaHasBeenSent(bool media_sent) RTC_LOCKS_EXCLUDED(lock_);
|
||||
void SetTimestampOffset(uint32_t timestamp) RTC_LOCKS_EXCLUDED(lock_);
|
||||
|
||||
// For each sequence number in |sequence_number|, recall the last RTP packet
|
||||
// For each sequence number in `sequence_number`, recall the last RTP packet
|
||||
// which bore it - its timestamp and whether it was the first and/or last
|
||||
// packet in that frame. If all of the given sequence numbers could be
|
||||
// recalled, return a vector with all of them (in corresponding order).
|
||||
@ -96,7 +96,7 @@ class DEPRECATED_RtpSenderEgress {
|
||||
void UpdateOnSendPacket(int packet_id,
|
||||
int64_t capture_time_ms,
|
||||
uint32_t ssrc);
|
||||
// Sends packet on to |transport_|, leaving the RTP module.
|
||||
// Sends packet on to `transport_`, leaving the RTP module.
|
||||
bool SendPacketToNetwork(const RtpPacketToSend& packet,
|
||||
const PacketOptions& options,
|
||||
const PacedPacketInfo& pacing_info);
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
// packets, all "consecutive" losses of size <= m are completely recoverable.
|
||||
// By consecutive losses we mean consecutive with respect to the sequence
|
||||
// number ordering of the list (media and FEC) of packets. The difference
|
||||
// between these masks (|kFecMaskBursty|) and |kFecMaskRandom| type, defined
|
||||
// between these masks (`kFecMaskBursty`) and `kFecMaskRandom` type, defined
|
||||
// in fec_private_tables.h, is more significant for longer codes
|
||||
// (i.e., more packets/symbols in the code, so larger (k,m), i.e., k > 4,
|
||||
// m > 3).
|
||||
|
||||
@ -38,7 +38,7 @@ class MediaPacketGenerator {
|
||||
Random* random);
|
||||
~MediaPacketGenerator();
|
||||
|
||||
// Construct the media packets, up to |num_media_packets| packets.
|
||||
// Construct the media packets, up to `num_media_packets` packets.
|
||||
ForwardErrorCorrection::PacketList ConstructMediaPackets(
|
||||
int num_media_packets,
|
||||
uint16_t start_seq_num);
|
||||
@ -72,7 +72,7 @@ class AugmentedPacketGenerator {
|
||||
std::unique_ptr<AugmentedPacket> NextPacket(size_t offset, size_t length);
|
||||
|
||||
protected:
|
||||
// Given |header|, writes the appropriate RTP header fields in |data|.
|
||||
// Given `header`, writes the appropriate RTP header fields in `data`.
|
||||
static void WriteRtpHeader(const RTPHeader& header, uint8_t* data);
|
||||
|
||||
// Number of packets left to generate, in the current frame.
|
||||
|
||||
@ -26,7 +26,7 @@ namespace {
|
||||
constexpr size_t kMaxMediaPackets = 48; // Since we are reusing ULPFEC masks.
|
||||
|
||||
// Maximum number of media packets tracked by FEC decoder.
|
||||
// Maintain a sufficiently larger tracking window than |kMaxMediaPackets|
|
||||
// Maintain a sufficiently larger tracking window than `kMaxMediaPackets`
|
||||
// to account for packet reordering in pacer/ network.
|
||||
constexpr size_t kMaxTrackedMediaPackets = 4 * kMaxMediaPackets;
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ void FlexfecReceiver::OnRtpPacket(const RtpPacketReceived& packet) {
|
||||
|
||||
// If this packet was recovered, it might be originating from
|
||||
// ProcessReceivedPacket in this object. To avoid lifetime issues with
|
||||
// |recovered_packets_|, we therefore break the cycle here.
|
||||
// `recovered_packets_`, we therefore break the cycle here.
|
||||
// This might reduce decoding efficiency a bit, since we can't disambiguate
|
||||
// recovered packets by RTX from recovered packets by FlexFEC.
|
||||
if (packet.recovered())
|
||||
|
||||
@ -66,12 +66,12 @@ class FlexfecReceiverTest : public ::testing::Test {
|
||||
ForwardErrorCorrection::CreateFlexfec(kFlexfecSsrc, kMediaSsrc)),
|
||||
packet_generator_(kMediaSsrc, kFlexfecSsrc) {}
|
||||
|
||||
// Generates |num_media_packets| corresponding to a single frame.
|
||||
// Generates `num_media_packets` corresponding to a single frame.
|
||||
void PacketizeFrame(size_t num_media_packets,
|
||||
size_t frame_offset,
|
||||
PacketList* media_packets);
|
||||
|
||||
// Generates |num_fec_packets| FEC packets, given |media_packets|.
|
||||
// Generates `num_fec_packets` FEC packets, given `media_packets`.
|
||||
std::list<Packet*> EncodeFec(const PacketList& media_packets,
|
||||
size_t num_fec_packets);
|
||||
|
||||
@ -470,7 +470,7 @@ TEST_F(FlexfecReceiverTest, SurvivesOldRecoveredPacketBeingReinserted) {
|
||||
FlexfecReceiver* receiver_;
|
||||
} loopback_recovered_packet_receiver;
|
||||
|
||||
// Feed recovered packets back into |receiver|.
|
||||
// Feed recovered packets back into `receiver`.
|
||||
FlexfecReceiver receiver(Clock::GetRealTimeClock(), kFlexfecSsrc, kMediaSsrc,
|
||||
&loopback_recovered_packet_receiver);
|
||||
loopback_recovered_packet_receiver.SetReceiver(&receiver);
|
||||
@ -594,7 +594,7 @@ TEST_F(FlexfecReceiverTest, RecoveryCallbackDoesNotLoopInfinitely) {
|
||||
bool deep_recursion_;
|
||||
} loopback_recovered_packet_receiver;
|
||||
|
||||
// Feed recovered packets back into |receiver|.
|
||||
// Feed recovered packets back into `receiver`.
|
||||
FlexfecReceiver receiver(Clock::GetRealTimeClock(), kFlexfecSsrc, kMediaSsrc,
|
||||
&loopback_recovered_packet_receiver);
|
||||
loopback_recovered_packet_receiver.SetReceiver(&receiver);
|
||||
@ -670,7 +670,7 @@ TEST_F(FlexfecReceiverTest, DoesNotDecodeWrappedMediaSequenceUsingOldFec) {
|
||||
PacketizeFrame(kNumMediaPacketsPerFrame, i, &media_packets);
|
||||
}
|
||||
|
||||
// Receive first (|kFirstFrameNumMediaPackets| + 192) media packets.
|
||||
// Receive first (`kFirstFrameNumMediaPackets` + 192) media packets.
|
||||
// Simulate an old FEC packet by separating it from its encoded media
|
||||
// packets by at least 192 packets.
|
||||
auto media_it = media_packets.begin();
|
||||
|
||||
@ -176,7 +176,7 @@ int ForwardErrorCorrection::EncodeFec(const PacketList& media_packets,
|
||||
}
|
||||
packet_mask_size_ = internal::PacketMaskSize(num_mask_bits);
|
||||
|
||||
// Write FEC packets to |generated_fec_packets_|.
|
||||
// Write FEC packets to `generated_fec_packets_`.
|
||||
GenerateFecPayloads(media_packets, num_fec_packets);
|
||||
// TODO(brandtr): Generalize this when multistream protection support is
|
||||
// added.
|
||||
@ -219,7 +219,7 @@ void ForwardErrorCorrection::GenerateFecPayloads(
|
||||
while (media_packets_it != media_packets.end()) {
|
||||
Packet* const media_packet = media_packets_it->get();
|
||||
const uint8_t* media_packet_data = media_packet->data.cdata();
|
||||
// Should |media_packet| be protected by |fec_packet|?
|
||||
// Should `media_packet` be protected by `fec_packet`?
|
||||
if (packet_masks_[pkt_mask_idx] & (1 << (7 - media_pkt_idx))) {
|
||||
size_t media_payload_length =
|
||||
media_packet->data.size() - kRtpHeaderSize;
|
||||
@ -391,12 +391,12 @@ void ForwardErrorCorrection::InsertMediaPacket(
|
||||
void ForwardErrorCorrection::UpdateCoveringFecPackets(
|
||||
const RecoveredPacket& packet) {
|
||||
for (auto& fec_packet : received_fec_packets_) {
|
||||
// Is this FEC packet protecting the media packet |packet|?
|
||||
// Is this FEC packet protecting the media packet `packet`?
|
||||
auto protected_it = absl::c_lower_bound(
|
||||
fec_packet->protected_packets, &packet, SortablePacket::LessThan());
|
||||
if (protected_it != fec_packet->protected_packets.end() &&
|
||||
(*protected_it)->seq_num == packet.seq_num) {
|
||||
// Found an FEC packet which is protecting |packet|.
|
||||
// Found an FEC packet which is protecting `packet`.
|
||||
(*protected_it)->pkt = packet.pkt;
|
||||
}
|
||||
}
|
||||
@ -481,8 +481,8 @@ void ForwardErrorCorrection::AssignRecoveredPackets(
|
||||
ProtectedPacketList* protected_packets = &fec_packet->protected_packets;
|
||||
std::vector<RecoveredPacket*> recovered_protected_packets;
|
||||
|
||||
// Find intersection between the (sorted) containers |protected_packets|
|
||||
// and |recovered_packets|, i.e. all protected packets that have already
|
||||
// Find intersection between the (sorted) containers `protected_packets`
|
||||
// and `recovered_packets`, i.e. all protected packets that have already
|
||||
// been recovered. Update the corresponding protected packets to point to
|
||||
// the recovered packets.
|
||||
auto it_p = protected_packets->cbegin();
|
||||
@ -506,16 +506,16 @@ void ForwardErrorCorrection::InsertPacket(
|
||||
const ReceivedPacket& received_packet,
|
||||
RecoveredPacketList* recovered_packets) {
|
||||
// Discard old FEC packets such that the sequence numbers in
|
||||
// |received_fec_packets_| span at most 1/2 of the sequence number space.
|
||||
// This is important for keeping |received_fec_packets_| sorted, and may
|
||||
// `received_fec_packets_` span at most 1/2 of the sequence number space.
|
||||
// This is important for keeping `received_fec_packets_` sorted, and may
|
||||
// also reduce the possibility of incorrect decoding due to sequence number
|
||||
// wrap-around.
|
||||
if (!received_fec_packets_.empty() &&
|
||||
received_packet.ssrc == received_fec_packets_.front()->ssrc) {
|
||||
// It only makes sense to detect wrap-around when |received_packet|
|
||||
// and |front_received_fec_packet| belong to the same sequence number
|
||||
// space, i.e., the same SSRC. This happens when |received_packet|
|
||||
// is a FEC packet, or if |received_packet| is a media packet and
|
||||
// It only makes sense to detect wrap-around when `received_packet`
|
||||
// and `front_received_fec_packet` belong to the same sequence number
|
||||
// space, i.e., the same SSRC. This happens when `received_packet`
|
||||
// is a FEC packet, or if `received_packet` is a media packet and
|
||||
// RED+ULPFEC is used.
|
||||
auto it = received_fec_packets_.begin();
|
||||
while (it != received_fec_packets_.end()) {
|
||||
@ -523,7 +523,7 @@ void ForwardErrorCorrection::InsertPacket(
|
||||
if (seq_num_diff > kOldSequenceThreshold) {
|
||||
it = received_fec_packets_.erase(it);
|
||||
} else {
|
||||
// No need to keep iterating, since |received_fec_packets_| is sorted.
|
||||
// No need to keep iterating, since `received_fec_packets_` is sorted.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,8 +62,8 @@ class ForwardErrorCorrection {
|
||||
// TODO(holmer): Refactor into a proper class.
|
||||
class SortablePacket {
|
||||
public:
|
||||
// Functor which returns true if the sequence number of |first|
|
||||
// is < the sequence number of |second|. Should only ever be called for
|
||||
// Functor which returns true if the sequence number of `first`
|
||||
// is < the sequence number of `second`. Should only ever be called for
|
||||
// packets belonging to the same SSRC.
|
||||
struct LessThan {
|
||||
template <typename S, typename T>
|
||||
@ -76,7 +76,7 @@ class ForwardErrorCorrection {
|
||||
|
||||
// Used for the input to DecodeFec().
|
||||
//
|
||||
// TODO(nisse): Delete class, instead passing |is_fec| and |pkt| as separate
|
||||
// TODO(nisse): Delete class, instead passing `is_fec` and `pkt` as separate
|
||||
// arguments.
|
||||
class ReceivedPacket : public SortablePacket {
|
||||
public:
|
||||
@ -197,14 +197,14 @@ class ForwardErrorCorrection {
|
||||
std::list<Packet*>* fec_packets);
|
||||
|
||||
// Decodes a list of received media and FEC packets. It will parse the
|
||||
// |received_packets|, storing FEC packets internally, and move
|
||||
// media packets to |recovered_packets|. The recovered list will be
|
||||
// `received_packets`, storing FEC packets internally, and move
|
||||
// media packets to `recovered_packets`. The recovered list will be
|
||||
// sorted by ascending sequence number and have duplicates removed.
|
||||
// The function should be called as new packets arrive, and
|
||||
// |recovered_packets| will be progressively assembled with each call.
|
||||
// When the function returns, |received_packets| will be empty.
|
||||
// `recovered_packets` will be progressively assembled with each call.
|
||||
// When the function returns, `received_packets` will be empty.
|
||||
//
|
||||
// The caller will allocate packets submitted through |received_packets|.
|
||||
// The caller will allocate packets submitted through `received_packets`.
|
||||
// The function will handle allocation of recovered packets.
|
||||
//
|
||||
// Input: received_packets List of new received packets, of type
|
||||
@ -229,7 +229,7 @@ class ForwardErrorCorrection {
|
||||
// accounted for as packet overhead.
|
||||
size_t MaxPacketOverhead() const;
|
||||
|
||||
// Reset internal states from last frame and clear |recovered_packets|.
|
||||
// Reset internal states from last frame and clear `recovered_packets`.
|
||||
// Frees all memory allocated by this class.
|
||||
void ResetState(RecoveredPacketList* recovered_packets);
|
||||
|
||||
@ -245,11 +245,11 @@ class ForwardErrorCorrection {
|
||||
uint32_t protected_media_ssrc);
|
||||
|
||||
private:
|
||||
// Analyzes |media_packets| for holes in the sequence and inserts zero columns
|
||||
// into the |packet_mask| where those holes are found. Zero columns means that
|
||||
// Analyzes `media_packets` for holes in the sequence and inserts zero columns
|
||||
// into the `packet_mask` where those holes are found. Zero columns means that
|
||||
// those packets will have no protection.
|
||||
// Returns the number of bits used for one row of the new packet mask.
|
||||
// Requires that |packet_mask| has at least 6 * |num_fec_packets| bytes
|
||||
// Requires that `packet_mask` has at least 6 * `num_fec_packets` bytes
|
||||
// allocated.
|
||||
int InsertZerosInPacketMasks(const PacketList& media_packets,
|
||||
size_t num_fec_packets);
|
||||
@ -264,12 +264,12 @@ class ForwardErrorCorrection {
|
||||
uint32_t media_ssrc,
|
||||
uint16_t seq_num_base);
|
||||
|
||||
// Inserts the |received_packet| into the internal received FEC packet list
|
||||
// or into |recovered_packets|.
|
||||
// Inserts the `received_packet` into the internal received FEC packet list
|
||||
// or into `recovered_packets`.
|
||||
void InsertPacket(const ReceivedPacket& received_packet,
|
||||
RecoveredPacketList* recovered_packets);
|
||||
|
||||
// Inserts the |received_packet| into |recovered_packets|. Deletes duplicates.
|
||||
// Inserts the `received_packet` into `recovered_packets`. Deletes duplicates.
|
||||
void InsertMediaPacket(RecoveredPacketList* recovered_packets,
|
||||
const ReceivedPacket& received_packet);
|
||||
|
||||
@ -280,11 +280,11 @@ class ForwardErrorCorrection {
|
||||
// packets covered by the FEC packet.
|
||||
void UpdateCoveringFecPackets(const RecoveredPacket& packet);
|
||||
|
||||
// Insert |received_packet| into internal FEC list. Deletes duplicates.
|
||||
// Insert `received_packet` into internal FEC list. Deletes duplicates.
|
||||
void InsertFecPacket(const RecoveredPacketList& recovered_packets,
|
||||
const ReceivedPacket& received_packet);
|
||||
|
||||
// Assigns pointers to already recovered packets covered by |fec_packet|.
|
||||
// Assigns pointers to already recovered packets covered by `fec_packet`.
|
||||
static void AssignRecoveredPackets(
|
||||
const RecoveredPacketList& recovered_packets,
|
||||
ReceivedFecPacket* fec_packet);
|
||||
@ -298,14 +298,14 @@ class ForwardErrorCorrection {
|
||||
static bool StartPacketRecovery(const ReceivedFecPacket& fec_packet,
|
||||
RecoveredPacket* recovered_packet);
|
||||
|
||||
// Performs XOR between the first 8 bytes of |src| and |dst| and stores
|
||||
// the result in |dst|. The 3rd and 4th bytes are used for storing
|
||||
// Performs XOR between the first 8 bytes of `src` and `dst` and stores
|
||||
// the result in `dst`. The 3rd and 4th bytes are used for storing
|
||||
// the length recovery field.
|
||||
static void XorHeaders(const Packet& src, Packet* dst);
|
||||
|
||||
// Performs XOR between the payloads of |src| and |dst| and stores the result
|
||||
// in |dst|. The parameter |dst_offset| determines at what byte the
|
||||
// XOR operation starts in |dst|. In total, |payload_length| bytes are XORed.
|
||||
// Performs XOR between the payloads of `src` and `dst` and stores the result
|
||||
// in `dst`. The parameter `dst_offset` determines at what byte the
|
||||
// XOR operation starts in `dst`. In total, `payload_length` bytes are XORed.
|
||||
static void XorPayloads(const Packet& src,
|
||||
size_t payload_length,
|
||||
size_t dst_offset,
|
||||
@ -320,13 +320,13 @@ class ForwardErrorCorrection {
|
||||
static bool RecoverPacket(const ReceivedFecPacket& fec_packet,
|
||||
RecoveredPacket* recovered_packet);
|
||||
|
||||
// Get the number of missing media packets which are covered by |fec_packet|.
|
||||
// Get the number of missing media packets which are covered by `fec_packet`.
|
||||
// An FEC packet can recover at most one packet, and if zero packets are
|
||||
// missing the FEC packet can be discarded. This function returns 2 when two
|
||||
// or more packets are missing.
|
||||
static int NumCoveredPacketsMissing(const ReceivedFecPacket& fec_packet);
|
||||
|
||||
// Discards old packets in |recovered_packets|, which are no longer relevant
|
||||
// Discards old packets in `recovered_packets`, which are no longer relevant
|
||||
// for recovering lost packets.
|
||||
void DiscardOldRecoveredPackets(RecoveredPacketList* recovered_packets);
|
||||
|
||||
@ -347,7 +347,7 @@ class ForwardErrorCorrection {
|
||||
|
||||
// Arrays used to avoid dynamically allocating memory when generating
|
||||
// the packet masks.
|
||||
// (There are never more than |kUlpfecMaxMediaPackets| FEC packets generated.)
|
||||
// (There are never more than `kUlpfecMaxMediaPackets` FEC packets generated.)
|
||||
uint8_t packet_masks_[kUlpfecMaxMediaPackets * kUlpfecMaxPacketMaskSize];
|
||||
uint8_t tmp_packet_masks_[kUlpfecMaxMediaPackets * kUlpfecMaxPacketMaskSize];
|
||||
size_t packet_mask_size_;
|
||||
|
||||
@ -212,7 +212,7 @@ rtc::ArrayView<const uint8_t> PacketMaskTable::LookUp(int num_media_packets,
|
||||
static_cast<size_t>(num_fec_packets * mask_length)};
|
||||
}
|
||||
|
||||
// If |num_media_packets| is larger than the maximum allowed by |fec_mask_type|
|
||||
// If `num_media_packets` is larger than the maximum allowed by `fec_mask_type`
|
||||
// for the bursty type, or the random table is explicitly asked for, then the
|
||||
// random type is selected. Otherwise the bursty table callback is returned.
|
||||
const uint8_t* PacketMaskTable::PickTable(FecMaskType fec_mask_type,
|
||||
@ -393,8 +393,8 @@ void UnequalProtectionMask(int num_media_packets,
|
||||
}
|
||||
}
|
||||
|
||||
// This algorithm is tailored to look up data in the |kPacketMaskRandomTbl| and
|
||||
// |kPacketMaskBurstyTbl| tables. These tables only cover fec code for up to 12
|
||||
// This algorithm is tailored to look up data in the `kPacketMaskRandomTbl` and
|
||||
// `kPacketMaskBurstyTbl` tables. These tables only cover fec code for up to 12
|
||||
// media packets. Starting from 13 media packets, the fec code will be generated
|
||||
// at runtime. The format of those arrays is that they're essentially a 3
|
||||
// dimensional array with the following dimensions: * media packet
|
||||
|
||||
@ -71,7 +71,7 @@ rtc::ArrayView<const uint8_t> LookUpInFecTable(const uint8_t* table,
|
||||
// protection scenario.
|
||||
// \param[in] use_unequal_protection Enables unequal protection: allocates
|
||||
// more protection to the num_imp_packets.
|
||||
// \param[in] mask_table An instance of the |PacketMaskTable|
|
||||
// \param[in] mask_table An instance of the `PacketMaskTable`
|
||||
// class, which contains the type of FEC
|
||||
// packet mask used, and a pointer to the
|
||||
// corresponding packet masks.
|
||||
@ -89,9 +89,9 @@ void GeneratePacketMasks(int num_media_packets,
|
||||
// that will be covered.
|
||||
size_t PacketMaskSize(size_t num_sequence_numbers);
|
||||
|
||||
// Inserts |num_zeros| zero columns into |new_mask| at position
|
||||
// |new_bit_index|. If the current byte of |new_mask| can't fit all zeros, the
|
||||
// byte will be filled with zeros from |new_bit_index|, but the next byte will
|
||||
// Inserts `num_zeros` zero columns into `new_mask` at position
|
||||
// `new_bit_index`. If the current byte of `new_mask` can't fit all zeros, the
|
||||
// byte will be filled with zeros from `new_bit_index`, but the next byte will
|
||||
// be untouched.
|
||||
void InsertZeroColumns(int num_zeros,
|
||||
uint8_t* new_mask,
|
||||
@ -100,12 +100,12 @@ void InsertZeroColumns(int num_zeros,
|
||||
int new_bit_index);
|
||||
|
||||
// Copies the left most bit column from the byte pointed to by
|
||||
// |old_bit_index| in |old_mask| to the right most column of the byte pointed
|
||||
// to by |new_bit_index| in |new_mask|. |old_mask_bytes| and |new_mask_bytes|
|
||||
// represent the number of bytes used per row for each mask. |num_fec_packets|
|
||||
// `old_bit_index` in `old_mask` to the right most column of the byte pointed
|
||||
// to by `new_bit_index` in `new_mask`. `old_mask_bytes` and `new_mask_bytes`
|
||||
// represent the number of bytes used per row for each mask. `num_fec_packets`
|
||||
// represent the number of rows of the masks.
|
||||
// The copied bit is shifted out from |old_mask| and is shifted one step to
|
||||
// the left in |new_mask|. |new_mask| will contain "xxxx xxn0" after this
|
||||
// The copied bit is shifted out from `old_mask` and is shifted one step to
|
||||
// the left in `new_mask`. `new_mask` will contain "xxxx xxn0" after this
|
||||
// operation, where x are previously inserted bits and n is the new bit.
|
||||
void CopyColumn(uint8_t* new_mask,
|
||||
int new_mask_bytes,
|
||||
|
||||
@ -86,7 +86,7 @@ void PacketSequencer::PopulateRtpState(RtpState& state) const {
|
||||
|
||||
void PacketSequencer::UpdateLastPacketState(const RtpPacketToSend& packet) {
|
||||
// Remember marker bit to determine if padding can be inserted with
|
||||
// sequence number following |packet|.
|
||||
// sequence number following `packet`.
|
||||
last_packet_marker_bit_ = packet.Marker();
|
||||
// Remember media payload type to use in the padding packet if rtx is
|
||||
// disabled.
|
||||
|
||||
@ -64,7 +64,7 @@ StreamStatisticianImpl::~StreamStatisticianImpl() = default;
|
||||
bool StreamStatisticianImpl::UpdateOutOfOrder(const RtpPacketReceived& packet,
|
||||
int64_t sequence_number,
|
||||
int64_t now_ms) {
|
||||
// Check if |packet| is second packet of a stream restart.
|
||||
// Check if `packet` is second packet of a stream restart.
|
||||
if (received_seq_out_of_order_) {
|
||||
// Count the previous packet as a received; it was postponed below.
|
||||
--cumulative_loss_;
|
||||
@ -75,7 +75,7 @@ bool StreamStatisticianImpl::UpdateOutOfOrder(const RtpPacketReceived& packet,
|
||||
// Ignore sequence number gap caused by stream restart for packet loss
|
||||
// calculation, by setting received_seq_max_ to the sequence number just
|
||||
// before the out-of-order seqno. This gives a net zero change of
|
||||
// |cumulative_loss_|, for the two packets interpreted as a stream reset.
|
||||
// `cumulative_loss_`, for the two packets interpreted as a stream reset.
|
||||
//
|
||||
// Fraction loss for the next report may get a bit off, since we don't
|
||||
// update last_report_seq_max_ and last_report_cumulative_loss_ in a
|
||||
@ -92,10 +92,10 @@ bool StreamStatisticianImpl::UpdateOutOfOrder(const RtpPacketReceived& packet,
|
||||
// for a stream restart.
|
||||
received_seq_out_of_order_ = packet.SequenceNumber();
|
||||
// Postpone counting this as a received packet until we know how to update
|
||||
// |received_seq_max_|, otherwise we temporarily decrement
|
||||
// |cumulative_loss_|. The
|
||||
// `received_seq_max_`, otherwise we temporarily decrement
|
||||
// `cumulative_loss_`. The
|
||||
// ReceiveStatisticsTest.StreamRestartDoesntCountAsLoss test expects
|
||||
// |cumulative_loss_| to be unchanged by the reception of the first packet
|
||||
// `cumulative_loss_` to be unchanged by the reception of the first packet
|
||||
// after stream reset.
|
||||
++cumulative_loss_;
|
||||
return true;
|
||||
|
||||
@ -63,7 +63,7 @@ bool LossNotification::Create(uint8_t* packet,
|
||||
|
||||
const size_t index_end = *index + BlockLength();
|
||||
|
||||
// Note: |index| updated by the function below.
|
||||
// Note: `index` updated by the function below.
|
||||
CreateHeader(Psfb::kAfbMessageType, kPacketType, HeaderLength(), packet,
|
||||
index);
|
||||
|
||||
|
||||
@ -42,8 +42,8 @@ class LossNotification : public Psfb {
|
||||
// Set all of the values transmitted by the loss notification message.
|
||||
// If the values may not be represented by a loss notification message,
|
||||
// false is returned, and no change is made to the object; this happens
|
||||
// when |last_recieved| is ahead of |last_decoded| by more than 0x7fff.
|
||||
// This is because |last_recieved| is represented on the wire as a delta,
|
||||
// when `last_recieved` is ahead of `last_decoded` by more than 0x7fff.
|
||||
// This is because `last_recieved` is represented on the wire as a delta,
|
||||
// and only 15 bits are available for that delta.
|
||||
ABSL_MUST_USE_RESULT
|
||||
bool Set(uint16_t last_decoded,
|
||||
|
||||
@ -80,7 +80,7 @@ TEST(RtcpPacketLossNotificationTest,
|
||||
test::ParseSinglePacket(packet, packet_length_bytes, &loss_notification));
|
||||
|
||||
// Show that after shaving off a word, the packet is no longer parsable.
|
||||
packet[3] -= 1; // Change the |length| field of the RTCP packet.
|
||||
packet[3] -= 1; // Change the `length` field of the RTCP packet.
|
||||
packet_length_bytes -= 4; // Effectively forget the last 32-bit word.
|
||||
EXPECT_FALSE(
|
||||
test::ParseSinglePacket(packet, packet_length_bytes, &loss_notification));
|
||||
|
||||
@ -129,7 +129,7 @@ uint16_t TransportFeedback::LastChunk::Emit() {
|
||||
}
|
||||
RTC_DCHECK_GE(size_, kMaxTwoBitCapacity);
|
||||
uint16_t chunk = EncodeTwoBit(kMaxTwoBitCapacity);
|
||||
// Remove |kMaxTwoBitCapacity| encoded delta sizes:
|
||||
// Remove `kMaxTwoBitCapacity` encoded delta sizes:
|
||||
// Shift remaining delta sizes and recalculate all_same_ && has_large_delta_.
|
||||
size_ -= kMaxTwoBitCapacity;
|
||||
all_same_ = true;
|
||||
@ -153,7 +153,7 @@ uint16_t TransportFeedback::LastChunk::EncodeLast() const {
|
||||
return EncodeOneBit();
|
||||
}
|
||||
|
||||
// Appends content of the Lastchunk to |deltas|.
|
||||
// Appends content of the Lastchunk to `deltas`.
|
||||
void TransportFeedback::LastChunk::AppendTo(
|
||||
std::vector<DeltaSize>* deltas) const {
|
||||
if (all_same_) {
|
||||
@ -441,7 +441,7 @@ bool TransportFeedback::Parse(const CommonHeader& packet) {
|
||||
last_chunk_.Decode(chunk, status_count - delta_sizes.size());
|
||||
last_chunk_.AppendTo(&delta_sizes);
|
||||
}
|
||||
// Last chunk is stored in the |last_chunk_|.
|
||||
// Last chunk is stored in the `last_chunk_`.
|
||||
encoded_chunks_.pop_back();
|
||||
RTC_DCHECK_EQ(delta_sizes.size(), status_count);
|
||||
num_seq_no_ = status_count;
|
||||
|
||||
@ -54,7 +54,7 @@ class TransportFeedback : public Rtpfb {
|
||||
|
||||
TransportFeedback();
|
||||
|
||||
// If |include_timestamps| is set to false, the created packet will not
|
||||
// If `include_timestamps` is set to false, the created packet will not
|
||||
// contain the receive delta block.
|
||||
explicit TransportFeedback(bool include_timestamps,
|
||||
bool include_lost = false);
|
||||
@ -80,7 +80,7 @@ class TransportFeedback : public Rtpfb {
|
||||
int64_t GetBaseTimeUs() const;
|
||||
TimeDelta GetBaseTime() const;
|
||||
|
||||
// Get the unwrapped delta between current base time and |prev_timestamp_us|.
|
||||
// Get the unwrapped delta between current base time and `prev_timestamp_us`.
|
||||
int64_t GetBaseDeltaUs(int64_t prev_timestamp_us) const;
|
||||
TimeDelta GetBaseDelta(TimeDelta prev_timestamp) const;
|
||||
|
||||
@ -116,9 +116,9 @@ class TransportFeedback : public Rtpfb {
|
||||
bool Empty() const;
|
||||
void Clear();
|
||||
// Return if delta sizes still can be encoded into single chunk with added
|
||||
// |delta_size|.
|
||||
// `delta_size`.
|
||||
bool CanAdd(DeltaSize delta_size) const;
|
||||
// Add |delta_size|, assumes |CanAdd(delta_size)|,
|
||||
// Add `delta_size`, assumes `CanAdd(delta_size)`,
|
||||
void Add(DeltaSize delta_size);
|
||||
|
||||
// Encode chunk as large as possible removing encoded delta sizes.
|
||||
@ -127,9 +127,9 @@ class TransportFeedback : public Rtpfb {
|
||||
// Encode all stored delta_sizes into single chunk, pad with 0s if needed.
|
||||
uint16_t EncodeLast() const;
|
||||
|
||||
// Decode up to |max_size| delta sizes from |chunk|.
|
||||
// Decode up to `max_size` delta sizes from `chunk`.
|
||||
void Decode(uint16_t chunk, size_t max_size);
|
||||
// Appends content of the Lastchunk to |deltas|.
|
||||
// Appends content of the Lastchunk to `deltas`.
|
||||
void AppendTo(std::vector<DeltaSize>* deltas) const;
|
||||
|
||||
private:
|
||||
|
||||
@ -68,7 +68,7 @@ const size_t kMaxNumberOfStoredRrtrs = 300;
|
||||
constexpr TimeDelta kDefaultVideoReportInterval = TimeDelta::Seconds(1);
|
||||
constexpr TimeDelta kDefaultAudioReportInterval = TimeDelta::Seconds(5);
|
||||
|
||||
// Returns true if the |timestamp| has exceeded the |interval *
|
||||
// Returns true if the `timestamp` has exceeded the |interval *
|
||||
// kRrTimeoutIntervals| period and was reset (set to PlusInfinity()). Returns
|
||||
// false if the timer was either already reset or if it has not expired.
|
||||
bool ResetTimestampIfExpired(const Timestamp now,
|
||||
@ -127,7 +127,7 @@ struct RTCPReceiver::PacketInformation {
|
||||
|
||||
uint32_t remote_ssrc = 0;
|
||||
std::vector<uint16_t> nack_sequence_numbers;
|
||||
// TODO(hbos): Remove |report_blocks| in favor of |report_block_datas|.
|
||||
// TODO(hbos): Remove `report_blocks` in favor of `report_block_datas`.
|
||||
ReportBlockList report_blocks;
|
||||
std::vector<ReportBlockData> report_block_datas;
|
||||
int64_t rtt_ms = 0;
|
||||
@ -636,7 +636,7 @@ void RTCPReceiver::HandleReportBlock(const ReportBlock& report_block,
|
||||
// Receiver rtp_rtcp module is not expected to calculate rtt using
|
||||
// Sender Reports even if it accidentally can.
|
||||
|
||||
// TODO(nisse): Use this way to determine the RTT only when |receiver_only_|
|
||||
// TODO(nisse): Use this way to determine the RTT only when `receiver_only_`
|
||||
// is false. However, that currently breaks the tests of the
|
||||
// googCaptureStartNtpTimeMs stat for audio receive streams. To fix, either
|
||||
// delete all dependencies on RTT measurements for audio receive streams, or
|
||||
@ -956,7 +956,7 @@ void RTCPReceiver::HandleTmmbr(const CommonHeader& rtcp_block,
|
||||
auto* entry = &tmmbr_info->tmmbr[sender_ssrc];
|
||||
entry->tmmbr_item = rtcp::TmmbItem(sender_ssrc, request.bitrate_bps(),
|
||||
request.packet_overhead());
|
||||
// FindOrCreateTmmbrInfo always sets |last_time_received_ms| to
|
||||
// FindOrCreateTmmbrInfo always sets `last_time_received_ms` to
|
||||
// |clock_->TimeInMilliseconds()|.
|
||||
entry->last_updated_ms = tmmbr_info->last_time_received_ms;
|
||||
|
||||
|
||||
@ -821,7 +821,7 @@ std::vector<rtcp::ReportBlock> RTCPSender::CreateReportBlocks(
|
||||
if (!receive_statistics_)
|
||||
return result;
|
||||
|
||||
// TODO(danilchap): Support sending more than |RTCP_MAX_REPORT_BLOCKS| per
|
||||
// TODO(danilchap): Support sending more than `RTCP_MAX_REPORT_BLOCKS` per
|
||||
// compound rtcp packet when single rtcp module is used for multiple media
|
||||
// streams.
|
||||
result = receive_statistics_->RtcpReportBlocks(RTCP_MAX_REPORT_BLOCKS);
|
||||
|
||||
@ -54,7 +54,7 @@ class RTCPSender final {
|
||||
// a video version.
|
||||
bool audio = false;
|
||||
// SSRCs for media and retransmission, respectively.
|
||||
// FlexFec SSRC is fetched from |flexfec_sender|.
|
||||
// FlexFec SSRC is fetched from `flexfec_sender`.
|
||||
uint32_t local_media_ssrc = 0;
|
||||
// The clock to use to read time. If nullptr then system clock will be used.
|
||||
Clock* clock = nullptr;
|
||||
@ -225,7 +225,7 @@ class RTCPSender final {
|
||||
void BuildNACK(const RtcpContext& context, PacketSender& sender)
|
||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||
|
||||
// |duration| being TimeDelta::Zero() means schedule immediately.
|
||||
// `duration` being TimeDelta::Zero() means schedule immediately.
|
||||
void SetNextRtcpSendEvaluationDuration(TimeDelta duration)
|
||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ class RtcpTransceiver : public RtcpFeedbackSenderInterface {
|
||||
// No other methods can be called.
|
||||
// Note that interfaces provided in constructor or registered with AddObserver
|
||||
// still might be used by the transceiver on the task queue
|
||||
// until |on_destroyed| runs.
|
||||
// until `on_destroyed` runs.
|
||||
void Stop(std::function<void()> on_destroyed);
|
||||
|
||||
// Registers observer to be notified about incoming rtcp packets.
|
||||
@ -51,7 +51,7 @@ class RtcpTransceiver : public RtcpFeedbackSenderInterface {
|
||||
void AddMediaReceiverRtcpObserver(uint32_t remote_ssrc,
|
||||
MediaReceiverRtcpObserver* observer);
|
||||
// Deregisters the observer. Might return before observer is deregistered.
|
||||
// Runs |on_removed| when observer is deregistered.
|
||||
// Runs `on_removed` when observer is deregistered.
|
||||
void RemoveMediaReceiverRtcpObserver(uint32_t remote_ssrc,
|
||||
MediaReceiverRtcpObserver* observer,
|
||||
std::function<void()> on_removed);
|
||||
|
||||
@ -86,7 +86,7 @@ struct RtcpTransceiverConfig {
|
||||
//
|
||||
// Tuning parameters.
|
||||
//
|
||||
// Initial state if |outgoing_transport| ready to accept packets.
|
||||
// Initial state if `outgoing_transport` ready to accept packets.
|
||||
bool initial_ready_to_send = true;
|
||||
// Delay before 1st periodic compound packet.
|
||||
int initial_report_delay_ms = 500;
|
||||
|
||||
@ -34,7 +34,7 @@ class RtpDependencyDescriptorReader {
|
||||
bool ParseSuccessful() { return !parsing_failed_; }
|
||||
|
||||
private:
|
||||
// Reads bits from |buffer_|. If it fails, returns 0 and marks parsing as
|
||||
// Reads bits from `buffer_`. If it fails, returns 0 and marks parsing as
|
||||
// failed, but doesn't stop the parsing.
|
||||
uint32_t ReadBits(size_t bit_count);
|
||||
uint32_t ReadNonSymmetric(size_t num_values);
|
||||
|
||||
@ -22,19 +22,19 @@
|
||||
namespace webrtc {
|
||||
class RtpDependencyDescriptorWriter {
|
||||
public:
|
||||
// Assumes |structure| and |descriptor| are valid and
|
||||
// |descriptor| matches the |structure|.
|
||||
// Assumes `structure` and `descriptor` are valid and
|
||||
// `descriptor` matches the `structure`.
|
||||
RtpDependencyDescriptorWriter(rtc::ArrayView<uint8_t> data,
|
||||
const FrameDependencyStructure& structure,
|
||||
std::bitset<32> active_chains,
|
||||
const DependencyDescriptor& descriptor);
|
||||
|
||||
// Serializes DependencyDescriptor rtp header extension.
|
||||
// Returns false if |data| is too small to serialize the |descriptor|.
|
||||
// Returns false if `data` is too small to serialize the `descriptor`.
|
||||
bool Write();
|
||||
|
||||
// Returns minimum number of bits needed to serialize descriptor with respect
|
||||
// to the |structure|. Returns 0 if |descriptor| can't be serialized.
|
||||
// to the `structure`. Returns 0 if `descriptor` can't be serialized.
|
||||
int ValueSizeBits() const;
|
||||
|
||||
private:
|
||||
|
||||
@ -32,7 +32,7 @@ constexpr uint32_t kFlexfecSsrc = 43245;
|
||||
|
||||
constexpr size_t kMaxMediaPackets = 48;
|
||||
|
||||
// Deep copies |src| to |dst|, but only keeps every Nth packet.
|
||||
// Deep copies `src` to `dst`, but only keeps every Nth packet.
|
||||
void DeepCopyEveryNthPacket(const ForwardErrorCorrection::PacketList& src,
|
||||
int n,
|
||||
ForwardErrorCorrection::PacketList* dst) {
|
||||
@ -62,7 +62,7 @@ class RtpFecTest : public ::testing::Test {
|
||||
kMediaSsrc,
|
||||
&random_) {}
|
||||
|
||||
// Construct |received_packets_|: a subset of the media and FEC packets.
|
||||
// Construct `received_packets_`: a subset of the media and FEC packets.
|
||||
//
|
||||
// Media packet "i" is lost if media_loss_mask_[i] = 1, received if
|
||||
// media_loss_mask_[i] = 0.
|
||||
@ -70,9 +70,9 @@ class RtpFecTest : public ::testing::Test {
|
||||
// fec_loss_mask_[i] = 0.
|
||||
void NetworkReceivedPackets(int* media_loss_mask, int* fec_loss_mask);
|
||||
|
||||
// Add packet from |packet_list| to list of received packets, using the
|
||||
// |loss_mask|.
|
||||
// The |packet_list| may be a media packet list (is_fec = false), or a
|
||||
// Add packet from `packet_list` to list of received packets, using the
|
||||
// `loss_mask`.
|
||||
// The `packet_list` may be a media packet list (is_fec = false), or a
|
||||
// FEC packet list (is_fec = true).
|
||||
template <typename T>
|
||||
void ReceivedPackets(const T& packet_list, int* loss_mask, bool is_fec);
|
||||
@ -168,7 +168,7 @@ bool RtpFecTest<ForwardErrorCorrectionType>::IsRecoveryComplete() {
|
||||
|
||||
// Define gTest typed test to loop over both ULPFEC and FlexFEC.
|
||||
// Since the tests now are parameterized, we need to access
|
||||
// member variables using |this|, thereby enforcing runtime
|
||||
// member variables using `this`, thereby enforcing runtime
|
||||
// resolution.
|
||||
|
||||
class FlexfecForwardErrorCorrection : public ForwardErrorCorrection {
|
||||
@ -244,7 +244,7 @@ TYPED_TEST(RtpFecTest,
|
||||
this->media_packets_ =
|
||||
this->media_packet_generator_.ConstructMediaPackets(kNumMediaPackets);
|
||||
|
||||
// Create |kMaxMediaPackets| sequence number difference.
|
||||
// Create `kMaxMediaPackets` sequence number difference.
|
||||
ByteWriter<uint16_t>::WriteBigEndian(
|
||||
this->media_packets_.front()->data.MutableData() + 2, 1);
|
||||
ByteWriter<uint16_t>::WriteBigEndian(
|
||||
|
||||
@ -48,11 +48,11 @@ class RtpPacketizer {
|
||||
virtual size_t NumPackets() const = 0;
|
||||
|
||||
// Get the next payload with payload header.
|
||||
// Write payload and set marker bit of the |packet|.
|
||||
// Write payload and set marker bit of the `packet`.
|
||||
// Returns true on success, false otherwise.
|
||||
virtual bool NextPacket(RtpPacketToSend* packet) = 0;
|
||||
|
||||
// Split payload_len into sum of integers with respect to |limits|.
|
||||
// Split payload_len into sum of integers with respect to `limits`.
|
||||
// Returns empty vector on failure.
|
||||
static std::vector<int> SplitAboutEqually(int payload_len,
|
||||
const PayloadSizeLimits& limits);
|
||||
|
||||
@ -40,7 +40,7 @@ class RtpPacketizerH264 : public RtpPacketizer {
|
||||
size_t NumPackets() const override;
|
||||
|
||||
// Get the next payload with H264 payload header.
|
||||
// Write payload and set marker bit of the |packet|.
|
||||
// Write payload and set marker bit of the `packet`.
|
||||
// Returns true on success, false otherwise.
|
||||
bool NextPacket(RtpPacketToSend* rtp_packet) override;
|
||||
|
||||
|
||||
@ -404,7 +404,7 @@ TEST(RtpPacketizerH264Test, LastFragmentFitsInSingleButNotLastPacket) {
|
||||
limits.max_payload_len - limits.last_packet_reduction_len);
|
||||
}
|
||||
|
||||
// Splits frame with payload size |frame_payload_size| without fragmentation,
|
||||
// Splits frame with payload size `frame_payload_size` without fragmentation,
|
||||
// Returns sizes of the payloads excluding fua headers.
|
||||
std::vector<int> TestFua(size_t frame_payload_size,
|
||||
const RtpPacketizer::PayloadSizeLimits& limits) {
|
||||
|
||||
@ -35,13 +35,13 @@ class RtpPacketizerGeneric : public RtpPacketizer {
|
||||
public:
|
||||
// Initialize with payload from encoder.
|
||||
// The payload_data must be exactly one encoded generic frame.
|
||||
// Packets returned by |NextPacket| will contain the generic payload header.
|
||||
// Packets returned by `NextPacket` will contain the generic payload header.
|
||||
RtpPacketizerGeneric(rtc::ArrayView<const uint8_t> payload,
|
||||
PayloadSizeLimits limits,
|
||||
const RTPVideoHeader& rtp_video_header);
|
||||
// Initialize with payload from encoder.
|
||||
// The payload_data must be exactly one encoded generic frame.
|
||||
// Packets returned by |NextPacket| will contain raw payload without the
|
||||
// Packets returned by `NextPacket` will contain raw payload without the
|
||||
// generic payload header.
|
||||
RtpPacketizerGeneric(rtc::ArrayView<const uint8_t> payload,
|
||||
PayloadSizeLimits limits);
|
||||
@ -51,7 +51,7 @@ class RtpPacketizerGeneric : public RtpPacketizer {
|
||||
size_t NumPackets() const override;
|
||||
|
||||
// Get the next payload.
|
||||
// Write payload and set marker bit of the |packet|.
|
||||
// Write payload and set marker bit of the `packet`.
|
||||
// Returns true on success, false otherwise.
|
||||
bool NextPacket(RtpPacketToSend* packet) override;
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ class RtpPacketizerVp8 : public RtpPacketizer {
|
||||
size_t NumPackets() const override;
|
||||
|
||||
// Get the next payload with VP8 payload header.
|
||||
// Write payload and set marker bit of the |packet|.
|
||||
// Write payload and set marker bit of the `packet`.
|
||||
// Returns true on success, false otherwise.
|
||||
bool NextPacket(RtpPacketToSend* packet) override;
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ namespace webrtc {
|
||||
|
||||
class RtpPacketizerVp9 : public RtpPacketizer {
|
||||
public:
|
||||
// The |payload| must be one encoded VP9 layer frame.
|
||||
// The `payload` must be one encoded VP9 layer frame.
|
||||
RtpPacketizerVp9(rtc::ArrayView<const uint8_t> payload,
|
||||
PayloadSizeLimits limits,
|
||||
const RTPVideoHeaderVP9& hdr);
|
||||
@ -46,13 +46,13 @@ class RtpPacketizerVp9 : public RtpPacketizer {
|
||||
size_t NumPackets() const override;
|
||||
|
||||
// Gets the next payload with VP9 payload header.
|
||||
// Write payload and set marker bit of the |packet|.
|
||||
// Write payload and set marker bit of the `packet`.
|
||||
// Returns true on success, false otherwise.
|
||||
bool NextPacket(RtpPacketToSend* packet) override;
|
||||
|
||||
private:
|
||||
// Writes the payload descriptor header.
|
||||
// |layer_begin| and |layer_end| indicates the postision of the packet in
|
||||
// `layer_begin` and `layer_end` indicates the postision of the packet in
|
||||
// the layer frame. Returns false on failure.
|
||||
bool WriteHeader(bool layer_begin,
|
||||
bool layer_end,
|
||||
|
||||
@ -501,7 +501,7 @@ TEST_F(RtpPacketizerVp9Test, TestGeneratesMinimumNumberOfPackets) {
|
||||
RtpPacketizer::PayloadSizeLimits limits;
|
||||
limits.max_payload_len = 8;
|
||||
// Calculated by hand. One packet can contain
|
||||
// |kPacketSize| - |kVp9MinDiscriptorSize| = 6 bytes of the frame payload,
|
||||
// `kPacketSize` - `kVp9MinDiscriptorSize` = 6 bytes of the frame payload,
|
||||
// thus to fit 10 bytes two packets are required.
|
||||
const size_t kMinNumberOfPackets = 2;
|
||||
const uint8_t kFrame[kFrameSize] = {7};
|
||||
@ -526,7 +526,7 @@ TEST_F(RtpPacketizerVp9Test, TestRespectsLastPacketReductionLen) {
|
||||
limits.last_packet_reduction_len = 5;
|
||||
// Calculated by hand. VP9 payload descriptor is 2 bytes. Like in the test
|
||||
// above, 1 packet is not enough. 2 packets can contain
|
||||
// 2*(|kPacketSize| - |kVp9MinDiscriptorSize|) - |kLastPacketReductionLen| = 7
|
||||
// 2*(`kPacketSize` - `kVp9MinDiscriptorSize`) - `kLastPacketReductionLen` = 7
|
||||
// But three packets are enough, since they have capacity of 3*(8-2)-5=13
|
||||
// bytes.
|
||||
const size_t kMinNumberOfPackets = 3;
|
||||
|
||||
@ -20,7 +20,7 @@ constexpr uint8_t kFlagEndOfSubframe = 0x40;
|
||||
|
||||
// In version 00, the flags F and L in the first byte correspond to
|
||||
// kFlagFirstSubframeV00 and kFlagLastSubframeV00. In practice, they were
|
||||
// always set to |true|.
|
||||
// always set to `true`.
|
||||
constexpr uint8_t kFlagFirstSubframeV00 = 0x20;
|
||||
constexpr uint8_t kFlagLastSubframeV00 = 0x10;
|
||||
|
||||
|
||||
@ -145,7 +145,7 @@ bool RtpHeaderExtensionMap::Register(int id,
|
||||
}
|
||||
|
||||
if (registered_type !=
|
||||
kInvalidType) { // |id| used by another extension type.
|
||||
kInvalidType) { // `id` used by another extension type.
|
||||
RTC_LOG(LS_WARNING) << "Failed to register extension uri:'" << uri
|
||||
<< "', id:" << id
|
||||
<< ". Id already in use by extension type "
|
||||
|
||||
@ -26,7 +26,7 @@ int RtpHeaderExtensionSize(rtc::ArrayView<const RtpExtensionSize> extensions,
|
||||
int id = registered_extensions.GetId(extension.type);
|
||||
if (id == RtpHeaderExtensionMap::kInvalidId)
|
||||
continue;
|
||||
// All extensions should use same size header. Check if the |extension|
|
||||
// All extensions should use same size header. Check if the `extension`
|
||||
// forces to switch to two byte header that allows larger id and value size.
|
||||
if (id > RtpExtension::kOneByteHeaderExtensionMaxId ||
|
||||
extension.value_size >
|
||||
|
||||
@ -22,8 +22,8 @@ struct RtpExtensionSize {
|
||||
};
|
||||
|
||||
// Calculates rtp header extension size in bytes assuming packet contain
|
||||
// all |extensions| with provided |value_size|.
|
||||
// Counts only extensions present among |registered_extensions|.
|
||||
// all `extensions` with provided `value_size`.
|
||||
// Counts only extensions present among `registered_extensions`.
|
||||
int RtpHeaderExtensionSize(rtc::ArrayView<const RtpExtensionSize> extensions,
|
||||
const RtpHeaderExtensionMap& registered_extensions);
|
||||
|
||||
|
||||
@ -315,9 +315,9 @@ bool TransportSequenceNumber::Write(rtc::ArrayView<uint8_t> data,
|
||||
// |seq count cont.|
|
||||
// +-+-+-+-+-+-+-+-+
|
||||
//
|
||||
// The bit |T| determines whether the feedback should include timing information
|
||||
// or not and |seq_count| determines how many packets the feedback packet should
|
||||
// cover including the current packet. If |seq_count| is zero no feedback is
|
||||
// The bit `T` determines whether the feedback should include timing information
|
||||
// or not and `seq_count` determines how many packets the feedback packet should
|
||||
// cover including the current packet. If `seq_count` is zero no feedback is
|
||||
// requested.
|
||||
constexpr RTPExtensionType TransportSequenceNumberV2::kId;
|
||||
constexpr uint8_t TransportSequenceNumberV2::kValueSizeBytes;
|
||||
@ -344,7 +344,7 @@ bool TransportSequenceNumberV2::Parse(
|
||||
(feedback_request_raw & kIncludeTimestampsBit) != 0;
|
||||
uint16_t sequence_count = feedback_request_raw & ~kIncludeTimestampsBit;
|
||||
|
||||
// If |sequence_count| is zero no feedback is requested.
|
||||
// If `sequence_count` is zero no feedback is requested.
|
||||
if (sequence_count != 0) {
|
||||
*feedback_request = {include_timestamps, sequence_count};
|
||||
}
|
||||
@ -487,7 +487,7 @@ bool VideoContentTypeExtension::Write(rtc::ArrayView<uint8_t> data,
|
||||
// Video Timing.
|
||||
// 6 timestamps in milliseconds counted from capture time stored in rtp header:
|
||||
// encode start/finish, packetization complete, pacer exit and reserved for
|
||||
// modification by the network modification. |flags| is a bitmask and has the
|
||||
// modification by the network modification. `flags` is a bitmask and has the
|
||||
// following allowed values:
|
||||
// 0 = Valid data, but no flags available (backwards compatibility)
|
||||
// 1 = Frame marked as timing frame due to cyclic timer.
|
||||
@ -804,7 +804,7 @@ bool BaseRtpStringExtension::Parse(rtc::ArrayView<const uint8_t> data,
|
||||
if (data.empty() || data[0] == 0) // Valid string extension can't be empty.
|
||||
return false;
|
||||
const char* cstr = reinterpret_cast<const char*>(data.data());
|
||||
// If there is a \0 character in the middle of the |data|, treat it as end
|
||||
// If there is a \0 character in the middle of the `data`, treat it as end
|
||||
// of the string. Well-formed string extensions shouldn't contain it.
|
||||
str->assign(cstr, strnlen(cstr, data.size()));
|
||||
RTC_DCHECK(!str->empty());
|
||||
|
||||
@ -26,9 +26,9 @@ class RtpPacket {
|
||||
using ExtensionType = RTPExtensionType;
|
||||
using ExtensionManager = RtpHeaderExtensionMap;
|
||||
|
||||
// |extensions| required for SetExtension/ReserveExtension functions during
|
||||
// `extensions` required for SetExtension/ReserveExtension functions during
|
||||
// packet creating and used if available in Parse function.
|
||||
// Adding and getting extensions will fail until |extensions| is
|
||||
// Adding and getting extensions will fail until `extensions` is
|
||||
// provided via constructor or IdentifyExtensions function.
|
||||
// |*extensions| is only accessed during construction; the pointer is not
|
||||
// stored.
|
||||
@ -99,7 +99,7 @@ class RtpPacket {
|
||||
// which are modified after FEC protection is generated.
|
||||
void ZeroMutableExtensions();
|
||||
|
||||
// Removes extension of given |type|, returns false is extension was not
|
||||
// Removes extension of given `type`, returns false is extension was not
|
||||
// registered in packet's extension map or not present in the packet. Only
|
||||
// extension that should be removed must be registered, other extensions may
|
||||
// not be registered and will be preserved as is.
|
||||
@ -136,11 +136,11 @@ class RtpPacket {
|
||||
template <typename Extension>
|
||||
bool ReserveExtension();
|
||||
|
||||
// Find or allocate an extension |type|. Returns view of size |length|
|
||||
// Find or allocate an extension `type`. Returns view of size `length`
|
||||
// to write raw extension to or an empty view on failure.
|
||||
rtc::ArrayView<uint8_t> AllocateExtension(ExtensionType type, size_t length);
|
||||
|
||||
// Find an extension |type|.
|
||||
// Find an extension `type`.
|
||||
// Returns view of the raw extension or empty view on failure.
|
||||
rtc::ArrayView<const uint8_t> FindExtension(ExtensionType type) const;
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ RtpPacketHistory::StoredPacket::~StoredPacket() = default;
|
||||
void RtpPacketHistory::StoredPacket::IncrementTimesRetransmitted(
|
||||
PacketPrioritySet* priority_set) {
|
||||
// Check if this StoredPacket is in the priority set. If so, we need to remove
|
||||
// it before updating |times_retransmitted_| since that is used in sorting,
|
||||
// it before updating `times_retransmitted_` since that is used in sorting,
|
||||
// and then add it back.
|
||||
const bool in_priority_set = priority_set && priority_set->erase(this) > 0;
|
||||
++times_retransmitted_;
|
||||
|
||||
@ -31,7 +31,7 @@ class RtpPacketHistory {
|
||||
public:
|
||||
enum class StorageMode {
|
||||
kDisabled, // Don't store any packets.
|
||||
kStoreAndCull // Store up to |number_to_store| packets, but try to remove
|
||||
kStoreAndCull // Store up to `number_to_store` packets, but try to remove
|
||||
// packets as they time out or as signaled as received.
|
||||
};
|
||||
|
||||
@ -78,7 +78,7 @@ class RtpPacketHistory {
|
||||
// a packet in the history before we are reasonably sure it has been received.
|
||||
void SetRtt(int64_t rtt_ms);
|
||||
|
||||
// If |send_time| is set, packet was sent without using pacer, so state will
|
||||
// If `send_time` is set, packet was sent without using pacer, so state will
|
||||
// be set accordingly.
|
||||
void PutRtpPacket(std::unique_ptr<RtpPacketToSend> packet,
|
||||
absl::optional<int64_t> send_time_ms);
|
||||
@ -206,13 +206,13 @@ class RtpPacketHistory {
|
||||
// the front and new packets being added to the back. Note that there may be
|
||||
// wrap-arounds so the back may have a lower sequence number.
|
||||
// Packets may also be removed out-of-order, in which case there will be
|
||||
// instances of StoredPacket with |packet_| set to nullptr. The first and last
|
||||
// instances of StoredPacket with `packet_` set to nullptr. The first and last
|
||||
// entry in the queue will however always be populated.
|
||||
std::deque<StoredPacket> packet_history_ RTC_GUARDED_BY(lock_);
|
||||
|
||||
// Total number of packets with inserted.
|
||||
uint64_t packets_inserted_ RTC_GUARDED_BY(lock_);
|
||||
// Objects from |packet_history_| ordered by "most likely to be useful", used
|
||||
// Objects from `packet_history_` ordered by "most likely to be useful", used
|
||||
// in GetPayloadPaddingPacket().
|
||||
PacketPrioritySet padding_priority_ RTC_GUARDED_BY(lock_);
|
||||
};
|
||||
|
||||
@ -70,7 +70,7 @@ int WriteLeb128(uint32_t value, uint8_t* buffer) {
|
||||
return size;
|
||||
}
|
||||
|
||||
// Given |remaining_bytes| free bytes left in a packet, returns max size of an
|
||||
// Given `remaining_bytes` free bytes left in a packet, returns max size of an
|
||||
// OBU fragment that can fit into the packet.
|
||||
// i.e. MaxFragmentSize + Leb128Size(MaxFragmentSize) <= remaining_bytes.
|
||||
int MaxFragmentSize(int remaining_bytes) {
|
||||
@ -191,7 +191,7 @@ std::vector<RtpPacketizerAv1::Packet> RtpPacketizerAv1::Packetize(
|
||||
const bool is_last_obu = obu_index == obus.size() - 1;
|
||||
const Obu& obu = obus[obu_index];
|
||||
|
||||
// Putting |obu| into the last packet would make last obu element stored in
|
||||
// Putting `obu` into the last packet would make last obu element stored in
|
||||
// that packet not last. All not last OBU elements must be prepend with the
|
||||
// element length. AdditionalBytesForPreviousObuElement calculates how many
|
||||
// bytes are needed to store that length.
|
||||
@ -242,12 +242,12 @@ std::vector<RtpPacketizerAv1::Packet> RtpPacketizerAv1::Packetize(
|
||||
: packet_remaining_bytes;
|
||||
// Because available_bytes might be different than
|
||||
// packet_remaining_bytes it might happen that max_first_fragment_size >=
|
||||
// obu.size. Also, since checks above verified |obu| should not be put
|
||||
// completely into the |packet|, leave at least 1 byte for later packet.
|
||||
// obu.size. Also, since checks above verified `obu` should not be put
|
||||
// completely into the `packet`, leave at least 1 byte for later packet.
|
||||
int first_fragment_size = std::min(obu.size - 1, max_first_fragment_size);
|
||||
if (first_fragment_size == 0) {
|
||||
// Rather than writing 0-size element at the tail of the packet,
|
||||
// 'uninsert' the |obu| from the |packet|.
|
||||
// 'uninsert' the `obu` from the `packet`.
|
||||
packet.num_obu_elements--;
|
||||
packet.packet_size -= previous_obu_extra_size;
|
||||
} else {
|
||||
|
||||
@ -128,9 +128,9 @@ void ModuleRtpRtcpImpl::Process() {
|
||||
bool process_rtt = now >= last_rtt_process_time_ + kRtpRtcpRttProcessTimeMs;
|
||||
if (rtcp_sender_.Sending()) {
|
||||
// Process RTT if we have received a report block and we haven't
|
||||
// processed RTT for at least |kRtpRtcpRttProcessTimeMs| milliseconds.
|
||||
// processed RTT for at least `kRtpRtcpRttProcessTimeMs` milliseconds.
|
||||
// Note that LastReceivedReportBlockMs() grabs a lock, so check
|
||||
// |process_rtt| first.
|
||||
// `process_rtt` first.
|
||||
if (process_rtt && rtt_stats_ != nullptr &&
|
||||
rtcp_receiver_.LastReceivedReportBlockMs() > last_rtt_process_time_) {
|
||||
int64_t max_rtt_ms = 0;
|
||||
@ -530,7 +530,7 @@ int64_t ModuleRtpRtcpImpl::ExpectedRetransmissionTimeMs() const {
|
||||
if (expected_retransmission_time_ms > 0) {
|
||||
return expected_retransmission_time_ms;
|
||||
}
|
||||
// No rtt available (|kRtpRtcpRttProcessTimeMs| not yet passed?), so try to
|
||||
// No rtt available (`kRtpRtcpRttProcessTimeMs` not yet passed?), so try to
|
||||
// poll avg_rtt_ms directly from rtcp receiver.
|
||||
if (rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), nullptr,
|
||||
&expected_retransmission_time_ms, nullptr,
|
||||
@ -666,7 +666,7 @@ bool ModuleRtpRtcpImpl::TimeToSendFullNackList(int64_t now) const {
|
||||
wait_time = kStartUpRttMs;
|
||||
}
|
||||
|
||||
// Send a full NACK list once within every |wait_time|.
|
||||
// Send a full NACK list once within every `wait_time`.
|
||||
return now - nack_last_time_sent_full_ms_ > wait_time;
|
||||
}
|
||||
|
||||
|
||||
@ -279,7 +279,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp, public RTCPReceiver::ModuleRtpRtcp {
|
||||
// Handles final time timestamping/stats/etc and handover to Transport.
|
||||
DEPRECATED_RtpSenderEgress packet_sender;
|
||||
// If no paced sender configured, this class will be used to pass packets
|
||||
// from |packet_generator_| to |packet_sender_|.
|
||||
// from `packet_generator_` to `packet_sender_`.
|
||||
DEPRECATED_RtpSenderEgress::NonPacedPacketSender non_paced_sender;
|
||||
// Handles creation of RTP packets to be sent.
|
||||
RTPSender packet_generator;
|
||||
|
||||
@ -53,7 +53,7 @@ RTCPSender::Configuration AddRtcpSendEvaluationCallback(
|
||||
|
||||
int DelayMillisForDuration(TimeDelta duration) {
|
||||
// TimeDelta::ms() rounds downwards sometimes which leads to too little time
|
||||
// slept. Account for this, unless |duration| is exactly representable in
|
||||
// slept. Account for this, unless `duration` is exactly representable in
|
||||
// millisecs.
|
||||
return (duration.us() + rtc::kNumMillisecsPerSec - 1) /
|
||||
rtc::kNumMicrosecsPerMillisec;
|
||||
@ -528,9 +528,9 @@ int32_t ModuleRtpRtcpImpl2::RemoteNTP(uint32_t* received_ntpsecs,
|
||||
: -1;
|
||||
}
|
||||
|
||||
// TODO(tommi): Check if |avg_rtt_ms|, |min_rtt_ms|, |max_rtt_ms| params are
|
||||
// TODO(tommi): Check if `avg_rtt_ms`, `min_rtt_ms`, `max_rtt_ms` params are
|
||||
// actually used in practice (some callers ask for it but don't use it). It
|
||||
// could be that only |rtt| is needed and if so, then the fast path could be to
|
||||
// could be that only `rtt` is needed and if so, then the fast path could be to
|
||||
// just call rtt_ms() and rely on the calculation being done periodically.
|
||||
int32_t ModuleRtpRtcpImpl2::RTT(const uint32_t remote_ssrc,
|
||||
int64_t* rtt,
|
||||
@ -550,7 +550,7 @@ int64_t ModuleRtpRtcpImpl2::ExpectedRetransmissionTimeMs() const {
|
||||
if (expected_retransmission_time_ms > 0) {
|
||||
return expected_retransmission_time_ms;
|
||||
}
|
||||
// No rtt available (|kRttUpdateInterval| not yet passed?), so try to
|
||||
// No rtt available (`kRttUpdateInterval` not yet passed?), so try to
|
||||
// poll avg_rtt_ms directly from rtcp receiver.
|
||||
if (rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), nullptr,
|
||||
&expected_retransmission_time_ms, nullptr,
|
||||
@ -686,7 +686,7 @@ bool ModuleRtpRtcpImpl2::TimeToSendFullNackList(int64_t now) const {
|
||||
wait_time = kStartUpRttMs;
|
||||
}
|
||||
|
||||
// Send a full NACK list once within every |wait_time|.
|
||||
// Send a full NACK list once within every `wait_time`.
|
||||
return now - nack_last_time_sent_full_ms_ > wait_time;
|
||||
}
|
||||
|
||||
@ -865,7 +865,7 @@ void ModuleRtpRtcpImpl2::ScheduleMaybeSendRtcpAtOrAfterTimestamp(
|
||||
TimeDelta duration) {
|
||||
// We end up here under various sequences including the worker queue, and
|
||||
// the RTCPSender lock is held.
|
||||
// See note in ScheduleRtcpSendEvaluation about why |worker_queue_| can be
|
||||
// See note in ScheduleRtcpSendEvaluation about why `worker_queue_` can be
|
||||
// accessed.
|
||||
worker_queue_->PostDelayedTask(
|
||||
ToQueuedTask(task_safety_,
|
||||
|
||||
@ -274,7 +274,7 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
|
||||
// Handles final time timestamping/stats/etc and handover to Transport.
|
||||
RtpSenderEgress packet_sender;
|
||||
// If no paced sender configured, this class will be used to pass packets
|
||||
// from |packet_generator_| to |packet_sender_|.
|
||||
// from `packet_generator_` to `packet_sender_`.
|
||||
RtpSenderEgress::NonPacedPacketSender non_paced_sender;
|
||||
// Handles creation of RTP packets to be sent.
|
||||
RTPSender packet_generator;
|
||||
@ -295,7 +295,7 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
|
||||
// Used from RtcpSenderMediator to maybe send rtcp.
|
||||
void MaybeSendRtcp() RTC_RUN_ON(worker_queue_);
|
||||
|
||||
// Called when |rtcp_sender_| informs of the next RTCP instant. The method may
|
||||
// Called when `rtcp_sender_` informs of the next RTCP instant. The method may
|
||||
// be called on various sequences, and is called under a RTCPSenderLock.
|
||||
void ScheduleRtcpSendEvaluation(TimeDelta duration);
|
||||
|
||||
@ -305,7 +305,7 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
|
||||
void MaybeSendRtcpAtOrAfterTimestamp(Timestamp execution_time)
|
||||
RTC_RUN_ON(worker_queue_);
|
||||
|
||||
// Schedules a call to MaybeSendRtcpAtOrAfterTimestamp delayed by |duration|.
|
||||
// Schedules a call to MaybeSendRtcpAtOrAfterTimestamp delayed by `duration`.
|
||||
void ScheduleMaybeSendRtcpAtOrAfterTimestamp(Timestamp execution_time,
|
||||
TimeDelta duration);
|
||||
|
||||
|
||||
@ -124,12 +124,12 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
|
||||
// done by RTCP RR acking.
|
||||
bool always_send_mid_and_rid = false;
|
||||
|
||||
// If set, field trials are read from |field_trials|, otherwise
|
||||
// If set, field trials are read from `field_trials`, otherwise
|
||||
// defaults to webrtc::FieldTrialBasedConfig.
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr;
|
||||
|
||||
// SSRCs for media and retransmission, respectively.
|
||||
// FlexFec SSRC is fetched from |flexfec_sender|.
|
||||
// FlexFec SSRC is fetched from `flexfec_sender`.
|
||||
uint32_t local_media_ssrc = 0;
|
||||
absl::optional<uint32_t> rtx_send_ssrc;
|
||||
|
||||
@ -203,7 +203,7 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
|
||||
int payload_frequency) = 0;
|
||||
|
||||
// Unregisters a send payload.
|
||||
// |payload_type| - payload type of codec
|
||||
// `payload_type` - payload type of codec
|
||||
// Returns -1 on failure else 0.
|
||||
virtual int32_t DeRegisterSendPayload(int8_t payload_type) = 0;
|
||||
|
||||
@ -259,7 +259,7 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
|
||||
virtual void SetMid(const std::string& mid) = 0;
|
||||
|
||||
// Sets CSRC.
|
||||
// |csrcs| - vector of CSRCs
|
||||
// `csrcs` - vector of CSRCs
|
||||
virtual void SetCsrcs(const std::vector<uint32_t>& csrcs) = 0;
|
||||
|
||||
// Turns on/off sending RTX (RFC 4588). The modes can be set as a combination
|
||||
@ -355,7 +355,7 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
|
||||
virtual RtcpMode RTCP() const = 0;
|
||||
|
||||
// Sets RTCP status i.e on(compound or non-compound)/off.
|
||||
// |method| - RTCP method to use.
|
||||
// `method` - RTCP method to use.
|
||||
virtual void SetRTCPStatus(RtcpMode method) = 0;
|
||||
|
||||
// Sets RTCP CName (i.e unique identifier).
|
||||
|
||||
@ -393,7 +393,7 @@ std::vector<std::unique_ptr<RtpPacketToSend>> RTPSender::GeneratePadding(
|
||||
packet_history_->GetPayloadPaddingPacket(
|
||||
[&](const RtpPacketToSend& packet)
|
||||
-> std::unique_ptr<RtpPacketToSend> {
|
||||
// Limit overshoot, generate <= |max_padding_size_factor_| *
|
||||
// Limit overshoot, generate <= `max_padding_size_factor_` *
|
||||
// target_size_bytes.
|
||||
const size_t max_overshoot_bytes = static_cast<size_t>(
|
||||
((max_padding_size_factor_ - 1.0) * target_size_bytes) +
|
||||
@ -555,7 +555,7 @@ std::unique_ptr<RtpPacketToSend> RTPSender::AllocatePacket() const {
|
||||
// sender can reduce overhead by omitting these header extensions once it
|
||||
// knows that the receiver has "bound" the SSRC.
|
||||
// This optimization can be configured by setting
|
||||
// |always_send_mid_and_rid_| appropriately.
|
||||
// `always_send_mid_and_rid_` appropriately.
|
||||
//
|
||||
// The algorithm here is fairly simple: Always attach a MID and/or RID (if
|
||||
// configured) to the outgoing packets until an RTCP receiver report comes
|
||||
|
||||
@ -165,7 +165,7 @@ class RTPSender {
|
||||
return flexfec_ssrc_;
|
||||
}
|
||||
|
||||
// Sends packet to |transport_| or to the pacer, depending on configuration.
|
||||
// Sends packet to `transport_` or to the pacer, depending on configuration.
|
||||
// TODO(bugs.webrtc.org/XXX): Remove in favor of EnqueuePackets().
|
||||
bool SendToNetwork(std::unique_ptr<RtpPacketToSend> packet)
|
||||
RTC_LOCKS_EXCLUDED(send_mutex_);
|
||||
@ -201,7 +201,7 @@ class RTPSender {
|
||||
const absl::optional<uint32_t> rtx_ssrc_;
|
||||
const absl::optional<uint32_t> flexfec_ssrc_;
|
||||
// Limits GeneratePadding() outcome to <=
|
||||
// |max_padding_size_factor_| * |target_size_bytes|
|
||||
// `max_padding_size_factor_` * `target_size_bytes`
|
||||
const double max_padding_size_factor_;
|
||||
|
||||
RtpPacketHistory* const packet_history_;
|
||||
|
||||
@ -295,7 +295,7 @@ void RtpSenderEgress::SendPacket(RtpPacketToSend* packet,
|
||||
}
|
||||
|
||||
if (send_success) {
|
||||
// |media_has_been_sent_| is used by RTPSender to figure out if it can send
|
||||
// `media_has_been_sent_` is used by RTPSender to figure out if it can send
|
||||
// padding in the absence of transport-cc or abs-send-time.
|
||||
// In those cases media must be sent first to set a reference timestamp.
|
||||
media_has_been_sent_ = true;
|
||||
|
||||
@ -80,7 +80,7 @@ class RtpSenderEgress {
|
||||
void SetMediaHasBeenSent(bool media_sent) RTC_LOCKS_EXCLUDED(lock_);
|
||||
void SetTimestampOffset(uint32_t timestamp) RTC_LOCKS_EXCLUDED(lock_);
|
||||
|
||||
// For each sequence number in |sequence_number|, recall the last RTP packet
|
||||
// For each sequence number in `sequence_number`, recall the last RTP packet
|
||||
// which bore it - its timestamp and whether it was the first and/or last
|
||||
// packet in that frame. If all of the given sequence numbers could be
|
||||
// recalled, return a vector with all of them (in corresponding order).
|
||||
@ -112,7 +112,7 @@ class RtpSenderEgress {
|
||||
void UpdateOnSendPacket(int packet_id,
|
||||
int64_t capture_time_ms,
|
||||
uint32_t ssrc);
|
||||
// Sends packet on to |transport_|, leaving the RTP module.
|
||||
// Sends packet on to `transport_`, leaving the RTP module.
|
||||
bool SendPacketToNetwork(const RtpPacketToSend& packet,
|
||||
const PacketOptions& options,
|
||||
const PacedPacketInfo& pacing_info);
|
||||
|
||||
@ -588,7 +588,7 @@ bool RTPSenderVideo::SendVideo(
|
||||
first_packet->HasExtension<RtpDependencyDescriptorExtension>();
|
||||
|
||||
// Minimization of the vp8 descriptor may erase temporal_id, so use
|
||||
// |temporal_id| rather than reference |video_header| beyond this point.
|
||||
// `temporal_id` rather than reference `video_header` beyond this point.
|
||||
if (has_generic_descriptor) {
|
||||
MinimizeDescriptor(&video_header);
|
||||
}
|
||||
@ -687,7 +687,7 @@ bool RTPSenderVideo::SendVideo(
|
||||
red_packet->SetPayloadType(*red_payload_type_);
|
||||
red_packet->set_is_red(true);
|
||||
|
||||
// Append |red_packet| instead of |packet| to output.
|
||||
// Append `red_packet` instead of `packet` to output.
|
||||
red_packet->set_packet_type(RtpPacketMediaType::kVideo);
|
||||
red_packet->set_allow_retransmission(packet->allow_retransmission());
|
||||
rtp_packets.emplace_back(std::move(red_packet));
|
||||
|
||||
@ -67,7 +67,7 @@ class RTPSenderVideo {
|
||||
Config(const Config&) = delete;
|
||||
Config(Config&&) = default;
|
||||
|
||||
// All members of this struct, with the exception of |field_trials|, are
|
||||
// All members of this struct, with the exception of `field_trials`, are
|
||||
// expected to outlive the RTPSenderVideo object they are passed to.
|
||||
Clock* clock = nullptr;
|
||||
RTPSender* rtp_sender = nullptr;
|
||||
@ -91,7 +91,7 @@ class RTPSenderVideo {
|
||||
// expected_retransmission_time_ms.has_value() -> retransmission allowed.
|
||||
// `capture_time_ms` and `clock::CurrentTime` should be using the same epoch.
|
||||
// Calls to this method is assumed to be externally serialized.
|
||||
// |estimated_capture_clock_offset_ms| is an estimated clock offset between
|
||||
// `estimated_capture_clock_offset_ms` is an estimated clock offset between
|
||||
// this sender and the original capturer, for this video packet. See
|
||||
// http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time for more
|
||||
// details. If the sender and the capture has the same clock, it is supposed
|
||||
@ -208,12 +208,12 @@ class RTPSenderVideo {
|
||||
RTC_GUARDED_BY(send_checker_);
|
||||
absl::optional<VideoLayersAllocation> allocation_
|
||||
RTC_GUARDED_BY(send_checker_);
|
||||
// Flag indicating if we should send |allocation_|.
|
||||
// Flag indicating if we should send `allocation_`.
|
||||
SendVideoLayersAllocation send_allocation_ RTC_GUARDED_BY(send_checker_);
|
||||
|
||||
// Current target playout delay.
|
||||
VideoPlayoutDelay current_playout_delay_ RTC_GUARDED_BY(send_checker_);
|
||||
// Flag indicating if we need to send |current_playout_delay_| in order
|
||||
// Flag indicating if we need to send `current_playout_delay_` in order
|
||||
// to guarantee it gets delivered.
|
||||
bool playout_delay_pending_;
|
||||
// Set by the field trial WebRTC-ForceSendPlayoutDelay to override the playout
|
||||
|
||||
@ -45,26 +45,26 @@ class RTPSenderVideoFrameTransformerDelegate : public TransformedFrameCallback {
|
||||
absl::optional<int64_t> expected_retransmission_time_ms);
|
||||
|
||||
// Implements TransformedFrameCallback. Can be called on any thread. Posts
|
||||
// the transformed frame to be sent on the |encoder_queue_|.
|
||||
// the transformed frame to be sent on the `encoder_queue_`.
|
||||
void OnTransformedFrame(
|
||||
std::unique_ptr<TransformableFrameInterface> frame) override;
|
||||
|
||||
// Delegates the call to RTPSendVideo::SendVideo on the |encoder_queue_|.
|
||||
// Delegates the call to RTPSendVideo::SendVideo on the `encoder_queue_`.
|
||||
void SendVideo(std::unique_ptr<TransformableFrameInterface> frame) const;
|
||||
|
||||
// Delegates the call to RTPSendVideo::SetVideoStructureAfterTransformation
|
||||
// under |sender_lock_|.
|
||||
// under `sender_lock_`.
|
||||
void SetVideoStructureUnderLock(
|
||||
const FrameDependencyStructure* video_structure);
|
||||
|
||||
// Delegates the call to
|
||||
// RTPSendVideo::SetVideoLayersAllocationAfterTransformation under
|
||||
// |sender_lock_|.
|
||||
// `sender_lock_`.
|
||||
void SetVideoLayersAllocationUnderLock(VideoLayersAllocation allocation);
|
||||
|
||||
// Unregisters and releases the |frame_transformer_| reference, and resets
|
||||
// |sender_| under lock. Called from RTPSenderVideo destructor to prevent the
|
||||
// |sender_| to dangle.
|
||||
// Unregisters and releases the `frame_transformer_` reference, and resets
|
||||
// `sender_` under lock. Called from RTPSenderVideo destructor to prevent the
|
||||
// `sender_` to dangle.
|
||||
void Reset();
|
||||
|
||||
protected:
|
||||
|
||||
@ -23,7 +23,7 @@ namespace webrtc {
|
||||
|
||||
RtpSequenceNumberMap::RtpSequenceNumberMap(size_t max_entries)
|
||||
: max_entries_(max_entries) {
|
||||
RTC_DCHECK_GT(max_entries_, 4); // See code paring down to |max_entries_|.
|
||||
RTC_DCHECK_GT(max_entries_, 4); // See code paring down to `max_entries_`.
|
||||
RTC_DCHECK_LE(max_entries_, 1 << 15);
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ void RtpSequenceNumberMap::InsertPacket(uint16_t sequence_number, Info info) {
|
||||
if (AheadOrAt(sequence_number, associations_.front().sequence_number) &&
|
||||
AheadOrAt(associations_.back().sequence_number, sequence_number)) {
|
||||
// The sequence number has wrapped around and is within the range
|
||||
// currently held by |associations_| - we should invalidate all entries.
|
||||
// currently held by `associations_` - we should invalidate all entries.
|
||||
RTC_LOG(LS_WARNING) << "Sequence number wrapped-around unexpectedly.";
|
||||
associations_.clear();
|
||||
associations_.emplace_back(sequence_number, info);
|
||||
@ -59,7 +59,7 @@ void RtpSequenceNumberMap::InsertPacket(uint16_t sequence_number, Info info) {
|
||||
erase_to = std::next(erase_to, max_entries_ - new_size);
|
||||
}
|
||||
|
||||
// It is guaranteed that |associations_| can be split into two partitions,
|
||||
// It is guaranteed that `associations_` can be split into two partitions,
|
||||
// either partition possibly empty, such that:
|
||||
// * In the first partition, all elements are AheadOf the new element.
|
||||
// This is the partition of the obsolete elements.
|
||||
|
||||
@ -22,7 +22,7 @@ namespace webrtc {
|
||||
// Records the association of RTP sequence numbers to timestamps and to whether
|
||||
// the packet was first and/or last in the frame.
|
||||
//
|
||||
// 1. Limits number of entries. Whenever |max_entries| is about to be exceeded,
|
||||
// 1. Limits number of entries. Whenever `max_entries` is about to be exceeded,
|
||||
// the size is reduced by approximately 25%.
|
||||
// 2. RTP sequence numbers wrap around relatively infrequently.
|
||||
// This class therefore only remembers at most the last 2^15 RTP packets,
|
||||
|
||||
@ -438,7 +438,7 @@ TEST_F(RtpSequenceNumberMapTest, MaxEntriesObserved) {
|
||||
uut.InsertPacket(new_association.sequence_number, new_association.info);
|
||||
associations.push_back(new_association);
|
||||
|
||||
// The +1 is for |new_association|.
|
||||
// The +1 is for `new_association`.
|
||||
const size_t kExpectedAssociationCount = 3 * kMaxEntries / 4 + 1;
|
||||
const auto expected_begin =
|
||||
std::prev(associations.end(), kExpectedAssociationCount);
|
||||
@ -466,7 +466,7 @@ void RtpSequenceNumberMapTest::MaxEntriesReachedAtSameTimeAsObsoletionOfItem(
|
||||
uut.InsertPacket(new_association.sequence_number, new_association.info);
|
||||
associations.push_back(new_association);
|
||||
|
||||
// The +1 is for |new_association|.
|
||||
// The +1 is for `new_association`.
|
||||
const size_t kExpectedAssociationCount =
|
||||
std::min(3 * max_entries / 4, max_entries - obsoleted_count) + 1;
|
||||
const auto expected_begin =
|
||||
|
||||
@ -72,7 +72,7 @@ std::vector<RtpSource> SourceTracker::GetSources() const {
|
||||
|
||||
SourceTracker::SourceEntry& SourceTracker::UpdateEntry(const SourceKey& key) {
|
||||
// We intentionally do |find() + emplace()|, instead of checking the return
|
||||
// value of |emplace()|, for performance reasons. It's much more likely for
|
||||
// value of `emplace()`, for performance reasons. It's much more likely for
|
||||
// the key to already exist than for it not to.
|
||||
auto map_it = map_.find(key);
|
||||
if (map_it == map_.end()) {
|
||||
|
||||
@ -48,8 +48,8 @@ class SourceTracker {
|
||||
// RTCRtpReceiver's MediaStreamTrack.
|
||||
void OnFrameDelivered(const RtpPacketInfos& packet_infos);
|
||||
|
||||
// Returns an |RtpSource| for each unique SSRC and CSRC identifier updated in
|
||||
// the last |kTimeoutMs| milliseconds. Entries appear in reverse chronological
|
||||
// Returns an `RtpSource` for each unique SSRC and CSRC identifier updated in
|
||||
// the last `kTimeoutMs` milliseconds. Entries appear in reverse chronological
|
||||
// order (i.e. with the most recently updated entries appearing first).
|
||||
std::vector<RtpSource> GetSources() const;
|
||||
|
||||
@ -58,7 +58,7 @@ class SourceTracker {
|
||||
SourceKey(RtpSourceType source_type, uint32_t source)
|
||||
: source_type(source_type), source(source) {}
|
||||
|
||||
// Type of |source|.
|
||||
// Type of `source`.
|
||||
RtpSourceType source_type;
|
||||
|
||||
// CSRC or SSRC identifier of the contributing or synchronization source.
|
||||
@ -81,12 +81,12 @@ class SourceTracker {
|
||||
struct SourceEntry {
|
||||
// Timestamp indicating the most recent time a frame from an RTP packet,
|
||||
// originating from this source, was delivered to the RTCRtpReceiver's
|
||||
// MediaStreamTrack. Its reference clock is the outer class's |clock_|.
|
||||
// MediaStreamTrack. Its reference clock is the outer class's `clock_`.
|
||||
int64_t timestamp_ms;
|
||||
|
||||
// Audio level from an RFC 6464 or RFC 6465 header extension received with
|
||||
// the most recent packet used to assemble the frame associated with
|
||||
// |timestamp_ms|. May be absent. Only relevant for audio receivers. See the
|
||||
// `timestamp_ms`. May be absent. Only relevant for audio receivers. See the
|
||||
// specs for `RTCRtpContributingSource` for more info.
|
||||
absl::optional<uint8_t> audio_level;
|
||||
|
||||
@ -96,7 +96,7 @@ class SourceTracker {
|
||||
absl::optional<AbsoluteCaptureTime> absolute_capture_time;
|
||||
|
||||
// RTP timestamp of the most recent packet used to assemble the frame
|
||||
// associated with |timestamp_ms|.
|
||||
// associated with `timestamp_ms`.
|
||||
uint32_t rtp_timestamp;
|
||||
};
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ using ::testing::Values;
|
||||
|
||||
constexpr size_t kPacketInfosCountMax = 5;
|
||||
|
||||
// Simple "guaranteed to be correct" re-implementation of |SourceTracker| for
|
||||
// Simple "guaranteed to be correct" re-implementation of `SourceTracker` for
|
||||
// dual-implementation testing purposes.
|
||||
class ExpectedSourceTracker {
|
||||
public:
|
||||
|
||||
@ -40,17 +40,17 @@ constexpr int kMaxExcessOverhead = 50; // Q8.
|
||||
constexpr size_t kMinMediaPackets = 4;
|
||||
|
||||
// Threshold on the received FEC protection level, above which we enforce at
|
||||
// least |kMinMediaPackets| packets for the FEC code. Below this
|
||||
// threshold |kMinMediaPackets| is set to default value of 1.
|
||||
// least `kMinMediaPackets` packets for the FEC code. Below this
|
||||
// threshold `kMinMediaPackets` is set to default value of 1.
|
||||
//
|
||||
// The range is between 0 and 255, where 255 corresponds to 100% overhead
|
||||
// (relative to the number of protected media packets).
|
||||
constexpr uint8_t kHighProtectionThreshold = 80;
|
||||
|
||||
// This threshold is used to adapt the |kMinMediaPackets| threshold, based
|
||||
// This threshold is used to adapt the `kMinMediaPackets` threshold, based
|
||||
// on the average number of packets per frame seen so far. When there are few
|
||||
// packets per frame (as given by this threshold), at least
|
||||
// |kMinMediaPackets| + 1 packets are sent to the FEC code.
|
||||
// `kMinMediaPackets` + 1 packets are sent to the FEC code.
|
||||
constexpr float kMinMediaPacketsAdaptationThreshold = 2.0f;
|
||||
|
||||
// At construction time, we don't know the SSRC that is used for the generated
|
||||
@ -129,7 +129,7 @@ void UlpfecGenerator::AddPacketAndGenerateFec(const RtpPacketToSend& packet) {
|
||||
}
|
||||
const bool complete_frame = packet.Marker();
|
||||
if (media_packets_.size() < kUlpfecMaxMediaPackets) {
|
||||
// Our packet masks can only protect up to |kUlpfecMaxMediaPackets| packets.
|
||||
// Our packet masks can only protect up to `kUlpfecMaxMediaPackets` packets.
|
||||
auto fec_packet = std::make_unique<ForwardErrorCorrection::Packet>();
|
||||
fec_packet->data = packet.Buffer();
|
||||
media_packets_.push_back(std::move(fec_packet));
|
||||
@ -148,8 +148,8 @@ void UlpfecGenerator::AddPacketAndGenerateFec(const RtpPacketToSend& packet) {
|
||||
|
||||
// Produce FEC over at most |params_.max_fec_frames| frames, or as soon as:
|
||||
// (1) the excess overhead (actual overhead - requested/target overhead) is
|
||||
// less than |kMaxExcessOverhead|, and
|
||||
// (2) at least |min_num_media_packets_| media packets is reached.
|
||||
// less than `kMaxExcessOverhead`, and
|
||||
// (2) at least `min_num_media_packets_` media packets is reached.
|
||||
if (complete_frame &&
|
||||
(num_protected_frames_ >= params.max_fec_frames ||
|
||||
(ExcessOverheadBelowMax() && MinimumMediaPacketsReached()))) {
|
||||
@ -203,7 +203,7 @@ std::vector<std::unique_ptr<RtpPacketToSend>> UlpfecGenerator::GetFecPackets() {
|
||||
}
|
||||
|
||||
// Wrap FEC packet (including FEC headers) in a RED packet. Since the
|
||||
// FEC packets in |generated_fec_packets_| don't have RTP headers, we
|
||||
// FEC packets in `generated_fec_packets_` don't have RTP headers, we
|
||||
// reuse the header from the last media packet.
|
||||
RTC_CHECK(last_media_packet_.has_value());
|
||||
last_media_packet_->SetPayloadSize(0);
|
||||
|
||||
@ -81,14 +81,14 @@ class UlpfecGenerator : public VideoFecGenerator {
|
||||
int Overhead() const;
|
||||
|
||||
// Returns true if the excess overhead (actual - target) for the FEC is below
|
||||
// the amount |kMaxExcessOverhead|. This effects the lower protection level
|
||||
// the amount `kMaxExcessOverhead`. This effects the lower protection level
|
||||
// cases and low number of media packets/frame. The target overhead is given
|
||||
// by |params_.fec_rate|, and is only achievable in the limit of large number
|
||||
// of media packets.
|
||||
bool ExcessOverheadBelowMax() const;
|
||||
|
||||
// Returns true if the number of added media packets is at least
|
||||
// |min_num_media_packets_|. This condition tries to capture the effect
|
||||
// `min_num_media_packets_`. This condition tries to capture the effect
|
||||
// that, for the same amount of protection/overhead, longer codes
|
||||
// (e.g. (2k,2m) vs (k,m)) are generally more effective at recovering losses.
|
||||
bool MinimumMediaPacketsReached() const;
|
||||
|
||||
@ -103,12 +103,12 @@ TEST_F(UlpfecGeneratorTest, NoEmptyFecWithSeqNumGaps) {
|
||||
}
|
||||
|
||||
TEST_F(UlpfecGeneratorTest, OneFrameFec) {
|
||||
// The number of media packets (|kNumPackets|), number of frames (one for
|
||||
// The number of media packets (`kNumPackets`), number of frames (one for
|
||||
// this test), and the protection factor (|params->fec_rate|) are set to make
|
||||
// sure the conditions for generating FEC are satisfied. This means:
|
||||
// (1) protection factor is high enough so that actual overhead over 1 frame
|
||||
// of packets is within |kMaxExcessOverhead|, and (2) the total number of
|
||||
// media packets for 1 frame is at least |minimum_media_packets_fec_|.
|
||||
// of packets is within `kMaxExcessOverhead`, and (2) the total number of
|
||||
// media packets for 1 frame is at least `minimum_media_packets_fec_`.
|
||||
constexpr size_t kNumPackets = 4;
|
||||
FecProtectionParams params = {15, 3, kFecMaskRandom};
|
||||
packet_generator_.NewFrame(kNumPackets);
|
||||
@ -137,13 +137,13 @@ TEST_F(UlpfecGeneratorTest, OneFrameFec) {
|
||||
}
|
||||
|
||||
TEST_F(UlpfecGeneratorTest, TwoFrameFec) {
|
||||
// The number of media packets/frame (|kNumPackets|), the number of frames
|
||||
// (|kNumFrames|), and the protection factor (|params->fec_rate|) are set to
|
||||
// The number of media packets/frame (`kNumPackets`), the number of frames
|
||||
// (`kNumFrames`), and the protection factor (|params->fec_rate|) are set to
|
||||
// make sure the conditions for generating FEC are satisfied. This means:
|
||||
// (1) protection factor is high enough so that actual overhead over
|
||||
// |kNumFrames| is within |kMaxExcessOverhead|, and (2) the total number of
|
||||
// media packets for |kNumFrames| frames is at least
|
||||
// |minimum_media_packets_fec_|.
|
||||
// `kNumFrames` is within `kMaxExcessOverhead`, and (2) the total number of
|
||||
// media packets for `kNumFrames` frames is at least
|
||||
// `minimum_media_packets_fec_`.
|
||||
constexpr size_t kNumPackets = 2;
|
||||
constexpr size_t kNumFrames = 2;
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ namespace {
|
||||
constexpr size_t kMaxMediaPackets = 48;
|
||||
|
||||
// Maximum number of media packets tracked by FEC decoder.
|
||||
// Maintain a sufficiently larger tracking window than |kMaxMediaPackets|
|
||||
// Maintain a sufficiently larger tracking window than `kMaxMediaPackets`
|
||||
// to account for packet reordering in pacer/ network.
|
||||
constexpr size_t kMaxTrackedMediaPackets = 4 * kMaxMediaPackets;
|
||||
|
||||
|
||||
@ -157,10 +157,10 @@ bool UlpfecReceiverImpl::AddReceivedRedPacket(
|
||||
int32_t UlpfecReceiverImpl::ProcessReceivedFec() {
|
||||
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
||||
|
||||
// If we iterate over |received_packets_| and it contains a packet that cause
|
||||
// If we iterate over `received_packets_` and it contains a packet that cause
|
||||
// us to recurse back to this function (for example a RED packet encapsulating
|
||||
// a RED packet), then we will recurse forever. To avoid this we swap
|
||||
// |received_packets_| with an empty vector so that the next recursive call
|
||||
// `received_packets_` with an empty vector so that the next recursive call
|
||||
// wont iterate over the same packet again. This also solves the problem of
|
||||
// not modifying the vector we are currently iterating over (packets are added
|
||||
// in AddReceivedRedPacket).
|
||||
|
||||
@ -54,27 +54,27 @@ class UlpfecReceiverTest : public ::testing::Test {
|
||||
{})),
|
||||
packet_generator_(kMediaSsrc) {}
|
||||
|
||||
// Generates |num_fec_packets| FEC packets, given |media_packets|.
|
||||
// Generates `num_fec_packets` FEC packets, given `media_packets`.
|
||||
void EncodeFec(const ForwardErrorCorrection::PacketList& media_packets,
|
||||
size_t num_fec_packets,
|
||||
std::list<ForwardErrorCorrection::Packet*>* fec_packets);
|
||||
|
||||
// Generates |num_media_packets| corresponding to a single frame.
|
||||
// Generates `num_media_packets` corresponding to a single frame.
|
||||
void PacketizeFrame(size_t num_media_packets,
|
||||
size_t frame_offset,
|
||||
std::list<AugmentedPacket*>* augmented_packets,
|
||||
ForwardErrorCorrection::PacketList* packets);
|
||||
|
||||
// Build a media packet using |packet_generator_| and add it
|
||||
// Build a media packet using `packet_generator_` and add it
|
||||
// to the receiver.
|
||||
void BuildAndAddRedMediaPacket(AugmentedPacket* packet,
|
||||
bool is_recovered = false);
|
||||
|
||||
// Build a FEC packet using |packet_generator_| and add it
|
||||
// Build a FEC packet using `packet_generator_` and add it
|
||||
// to the receiver.
|
||||
void BuildAndAddRedFecPacket(Packet* packet);
|
||||
|
||||
// Ensure that |recovered_packet_receiver_| will be called correctly
|
||||
// Ensure that `recovered_packet_receiver_` will be called correctly
|
||||
// and that the recovered packet will be identical to the lost packet.
|
||||
void VerifyReconstructedMediaPacket(const AugmentedPacket& packet,
|
||||
size_t times);
|
||||
@ -139,7 +139,7 @@ void UlpfecReceiverTest::VerifyReconstructedMediaPacket(
|
||||
const AugmentedPacket& packet,
|
||||
size_t times) {
|
||||
// Verify that the content of the reconstructed packet is equal to the
|
||||
// content of |packet|, and that the same content is received |times| number
|
||||
// content of `packet`, and that the same content is received `times` number
|
||||
// of times in a row.
|
||||
EXPECT_CALL(recovered_packet_receiver_,
|
||||
OnRecoveredPacket(_, packet.data.size()))
|
||||
|
||||
@ -155,7 +155,7 @@ class FecPacketMaskMetricsTest : public ::testing::Test {
|
||||
uint8_t fec_packet_masks_[kMaxNumberMediaPackets][kMaxNumberMediaPackets];
|
||||
FILE* fp_mask_;
|
||||
|
||||
// Measure of the gap of the loss for configuration given by |state|.
|
||||
// Measure of the gap of the loss for configuration given by `state`.
|
||||
// This is to measure degree of consecutiveness for the loss configuration.
|
||||
// Useful if the packets are sent out in order of sequence numbers and there
|
||||
// is little/no re-ordering during transmission.
|
||||
@ -183,8 +183,8 @@ class FecPacketMaskMetricsTest : public ::testing::Test {
|
||||
}
|
||||
|
||||
// Returns the number of recovered media packets for the XOR code, given the
|
||||
// packet mask |fec_packet_masks_|, for the loss state/configuration given by
|
||||
// |state|.
|
||||
// packet mask `fec_packet_masks_`, for the loss state/configuration given by
|
||||
// `state`.
|
||||
int RecoveredMediaPackets(int num_media_packets,
|
||||
int num_fec_packets,
|
||||
uint8_t* state) {
|
||||
@ -241,7 +241,7 @@ class FecPacketMaskMetricsTest : public ::testing::Test {
|
||||
}
|
||||
|
||||
// Compute the probability of occurence of the loss state/configuration,
|
||||
// given by |state|, for all the loss models considered in this test.
|
||||
// given by `state`, for all the loss models considered in this test.
|
||||
void ComputeProbabilityWeight(double* prob_weight,
|
||||
uint8_t* state,
|
||||
int tot_num_packets) {
|
||||
@ -317,8 +317,8 @@ class FecPacketMaskMetricsTest : public ::testing::Test {
|
||||
}
|
||||
|
||||
// Compute the residual loss per gap, by summing the
|
||||
// |residual_loss_per_loss_gap| over all loss configurations up to loss number
|
||||
// = |num_fec_packets|.
|
||||
// `residual_loss_per_loss_gap` over all loss configurations up to loss number
|
||||
// = `num_fec_packets`.
|
||||
double ComputeResidualLossPerGap(MetricsFecCode metrics,
|
||||
int gap_number,
|
||||
int num_fec_packets,
|
||||
@ -339,7 +339,7 @@ class FecPacketMaskMetricsTest : public ::testing::Test {
|
||||
}
|
||||
|
||||
// Compute the recovery rate per loss number, by summing the
|
||||
// |residual_loss_per_loss_gap| over all gap configurations.
|
||||
// `residual_loss_per_loss_gap` over all gap configurations.
|
||||
void ComputeRecoveryRatePerLoss(MetricsFecCode* metrics,
|
||||
int num_media_packets,
|
||||
int num_fec_packets,
|
||||
@ -358,7 +358,7 @@ class FecPacketMaskMetricsTest : public ::testing::Test {
|
||||
if (tot_num_configs > 0) {
|
||||
arl = arl / static_cast<double>(tot_num_configs);
|
||||
}
|
||||
// Recovery rate for a given loss |loss| is 1 minus the scaled |arl|,
|
||||
// Recovery rate for a given loss `loss` is 1 minus the scaled `arl`,
|
||||
// where the scale factor is relative to code size/parameters.
|
||||
double scaled_loss =
|
||||
static_cast<double>(loss * num_media_packets) /
|
||||
@ -376,8 +376,8 @@ class FecPacketMaskMetricsTest : public ::testing::Test {
|
||||
sizeof(double) * 2 * kMaxMediaPacketsTest + 1);
|
||||
}
|
||||
|
||||
// Compute the metrics for an FEC code, given by the code type |code_type|
|
||||
// (XOR-random/ bursty or RS), and by the code index |code_index|
|
||||
// Compute the metrics for an FEC code, given by the code type `code_type`
|
||||
// (XOR-random/ bursty or RS), and by the code index `code_index`
|
||||
// (which containes the code size parameters/protection length).
|
||||
void ComputeMetricsForCode(CodeType code_type, int code_index) {
|
||||
std::unique_ptr<double[]> prob_weight(new double[kNumLossModels]);
|
||||
@ -393,7 +393,7 @@ class FecPacketMaskMetricsTest : public ::testing::Test {
|
||||
|
||||
int num_loss_configurations = 1 << tot_num_packets;
|
||||
// Loop over all loss configurations for the symbol sequence of length
|
||||
// |tot_num_packets|. In this version we process up to (k=12, m=12) codes,
|
||||
// `tot_num_packets`. In this version we process up to (k=12, m=12) codes,
|
||||
// and get exact expressions for the residual loss.
|
||||
// TODO(marpan): For larger codes, loop over some random sample of loss
|
||||
// configurations, sampling driven by the underlying statistical loss model
|
||||
@ -470,16 +470,16 @@ class FecPacketMaskMetricsTest : public ::testing::Test {
|
||||
metrics_code.residual_loss_per_loss_gap[index] += residual_loss;
|
||||
if (code_type == xor_random_code) {
|
||||
// The configuration density is only a function of the code length and
|
||||
// only needs to computed for the first |code_type| passed here.
|
||||
// only needs to computed for the first `code_type` passed here.
|
||||
code_params_[code_index].configuration_density[index]++;
|
||||
}
|
||||
} // Done with loop over configurations.
|
||||
// Normalize the average residual loss and compute/normalize the variance.
|
||||
for (int k = 0; k < kNumLossModels; k++) {
|
||||
// Normalize the average residual loss by the total number of packets
|
||||
// |tot_num_packets| (i.e., the code length). For a code with no (zero)
|
||||
// `tot_num_packets` (i.e., the code length). For a code with no (zero)
|
||||
// recovery, the average residual loss for that code would be reduced like
|
||||
// ~|average_loss_rate| * |num_media_packets| / |tot_num_packets|. This is
|
||||
// ~`average_loss_rate` * `num_media_packets` / `tot_num_packets`. This is
|
||||
// the expected reduction in the average residual loss just from adding
|
||||
// FEC packets to the symbol sequence.
|
||||
metrics_code.average_residual_loss[k] =
|
||||
@ -516,7 +516,7 @@ class FecPacketMaskMetricsTest : public ::testing::Test {
|
||||
void WriteOutMetricsAllFecCodes() {
|
||||
std::string filename = test::OutputPath() + "data_metrics_all_codes";
|
||||
FILE* fp = fopen(filename.c_str(), "wb");
|
||||
// Loop through codes up to |kMaxMediaPacketsTest|.
|
||||
// Loop through codes up to `kMaxMediaPacketsTest`.
|
||||
int code_index = 0;
|
||||
for (int num_media_packets = 1; num_media_packets <= kMaxMediaPacketsTest;
|
||||
num_media_packets++) {
|
||||
@ -714,7 +714,7 @@ class FecPacketMaskMetricsTest : public ::testing::Test {
|
||||
const int packet_mask_max = kMaxMediaPackets[fec_mask_type];
|
||||
std::unique_ptr<uint8_t[]> packet_mask(
|
||||
new uint8_t[packet_mask_max * kUlpfecMaxPacketMaskSize]);
|
||||
// Loop through codes up to |kMaxMediaPacketsTest|.
|
||||
// Loop through codes up to `kMaxMediaPacketsTest`.
|
||||
for (int num_media_packets = 1; num_media_packets <= kMaxMediaPacketsTest;
|
||||
++num_media_packets) {
|
||||
const int mask_bytes_fec_packet =
|
||||
@ -955,7 +955,7 @@ TEST_F(FecPacketMaskMetricsTest, FecXorBurstyPerfectRecoveryConsecutiveLoss) {
|
||||
for (int code_index = 0; code_index < max_num_codes_; code_index++) {
|
||||
int num_fec_packets = code_params_[code_index].num_fec_packets;
|
||||
for (int loss = 1; loss <= num_fec_packets; loss++) {
|
||||
int index = loss; // |gap| is zero.
|
||||
int index = loss; // `gap` is zero.
|
||||
EXPECT_EQ(kMetricsXorBursty[code_index].residual_loss_per_loss_gap[index],
|
||||
0.0);
|
||||
}
|
||||
@ -1010,8 +1010,8 @@ TEST_F(FecPacketMaskMetricsTest, FecRecoveryRateUnderLossConditions) {
|
||||
for (int code_index = 0; code_index < max_num_codes_; code_index++) {
|
||||
int num_media_packets = code_params_[code_index].num_media_packets;
|
||||
int num_fec_packets = code_params_[code_index].num_fec_packets;
|
||||
// Perfect recovery (|recovery_rate_per_loss| == 1) is expected for
|
||||
// |loss_number| = 1, for all codes.
|
||||
// Perfect recovery (`recovery_rate_per_loss` == 1) is expected for
|
||||
// `loss_number` = 1, for all codes.
|
||||
int loss_number = 1;
|
||||
EXPECT_EQ(
|
||||
kMetricsReedSolomon[code_index].recovery_rate_per_loss[loss_number],
|
||||
@ -1020,7 +1020,7 @@ TEST_F(FecPacketMaskMetricsTest, FecRecoveryRateUnderLossConditions) {
|
||||
1.0);
|
||||
EXPECT_EQ(kMetricsXorBursty[code_index].recovery_rate_per_loss[loss_number],
|
||||
1.0);
|
||||
// For |loss_number| = |num_fec_packets| / 2, we expect the following:
|
||||
// For `loss_number` = `num_fec_packets` / 2, we expect the following:
|
||||
// Perfect recovery for RS, and recovery for XOR above the threshold.
|
||||
loss_number = num_fec_packets / 2 > 0 ? num_fec_packets / 2 : 1;
|
||||
EXPECT_EQ(
|
||||
@ -1030,7 +1030,7 @@ TEST_F(FecPacketMaskMetricsTest, FecRecoveryRateUnderLossConditions) {
|
||||
kRecoveryRateXorRandom[0]);
|
||||
EXPECT_GE(kMetricsXorBursty[code_index].recovery_rate_per_loss[loss_number],
|
||||
kRecoveryRateXorBursty[0]);
|
||||
// For |loss_number| = |num_fec_packets|, we expect the following:
|
||||
// For `loss_number` = `num_fec_packets`, we expect the following:
|
||||
// Perfect recovery for RS, and recovery for XOR above the threshold.
|
||||
loss_number = num_fec_packets;
|
||||
EXPECT_EQ(
|
||||
@ -1040,7 +1040,7 @@ TEST_F(FecPacketMaskMetricsTest, FecRecoveryRateUnderLossConditions) {
|
||||
kRecoveryRateXorRandom[1]);
|
||||
EXPECT_GE(kMetricsXorBursty[code_index].recovery_rate_per_loss[loss_number],
|
||||
kRecoveryRateXorBursty[1]);
|
||||
// For |loss_number| = |num_fec_packets| + 1, we expect the following:
|
||||
// For `loss_number` = `num_fec_packets` + 1, we expect the following:
|
||||
// Zero recovery for RS, but non-zero recovery for XOR.
|
||||
if (num_fec_packets > 1 && num_media_packets > 2) {
|
||||
loss_number = num_fec_packets + 1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user