Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Side by Side Diff: webrtc/call/rtc_event_log.cc

Issue 1748403002: Move RtcEventLog object from inside VoiceEngine to Call. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Undid unneccessary changes to rtp_rtcp module. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/call/rtc_event_log.h"
12 12
13 #include <deque> 13 #include <deque>
14 #include <vector> 14 #include <vector>
15 15
16 #include "webrtc/base/checks.h" 16 #include "webrtc/base/checks.h"
17 #include "webrtc/base/criticalsection.h" 17 #include "webrtc/base/criticalsection.h"
18 #include "webrtc/base/thread_annotations.h" 18 #include "webrtc/base/thread_annotations.h"
19 #include "webrtc/base/thread_checker.h"
19 #include "webrtc/call.h" 20 #include "webrtc/call.h"
20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 21 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
21 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 22 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
22 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" 23 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
23 #include "webrtc/system_wrappers/include/clock.h" 24 #include "webrtc/system_wrappers/include/clock.h"
24 #include "webrtc/system_wrappers/include/file_wrapper.h" 25 #include "webrtc/system_wrappers/include/file_wrapper.h"
25 26
26 #ifdef ENABLE_RTC_EVENT_LOG 27 #ifdef ENABLE_RTC_EVENT_LOG
27 // Files generated at build-time by the protobuf compiler. 28 // Files generated at build-time by the protobuf compiler.
28 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD 29 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD
(...skipping 30 matching lines...) Expand all
59 void LogBwePacketLossEvent(int32_t bitrate, 60 void LogBwePacketLossEvent(int32_t bitrate,
60 uint8_t fraction_loss, 61 uint8_t fraction_loss,
61 int32_t total_packets) override {} 62 int32_t total_packets) override {}
62 }; 63 };
63 64
64 #else // ENABLE_RTC_EVENT_LOG is defined 65 #else // ENABLE_RTC_EVENT_LOG is defined
65 66
66 class RtcEventLogImpl final : public RtcEventLog { 67 class RtcEventLogImpl final : public RtcEventLog {
67 public: 68 public:
68 RtcEventLogImpl(); 69 RtcEventLogImpl();
70 ~RtcEventLogImpl();
the sun 2016/03/21 13:03:08 override
ivoc 2016/03/22 13:44:54 Done.
69 71
70 void SetBufferDuration(int64_t buffer_duration_us) override; 72 void SetBufferDuration(int64_t buffer_duration_us) override;
71 void StartLogging(const std::string& file_name, int duration_ms) override; 73 void StartLogging(const std::string& file_name, int duration_ms) override;
72 bool StartLogging(rtc::PlatformFile log_file) override; 74 bool StartLogging(rtc::PlatformFile log_file) override;
73 void StopLogging() override; 75 void StopLogging() override;
74 void LogVideoReceiveStreamConfig( 76 void LogVideoReceiveStreamConfig(
75 const VideoReceiveStream::Config& config) override; 77 const VideoReceiveStream::Config& config) override;
76 void LogVideoSendStreamConfig(const VideoSendStream::Config& config) override; 78 void LogVideoSendStreamConfig(const VideoSendStream::Config& config) override;
77 void LogRtpHeader(PacketDirection direction, 79 void LogRtpHeader(PacketDirection direction,
78 MediaType media_type, 80 MediaType media_type,
(...skipping 18 matching lines...) Expand all
97 // list of recent log events otherwise. 99 // list of recent log events otherwise.
98 void HandleEvent(rtclog::Event* event) EXCLUSIVE_LOCKS_REQUIRED(crit_); 100 void HandleEvent(rtclog::Event* event) EXCLUSIVE_LOCKS_REQUIRED(crit_);
99 // Writes the event to the file. Note that this will destroy the state of the 101 // Writes the event to the file. Note that this will destroy the state of the
100 // input argument. 102 // input argument.
101 void StoreToFile(rtclog::Event* event) EXCLUSIVE_LOCKS_REQUIRED(crit_); 103 void StoreToFile(rtclog::Event* event) EXCLUSIVE_LOCKS_REQUIRED(crit_);
102 // Adds the event to the list of recent events, and removes any events that 104 // Adds the event to the list of recent events, and removes any events that
103 // are too old and no longer fall in the time window. 105 // are too old and no longer fall in the time window.
104 void AddRecentEvent(const rtclog::Event& event) 106 void AddRecentEvent(const rtclog::Event& event)
105 EXCLUSIVE_LOCKS_REQUIRED(crit_); 107 EXCLUSIVE_LOCKS_REQUIRED(crit_);
106 108
109 rtc::ThreadChecker thread_checker_;
107 rtc::CriticalSection crit_; 110 rtc::CriticalSection crit_;
108 rtc::scoped_ptr<FileWrapper> file_ GUARDED_BY(crit_) = 111 rtc::scoped_ptr<FileWrapper> file_ GUARDED_BY(crit_) =
109 rtc::scoped_ptr<FileWrapper>(FileWrapper::Create()); 112 rtc::scoped_ptr<FileWrapper>(FileWrapper::Create());
110 rtc::PlatformFile platform_file_ GUARDED_BY(crit_) = 113 rtc::PlatformFile platform_file_ GUARDED_BY(crit_) =
111 rtc::kInvalidPlatformFileValue; 114 rtc::kInvalidPlatformFileValue;
112 rtclog::EventStream stream_ GUARDED_BY(crit_); 115 rtclog::EventStream stream_ GUARDED_BY(crit_);
113 std::deque<rtclog::Event> recent_log_events_ GUARDED_BY(crit_); 116 std::deque<rtclog::Event> recent_log_events_ GUARDED_BY(crit_);
114 std::vector<rtclog::Event> config_events_ GUARDED_BY(crit_); 117 std::vector<rtclog::Event> config_events_ GUARDED_BY(crit_);
115 118
116 // Microseconds to record log events, before starting the actual log. 119 // Microseconds to record log events, before starting the actual log.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 176
174 // RtcEventLogImpl member functions. 177 // RtcEventLogImpl member functions.
175 RtcEventLogImpl::RtcEventLogImpl() 178 RtcEventLogImpl::RtcEventLogImpl()
176 : file_(FileWrapper::Create()), 179 : file_(FileWrapper::Create()),
177 stream_(), 180 stream_(),
178 buffer_duration_us_(10000000), 181 buffer_duration_us_(10000000),
179 currently_logging_(false), 182 currently_logging_(false),
180 start_time_us_(0), 183 start_time_us_(0),
181 duration_us_(0), 184 duration_us_(0),
182 clock_(Clock::GetRealTimeClock()) { 185 clock_(Clock::GetRealTimeClock()) {
186 RTC_DCHECK(thread_checker_.CalledOnValidThread());
187 }
188
189 RtcEventLogImpl::~RtcEventLogImpl() {
190 RTC_DCHECK(thread_checker_.CalledOnValidThread());
183 } 191 }
184 192
185 void RtcEventLogImpl::SetBufferDuration(int64_t buffer_duration_us) { 193 void RtcEventLogImpl::SetBufferDuration(int64_t buffer_duration_us) {
186 rtc::CritScope lock(&crit_); 194 rtc::CritScope lock(&crit_);
187 buffer_duration_us_ = buffer_duration_us; 195 buffer_duration_us_ = buffer_duration_us;
188 } 196 }
189 197
190 void RtcEventLogImpl::StartLogging(const std::string& file_name, 198 void RtcEventLogImpl::StartLogging(const std::string& file_name,
191 int duration_ms) { 199 int duration_ms) {
192 rtc::CritScope lock(&crit_); 200 rtc::CritScope lock(&crit_);
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 } 522 }
515 523
516 #endif // ENABLE_RTC_EVENT_LOG 524 #endif // ENABLE_RTC_EVENT_LOG
517 525
518 // RtcEventLog member functions. 526 // RtcEventLog member functions.
519 rtc::scoped_ptr<RtcEventLog> RtcEventLog::Create() { 527 rtc::scoped_ptr<RtcEventLog> RtcEventLog::Create() {
520 return rtc::scoped_ptr<RtcEventLog>(new RtcEventLogImpl()); 528 return rtc::scoped_ptr<RtcEventLog>(new RtcEventLogImpl());
521 } 529 }
522 530
523 } // namespace webrtc 531 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698