OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 event_type == rtclog::Event::AUDIO_SENDER_CONFIG_EVENT; | 31 event_type == rtclog::Event::AUDIO_SENDER_CONFIG_EVENT; |
32 } | 32 } |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 // RtcEventLogImpl member functions. | 35 // RtcEventLogImpl member functions. |
36 RtcEventLogHelperThread::RtcEventLogHelperThread( | 36 RtcEventLogHelperThread::RtcEventLogHelperThread( |
37 SwapQueue<ControlMessage>* message_queue, | 37 SwapQueue<ControlMessage>* message_queue, |
38 SwapQueue<std::unique_ptr<rtclog::Event>>* event_queue) | 38 SwapQueue<std::unique_ptr<rtclog::Event>>* event_queue) |
39 : message_queue_(message_queue), | 39 : message_queue_(message_queue), |
40 event_queue_(event_queue), | 40 event_queue_(event_queue), |
41 history_(kEventsInHistory), | 41 history_(), |
tommi
2017/06/01 21:29:43
Nit: might as well just remove from the list
| |
42 config_history_(), | 42 config_history_(), |
43 file_(FileWrapper::Create()), | 43 file_(FileWrapper::Create()), |
44 thread_(&ThreadOutputFunction, this, "RtcEventLog thread"), | 44 thread_(&ThreadOutputFunction, this, "RtcEventLog thread"), |
45 max_size_bytes_(std::numeric_limits<int64_t>::max()), | 45 max_size_bytes_(std::numeric_limits<int64_t>::max()), |
46 written_bytes_(0), | 46 written_bytes_(0), |
47 start_time_(0), | 47 start_time_(0), |
48 stop_time_(std::numeric_limits<int64_t>::max()), | 48 stop_time_(std::numeric_limits<int64_t>::max()), |
49 has_recent_event_(false), | 49 has_recent_event_(false), |
50 most_recent_event_(), | 50 most_recent_event_(), |
51 output_string_(), | 51 output_string_(), |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 int64_t current_time = rtc::TimeMicros(); | 113 int64_t current_time = rtc::TimeMicros(); |
114 if (!has_recent_event_) { | 114 if (!has_recent_event_) { |
115 has_recent_event_ = event_queue_->Remove(&most_recent_event_); | 115 has_recent_event_ = event_queue_->Remove(&most_recent_event_); |
116 } | 116 } |
117 while (has_recent_event_ && | 117 while (has_recent_event_ && |
118 most_recent_event_->timestamp_us() <= current_time) { | 118 most_recent_event_->timestamp_us() <= current_time) { |
119 if (IsConfigEvent(*most_recent_event_)) { | 119 if (IsConfigEvent(*most_recent_event_)) { |
120 config_history_.push_back(std::move(most_recent_event_)); | 120 config_history_.push_back(std::move(most_recent_event_)); |
121 } else { | 121 } else { |
122 history_.push_back(std::move(most_recent_event_)); | 122 history_.push_back(std::move(most_recent_event_)); |
123 if (history_.size() > kEventsInHistory) | |
124 history_.pop_front(); | |
123 } | 125 } |
124 has_recent_event_ = event_queue_->Remove(&most_recent_event_); | 126 has_recent_event_ = event_queue_->Remove(&most_recent_event_); |
125 message_received = true; | 127 message_received = true; |
126 } | 128 } |
127 return message_received; | 129 return message_received; |
128 } | 130 } |
129 | 131 |
130 void RtcEventLogHelperThread::StartLogFile() { | 132 void RtcEventLogHelperThread::StartLogFile() { |
131 RTC_DCHECK(file_->is_open()); | 133 RTC_DCHECK(file_->is_open()); |
132 bool stop = false; | 134 bool stop = false; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 } | 310 } |
309 | 311 |
310 void RtcEventLogHelperThread::ThreadOutputFunction(void* obj) { | 312 void RtcEventLogHelperThread::ThreadOutputFunction(void* obj) { |
311 RtcEventLogHelperThread* helper = static_cast<RtcEventLogHelperThread*>(obj); | 313 RtcEventLogHelperThread* helper = static_cast<RtcEventLogHelperThread*>(obj); |
312 helper->ProcessEvents(); | 314 helper->ProcessEvents(); |
313 } | 315 } |
314 | 316 |
315 } // namespace webrtc | 317 } // namespace webrtc |
316 | 318 |
317 #endif // ENABLE_RTC_EVENT_LOG | 319 #endif // ENABLE_RTC_EVENT_LOG |
OLD | NEW |