diff options
Diffstat (limited to 'third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.cc')
-rw-r--r-- | third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.cc | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.cc b/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.cc index a3cb68cf54..30fc6f126f 100644 --- a/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.cc +++ b/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.cc @@ -11,10 +11,11 @@ #include "api/rtc_event_log/rtc_event_log_factory.h" #include <memory> -#include <utility> -#include "rtc_base/checks.h" -#include "system_wrappers/include/field_trial.h" +#include "absl/base/nullability.h" +#include "api/environment/environment.h" +#include "api/field_trials_view.h" +#include "api/rtc_event_log/rtc_event_log.h" #ifdef WEBRTC_ENABLE_RTC_EVENT_LOG #include "logging/rtc_event_log/rtc_event_log_impl.h" @@ -22,27 +23,21 @@ namespace webrtc { -RtcEventLogFactory::RtcEventLogFactory(TaskQueueFactory* task_queue_factory) - : task_queue_factory_(task_queue_factory) { - RTC_DCHECK(task_queue_factory_); -} - -std::unique_ptr<RtcEventLog> RtcEventLogFactory::Create( - RtcEventLog::EncodingType encoding_type) const { -#ifdef WEBRTC_ENABLE_RTC_EVENT_LOG - if (field_trial::IsEnabled("WebRTC-RtcEventLogKillSwitch")) { +absl::Nonnull<std::unique_ptr<RtcEventLog>> RtcEventLogFactory::Create( + const Environment& env) const { +#ifndef WEBRTC_ENABLE_RTC_EVENT_LOG + return std::make_unique<RtcEventLogNull>(); +#else + if (env.field_trials().IsEnabled("WebRTC-RtcEventLogKillSwitch")) { return std::make_unique<RtcEventLogNull>(); } + RtcEventLog::EncodingType encoding_type = + env.field_trials().IsDisabled("WebRTC-RtcEventLogNewFormat") + ? RtcEventLog::EncodingType::Legacy + : RtcEventLog::EncodingType::NewFormat; return std::make_unique<RtcEventLogImpl>( - RtcEventLogImpl::CreateEncoder(encoding_type), task_queue_factory_); -#else - return std::make_unique<RtcEventLogNull>(); + RtcEventLogImpl::CreateEncoder(encoding_type), &env.task_queue_factory()); #endif } -std::unique_ptr<RtcEventLog> RtcEventLogFactory::CreateRtcEventLog( - RtcEventLog::EncodingType encoding_type) { - return Create(encoding_type); -} - } // namespace webrtc |