| 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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 enum PacketDirection { kIncomingPacket = 0, kOutgoingPacket }; | 34 enum PacketDirection { kIncomingPacket = 0, kOutgoingPacket }; |
| 35 | 35 |
| 36 class RtcEventLog { | 36 class RtcEventLog { |
| 37 public: | 37 public: |
| 38 virtual ~RtcEventLog() {} | 38 virtual ~RtcEventLog() {} |
| 39 | 39 |
| 40 // Factory method to create an RtcEventLog object. | 40 // Factory method to create an RtcEventLog object. |
| 41 static std::unique_ptr<RtcEventLog> Create(const Clock* clock); | 41 static std::unique_ptr<RtcEventLog> Create(const Clock* clock); |
| 42 | 42 |
| 43 // Create an RtcEventLog object that does nothing. | |
| 44 static std::unique_ptr<RtcEventLog> CreateNull(); | |
| 45 | |
| 46 // Starts logging a maximum of max_size_bytes bytes to the specified file. | 43 // Starts logging a maximum of max_size_bytes bytes to the specified file. |
| 47 // If the file already exists it will be overwritten. | 44 // If the file already exists it will be overwritten. |
| 48 // If max_size_bytes <= 0, logging will be active until StopLogging is called. | 45 // If max_size_bytes <= 0, logging will be active until StopLogging is called. |
| 49 // The function has no effect and returns false if we can't start a new log | 46 // The function has no effect and returns false if we can't start a new log |
| 50 // e.g. because we are already logging or the file cannot be opened. | 47 // e.g. because we are already logging or the file cannot be opened. |
| 51 virtual bool StartLogging(const std::string& file_name, | 48 virtual bool StartLogging(const std::string& file_name, |
| 52 int64_t max_size_bytes) = 0; | 49 int64_t max_size_bytes) = 0; |
| 53 | 50 |
| 54 // Same as above. The RtcEventLog takes ownership of the file if the call | 51 // Same as above. The RtcEventLog takes ownership of the file if the call |
| 55 // is successful, i.e. if it returns true. | 52 // is successful, i.e. if it returns true. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // The result is stored in the given EventStream object. | 99 // The result is stored in the given EventStream object. |
| 103 // The order of the events in the EventStream is implementation defined. | 100 // The order of the events in the EventStream is implementation defined. |
| 104 // The current implementation writes a LOG_START event, then the old | 101 // The current implementation writes a LOG_START event, then the old |
| 105 // configurations, then the remaining events in timestamp order and finally | 102 // configurations, then the remaining events in timestamp order and finally |
| 106 // a LOG_END event. However, this might change without further notice. | 103 // a LOG_END event. However, this might change without further notice. |
| 107 // TODO(terelius): Change result type to a vector? | 104 // TODO(terelius): Change result type to a vector? |
| 108 static bool ParseRtcEventLog(const std::string& file_name, | 105 static bool ParseRtcEventLog(const std::string& file_name, |
| 109 rtclog::EventStream* result); | 106 rtclog::EventStream* result); |
| 110 }; | 107 }; |
| 111 | 108 |
| 112 // No-op implementation is used if flag is not set, or in tests. | |
| 113 class RtcEventLogNullImpl final : public RtcEventLog { | |
| 114 public: | |
| 115 bool StartLogging(const std::string& file_name, | |
| 116 int64_t max_size_bytes) override { | |
| 117 return false; | |
| 118 } | |
| 119 bool StartLogging(rtc::PlatformFile platform_file, | |
| 120 int64_t max_size_bytes) override; | |
| 121 void StopLogging() override {} | |
| 122 void LogVideoReceiveStreamConfig( | |
| 123 const VideoReceiveStream::Config& config) override {} | |
| 124 void LogVideoSendStreamConfig( | |
| 125 const VideoSendStream::Config& config) override {} | |
| 126 void LogRtpHeader(PacketDirection direction, | |
| 127 MediaType media_type, | |
| 128 const uint8_t* header, | |
| 129 size_t packet_length) override {} | |
| 130 void LogRtcpPacket(PacketDirection direction, | |
| 131 MediaType media_type, | |
| 132 const uint8_t* packet, | |
| 133 size_t length) override {} | |
| 134 void LogAudioPlayout(uint32_t ssrc) override {} | |
| 135 void LogBwePacketLossEvent(int32_t bitrate, | |
| 136 uint8_t fraction_loss, | |
| 137 int32_t total_packets) override {} | |
| 138 }; | |
| 139 | |
| 140 } // namespace webrtc | 109 } // namespace webrtc |
| 141 | 110 |
| 142 #endif // WEBRTC_CALL_RTC_EVENT_LOG_H_ | 111 #endif // WEBRTC_CALL_RTC_EVENT_LOG_H_ |
| OLD | NEW |