OLD | NEW |
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 Loading... |
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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 #else | 427 #else |
462 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | 428 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); |
463 #endif // ENABLE_RTC_EVENT_LOG | 429 #endif // ENABLE_RTC_EVENT_LOG |
464 } | 430 } |
465 | 431 |
466 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { | 432 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { |
467 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); | 433 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); |
468 } | 434 } |
469 | 435 |
470 } // namespace webrtc | 436 } // namespace webrtc |
OLD | NEW |