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 
18 #ifdef WEBRTC_ENABLE_RTC_EVENT_LOG
19 #include "logging/rtc_event_log/rtc_event_log_impl.h"
20 #endif
21 
22 namespace webrtc {
23 
RtcEventLogFactory(TaskQueueFactory * task_queue_factory)24 RtcEventLogFactory::RtcEventLogFactory(TaskQueueFactory* task_queue_factory)
25     : task_queue_factory_(task_queue_factory) {
26   RTC_DCHECK(task_queue_factory_);
27 }
28 
CreateRtcEventLog(RtcEventLog::EncodingType encoding_type)29 std::unique_ptr<RtcEventLog> RtcEventLogFactory::CreateRtcEventLog(
30     RtcEventLog::EncodingType encoding_type) {
31 #ifdef WEBRTC_ENABLE_RTC_EVENT_LOG
32   return std::make_unique<RtcEventLogImpl>(encoding_type, task_queue_factory_);
33 #else
34   return std::make_unique<RtcEventLogNull>();
35 #endif
36 }
37 
38 }  // namespace webrtc
39