1 /* 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #include "api/rtc_event_log/rtc_event_log_factory.h" 12 13 #include <memory> 14 #include <utility> 15 16 #include "rtc_base/checks.h" 17 #include "system_wrappers/include/field_trial.h" 18 19 #ifdef WEBRTC_ENABLE_RTC_EVENT_LOG 20 #include "logging/rtc_event_log/rtc_event_log_impl.h" 21 #endif 22 23 namespace webrtc { 24 RtcEventLogFactory(TaskQueueFactory * task_queue_factory)25RtcEventLogFactory::RtcEventLogFactory(TaskQueueFactory* task_queue_factory) 26 : task_queue_factory_(task_queue_factory) { 27 RTC_DCHECK(task_queue_factory_); 28 } 29 Create(RtcEventLog::EncodingType encoding_type) const30std::unique_ptr<RtcEventLog> RtcEventLogFactory::Create( 31 RtcEventLog::EncodingType encoding_type) const { 32 #ifdef WEBRTC_ENABLE_RTC_EVENT_LOG 33 if (field_trial::IsEnabled("WebRTC-RtcEventLogKillSwitch")) { 34 return std::make_unique<RtcEventLogNull>(); 35 } 36 return std::make_unique<RtcEventLogImpl>(encoding_type, task_queue_factory_); 37 #else 38 return std::make_unique<RtcEventLogNull>(); 39 #endif 40 } 41 CreateRtcEventLog(RtcEventLog::EncodingType encoding_type)42std::unique_ptr<RtcEventLog> RtcEventLogFactory::CreateRtcEventLog( 43 RtcEventLog::EncodingType encoding_type) { 44 return Create(encoding_type); 45 } 46 47 } // namespace webrtc 48