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

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

Issue 2193763002: Reland: Add BWE plot to event log analyzer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix lib fuzzer. Created 4 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
(...skipping 20 matching lines...) Expand all
31 // Files generated at build-time by the protobuf compiler. 31 // Files generated at build-time by the protobuf compiler.
32 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD 32 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD
33 #include "external/webrtc/webrtc/call/rtc_event_log.pb.h" 33 #include "external/webrtc/webrtc/call/rtc_event_log.pb.h"
34 #else 34 #else
35 #include "webrtc/call/rtc_event_log.pb.h" 35 #include "webrtc/call/rtc_event_log.pb.h"
36 #endif 36 #endif
37 #endif 37 #endif
38 38
39 namespace webrtc { 39 namespace webrtc {
40 40
41 // No-op implementation is used if flag is not set, or in tests.
42 class RtcEventLogNullImpl final : public RtcEventLog {
43 public:
44 bool StartLogging(const std::string& file_name,
45 int64_t max_size_bytes) override {
46 return false;
47 }
48 bool StartLogging(rtc::PlatformFile platform_file,
49 int64_t max_size_bytes) override {
50 // The platform_file is open and needs to be closed.
51 if (!rtc::ClosePlatformFile(platform_file)) {
52 LOG(LS_ERROR) << "Can't close file.";
53 }
54 return false;
55 }
56 void StopLogging() override {}
57 void LogVideoReceiveStreamConfig(
58 const VideoReceiveStream::Config& config) override {}
59 void LogVideoSendStreamConfig(
60 const VideoSendStream::Config& config) override {}
61 void LogRtpHeader(PacketDirection direction,
62 MediaType media_type,
63 const uint8_t* header,
64 size_t packet_length) override {}
65 void LogRtcpPacket(PacketDirection direction,
66 MediaType media_type,
67 const uint8_t* packet,
68 size_t length) override {}
69 void LogAudioPlayout(uint32_t ssrc) override {}
70 void LogBwePacketLossEvent(int32_t bitrate,
71 uint8_t fraction_loss,
72 int32_t total_packets) override {}
73 };
74
75 #ifdef ENABLE_RTC_EVENT_LOG 41 #ifdef ENABLE_RTC_EVENT_LOG
76 42
77 class RtcEventLogImpl final : public RtcEventLog { 43 class RtcEventLogImpl final : public RtcEventLog {
78 public: 44 public:
79 explicit RtcEventLogImpl(const Clock* clock); 45 explicit RtcEventLogImpl(const Clock* clock);
80 ~RtcEventLogImpl() override; 46 ~RtcEventLogImpl() override;
81 47
82 bool StartLogging(const std::string& file_name, 48 bool StartLogging(const std::string& file_name,
83 int64_t max_size_bytes) override; 49 int64_t max_size_bytes) override;
84 bool StartLogging(rtc::PlatformFile platform_file, 50 bool StartLogging(rtc::PlatformFile platform_file,
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 std::string dump_buffer; 413 std::string dump_buffer;
448 while ((bytes_read = dump_file->Read(tmp_buffer, sizeof(tmp_buffer))) > 0) { 414 while ((bytes_read = dump_file->Read(tmp_buffer, sizeof(tmp_buffer))) > 0) {
449 dump_buffer.append(tmp_buffer, bytes_read); 415 dump_buffer.append(tmp_buffer, bytes_read);
450 } 416 }
451 dump_file->CloseFile(); 417 dump_file->CloseFile();
452 return result->ParseFromString(dump_buffer); 418 return result->ParseFromString(dump_buffer);
453 } 419 }
454 420
455 #endif // ENABLE_RTC_EVENT_LOG 421 #endif // ENABLE_RTC_EVENT_LOG
456 422
423 bool RtcEventLogNullImpl::StartLogging(rtc::PlatformFile platform_file,
424 int64_t max_size_bytes) {
425 // The platform_file is open and needs to be closed.
426 if (!rtc::ClosePlatformFile(platform_file)) {
427 LOG(LS_ERROR) << "Can't close file.";
428 }
429 return false;
430 }
431
457 // RtcEventLog member functions. 432 // RtcEventLog member functions.
458 std::unique_ptr<RtcEventLog> RtcEventLog::Create(const Clock* clock) { 433 std::unique_ptr<RtcEventLog> RtcEventLog::Create(const Clock* clock) {
459 #ifdef ENABLE_RTC_EVENT_LOG 434 #ifdef ENABLE_RTC_EVENT_LOG
460 return std::unique_ptr<RtcEventLog>(new RtcEventLogImpl(clock)); 435 return std::unique_ptr<RtcEventLog>(new RtcEventLogImpl(clock));
461 #else 436 #else
462 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); 437 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl());
463 #endif // ENABLE_RTC_EVENT_LOG 438 #endif // ENABLE_RTC_EVENT_LOG
464 } 439 }
465 440
466 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { 441 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() {
467 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); 442 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl());
468 } 443 }
469 444
470 } // namespace webrtc 445 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/rtc_event_log.h ('k') | webrtc/modules/congestion_controller/congestion_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698