OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 // Files generated at build-time by the protobuf compiler. | 31 // Files generated at build-time by the protobuf compiler. |
32 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD | 32 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD |
33 #include "external/webrtc/webrtc/call/rtc_event_log.pb.h" | 33 #include "external/webrtc/webrtc/call/rtc_event_log.pb.h" |
34 #else | 34 #else |
35 #include "webrtc/call/rtc_event_log.pb.h" | 35 #include "webrtc/call/rtc_event_log.pb.h" |
36 #endif | 36 #endif |
37 #endif | 37 #endif |
38 | 38 |
39 namespace webrtc { | 39 namespace webrtc { |
40 | 40 |
41 #ifndef ENABLE_RTC_EVENT_LOG | 41 // No-op implementation is used if flag is not set, or in tests. |
42 | |
43 // No-op implementation if flag is not set. | |
44 class RtcEventLogNullImpl final : public RtcEventLog { | 42 class RtcEventLogNullImpl final : public RtcEventLog { |
45 public: | 43 public: |
46 bool StartLogging(const std::string& file_name, | 44 bool StartLogging(const std::string& file_name, |
47 int64_t max_size_bytes) override { | 45 int64_t max_size_bytes) override { |
48 return false; | 46 return false; |
49 } | 47 } |
50 bool StartLogging(rtc::PlatformFile platform_file, | 48 bool StartLogging(rtc::PlatformFile platform_file, |
51 int64_t max_size_bytes) override { | 49 int64_t max_size_bytes) override { |
52 // The platform_file is open and needs to be closed. | 50 // The platform_file is open and needs to be closed. |
53 if (!rtc::ClosePlatformFile(platform_file)) { | 51 if (!rtc::ClosePlatformFile(platform_file)) { |
(...skipping 13 matching lines...) Expand all Loading... |
67 void LogRtcpPacket(PacketDirection direction, | 65 void LogRtcpPacket(PacketDirection direction, |
68 MediaType media_type, | 66 MediaType media_type, |
69 const uint8_t* packet, | 67 const uint8_t* packet, |
70 size_t length) override {} | 68 size_t length) override {} |
71 void LogAudioPlayout(uint32_t ssrc) override {} | 69 void LogAudioPlayout(uint32_t ssrc) override {} |
72 void LogBwePacketLossEvent(int32_t bitrate, | 70 void LogBwePacketLossEvent(int32_t bitrate, |
73 uint8_t fraction_loss, | 71 uint8_t fraction_loss, |
74 int32_t total_packets) override {} | 72 int32_t total_packets) override {} |
75 }; | 73 }; |
76 | 74 |
77 #else // ENABLE_RTC_EVENT_LOG is defined | 75 #ifdef ENABLE_RTC_EVENT_LOG |
78 | 76 |
79 class RtcEventLogImpl final : public RtcEventLog { | 77 class RtcEventLogImpl final : public RtcEventLog { |
80 public: | 78 public: |
81 explicit RtcEventLogImpl(const Clock* clock); | 79 explicit RtcEventLogImpl(const Clock* clock); |
82 ~RtcEventLogImpl() override; | 80 ~RtcEventLogImpl() override; |
83 | 81 |
84 bool StartLogging(const std::string& file_name, | 82 bool StartLogging(const std::string& file_name, |
85 int64_t max_size_bytes) override; | 83 int64_t max_size_bytes) override; |
86 bool StartLogging(rtc::PlatformFile platform_file, | 84 bool StartLogging(rtc::PlatformFile platform_file, |
87 int64_t max_size_bytes) override; | 85 int64_t max_size_bytes) override; |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 | 456 |
459 // RtcEventLog member functions. | 457 // RtcEventLog member functions. |
460 std::unique_ptr<RtcEventLog> RtcEventLog::Create(const Clock* clock) { | 458 std::unique_ptr<RtcEventLog> RtcEventLog::Create(const Clock* clock) { |
461 #ifdef ENABLE_RTC_EVENT_LOG | 459 #ifdef ENABLE_RTC_EVENT_LOG |
462 return std::unique_ptr<RtcEventLog>(new RtcEventLogImpl(clock)); | 460 return std::unique_ptr<RtcEventLog>(new RtcEventLogImpl(clock)); |
463 #else | 461 #else |
464 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | 462 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); |
465 #endif // ENABLE_RTC_EVENT_LOG | 463 #endif // ENABLE_RTC_EVENT_LOG |
466 } | 464 } |
467 | 465 |
| 466 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { |
| 467 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); |
| 468 } |
| 469 |
468 } // namespace webrtc | 470 } // namespace webrtc |
OLD | NEW |