Stop using LOG macros in favor of RTC_ prefixed macros.
This CL has been generated with the following script: for m in PLOG \ LOG_TAG \ LOG_GLEM \ LOG_GLE_EX \ LOG_GLE \ LAST_SYSTEM_ERROR \ LOG_ERRNO_EX \ LOG_ERRNO \ LOG_ERR_EX \ LOG_ERR \ LOG_V \ LOG_F \ LOG_T_F \ LOG_E \ LOG_T \ LOG_CHECK_LEVEL_V \ LOG_CHECK_LEVEL \ LOG do git grep -l $m | xargs sed -i "s,\b$m\b,RTC_$m,g" done git checkout rtc_base/logging.h git cl format Bug: webrtc:8452 Change-Id: I1a53ef3e0a5ef6e244e62b2e012b864914784600 Reviewed-on: https://webrtc-review.googlesource.com/21325 Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20617}
This commit is contained in:
committed by
Commit Bot
parent
34fa309129
commit
675513b96a
@ -40,11 +40,11 @@ App::~App() = default;
|
||||
bool App::Parse(const CommonHeader& packet) {
|
||||
RTC_DCHECK_EQ(packet.type(), kPacketType);
|
||||
if (packet.payload_size_bytes() < kAppBaseLength) {
|
||||
LOG(LS_WARNING) << "Packet is too small to be a valid APP packet";
|
||||
RTC_LOG(LS_WARNING) << "Packet is too small to be a valid APP packet";
|
||||
return false;
|
||||
}
|
||||
if (packet.payload_size_bytes() % 4 != 0) {
|
||||
LOG(LS_WARNING)
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Packet payload must be 32 bits aligned to make a valid APP packet";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ bool Bye::Parse(const CommonHeader& packet) {
|
||||
const uint8_t src_count = packet.count();
|
||||
// Validate packet.
|
||||
if (packet.payload_size_bytes() < 4u * src_count) {
|
||||
LOG(LS_WARNING)
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Packet is too small to contain CSRCs it promise to have.";
|
||||
return false;
|
||||
}
|
||||
@ -52,7 +52,7 @@ bool Bye::Parse(const CommonHeader& packet) {
|
||||
if (has_reason) {
|
||||
reason_length = payload[4u * src_count];
|
||||
if (packet.payload_size_bytes() - 4u * src_count < 1u + reason_length) {
|
||||
LOG(LS_WARNING) << "Invalid reason length: " << reason_length;
|
||||
RTC_LOG(LS_WARNING) << "Invalid reason length: " << reason_length;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -115,7 +115,7 @@ bool Bye::Create(uint8_t* packet,
|
||||
|
||||
bool Bye::SetCsrcs(std::vector<uint32_t> csrcs) {
|
||||
if (csrcs.size() > kMaxNumberOfCsrcs) {
|
||||
LOG(LS_WARNING) << "Too many CSRCs for Bye packet.";
|
||||
RTC_LOG(LS_WARNING) << "Too many CSRCs for Bye packet.";
|
||||
return false;
|
||||
}
|
||||
csrcs_ = std::move(csrcs);
|
||||
|
||||
@ -31,17 +31,18 @@ bool CommonHeader::Parse(const uint8_t* buffer, size_t size_bytes) {
|
||||
const uint8_t kVersion = 2;
|
||||
|
||||
if (size_bytes < kHeaderSizeBytes) {
|
||||
LOG(LS_WARNING) << "Too little data (" << size_bytes << " byte"
|
||||
<< (size_bytes != 1 ? "s" : "")
|
||||
<< ") remaining in buffer to parse RTCP header (4 bytes).";
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Too little data (" << size_bytes << " byte"
|
||||
<< (size_bytes != 1 ? "s" : "")
|
||||
<< ") remaining in buffer to parse RTCP header (4 bytes).";
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t version = buffer[0] >> 6;
|
||||
if (version != kVersion) {
|
||||
LOG(LS_WARNING) << "Invalid RTCP header: Version must be "
|
||||
<< static_cast<int>(kVersion) << " but was "
|
||||
<< static_cast<int>(version);
|
||||
RTC_LOG(LS_WARNING) << "Invalid RTCP header: Version must be "
|
||||
<< static_cast<int>(kVersion) << " but was "
|
||||
<< static_cast<int>(version);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -53,29 +54,31 @@ bool CommonHeader::Parse(const uint8_t* buffer, size_t size_bytes) {
|
||||
padding_size_ = 0;
|
||||
|
||||
if (size_bytes < kHeaderSizeBytes + payload_size_) {
|
||||
LOG(LS_WARNING) << "Buffer too small (" << size_bytes
|
||||
<< " bytes) to fit an RtcpPacket with a header and "
|
||||
<< payload_size_ << " bytes.";
|
||||
RTC_LOG(LS_WARNING) << "Buffer too small (" << size_bytes
|
||||
<< " bytes) to fit an RtcpPacket with a header and "
|
||||
<< payload_size_ << " bytes.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (has_padding) {
|
||||
if (payload_size_ == 0) {
|
||||
LOG(LS_WARNING) << "Invalid RTCP header: Padding bit set but 0 payload "
|
||||
"size specified.";
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Invalid RTCP header: Padding bit set but 0 payload "
|
||||
"size specified.";
|
||||
return false;
|
||||
}
|
||||
|
||||
padding_size_ = payload_[payload_size_ - 1];
|
||||
if (padding_size_ == 0) {
|
||||
LOG(LS_WARNING) << "Invalid RTCP header: Padding bit set but 0 padding "
|
||||
"size specified.";
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Invalid RTCP header: Padding bit set but 0 padding "
|
||||
"size specified.";
|
||||
return false;
|
||||
}
|
||||
if (padding_size_ > payload_size_) {
|
||||
LOG(LS_WARNING) << "Invalid RTCP header: Too many padding bytes ("
|
||||
<< padding_size_ << ") for a packet payload size of "
|
||||
<< payload_size_ << " bytes.";
|
||||
RTC_LOG(LS_WARNING) << "Invalid RTCP header: Too many padding bytes ("
|
||||
<< padding_size_ << ") for a packet payload size of "
|
||||
<< payload_size_ << " bytes.";
|
||||
return false;
|
||||
}
|
||||
payload_size_ -= padding_size_;
|
||||
|
||||
@ -46,7 +46,7 @@ bool Dlrr::Parse(const uint8_t* buffer, uint16_t block_length_32bits) {
|
||||
RTC_DCHECK_EQ(block_length_32bits,
|
||||
ByteReader<uint16_t>::ReadBigEndian(&buffer[2]));
|
||||
if (block_length_32bits % 3 != 0) {
|
||||
LOG(LS_WARNING) << "Invalid size for dlrr block.";
|
||||
RTC_LOG(LS_WARNING) << "Invalid size for dlrr block.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ bool ExtendedJitterReport::Parse(const CommonHeader& packet) {
|
||||
const uint8_t number_of_jitters = packet.count();
|
||||
|
||||
if (packet.payload_size_bytes() < number_of_jitters * kJitterSizeBytes) {
|
||||
LOG(LS_WARNING) << "Packet is too small to contain all the jitter.";
|
||||
RTC_LOG(LS_WARNING) << "Packet is too small to contain all the jitter.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ bool ExtendedJitterReport::Parse(const CommonHeader& packet) {
|
||||
|
||||
bool ExtendedJitterReport::SetJitterValues(std::vector<uint32_t> values) {
|
||||
if (values.size() > kMaxNumberOfJitterValues) {
|
||||
LOG(LS_WARNING) << "Too many inter-arrival jitter items.";
|
||||
RTC_LOG(LS_WARNING) << "Too many inter-arrival jitter items.";
|
||||
return false;
|
||||
}
|
||||
inter_arrival_jitters_ = std::move(values);
|
||||
|
||||
@ -47,7 +47,8 @@ bool ExtendedReports::Parse(const CommonHeader& packet) {
|
||||
RTC_DCHECK_EQ(packet.type(), kPacketType);
|
||||
|
||||
if (packet.payload_size_bytes() < kXrBaseLength) {
|
||||
LOG(LS_WARNING) << "Packet is too small to be an ExtendedReports packet.";
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Packet is too small to be an ExtendedReports packet.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -68,7 +69,8 @@ bool ExtendedReports::Parse(const CommonHeader& packet) {
|
||||
const uint8_t* next_block =
|
||||
current_block + kBlockHeaderSizeBytes + block_length * 4;
|
||||
if (next_block > packet_end) {
|
||||
LOG(LS_WARNING) << "Report block in extended report packet is too big.";
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Report block in extended report packet is too big.";
|
||||
return false;
|
||||
}
|
||||
switch (block_type) {
|
||||
@ -86,7 +88,8 @@ bool ExtendedReports::Parse(const CommonHeader& packet) {
|
||||
break;
|
||||
default:
|
||||
// Unknown block, ignore.
|
||||
LOG(LS_WARNING) << "Unknown extended report block type " << block_type;
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Unknown extended report block type " << block_type;
|
||||
break;
|
||||
}
|
||||
current_block = next_block;
|
||||
@ -97,7 +100,7 @@ bool ExtendedReports::Parse(const CommonHeader& packet) {
|
||||
|
||||
void ExtendedReports::SetRrtr(const Rrtr& rrtr) {
|
||||
if (rrtr_block_)
|
||||
LOG(LS_WARNING) << "Rrtr already set, overwriting.";
|
||||
RTC_LOG(LS_WARNING) << "Rrtr already set, overwriting.";
|
||||
rrtr_block_.emplace(rrtr);
|
||||
}
|
||||
|
||||
@ -107,13 +110,13 @@ void ExtendedReports::AddDlrrItem(const ReceiveTimeInfo& time_info) {
|
||||
|
||||
void ExtendedReports::SetVoipMetric(const VoipMetric& voip_metric) {
|
||||
if (voip_metric_block_)
|
||||
LOG(LS_WARNING) << "Voip metric already set, overwriting.";
|
||||
RTC_LOG(LS_WARNING) << "Voip metric already set, overwriting.";
|
||||
voip_metric_block_.emplace(voip_metric);
|
||||
}
|
||||
|
||||
void ExtendedReports::SetTargetBitrate(const TargetBitrate& bitrate) {
|
||||
if (target_bitrate_)
|
||||
LOG(LS_WARNING) << "TargetBitrate already set, overwriting.";
|
||||
RTC_LOG(LS_WARNING) << "TargetBitrate already set, overwriting.";
|
||||
|
||||
target_bitrate_ = rtc::Optional<TargetBitrate>(bitrate);
|
||||
}
|
||||
@ -165,12 +168,13 @@ size_t ExtendedReports::TargetBitrateLength() const {
|
||||
void ExtendedReports::ParseRrtrBlock(const uint8_t* block,
|
||||
uint16_t block_length) {
|
||||
if (block_length != Rrtr::kBlockLength) {
|
||||
LOG(LS_WARNING) << "Incorrect rrtr block size " << block_length
|
||||
<< " Should be " << Rrtr::kBlockLength;
|
||||
RTC_LOG(LS_WARNING) << "Incorrect rrtr block size " << block_length
|
||||
<< " Should be " << Rrtr::kBlockLength;
|
||||
return;
|
||||
}
|
||||
if (rrtr_block_) {
|
||||
LOG(LS_WARNING) << "Two rrtr blocks found in same Extended Report packet";
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Two rrtr blocks found in same Extended Report packet";
|
||||
return;
|
||||
}
|
||||
rrtr_block_.emplace();
|
||||
@ -180,7 +184,8 @@ void ExtendedReports::ParseRrtrBlock(const uint8_t* block,
|
||||
void ExtendedReports::ParseDlrrBlock(const uint8_t* block,
|
||||
uint16_t block_length) {
|
||||
if (dlrr_block_) {
|
||||
LOG(LS_WARNING) << "Two Dlrr blocks found in same Extended Report packet";
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Two Dlrr blocks found in same Extended Report packet";
|
||||
return;
|
||||
}
|
||||
dlrr_block_.Parse(block, block_length);
|
||||
@ -189,12 +194,12 @@ void ExtendedReports::ParseDlrrBlock(const uint8_t* block,
|
||||
void ExtendedReports::ParseVoipMetricBlock(const uint8_t* block,
|
||||
uint16_t block_length) {
|
||||
if (block_length != VoipMetric::kBlockLength) {
|
||||
LOG(LS_WARNING) << "Incorrect voip metric block size " << block_length
|
||||
<< " Should be " << VoipMetric::kBlockLength;
|
||||
RTC_LOG(LS_WARNING) << "Incorrect voip metric block size " << block_length
|
||||
<< " Should be " << VoipMetric::kBlockLength;
|
||||
return;
|
||||
}
|
||||
if (voip_metric_block_) {
|
||||
LOG(LS_WARNING)
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Two Voip Metric blocks found in same Extended Report packet";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -54,12 +54,12 @@ bool Fir::Parse(const CommonHeader& packet) {
|
||||
|
||||
// The FCI field MUST contain one or more FIR entries.
|
||||
if (packet.payload_size_bytes() < kCommonFeedbackLength + kFciLength) {
|
||||
LOG(LS_WARNING) << "Packet is too small to be a valid FIR packet.";
|
||||
RTC_LOG(LS_WARNING) << "Packet is too small to be a valid FIR packet.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((packet.payload_size_bytes() - kCommonFeedbackLength) % kFciLength != 0) {
|
||||
LOG(LS_WARNING) << "Invalid size for a valid FIR packet.";
|
||||
RTC_LOG(LS_WARNING) << "Invalid size for a valid FIR packet.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -53,8 +53,8 @@ bool Nack::Parse(const CommonHeader& packet) {
|
||||
RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType);
|
||||
|
||||
if (packet.payload_size_bytes() < kCommonFeedbackLength + kNackItemLength) {
|
||||
LOG(LS_WARNING) << "Payload length " << packet.payload_size_bytes()
|
||||
<< " is too small for a Nack.";
|
||||
RTC_LOG(LS_WARNING) << "Payload length " << packet.payload_size_bytes()
|
||||
<< " is too small for a Nack.";
|
||||
return false;
|
||||
}
|
||||
size_t nack_items =
|
||||
|
||||
@ -41,7 +41,7 @@ bool Pli::Parse(const CommonHeader& packet) {
|
||||
RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType);
|
||||
|
||||
if (packet.payload_size_bytes() < kCommonFeedbackLength) {
|
||||
LOG(LS_WARNING) << "Packet is too small to be a valid PLI packet";
|
||||
RTC_LOG(LS_WARNING) << "Packet is too small to be a valid PLI packet";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -34,9 +34,10 @@ bool RapidResyncRequest::Parse(const CommonHeader& packet) {
|
||||
RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType);
|
||||
|
||||
if (packet.payload_size_bytes() != kCommonFeedbackLength) {
|
||||
LOG(LS_WARNING) << "Packet payload size should be " << kCommonFeedbackLength
|
||||
<< " instead of " << packet.payload_size_bytes()
|
||||
<< " to be a valid Rapid Resynchronisation Request";
|
||||
RTC_LOG(LS_WARNING) << "Packet payload size should be "
|
||||
<< kCommonFeedbackLength << " instead of "
|
||||
<< packet.payload_size_bytes()
|
||||
<< " to be a valid Rapid Resynchronisation Request";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ bool ReceiverReport::Parse(const CommonHeader& packet) {
|
||||
|
||||
if (packet.payload_size_bytes() <
|
||||
kRrBaseLength + report_blocks_count * ReportBlock::kLength) {
|
||||
LOG(LS_WARNING) << "Packet is too small to contain all the data.";
|
||||
RTC_LOG(LS_WARNING) << "Packet is too small to contain all the data.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ bool ReceiverReport::Create(uint8_t* packet,
|
||||
|
||||
bool ReceiverReport::AddReportBlock(const ReportBlock& block) {
|
||||
if (report_blocks_.size() >= kMaxNumberOfReportBlocks) {
|
||||
LOG(LS_WARNING) << "Max report blocks reached.";
|
||||
RTC_LOG(LS_WARNING) << "Max report blocks reached.";
|
||||
return false;
|
||||
}
|
||||
report_blocks_.push_back(block);
|
||||
@ -98,8 +98,8 @@ bool ReceiverReport::AddReportBlock(const ReportBlock& block) {
|
||||
|
||||
bool ReceiverReport::SetReportBlocks(std::vector<ReportBlock> blocks) {
|
||||
if (blocks.size() > kMaxNumberOfReportBlocks) {
|
||||
LOG(LS_WARNING) << "Too many report blocks (" << blocks.size()
|
||||
<< ") for receiver report.";
|
||||
RTC_LOG(LS_WARNING) << "Too many report blocks (" << blocks.size()
|
||||
<< ") for receiver report.";
|
||||
return false;
|
||||
}
|
||||
report_blocks_ = std::move(blocks);
|
||||
|
||||
@ -48,20 +48,20 @@ bool Remb::Parse(const CommonHeader& packet) {
|
||||
RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType);
|
||||
|
||||
if (packet.payload_size_bytes() < 16) {
|
||||
LOG(LS_WARNING) << "Payload length " << packet.payload_size_bytes()
|
||||
<< " is too small for Remb packet.";
|
||||
RTC_LOG(LS_WARNING) << "Payload length " << packet.payload_size_bytes()
|
||||
<< " is too small for Remb packet.";
|
||||
return false;
|
||||
}
|
||||
const uint8_t* const payload = packet.payload();
|
||||
if (kUniqueIdentifier != ByteReader<uint32_t>::ReadBigEndian(&payload[8])) {
|
||||
LOG(LS_WARNING) << "REMB identifier not found, not a REMB packet.";
|
||||
RTC_LOG(LS_WARNING) << "REMB identifier not found, not a REMB packet.";
|
||||
return false;
|
||||
}
|
||||
uint8_t number_of_ssrcs = payload[12];
|
||||
if (packet.payload_size_bytes() !=
|
||||
kCommonFeedbackLength + (2 + number_of_ssrcs) * 4) {
|
||||
LOG(LS_WARNING) << "Payload size " << packet.payload_size_bytes()
|
||||
<< " does not match " << number_of_ssrcs << " ssrcs.";
|
||||
RTC_LOG(LS_WARNING) << "Payload size " << packet.payload_size_bytes()
|
||||
<< " does not match " << number_of_ssrcs << " ssrcs.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -72,8 +72,8 @@ bool Remb::Parse(const CommonHeader& packet) {
|
||||
bitrate_bps_ = (mantissa << exponenta);
|
||||
bool shift_overflow = (bitrate_bps_ >> exponenta) != mantissa;
|
||||
if (shift_overflow) {
|
||||
LOG(LS_ERROR) << "Invalid remb bitrate value : " << mantissa
|
||||
<< "*2^" << static_cast<int>(exponenta);
|
||||
RTC_LOG(LS_ERROR) << "Invalid remb bitrate value : " << mantissa << "*2^"
|
||||
<< static_cast<int>(exponenta);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ bool Remb::Parse(const CommonHeader& packet) {
|
||||
|
||||
bool Remb::SetSsrcs(std::vector<uint32_t> ssrcs) {
|
||||
if (ssrcs.size() > kMaxNumberOfSsrcs) {
|
||||
LOG(LS_WARNING) << "Not enough space for all given SSRCs.";
|
||||
RTC_LOG(LS_WARNING) << "Not enough space for all given SSRCs.";
|
||||
return false;
|
||||
}
|
||||
ssrcs_ = std::move(ssrcs);
|
||||
|
||||
@ -48,7 +48,7 @@ ReportBlock::ReportBlock()
|
||||
bool ReportBlock::Parse(const uint8_t* buffer, size_t length) {
|
||||
RTC_DCHECK(buffer != nullptr);
|
||||
if (length < ReportBlock::kLength) {
|
||||
LOG(LS_ERROR) << "Report Block should be 24 bytes long";
|
||||
RTC_LOG(LS_ERROR) << "Report Block should be 24 bytes long";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -78,7 +78,8 @@ void ReportBlock::Create(uint8_t* buffer) const {
|
||||
|
||||
bool ReportBlock::SetCumulativeLost(uint32_t cumulative_lost) {
|
||||
if (cumulative_lost >= (1u << 24)) { // Have only 3 bytes to store it.
|
||||
LOG(LS_WARNING) << "Cumulative lost is too big to fit into Report Block";
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Cumulative lost is too big to fit into Report Block";
|
||||
return false;
|
||||
}
|
||||
cumulative_lost_ = cumulative_lost;
|
||||
|
||||
@ -73,9 +73,10 @@ bool Sdes::Parse(const CommonHeader& packet) {
|
||||
size_t block_length = kHeaderLength;
|
||||
|
||||
if (packet.payload_size_bytes() % 4 != 0) {
|
||||
LOG(LS_WARNING) << "Invalid payload size " << packet.payload_size_bytes()
|
||||
<< " bytes for a valid Sdes packet. Size should be"
|
||||
" multiple of 4 bytes";
|
||||
RTC_LOG(LS_WARNING) << "Invalid payload size "
|
||||
<< packet.payload_size_bytes()
|
||||
<< " bytes for a valid Sdes packet. Size should be"
|
||||
" multiple of 4 bytes";
|
||||
}
|
||||
const uint8_t* const payload_end =
|
||||
packet.payload() + packet.payload_size_bytes();
|
||||
@ -84,7 +85,7 @@ bool Sdes::Parse(const CommonHeader& packet) {
|
||||
for (size_t i = 0; i < number_of_chunks;) {
|
||||
// Each chunk consumes at least 8 bytes.
|
||||
if (payload_end - looking_at < 8) {
|
||||
LOG(LS_WARNING) << "Not enough space left for chunk #" << (i + 1);
|
||||
RTC_LOG(LS_WARNING) << "Not enough space left for chunk #" << (i + 1);
|
||||
return false;
|
||||
}
|
||||
chunks[i].ssrc = ByteReader<uint32_t>::ReadBigEndian(looking_at);
|
||||
@ -94,22 +95,23 @@ bool Sdes::Parse(const CommonHeader& packet) {
|
||||
uint8_t item_type;
|
||||
while ((item_type = *(looking_at++)) != kTerminatorTag) {
|
||||
if (looking_at >= payload_end) {
|
||||
LOG(LS_WARNING) << "Unexpected end of packet while reading chunk #"
|
||||
<< (i + 1) << ". Expected to find size of the text.";
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Unexpected end of packet while reading chunk #" << (i + 1)
|
||||
<< ". Expected to find size of the text.";
|
||||
return false;
|
||||
}
|
||||
uint8_t item_length = *(looking_at++);
|
||||
const size_t kTerminatorSize = 1;
|
||||
if (looking_at + item_length + kTerminatorSize > payload_end) {
|
||||
LOG(LS_WARNING) << "Unexpected end of packet while reading chunk #"
|
||||
<< (i + 1) << ". Expected to find text of size "
|
||||
<< item_length;
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Unexpected end of packet while reading chunk #" << (i + 1)
|
||||
<< ". Expected to find text of size " << item_length;
|
||||
return false;
|
||||
}
|
||||
if (item_type == kCnameTag) {
|
||||
if (cname_found) {
|
||||
LOG(LS_WARNING) << "Found extra CNAME for same ssrc in chunk #"
|
||||
<< (i + 1);
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Found extra CNAME for same ssrc in chunk #" << (i + 1);
|
||||
return false;
|
||||
}
|
||||
cname_found = true;
|
||||
@ -128,7 +130,7 @@ bool Sdes::Parse(const CommonHeader& packet) {
|
||||
// But same time it allows chunk without items.
|
||||
// So while parsing, ignore all chunks without cname,
|
||||
// but do not fail the parse.
|
||||
LOG(LS_WARNING) << "CNAME not found for ssrc " << chunks[i].ssrc;
|
||||
RTC_LOG(LS_WARNING) << "CNAME not found for ssrc " << chunks[i].ssrc;
|
||||
--number_of_chunks;
|
||||
chunks.resize(number_of_chunks);
|
||||
}
|
||||
@ -144,7 +146,7 @@ bool Sdes::Parse(const CommonHeader& packet) {
|
||||
bool Sdes::AddCName(uint32_t ssrc, std::string cname) {
|
||||
RTC_DCHECK_LE(cname.length(), 0xffu);
|
||||
if (chunks_.size() >= kMaxNumberOfChunks) {
|
||||
LOG(LS_WARNING) << "Max SDES chunks reached.";
|
||||
RTC_LOG(LS_WARNING) << "Max SDES chunks reached.";
|
||||
return false;
|
||||
}
|
||||
Chunk chunk;
|
||||
|
||||
@ -54,7 +54,7 @@ bool SenderReport::Parse(const CommonHeader& packet) {
|
||||
const uint8_t report_block_count = packet.count();
|
||||
if (packet.payload_size_bytes() <
|
||||
kSenderBaseLength + report_block_count * ReportBlock::kLength) {
|
||||
LOG(LS_WARNING) << "Packet is too small to contain all the data.";
|
||||
RTC_LOG(LS_WARNING) << "Packet is too small to contain all the data.";
|
||||
return false;
|
||||
}
|
||||
// Read SenderReport header.
|
||||
@ -118,7 +118,7 @@ bool SenderReport::Create(uint8_t* packet,
|
||||
|
||||
bool SenderReport::AddReportBlock(const ReportBlock& block) {
|
||||
if (report_blocks_.size() >= kMaxNumberOfReportBlocks) {
|
||||
LOG(LS_WARNING) << "Max report blocks reached.";
|
||||
RTC_LOG(LS_WARNING) << "Max report blocks reached.";
|
||||
return false;
|
||||
}
|
||||
report_blocks_.push_back(block);
|
||||
@ -127,8 +127,8 @@ bool SenderReport::AddReportBlock(const ReportBlock& block) {
|
||||
|
||||
bool SenderReport::SetReportBlocks(std::vector<ReportBlock> blocks) {
|
||||
if (blocks.size() > kMaxNumberOfReportBlocks) {
|
||||
LOG(LS_WARNING) << "Too many report blocks (" << blocks.size()
|
||||
<< ") for sender report.";
|
||||
RTC_LOG(LS_WARNING) << "Too many report blocks (" << blocks.size()
|
||||
<< ") for sender report.";
|
||||
return false;
|
||||
}
|
||||
report_blocks_ = std::move(blocks);
|
||||
|
||||
@ -41,8 +41,8 @@ bool TmmbItem::Parse(const uint8_t* buffer) {
|
||||
|
||||
bool shift_overflow = (bitrate_bps_ >> exponent) != mantissa;
|
||||
if (shift_overflow) {
|
||||
LOG(LS_ERROR) << "Invalid tmmb bitrate value : " << mantissa
|
||||
<< "*2^" << static_cast<int>(exponent);
|
||||
RTC_LOG(LS_ERROR) << "Invalid tmmb bitrate value : " << mantissa << "*2^"
|
||||
<< static_cast<int>(exponent);
|
||||
return false;
|
||||
}
|
||||
packet_overhead_ = overhead;
|
||||
|
||||
@ -52,14 +52,14 @@ bool Tmmbn::Parse(const CommonHeader& packet) {
|
||||
RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType);
|
||||
|
||||
if (packet.payload_size_bytes() < kCommonFeedbackLength) {
|
||||
LOG(LS_WARNING) << "Payload length " << packet.payload_size_bytes()
|
||||
<< " is too small for TMMBN.";
|
||||
RTC_LOG(LS_WARNING) << "Payload length " << packet.payload_size_bytes()
|
||||
<< " is too small for TMMBN.";
|
||||
return false;
|
||||
}
|
||||
size_t items_size_bytes = packet.payload_size_bytes() - kCommonFeedbackLength;
|
||||
if (items_size_bytes % TmmbItem::kLength != 0) {
|
||||
LOG(LS_WARNING) << "Payload length " << packet.payload_size_bytes()
|
||||
<< " is not valid for TMMBN.";
|
||||
RTC_LOG(LS_WARNING) << "Payload length " << packet.payload_size_bytes()
|
||||
<< " is not valid for TMMBN.";
|
||||
return false;
|
||||
}
|
||||
ParseCommonFeedback(packet.payload());
|
||||
|
||||
@ -53,14 +53,14 @@ bool Tmmbr::Parse(const CommonHeader& packet) {
|
||||
RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType);
|
||||
|
||||
if (packet.payload_size_bytes() < kCommonFeedbackLength + TmmbItem::kLength) {
|
||||
LOG(LS_WARNING) << "Payload length " << packet.payload_size_bytes()
|
||||
<< " is too small for a TMMBR.";
|
||||
RTC_LOG(LS_WARNING) << "Payload length " << packet.payload_size_bytes()
|
||||
<< " is too small for a TMMBR.";
|
||||
return false;
|
||||
}
|
||||
size_t items_size_bytes = packet.payload_size_bytes() - kCommonFeedbackLength;
|
||||
if (items_size_bytes % TmmbItem::kLength != 0) {
|
||||
LOG(LS_WARNING) << "Payload length " << packet.payload_size_bytes()
|
||||
<< " is not valid for a TMMBR.";
|
||||
RTC_LOG(LS_WARNING) << "Payload length " << packet.payload_size_bytes()
|
||||
<< " is not valid for a TMMBR.";
|
||||
return false;
|
||||
}
|
||||
ParseCommonFeedback(packet.payload());
|
||||
|
||||
@ -343,7 +343,7 @@ bool TransportFeedback::AddReceivedPacket(uint16_t sequence_number,
|
||||
int16_t delta = static_cast<int16_t>(delta_full);
|
||||
// If larger than 16bit signed, we can't represent it - need new fb packet.
|
||||
if (delta != delta_full) {
|
||||
LOG(LS_WARNING) << "Delta value too large ( >= 2^16 ticks )";
|
||||
RTC_LOG(LS_WARNING) << "Delta value too large ( >= 2^16 ticks )";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -387,10 +387,10 @@ bool TransportFeedback::Parse(const CommonHeader& packet) {
|
||||
TRACE_EVENT0("webrtc", "TransportFeedback::Parse");
|
||||
|
||||
if (packet.payload_size_bytes() < kMinPayloadSizeBytes) {
|
||||
LOG(LS_WARNING) << "Buffer too small (" << packet.payload_size_bytes()
|
||||
<< " bytes) to fit a "
|
||||
"FeedbackPacket. Minimum size = "
|
||||
<< kMinPayloadSizeBytes;
|
||||
RTC_LOG(LS_WARNING) << "Buffer too small (" << packet.payload_size_bytes()
|
||||
<< " bytes) to fit a "
|
||||
"FeedbackPacket. Minimum size = "
|
||||
<< kMinPayloadSizeBytes;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -406,7 +406,7 @@ bool TransportFeedback::Parse(const CommonHeader& packet) {
|
||||
const size_t end_index = packet.payload_size_bytes();
|
||||
|
||||
if (status_count == 0) {
|
||||
LOG(LS_WARNING) << "Empty feedback messages not allowed.";
|
||||
RTC_LOG(LS_WARNING) << "Empty feedback messages not allowed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -414,7 +414,7 @@ bool TransportFeedback::Parse(const CommonHeader& packet) {
|
||||
delta_sizes.reserve(status_count);
|
||||
while (delta_sizes.size() < status_count) {
|
||||
if (index + kChunkSizeBytes > end_index) {
|
||||
LOG(LS_WARNING) << "Buffer overflow while parsing packet.";
|
||||
RTC_LOG(LS_WARNING) << "Buffer overflow while parsing packet.";
|
||||
Clear();
|
||||
return false;
|
||||
}
|
||||
@ -433,7 +433,7 @@ bool TransportFeedback::Parse(const CommonHeader& packet) {
|
||||
uint16_t seq_no = base_seq_no_;
|
||||
for (size_t delta_size : delta_sizes) {
|
||||
if (index + delta_size > end_index) {
|
||||
LOG(LS_WARNING) << "Buffer overflow while parsing packet.";
|
||||
RTC_LOG(LS_WARNING) << "Buffer overflow while parsing packet.";
|
||||
Clear();
|
||||
return false;
|
||||
}
|
||||
@ -456,7 +456,7 @@ bool TransportFeedback::Parse(const CommonHeader& packet) {
|
||||
}
|
||||
case 3:
|
||||
Clear();
|
||||
LOG(LS_WARNING) << "Invalid delta_size for seq_no " << seq_no;
|
||||
RTC_LOG(LS_WARNING) << "Invalid delta_size for seq_no " << seq_no;
|
||||
return false;
|
||||
default:
|
||||
RTC_NOTREACHED();
|
||||
@ -497,8 +497,8 @@ bool TransportFeedback::IsConsistent() const {
|
||||
packet_size += kChunkSizeBytes;
|
||||
}
|
||||
if (num_seq_no_ != delta_sizes.size()) {
|
||||
LOG(LS_ERROR) << delta_sizes.size() << " packets encoded. Expected "
|
||||
<< num_seq_no_;
|
||||
RTC_LOG(LS_ERROR) << delta_sizes.size() << " packets encoded. Expected "
|
||||
<< num_seq_no_;
|
||||
return false;
|
||||
}
|
||||
int64_t timestamp_us = base_time_ticks_ * kBaseScaleFactor;
|
||||
@ -507,18 +507,20 @@ bool TransportFeedback::IsConsistent() const {
|
||||
for (DeltaSize delta_size : delta_sizes) {
|
||||
if (delta_size > 0) {
|
||||
if (packet_it == packets_.end()) {
|
||||
LOG(LS_ERROR) << "Failed to find delta for seq_no " << seq_no;
|
||||
RTC_LOG(LS_ERROR) << "Failed to find delta for seq_no " << seq_no;
|
||||
return false;
|
||||
}
|
||||
if (packet_it->sequence_number() != seq_no) {
|
||||
LOG(LS_ERROR) << "Expected to find delta for seq_no " << seq_no
|
||||
<< ". Next delta is for " << packet_it->sequence_number();
|
||||
RTC_LOG(LS_ERROR) << "Expected to find delta for seq_no " << seq_no
|
||||
<< ". Next delta is for "
|
||||
<< packet_it->sequence_number();
|
||||
return false;
|
||||
}
|
||||
if (delta_size == 1 &&
|
||||
(packet_it->delta_ticks() < 0 || packet_it->delta_ticks() > 0xff)) {
|
||||
LOG(LS_ERROR) << "Delta " << packet_it->delta_ticks() << " for seq_no "
|
||||
<< seq_no << " doesn't fit into one byte";
|
||||
RTC_LOG(LS_ERROR) << "Delta " << packet_it->delta_ticks()
|
||||
<< " for seq_no " << seq_no
|
||||
<< " doesn't fit into one byte";
|
||||
return false;
|
||||
}
|
||||
timestamp_us += packet_it->delta_us();
|
||||
@ -528,18 +530,18 @@ bool TransportFeedback::IsConsistent() const {
|
||||
++seq_no;
|
||||
}
|
||||
if (packet_it != packets_.end()) {
|
||||
LOG(LS_ERROR) << "Unencoded delta for seq_no "
|
||||
<< packet_it->sequence_number();
|
||||
RTC_LOG(LS_ERROR) << "Unencoded delta for seq_no "
|
||||
<< packet_it->sequence_number();
|
||||
return false;
|
||||
}
|
||||
if (timestamp_us != last_timestamp_us_) {
|
||||
LOG(LS_ERROR) << "Last timestamp mismatch. Calculated: " << timestamp_us
|
||||
<< ". Saved: " << last_timestamp_us_;
|
||||
RTC_LOG(LS_ERROR) << "Last timestamp mismatch. Calculated: " << timestamp_us
|
||||
<< ". Saved: " << last_timestamp_us_;
|
||||
return false;
|
||||
}
|
||||
if (size_bytes_ != packet_size) {
|
||||
LOG(LS_ERROR) << "Rtcp packet size mismatch. Calculated: " << packet_size
|
||||
<< ". Saved: " << size_bytes_;
|
||||
RTC_LOG(LS_ERROR) << "Rtcp packet size mismatch. Calculated: "
|
||||
<< packet_size << ". Saved: " << size_bytes_;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user