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

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: Rebase and change CHECK to RTC_CHECK Created 5 years, 3 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 | « webrtc/video/rtc_event_log.h ('k') | webrtc/video/rtc_event_log2rtp_dump.cc » ('j') | 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) 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 <string>
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"
20 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
19 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 21 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
20 #include "webrtc/system_wrappers/interface/clock.h" 22 #include "webrtc/system_wrappers/interface/clock.h"
21 #include "webrtc/system_wrappers/interface/file_wrapper.h" 23 #include "webrtc/system_wrappers/interface/file_wrapper.h"
22 24
23 #ifdef ENABLE_RTC_EVENT_LOG 25 #ifdef ENABLE_RTC_EVENT_LOG
24 // Files generated at build-time by the protobuf compiler. 26 // Files generated at build-time by the protobuf compiler.
25 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD 27 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD
26 #include "external/webrtc/webrtc/video/rtc_event_log.pb.h" 28 #include "external/webrtc/webrtc/video/rtc_event_log.pb.h"
27 #else 29 #else
28 #include "webrtc/video/rtc_event_log.pb.h" 30 #include "webrtc/video/rtc_event_log.pb.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 } 375 }
374 376
375 void RtcEventLogImpl::AddRecentEvent(const rtclog::Event& event) { 377 void RtcEventLogImpl::AddRecentEvent(const rtclog::Event& event) {
376 recent_log_events_.push_back(event); 378 recent_log_events_.push_back(event);
377 while (recent_log_events_.front().timestamp_us() < 379 while (recent_log_events_.front().timestamp_us() <
378 event.timestamp_us() - recent_log_duration_us) { 380 event.timestamp_us() - recent_log_duration_us) {
379 recent_log_events_.pop_front(); 381 recent_log_events_.pop_front();
380 } 382 }
381 } 383 }
382 384
383 bool RtcEventLog::ParseRtcEventLog(const std::string& file_name,
384 rtclog::EventStream* result) {
385 char tmp_buffer[1024];
386 int bytes_read = 0;
387 rtc::scoped_ptr<FileWrapper> dump_file(FileWrapper::Create());
388 if (dump_file->OpenFile(file_name.c_str(), true) != 0) {
389 return false;
390 }
391 std::string dump_buffer;
392 while ((bytes_read = dump_file->Read(tmp_buffer, sizeof(tmp_buffer))) > 0) {
393 dump_buffer.append(tmp_buffer, bytes_read);
394 }
395 dump_file->CloseFile();
396 return result->ParseFromString(dump_buffer);
397 }
398 385
399 #endif // ENABLE_RTC_EVENT_LOG 386 #endif // ENABLE_RTC_EVENT_LOG
400 387
401 // RtcEventLog member functions. 388 // RtcEventLog member functions.
402 rtc::scoped_ptr<RtcEventLog> RtcEventLog::Create() { 389 rtc::scoped_ptr<RtcEventLog> RtcEventLog::Create() {
403 return rtc::scoped_ptr<RtcEventLog>(new RtcEventLogImpl()); 390 return rtc::scoped_ptr<RtcEventLog>(new RtcEventLogImpl());
404 } 391 }
392
405 } // namespace webrtc 393 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/rtc_event_log.h ('k') | webrtc/video/rtc_event_log2rtp_dump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698