| 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 |
| 11 #include "webrtc/call/rtc_event_log.h" | 11 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
| 12 | 12 |
| 13 #include <limits> | 13 #include <limits> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
| 17 #include "webrtc/base/constructormagic.h" | 17 #include "webrtc/base/constructormagic.h" |
| 18 #include "webrtc/base/event.h" | 18 #include "webrtc/base/event.h" |
| 19 #include "webrtc/base/swap_queue.h" | 19 #include "webrtc/base/swap_queue.h" |
| 20 #include "webrtc/base/thread_checker.h" | 20 #include "webrtc/base/thread_checker.h" |
| 21 #include "webrtc/call.h" | 21 #include "webrtc/call.h" |
| 22 #include "webrtc/call/rtc_event_log_helper_thread.h" | 22 #include "webrtc/logging/rtc_event_log/rtc_event_log_helper_thread.h" |
| 23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 24 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 24 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
| 25 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | 25 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
| 26 #include "webrtc/system_wrappers/include/clock.h" | 26 #include "webrtc/system_wrappers/include/clock.h" |
| 27 #include "webrtc/system_wrappers/include/file_wrapper.h" | 27 #include "webrtc/system_wrappers/include/file_wrapper.h" |
| 28 #include "webrtc/system_wrappers/include/logging.h" | 28 #include "webrtc/system_wrappers/include/logging.h" |
| 29 | 29 |
| 30 #ifdef ENABLE_RTC_EVENT_LOG | 30 #ifdef ENABLE_RTC_EVENT_LOG |
| 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/logging/rtc_event_log/rtc_event_log.pb.h" |
| 34 #else | 34 #else |
| 35 #include "webrtc/call/rtc_event_log.pb.h" | 35 #include "webrtc/logging/rtc_event_log/rtc_event_log.pb.h" |
| 36 #endif | 36 #endif |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 namespace webrtc { | 39 namespace webrtc { |
| 40 | 40 |
| 41 #ifdef ENABLE_RTC_EVENT_LOG | 41 #ifdef ENABLE_RTC_EVENT_LOG |
| 42 | 42 |
| 43 class RtcEventLogImpl final : public RtcEventLog { | 43 class RtcEventLogImpl final : public RtcEventLog { |
| 44 public: | 44 public: |
| 45 explicit RtcEventLogImpl(const Clock* clock); | 45 explicit RtcEventLogImpl(const Clock* clock); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 static const int kEventsPerSecond = 1000; | 122 static const int kEventsPerSecond = 1000; |
| 123 static const int kControlMessagesPerSecond = 10; | 123 static const int kControlMessagesPerSecond = 10; |
| 124 } // namespace | 124 } // namespace |
| 125 | 125 |
| 126 // RtcEventLogImpl member functions. | 126 // RtcEventLogImpl member functions. |
| 127 RtcEventLogImpl::RtcEventLogImpl(const Clock* clock) | 127 RtcEventLogImpl::RtcEventLogImpl(const Clock* clock) |
| 128 // Allocate buffers for roughly one second of history. | 128 // Allocate buffers for roughly one second of history. |
| 129 : message_queue_(kControlMessagesPerSecond), | 129 : message_queue_(kControlMessagesPerSecond), |
| 130 event_queue_(kEventsPerSecond), | 130 event_queue_(kEventsPerSecond), |
| 131 clock_(clock), | 131 clock_(clock), |
| 132 helper_thread_(&message_queue_, | 132 helper_thread_(&message_queue_, &event_queue_, clock), |
| 133 &event_queue_, | |
| 134 clock), | |
| 135 thread_checker_() { | 133 thread_checker_() { |
| 136 thread_checker_.DetachFromThread(); | 134 thread_checker_.DetachFromThread(); |
| 137 } | 135 } |
| 138 | 136 |
| 139 RtcEventLogImpl::~RtcEventLogImpl() { | 137 RtcEventLogImpl::~RtcEventLogImpl() { |
| 140 // The RtcEventLogHelperThread destructor closes the file | 138 // The RtcEventLogHelperThread destructor closes the file |
| 141 // and waits for the thread to terminate. | 139 // and waits for the thread to terminate. |
| 142 } | 140 } |
| 143 | 141 |
| 144 bool RtcEventLogImpl::StartLogging(const std::string& file_name, | 142 bool RtcEventLogImpl::StartLogging(const std::string& file_name, |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 #else | 434 #else |
| 437 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | 435 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); |
| 438 #endif // ENABLE_RTC_EVENT_LOG | 436 #endif // ENABLE_RTC_EVENT_LOG |
| 439 } | 437 } |
| 440 | 438 |
| 441 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { | 439 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { |
| 442 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | 440 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); |
| 443 } | 441 } |
| 444 | 442 |
| 445 } // namespace webrtc | 443 } // namespace webrtc |
| OLD | NEW |