diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /third_party/libwebrtc/logging/rtc_event_log | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-adbda400be353e676059e335c3c0aaf99e719475.tar.xz firefox-adbda400be353e676059e335c3c0aaf99e719475.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/logging/rtc_event_log')
7 files changed, 37 insertions, 42 deletions
diff --git a/third_party/libwebrtc/logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.cc b/third_party/libwebrtc/logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.cc index 5619827246..2c1444af07 100644 --- a/third_party/libwebrtc/logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.cc +++ b/third_party/libwebrtc/logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.cc @@ -53,17 +53,14 @@ #include "modules/rtp_rtcp/source/rtcp_packet/sender_report.h" #include "modules/rtp_rtcp/source/rtp_packet.h" #include "rtc_base/checks.h" -#include "rtc_base/ignore_wundef.h" #include "rtc_base/logging.h" // *.pb.h files are generated at build-time by the protobuf compiler. -RTC_PUSH_IGNORING_WUNDEF() #ifdef WEBRTC_ANDROID_PLATFORM_BUILD #include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log.pb.h" #else #include "logging/rtc_event_log/rtc_event_log.pb.h" #endif -RTC_POP_IGNORING_WUNDEF() namespace webrtc { diff --git a/third_party/libwebrtc/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc b/third_party/libwebrtc/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc index 2c9e42e064..01bd89718d 100644 --- a/third_party/libwebrtc/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc +++ b/third_party/libwebrtc/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc @@ -61,18 +61,15 @@ #include "modules/rtp_rtcp/source/rtp_header_extensions.h" #include "modules/rtp_rtcp/source/rtp_packet.h" #include "rtc_base/checks.h" -#include "rtc_base/ignore_wundef.h" #include "rtc_base/logging.h" #include "system_wrappers/include/field_trial.h" // *.pb.h files are generated at build-time by the protobuf compiler. -RTC_PUSH_IGNORING_WUNDEF() #ifdef WEBRTC_ANDROID_PLATFORM_BUILD #include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log2.pb.h" #else #include "logging/rtc_event_log/rtc_event_log2.pb.h" #endif -RTC_POP_IGNORING_WUNDEF() using webrtc_event_logging::ToUnsigned; diff --git a/third_party/libwebrtc/logging/rtc_event_log/fake_rtc_event_log_factory.cc b/third_party/libwebrtc/logging/rtc_event_log/fake_rtc_event_log_factory.cc index 47db40c9f4..bacc3cd1cb 100644 --- a/third_party/libwebrtc/logging/rtc_event_log/fake_rtc_event_log_factory.cc +++ b/third_party/libwebrtc/logging/rtc_event_log/fake_rtc_event_log_factory.cc @@ -17,17 +17,11 @@ namespace webrtc { -std::unique_ptr<RtcEventLog> FakeRtcEventLogFactory::Create( - RtcEventLog::EncodingType /*encoding_type*/) const { +absl::Nonnull<std::unique_ptr<RtcEventLog>> FakeRtcEventLogFactory::Create( + const Environment& /*env*/) const { auto fake_event_log = std::make_unique<FakeRtcEventLog>(); - const_cast<FakeRtcEventLogFactory*>(this)->last_log_created_ = - fake_event_log.get(); + const_cast<FakeRtcEventLog*&>(last_log_created_) = fake_event_log.get(); return fake_event_log; } -std::unique_ptr<RtcEventLog> FakeRtcEventLogFactory::CreateRtcEventLog( - RtcEventLog::EncodingType encoding_type) { - return Create(encoding_type); -} - } // namespace webrtc diff --git a/third_party/libwebrtc/logging/rtc_event_log/fake_rtc_event_log_factory.h b/third_party/libwebrtc/logging/rtc_event_log/fake_rtc_event_log_factory.h index c7ff33dee4..0d6d076038 100644 --- a/third_party/libwebrtc/logging/rtc_event_log/fake_rtc_event_log_factory.h +++ b/third_party/libwebrtc/logging/rtc_event_log/fake_rtc_event_log_factory.h @@ -13,6 +13,8 @@ #include <memory> +#include "absl/base/nullability.h" +#include "api/environment/environment.h" #include "api/rtc_event_log/rtc_event_log_factory_interface.h" #include "logging/rtc_event_log/fake_rtc_event_log.h" @@ -23,16 +25,13 @@ class FakeRtcEventLogFactory : public RtcEventLogFactoryInterface { FakeRtcEventLogFactory() = default; ~FakeRtcEventLogFactory() override = default; - std::unique_ptr<RtcEventLog> Create( - RtcEventLog::EncodingType encoding_type) const override; + absl::Nonnull<std::unique_ptr<RtcEventLog>> Create( + const Environment& env) const override; - std::unique_ptr<RtcEventLog> CreateRtcEventLog( - RtcEventLog::EncodingType encoding_type) override; - - webrtc::FakeRtcEventLog* last_log_created() { return last_log_created_; } + FakeRtcEventLog* last_log_created() { return last_log_created_; } private: - webrtc::FakeRtcEventLog* last_log_created_; + FakeRtcEventLog* last_log_created_ = nullptr; }; } // namespace webrtc diff --git a/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log2_proto_include.h b/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log2_proto_include.h index 3e43103897..43b914fd0c 100644 --- a/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log2_proto_include.h +++ b/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log2_proto_include.h @@ -11,15 +11,11 @@ #ifndef LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG2_PROTO_INCLUDE_H_ #define LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG2_PROTO_INCLUDE_H_ -#include "rtc_base/ignore_wundef.h" - // *.pb.h files are generated at build-time by the protobuf compiler. -RTC_PUSH_IGNORING_WUNDEF() #ifdef WEBRTC_ANDROID_PLATFORM_BUILD #include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log2.pb.h" #else #include "logging/rtc_event_log/rtc_event_log2.pb.h" #endif -RTC_POP_IGNORING_WUNDEF() #endif // LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG2_PROTO_INCLUDE_H_ diff --git a/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_parser.h b/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_parser.h index 9ad96274d3..def9f0ab35 100644 --- a/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_parser.h +++ b/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_parser.h @@ -54,10 +54,8 @@ #include "logging/rtc_event_log/events/rtc_event_video_send_stream_config.h" #include "modules/rtp_rtcp/include/rtp_header_extension_map.h" #include "modules/rtp_rtcp/source/rtcp_packet/common_header.h" -#include "rtc_base/ignore_wundef.h" // Files generated at build-time by the protobuf compiler. -RTC_PUSH_IGNORING_WUNDEF() #ifdef WEBRTC_ANDROID_PLATFORM_BUILD #include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log.pb.h" #include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log2.pb.h" @@ -65,7 +63,6 @@ RTC_PUSH_IGNORING_WUNDEF() #include "logging/rtc_event_log/rtc_event_log.pb.h" #include "logging/rtc_event_log/rtc_event_log2.pb.h" #endif -RTC_POP_IGNORING_WUNDEF() namespace webrtc { diff --git a/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_unittest.cc b/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_unittest.cc index 3730a080dd..a3005729ab 100644 --- a/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_unittest.cc +++ b/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_unittest.cc @@ -19,8 +19,9 @@ #include <utility> #include <vector> +#include "api/environment/environment.h" +#include "api/environment/environment_factory.h" #include "api/rtc_event_log/rtc_event_log_factory.h" -#include "api/task_queue/default_task_queue_factory.h" #include "logging/rtc_event_log/events/rtc_event_audio_network_adaptation.h" #include "logging/rtc_event_log/events/rtc_event_audio_playout.h" #include "logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.h" @@ -50,6 +51,7 @@ #include "rtc_base/checks.h" #include "rtc_base/fake_clock.h" #include "rtc_base/random.h" +#include "test/explicit_key_value_config.h" #include "test/gtest.h" #include "test/logging/memory_log_writer.h" #include "test/testsupport/file_utils.h" @@ -58,6 +60,8 @@ namespace webrtc { namespace { +using test::ExplicitKeyValueConfig; + struct EventCounts { size_t audio_send_streams = 0; size_t audio_recv_streams = 0; @@ -105,6 +109,21 @@ struct EventCounts { } }; +std::unique_ptr<FieldTrialsView> CreateFieldTrialsFor( + RtcEventLog::EncodingType encoding_type) { + switch (encoding_type) { + case RtcEventLog::EncodingType::Legacy: + return std::make_unique<ExplicitKeyValueConfig>( + "WebRTC-RtcEventLogNewFormat/Disabled/"); + case RtcEventLog::EncodingType::NewFormat: + return std::make_unique<ExplicitKeyValueConfig>( + "WebRTC-RtcEventLogNewFormat/Enabled/"); + case RtcEventLog::EncodingType::ProtoFree: + RTC_CHECK(false); + return nullptr; + } +} + class RtcEventLogSession : public ::testing::TestWithParam< std::tuple<uint64_t, int64_t, RtcEventLog::EncodingType>> { @@ -336,14 +355,13 @@ void RtcEventLogSession::WriteVideoSendConfigs(size_t video_send_streams, void RtcEventLogSession::WriteLog(EventCounts count, size_t num_events_before_start) { - // TODO(terelius): Allow test to run with either a real or a fake clock_. - // Maybe always use the ScopedFakeClock, but conditionally SleepMs()? + // TODO(terelius): Allow test to run with either a real or a fake clock_ + // e.g. by using clock and task_queue_factory from TimeController + // when RtcEventLogImpl switches to use injected clock from the environment. - auto task_queue_factory = CreateDefaultTaskQueueFactory(); - RtcEventLogFactory rtc_event_log_factory(task_queue_factory.get()); // The log will be flushed to output when the event_log goes out of scope. - std::unique_ptr<RtcEventLog> event_log = - rtc_event_log_factory.CreateRtcEventLog(encoding_type_); + std::unique_ptr<RtcEventLog> event_log = RtcEventLogFactory().Create( + CreateEnvironment(CreateFieldTrialsFor(encoding_type_))); // We can't send or receive packets without configured streams. RTC_CHECK_GE(count.video_recv_streams, 1); @@ -934,12 +952,9 @@ TEST_P(RtcEventLogCircularBufferTest, KeepsMostRecentEvents) { int64_t start_time_us, utc_start_time_us, stop_time_us; { - auto task_queue_factory = CreateDefaultTaskQueueFactory(); - RtcEventLogFactory rtc_event_log_factory(task_queue_factory.get()); - // When `log` goes out of scope, the contents are flushed - // to the output. - std::unique_ptr<RtcEventLog> log = - rtc_event_log_factory.CreateRtcEventLog(encoding_type_); + // When `log` goes out of scope, the contents are flushed to the output. + std::unique_ptr<RtcEventLog> log = RtcEventLogFactory().Create( + CreateEnvironment(CreateFieldTrialsFor(encoding_type_))); for (size_t i = 0; i < kNumEvents; i++) { // The purpose of the test is to verify that the log can handle |