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 // No-op implementation is used if flag is not set, or in tests. | 41 #ifndef ENABLE_RTC_EVENT_LOG |
| 42 |
| 43 // No-op implementation if flag is not set. |
42 class RtcEventLogNullImpl final : public RtcEventLog { | 44 class RtcEventLogNullImpl final : public RtcEventLog { |
43 public: | 45 public: |
44 bool StartLogging(const std::string& file_name, | 46 bool StartLogging(const std::string& file_name, |
45 int64_t max_size_bytes) override { | 47 int64_t max_size_bytes) override { |
46 return false; | 48 return false; |
47 } | 49 } |
48 bool StartLogging(rtc::PlatformFile platform_file, | 50 bool StartLogging(rtc::PlatformFile platform_file, |
49 int64_t max_size_bytes) override { | 51 int64_t max_size_bytes) override { |
50 // The platform_file is open and needs to be closed. | 52 // The platform_file is open and needs to be closed. |
51 if (!rtc::ClosePlatformFile(platform_file)) { | 53 if (!rtc::ClosePlatformFile(platform_file)) { |
(...skipping 13 matching lines...) Expand all Loading... |
65 void LogRtcpPacket(PacketDirection direction, | 67 void LogRtcpPacket(PacketDirection direction, |
66 MediaType media_type, | 68 MediaType media_type, |
67 const uint8_t* packet, | 69 const uint8_t* packet, |
68 size_t length) override {} | 70 size_t length) override {} |
69 void LogAudioPlayout(uint32_t ssrc) override {} | 71 void LogAudioPlayout(uint32_t ssrc) override {} |
70 void LogBwePacketLossEvent(int32_t bitrate, | 72 void LogBwePacketLossEvent(int32_t bitrate, |
71 uint8_t fraction_loss, | 73 uint8_t fraction_loss, |
72 int32_t total_packets) override {} | 74 int32_t total_packets) override {} |
73 }; | 75 }; |
74 | 76 |
75 #ifdef ENABLE_RTC_EVENT_LOG | 77 #else // ENABLE_RTC_EVENT_LOG is defined |
76 | 78 |
77 class RtcEventLogImpl final : public RtcEventLog { | 79 class RtcEventLogImpl final : public RtcEventLog { |
78 public: | 80 public: |
79 explicit RtcEventLogImpl(const Clock* clock); | 81 explicit RtcEventLogImpl(const Clock* clock); |
80 ~RtcEventLogImpl() override; | 82 ~RtcEventLogImpl() override; |
81 | 83 |
82 bool StartLogging(const std::string& file_name, | 84 bool StartLogging(const std::string& file_name, |
83 int64_t max_size_bytes) override; | 85 int64_t max_size_bytes) override; |
84 bool StartLogging(rtc::PlatformFile platform_file, | 86 bool StartLogging(rtc::PlatformFile platform_file, |
85 int64_t max_size_bytes) override; | 87 int64_t max_size_bytes) override; |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 458 |
457 // RtcEventLog member functions. | 459 // RtcEventLog member functions. |
458 std::unique_ptr<RtcEventLog> RtcEventLog::Create(const Clock* clock) { | 460 std::unique_ptr<RtcEventLog> RtcEventLog::Create(const Clock* clock) { |
459 #ifdef ENABLE_RTC_EVENT_LOG | 461 #ifdef ENABLE_RTC_EVENT_LOG |
460 return std::unique_ptr<RtcEventLog>(new RtcEventLogImpl(clock)); | 462 return std::unique_ptr<RtcEventLog>(new RtcEventLogImpl(clock)); |
461 #else | 463 #else |
462 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | 464 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); |
463 #endif // ENABLE_RTC_EVENT_LOG | 465 #endif // ENABLE_RTC_EVENT_LOG |
464 } | 466 } |
465 | 467 |
466 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { | |
467 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | |
468 } | |
469 | |
470 } // namespace webrtc | 468 } // namespace webrtc |
OLD | NEW |