mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Fix lint issues in logging/
Bug: None Change-Id: I998b3da0294bbf71f852c5947577622619c832d8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361262 Reviewed-by: Per Kjellander <perkj@webrtc.org> Commit-Queue: Björn Terelius <terelius@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42941}
This commit is contained in:
parent
dac0805955
commit
4a7ea89ac9
6 changed files with 46 additions and 44 deletions
|
@ -185,7 +185,7 @@ void EventEncoder::EncodeField(const FieldParameters& params,
|
|||
RTC_DCHECK_EQ(values.size(), batch_size_);
|
||||
}
|
||||
|
||||
if (values.size() == 0) {
|
||||
if (values.empty()) {
|
||||
// If all values for a particular field is empty/nullopt,
|
||||
// then we completely skip the field even if the the batch is non-empty.
|
||||
return;
|
||||
|
@ -240,7 +240,7 @@ void EventEncoder::EncodeField(const FieldParameters& params,
|
|||
const std::vector<absl::string_view>& values) {
|
||||
RTC_DCHECK_EQ(values.size(), batch_size_);
|
||||
|
||||
if (values.size() == 0) {
|
||||
if (values.empty()) {
|
||||
// If all values for a particular field is empty/nullopt,
|
||||
// then we completely skip the field even if the the batch is non-empty.
|
||||
return;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "logging/rtc_event_log/events/rtc_event_field_encoding.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
@ -592,21 +593,21 @@ TEST_F(RtcEventFieldTest, Increasing) {
|
|||
ParseEventHeader(s);
|
||||
ParseAndVerifyTimestamps();
|
||||
ParseAndVerifyField(RtcTestEvent::bool_params, bool_values,
|
||||
/*delta bits*/ 1);
|
||||
/*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyField(RtcTestEvent::signed32_params, signed32_values,
|
||||
/*delta bits*/ 1);
|
||||
/*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyField(RtcTestEvent::unsigned32_params, unsigned32_values,
|
||||
/*delta bits*/ 1);
|
||||
/*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyField(RtcTestEvent::signed64_params, signed64_values,
|
||||
/*delta bits*/ 1);
|
||||
/*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyField(RtcTestEvent::unsigned64_params, unsigned64_values,
|
||||
/*delta bits*/ 1);
|
||||
/*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyOptionalField(RtcTestEvent::optional32_params,
|
||||
optional32_values, /*delta bits*/ 1);
|
||||
optional32_values, /*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyOptionalField(RtcTestEvent::optional64_params,
|
||||
optional64_values, /*delta bits*/ 1);
|
||||
optional64_values, /*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyField(RtcTestEvent::wrapping21_params, wrapping21_values,
|
||||
/*delta bits*/ 1);
|
||||
/*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyStringField(RtcTestEvent::string_params, string_values);
|
||||
EXPECT_EQ(parser_.RemainingBytes(), 0u);
|
||||
}
|
||||
|
@ -663,21 +664,21 @@ TEST_F(RtcEventFieldTest, Decreasing) {
|
|||
ParseEventHeader(s);
|
||||
ParseAndVerifyTimestamps();
|
||||
ParseAndVerifyField(RtcTestEvent::bool_params, bool_values,
|
||||
/*delta bits*/ 1);
|
||||
/*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyField(RtcTestEvent::signed32_params, signed32_values,
|
||||
/*delta bits*/ 1);
|
||||
/*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyField(RtcTestEvent::unsigned32_params, unsigned32_values,
|
||||
/*delta bits*/ 1);
|
||||
/*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyField(RtcTestEvent::signed64_params, signed64_values,
|
||||
/*delta bits*/ 1);
|
||||
/*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyField(RtcTestEvent::unsigned64_params, unsigned64_values,
|
||||
/*delta bits*/ 1);
|
||||
/*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyOptionalField(RtcTestEvent::optional32_params,
|
||||
optional32_values, /*delta bits*/ 1);
|
||||
optional32_values, /*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyOptionalField(RtcTestEvent::optional64_params,
|
||||
optional64_values, /*delta bits*/ 1);
|
||||
optional64_values, /*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyField(RtcTestEvent::wrapping21_params, wrapping21_values,
|
||||
/*delta bits*/ 1);
|
||||
/*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyStringField(RtcTestEvent::string_params, string_values);
|
||||
EXPECT_EQ(parser_.RemainingBytes(), 0u);
|
||||
}
|
||||
|
@ -740,23 +741,23 @@ TEST_F(RtcEventFieldTest, SkipsDeprecatedFields) {
|
|||
ParseEventHeader(s);
|
||||
ParseAndVerifyTimestamps();
|
||||
ParseAndVerifyField(RtcTestEvent::bool_params, bool_values,
|
||||
/*delta_bits=*/1);
|
||||
/*expected_bits_per_delta=*/1);
|
||||
// Skips parsing the `signed32_values`. The following unsigned fields should
|
||||
// still be found.
|
||||
ParseAndVerifyField(RtcTestEvent::unsigned32_params, unsigned32_values,
|
||||
/*delta_bits=*/31,
|
||||
/*expected_bits_per_delta=*/31,
|
||||
/*expected_skipped_bytes=*/signed32_encoding_size);
|
||||
// Skips parsing the `signed64_values`. The following unsigned fields should
|
||||
// still be found.
|
||||
ParseAndVerifyField(RtcTestEvent::unsigned64_params, unsigned64_values,
|
||||
/*delta_bits=*/63, signed64_encoding_size);
|
||||
/*expected_bits_per_delta=*/63, signed64_encoding_size);
|
||||
// Skips parsing the `optional32_values`. The following unsigned fields should
|
||||
// still be found.
|
||||
ParseAndVerifyOptionalField(RtcTestEvent::optional64_params,
|
||||
optional64_values,
|
||||
/*delta_bits=*/63, optional32_encoding_size);
|
||||
ParseAndVerifyOptionalField(
|
||||
RtcTestEvent::optional64_params, optional64_values,
|
||||
/*expected_bits_per_delta=*/63, optional32_encoding_size);
|
||||
ParseAndVerifyField(RtcTestEvent::wrapping21_params, wrapping21_values,
|
||||
/*delta_bits=*/20);
|
||||
/*expected_bits_per_delta=*/20);
|
||||
ParseAndVerifyStringField(RtcTestEvent::string_params, string_values);
|
||||
EXPECT_EQ(parser_.RemainingBytes(), 0u);
|
||||
}
|
||||
|
@ -806,16 +807,17 @@ TEST_F(RtcEventFieldTest, SkipsMissingFields) {
|
|||
ParseAndVerifyTimestamps();
|
||||
ParseAndVerifyMissingField(RtcTestEvent::bool_params);
|
||||
ParseAndVerifyField(RtcTestEvent::signed32_params, signed32_values,
|
||||
/*delta_bits=*/31);
|
||||
/*expected_bits_per_delta=*/31);
|
||||
ParseAndVerifyMissingField(RtcTestEvent::unsigned32_params);
|
||||
ParseAndVerifyField(RtcTestEvent::signed64_params, signed64_values,
|
||||
/*delta_bits=*/63);
|
||||
/*expected_bits_per_delta=*/63);
|
||||
ParseAndVerifyMissingField(RtcTestEvent::unsigned64_params);
|
||||
ParseAndVerifyOptionalField(RtcTestEvent::optional32_params,
|
||||
optional32_values, /*delta_bits=*/31);
|
||||
optional32_values,
|
||||
/*expected_bits_per_delta=*/31);
|
||||
ParseAndVerifyMissingOptionalField(RtcTestEvent::optional64_params);
|
||||
ParseAndVerifyField(RtcTestEvent::wrapping21_params, wrapping21_values,
|
||||
/*delta_bits=*/20);
|
||||
/*expected_bits_per_delta=*/20);
|
||||
ParseAndVerifyStringField(RtcTestEvent::string_params, string_values);
|
||||
EXPECT_EQ(parser_.RemainingBytes(), 0u);
|
||||
}
|
||||
|
@ -851,11 +853,11 @@ TEST_F(RtcEventFieldTest, OptionalFields) {
|
|||
ParseEventHeader(s);
|
||||
ParseAndVerifyTimestamps();
|
||||
ParseAndVerifyOptionalField(RtcTestEvent::optional32_params,
|
||||
optional32_values, /*delta bits*/ 2);
|
||||
optional32_values, /*expected_bits_per_delta=*/2);
|
||||
ParseAndVerifyOptionalField(RtcTestEvent::optional64_params,
|
||||
optional64_values, /*delta bits*/ 1);
|
||||
optional64_values, /*expected_bits_per_delta=*/1);
|
||||
ParseAndVerifyField(RtcTestEvent::wrapping21_params, wrapping21_values,
|
||||
/*delta bits*/ 2);
|
||||
/*expected_bits_per_delta=*/2);
|
||||
EXPECT_EQ(parser_.RemainingBytes(), 0u);
|
||||
}
|
||||
|
||||
|
@ -887,7 +889,7 @@ TEST_F(RtcEventFieldTest, AllNulloptTreatedAsMissing) {
|
|||
ParseAndVerifyTimestamps();
|
||||
ParseAndVerifyMissingOptionalField(RtcTestEvent::optional32_params);
|
||||
ParseAndVerifyOptionalField(RtcTestEvent::optional64_params,
|
||||
optional64_values, /*delta_bits=*/1);
|
||||
optional64_values, /*expected_bits_per_delta=*/1);
|
||||
EXPECT_EQ(parser_.RemainingBytes(), 0u);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ using ::testing::Mock;
|
|||
using ::testing::Property;
|
||||
using ::testing::Ref;
|
||||
using ::testing::Return;
|
||||
using ::testing::StrEq;
|
||||
|
||||
class MockEventEncoder : public RtcEventLogEncoder {
|
||||
public:
|
||||
|
|
|
@ -1783,8 +1783,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreParsedLegacyEvent(
|
|||
case rtclog::Event::AUDIO_NETWORK_ADAPTATION_EVENT: {
|
||||
auto status_or_value = GetAudioNetworkAdaptation(event);
|
||||
RTC_RETURN_IF_ERROR(status_or_value.status());
|
||||
LoggedAudioNetworkAdaptationEvent ana_event = status_or_value.value();
|
||||
audio_network_adaptation_events_.push_back(ana_event);
|
||||
audio_network_adaptation_events_.push_back(status_or_value.value());
|
||||
break;
|
||||
}
|
||||
case rtclog::Event::BWE_PROBE_CLUSTER_CREATED_EVENT: {
|
||||
|
@ -2393,10 +2392,11 @@ std::vector<LoggedPacketInfo> ParsedRtcEventLog::GetPacketInfos(
|
|||
int64_t unwrapped_seq_num =
|
||||
seq_num_unwrapper.Unwrap(logged.transport_seq_no);
|
||||
if (indices.find(unwrapped_seq_num) != indices.end()) {
|
||||
auto prev = packets[indices[unwrapped_seq_num]];
|
||||
Timestamp prev_log_packet_time =
|
||||
packets[indices[unwrapped_seq_num]].log_packet_time;
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Repeated sent packet sequence number: " << unwrapped_seq_num
|
||||
<< " Packet time:" << prev.log_packet_time.seconds() << "s vs "
|
||||
<< " Packet time:" << prev_log_packet_time.seconds() << "s vs "
|
||||
<< logged.log_packet_time.seconds()
|
||||
<< "s at:" << rtp.log_time_ms() / 1000;
|
||||
}
|
||||
|
@ -2538,7 +2538,7 @@ std::vector<LoggedIceEvent> ParsedRtcEventLog::GetIceEvents() const {
|
|||
return log_events;
|
||||
}
|
||||
|
||||
const std::vector<MatchedSendArrivalTimes> GetNetworkTrace(
|
||||
std::vector<MatchedSendArrivalTimes> GetNetworkTrace(
|
||||
const ParsedRtcEventLog& parsed_log) {
|
||||
std::vector<MatchedSendArrivalTimes> rtp_rtcp_matched;
|
||||
for (auto& packet :
|
||||
|
|
|
@ -390,7 +390,7 @@ class ParsedRtcEventLog {
|
|||
void Clear();
|
||||
|
||||
// Reads an RtcEventLog file and returns success if parsing was successful.
|
||||
ParseStatus ParseFile(absl::string_view file_name);
|
||||
ParseStatus ParseFile(absl::string_view filename);
|
||||
|
||||
// Reads an RtcEventLog from a string and returns success if successful.
|
||||
ParseStatus ParseString(absl::string_view s);
|
||||
|
@ -783,7 +783,7 @@ class ParsedRtcEventLog {
|
|||
ParseStatus StoreOutgoingRtcpPackets(
|
||||
const rtclog2::OutgoingRtcpPackets& proto);
|
||||
ParseStatus StoreOutgoingRtpPackets(const rtclog2::OutgoingRtpPackets& proto);
|
||||
ParseStatus StoreParsedNewFormatEvent(const rtclog2::EventStream& event);
|
||||
ParseStatus StoreParsedNewFormatEvent(const rtclog2::EventStream& stream);
|
||||
ParseStatus StoreRouteChangeEvent(const rtclog2::RouteChange& proto);
|
||||
ParseStatus StoreRemoteEstimateEvent(const rtclog2::RemoteEstimates& proto);
|
||||
ParseStatus StoreStartEvent(const rtclog2::BeginLogEvent& proto);
|
||||
|
@ -942,7 +942,8 @@ struct MatchedSendArrivalTimes {
|
|||
int64_t arrival_time_ms; // kNotReceived for lost packets.
|
||||
int64_t payload_size;
|
||||
};
|
||||
const std::vector<MatchedSendArrivalTimes> GetNetworkTrace(
|
||||
|
||||
std::vector<MatchedSendArrivalTimes> GetNetworkTrace(
|
||||
const ParsedRtcEventLog& parsed_log);
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -158,10 +158,10 @@ class RtcEventLogSession
|
|||
temp_filename_ = test::OutputPath() + test_name;
|
||||
}
|
||||
|
||||
// Create and buffer the config events and `num_events_before_log_start`
|
||||
// Create and buffer the config events and `num_events_before_start`
|
||||
// randomized non-config events. Then call StartLogging and finally create and
|
||||
// write the remaining non-config events.
|
||||
void WriteLog(EventCounts count, size_t num_events_before_log_start);
|
||||
void WriteLog(EventCounts count, size_t num_events_before_start);
|
||||
void ReadAndVerifyLog();
|
||||
|
||||
bool IsNewFormat() {
|
||||
|
|
Loading…
Reference in a new issue