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

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

Issue 1295753003: Convenience functions to convert RtcEvents to webrtc types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 4 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/video/rtc_event_log.h" 11 #include "webrtc/video/rtc_event_log.h"
12 12
13 #include <cstring>
hlundin-webrtc 2015/08/18 09:22:59 string.h We tend to use the C header file for C l
terelius 2015/08/18 16:06:50 It should actually be <string>. The C string libra
13 #include <deque> 14 #include <deque>
14 15
15 #include "webrtc/base/checks.h" 16 #include "webrtc/base/checks.h"
16 #include "webrtc/base/criticalsection.h" 17 #include "webrtc/base/criticalsection.h"
17 #include "webrtc/base/thread_annotations.h" 18 #include "webrtc/base/thread_annotations.h"
18 #include "webrtc/call.h" 19 #include "webrtc/call.h"
19 #include "webrtc/system_wrappers/interface/clock.h" 20 #include "webrtc/system_wrappers/interface/clock.h"
20 #include "webrtc/system_wrappers/interface/file_wrapper.h" 21 #include "webrtc/system_wrappers/interface/file_wrapper.h"
21 22
22 #ifdef ENABLE_RTC_EVENT_LOG 23 #ifdef ENABLE_RTC_EVENT_LOG
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 } 375 }
375 376
376 void RtcEventLogImpl::AddRecentEvent(const rtclog::Event& event) { 377 void RtcEventLogImpl::AddRecentEvent(const rtclog::Event& event) {
377 recent_log_events_.push_back(event); 378 recent_log_events_.push_back(event);
378 while (recent_log_events_.front().timestamp_us() < 379 while (recent_log_events_.front().timestamp_us() <
379 event.timestamp_us() - recent_log_duration_us) { 380 event.timestamp_us() - recent_log_duration_us) {
380 recent_log_events_.pop_front(); 381 recent_log_events_.pop_front();
381 } 382 }
382 } 383 }
383 384
384 bool RtcEventLog::ParseRtcEventLog(const std::string& file_name,
385 rtclog::EventStream* result) {
386 char tmp_buffer[1024];
387 int bytes_read = 0;
388 rtc::scoped_ptr<FileWrapper> dump_file(FileWrapper::Create());
389 if (dump_file->OpenFile(file_name.c_str(), true) != 0) {
390 return false;
391 }
392 std::string dump_buffer;
393 while ((bytes_read = dump_file->Read(tmp_buffer, sizeof(tmp_buffer))) > 0) {
394 dump_buffer.append(tmp_buffer, bytes_read);
395 }
396 dump_file->CloseFile();
397 return result->ParseFromString(dump_buffer);
398 }
399 385
400 #endif // ENABLE_RTC_EVENT_LOG 386 #endif // ENABLE_RTC_EVENT_LOG
401 387
402 // RtcEventLog member functions. 388 // RtcEventLog member functions.
403 rtc::scoped_ptr<RtcEventLog> RtcEventLog::Create() { 389 rtc::scoped_ptr<RtcEventLog> RtcEventLog::Create() {
404 return rtc::scoped_ptr<RtcEventLog>(new RtcEventLogImpl()); 390 return rtc::scoped_ptr<RtcEventLog>(new RtcEventLogImpl());
405 } 391 }
392
406 } // namespace webrtc 393 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698