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 |
11 #ifndef WEBRTC_CALL_RTC_EVENT_LOG_H_ | 11 #ifndef WEBRTC_CALL_RTC_EVENT_LOG_H_ |
12 #define WEBRTC_CALL_RTC_EVENT_LOG_H_ | 12 #define WEBRTC_CALL_RTC_EVENT_LOG_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <string> | 15 #include <string> |
16 | 16 |
| 17 #include "webrtc/base/logging.h" |
17 #include "webrtc/base/platform_file.h" | 18 #include "webrtc/base/platform_file.h" |
18 #include "webrtc/video_receive_stream.h" | 19 #include "webrtc/video_receive_stream.h" |
19 #include "webrtc/video_send_stream.h" | 20 #include "webrtc/video_send_stream.h" |
20 | 21 |
21 namespace webrtc { | 22 namespace webrtc { |
22 | 23 |
23 // Forward declaration of storage class that is automatically generated from | 24 // Forward declaration of storage class that is automatically generated from |
24 // the protobuf file. | 25 // the protobuf file. |
25 namespace rtclog { | 26 namespace rtclog { |
26 class EventStream; | 27 class EventStream; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // The result is stored in the given EventStream object. | 103 // The result is stored in the given EventStream object. |
103 // The order of the events in the EventStream is implementation defined. | 104 // The order of the events in the EventStream is implementation defined. |
104 // The current implementation writes a LOG_START event, then the old | 105 // The current implementation writes a LOG_START event, then the old |
105 // configurations, then the remaining events in timestamp order and finally | 106 // configurations, then the remaining events in timestamp order and finally |
106 // a LOG_END event. However, this might change without further notice. | 107 // a LOG_END event. However, this might change without further notice. |
107 // TODO(terelius): Change result type to a vector? | 108 // TODO(terelius): Change result type to a vector? |
108 static bool ParseRtcEventLog(const std::string& file_name, | 109 static bool ParseRtcEventLog(const std::string& file_name, |
109 rtclog::EventStream* result); | 110 rtclog::EventStream* result); |
110 }; | 111 }; |
111 | 112 |
| 113 // No-op implementation is used if flag is not set, or in tests. |
| 114 class RtcEventLogNullImpl final : public RtcEventLog { |
| 115 public: |
| 116 bool StartLogging(const std::string& file_name, |
| 117 int64_t max_size_bytes) override { |
| 118 return false; |
| 119 } |
| 120 bool StartLogging(rtc::PlatformFile platform_file, |
| 121 int64_t max_size_bytes) override { |
| 122 // The platform_file is open and needs to be closed. |
| 123 if (!rtc::ClosePlatformFile(platform_file)) { |
| 124 LOG(LS_ERROR) << "Can't close file."; |
| 125 } |
| 126 return false; |
| 127 } |
| 128 void StopLogging() override {} |
| 129 void LogVideoReceiveStreamConfig( |
| 130 const VideoReceiveStream::Config& config) override {} |
| 131 void LogVideoSendStreamConfig( |
| 132 const VideoSendStream::Config& config) override {} |
| 133 void LogRtpHeader(PacketDirection direction, |
| 134 MediaType media_type, |
| 135 const uint8_t* header, |
| 136 size_t packet_length) override {} |
| 137 void LogRtcpPacket(PacketDirection direction, |
| 138 MediaType media_type, |
| 139 const uint8_t* packet, |
| 140 size_t length) override {} |
| 141 void LogAudioPlayout(uint32_t ssrc) override {} |
| 142 void LogBwePacketLossEvent(int32_t bitrate, |
| 143 uint8_t fraction_loss, |
| 144 int32_t total_packets) override {} |
| 145 }; |
| 146 |
112 } // namespace webrtc | 147 } // namespace webrtc |
113 | 148 |
114 #endif // WEBRTC_CALL_RTC_EVENT_LOG_H_ | 149 #endif // WEBRTC_CALL_RTC_EVENT_LOG_H_ |
OLD | NEW |