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

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

Issue 2175713002: Log current time if we stop logging before stop_time_. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Format Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 StopLogFile(); 217 StopLogFile();
218 } 218 }
219 return message_received; 219 return message_received;
220 } 220 }
221 221
222 void RtcEventLogHelperThread::StopLogFile() { 222 void RtcEventLogHelperThread::StopLogFile() {
223 RTC_DCHECK(file_->is_open()); 223 RTC_DCHECK(file_->is_open());
224 output_string_.clear(); 224 output_string_.clear();
225 225
226 rtclog::Event end_event; 226 rtclog::Event end_event;
227 end_event.set_timestamp_us(stop_time_); 227 // This function can be called either because we have reached the stop time,
228 // or because we have reached the log file size limit. Therefore, use the
229 // current time if we have not reached the time limit.
230 end_event.set_timestamp_us(
231 std::min(stop_time_, clock_->TimeInMicroseconds()));
ivoc 2016/07/27 09:18:00 Do you know if the value from TimeInMicroseconds()
pbos-webrtc 2016/07/27 16:44:20 This should never wrap. (It calls rtc::TimeMicros(
terelius 2016/07/27 20:34:40 When I wrote the code, I assumed that the 64-bit t
228 end_event.set_type(rtclog::Event::LOG_END); 232 end_event.set_type(rtclog::Event::LOG_END);
229 AppendEventToString(&end_event); 233 AppendEventToString(&end_event);
230 234
231 if (written_bytes_ + static_cast<int64_t>(output_string_.size()) <= 235 if (written_bytes_ + static_cast<int64_t>(output_string_.size()) <=
232 max_size_bytes_) { 236 max_size_bytes_) {
233 if (!file_->Write(output_string_.data(), output_string_.size())) { 237 if (!file_->Write(output_string_.data(), output_string_.size())) {
234 LOG(LS_ERROR) << "FileWrapper failed to write WebRtcEventLog file."; 238 LOG(LS_ERROR) << "FileWrapper failed to write WebRtcEventLog file.";
235 // The current FileWrapper implementation closes the file on error. 239 // The current FileWrapper implementation closes the file on error.
236 RTC_DCHECK(!file_->is_open()); 240 RTC_DCHECK(!file_->is_open());
237 } 241 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 311
308 bool RtcEventLogHelperThread::ThreadOutputFunction(void* obj) { 312 bool RtcEventLogHelperThread::ThreadOutputFunction(void* obj) {
309 RtcEventLogHelperThread* helper = static_cast<RtcEventLogHelperThread*>(obj); 313 RtcEventLogHelperThread* helper = static_cast<RtcEventLogHelperThread*>(obj);
310 helper->ProcessEvents(); 314 helper->ProcessEvents();
311 return false; 315 return false;
312 } 316 }
313 317
314 } // namespace webrtc 318 } // namespace webrtc
315 319
316 #endif // ENABLE_RTC_EVENT_LOG 320 #endif // ENABLE_RTC_EVENT_LOG
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698