diff --git a/logging/rtc_event_log/events/rtc_event_field_encoding.cc b/logging/rtc_event_log/events/rtc_event_field_encoding.cc index 08f7e8470a..6294eeebf5 100644 --- a/logging/rtc_event_log/events/rtc_event_field_encoding.cc +++ b/logging/rtc_event_log/events/rtc_event_field_encoding.cc @@ -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& 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; diff --git a/logging/rtc_event_log/events/rtc_event_field_encoding_unittest.cc b/logging/rtc_event_log/events/rtc_event_field_encoding_unittest.cc index 5fd6928e00..ba2e769d0c 100644 --- a/logging/rtc_event_log/events/rtc_event_field_encoding_unittest.cc +++ b/logging/rtc_event_log/events/rtc_event_field_encoding_unittest.cc @@ -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 @@ -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); } diff --git a/logging/rtc_event_log/rtc_event_log_impl_unittest.cc b/logging/rtc_event_log/rtc_event_log_impl_unittest.cc index 6ab2d2f6dc..f2bde7534e 100644 --- a/logging/rtc_event_log/rtc_event_log_impl_unittest.cc +++ b/logging/rtc_event_log/rtc_event_log_impl_unittest.cc @@ -38,7 +38,6 @@ using ::testing::Mock; using ::testing::Property; using ::testing::Ref; using ::testing::Return; -using ::testing::StrEq; class MockEventEncoder : public RtcEventLogEncoder { public: diff --git a/logging/rtc_event_log/rtc_event_log_parser.cc b/logging/rtc_event_log/rtc_event_log_parser.cc index 7197c97594..601a1bace2 100644 --- a/logging/rtc_event_log/rtc_event_log_parser.cc +++ b/logging/rtc_event_log/rtc_event_log_parser.cc @@ -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 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 ParsedRtcEventLog::GetIceEvents() const { return log_events; } -const std::vector GetNetworkTrace( +std::vector GetNetworkTrace( const ParsedRtcEventLog& parsed_log) { std::vector rtp_rtcp_matched; for (auto& packet : diff --git a/logging/rtc_event_log/rtc_event_log_parser.h b/logging/rtc_event_log/rtc_event_log_parser.h index f974f04d47..1dd65e7953 100644 --- a/logging/rtc_event_log/rtc_event_log_parser.h +++ b/logging/rtc_event_log/rtc_event_log_parser.h @@ -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 GetNetworkTrace( + +std::vector GetNetworkTrace( const ParsedRtcEventLog& parsed_log); } // namespace webrtc diff --git a/logging/rtc_event_log/rtc_event_log_unittest.cc b/logging/rtc_event_log/rtc_event_log_unittest.cc index df30e6323a..eafe857e30 100644 --- a/logging/rtc_event_log/rtc_event_log_unittest.cc +++ b/logging/rtc_event_log/rtc_event_log_unittest.cc @@ -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() {