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

Side by Side Diff: webrtc/logging/rtc_event_log/rtc_event_log.h

Issue 3016473002: Remove encoding code from RtcEventLogImpl and use RtcEventLogEncoder instead (Closed)
Patch Set: Created 3 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
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 #ifndef WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_H_ 11 #ifndef WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_H_
12 #define WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_H_ 12 #define WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_H_
13 13
14 #include <memory> 14 #include <memory>
15 #include <string> 15 #include <string>
16 #include <vector>
17 16
18 #include "webrtc/api/array_view.h" 17 #include "webrtc/api/array_view.h"
19 // TODO(eladalon): Get rid of this later in the CL-stack. 18 // TODO(eladalon): Get rid of this later in the CL-stack.
20 #include "webrtc/api/rtpparameters.h" 19 #include "webrtc/api/rtpparameters.h"
21 #include "webrtc/common_types.h" 20 #include "webrtc/common_types.h"
22 // TODO(eladalon): Get rid of this later in the CL-stack. 21 // TODO(eladalon): Get rid of this later in the CL-stack.
22 #include "webrtc/logging/rtc_event_log/encoder/rtc_event_log_encoder.h"
23 #include "webrtc/logging/rtc_event_log/events/rtc_event_probe_result_failure.h" 23 #include "webrtc/logging/rtc_event_log/events/rtc_event_probe_result_failure.h"
24 // TODO(eladalon): Remove this in an upcoming CL, that will modularize the
25 // log output into its own class.
24 #include "webrtc/rtc_base/platform_file.h" 26 #include "webrtc/rtc_base/platform_file.h"
25 27
26 namespace webrtc { 28 namespace webrtc {
27 29
28 namespace rtclog { 30 namespace rtclog {
29 class EventStream; // Storage class automatically generated from protobuf. 31 class EventStream; // Storage class automatically generated from protobuf.
30 // TODO(eladalon): Get rid of this when deprecated methods are removed. 32 // TODO(eladalon): Get rid of this when deprecated methods are removed.
31 struct StreamConfig; 33 struct StreamConfig;
32 } // namespace rtclog 34 } // namespace rtclog
33 35
34 class Clock; 36 class Clock;
37 // TODO(eladalon): The following may be removed when the deprecated methods
38 // are removed.
35 struct AudioEncoderRuntimeConfig; 39 struct AudioEncoderRuntimeConfig;
36 class RtpPacketReceived; 40 class RtpPacketReceived;
37 class RtpPacketToSend; 41 class RtpPacketToSend;
42 enum class BandwidthUsage;
43 enum PacketDirection { kIncomingPacket = 0, kOutgoingPacket };
38 44
39 enum class MediaType; 45 // TODO(eladalon): Two stages are upcoming.
40 enum class BandwidthUsage; 46 // 1. Extend this to actually support the new encoding.
41 47 // 2. Get rid of the legacy encoding, allowing us to get rid of this enum.
42 enum PacketDirection { kIncomingPacket = 0, kOutgoingPacket }; 48 enum class EncodingType { Legacy };
43 49
44 class RtcEventLog { 50 class RtcEventLog {
45 public: 51 public:
46 virtual ~RtcEventLog() {} 52 virtual ~RtcEventLog() {}
47 53
48 // Factory method to create an RtcEventLog object. 54 // Factory method to create an RtcEventLog object.
49 static std::unique_ptr<RtcEventLog> Create(); 55 // TODO(eladalon): Get rid of the default value after internal projects fixed.
56 static std::unique_ptr<RtcEventLog> Create(
57 EncodingType encoding_type = EncodingType::Legacy);
50 // TODO(nisse): webrtc::Clock is deprecated. Delete this method and 58 // TODO(nisse): webrtc::Clock is deprecated. Delete this method and
51 // above forward declaration of Clock when 59 // above forward declaration of Clock when
52 // webrtc/system_wrappers/include/clock.h is deleted. 60 // webrtc/system_wrappers/include/clock.h is deleted.
53 static std::unique_ptr<RtcEventLog> Create(const Clock* clock) { 61 // TODO(eladalon): Get rid of the default value after internal projects fixed.
54 return Create(); 62 static std::unique_ptr<RtcEventLog> Create(
63 const Clock* clock,
64 EncodingType encoding_type = EncodingType::Legacy) {
65 return Create(encoding_type);
55 } 66 }
56 67
57 // Create an RtcEventLog object that does nothing. 68 // Create an RtcEventLog object that does nothing.
58 static std::unique_ptr<RtcEventLog> CreateNull(); 69 static std::unique_ptr<RtcEventLog> CreateNull();
59 70
60 // Starts logging a maximum of max_size_bytes bytes to the specified file. 71 // Starts logging a maximum of max_size_bytes bytes to the specified file.
61 // If the file already exists it will be overwritten. 72 // If the file already exists it will be overwritten.
62 // If max_size_bytes <= 0, logging will be active until StopLogging is called. 73 // If max_size_bytes <= 0, logging will be active until StopLogging is called.
63 // The function has no effect and returns false if we can't start a new log 74 // The function has no effect and returns false if we can't start a new log
64 // e.g. because we are already logging or the file cannot be opened. 75 // e.g. because we are already logging or the file cannot be opened.
(...skipping 12 matching lines...) Expand all
77 88
78 // Deprecated. Pass an explicit file size limit. 89 // Deprecated. Pass an explicit file size limit.
79 RTC_DEPRECATED bool StartLogging(rtc::PlatformFile platform_file) { 90 RTC_DEPRECATED bool StartLogging(rtc::PlatformFile platform_file) {
80 return StartLogging(platform_file, 10000000); 91 return StartLogging(platform_file, 10000000);
81 } 92 }
82 93
83 // Stops logging to file and waits until the file has been closed, after 94 // Stops logging to file and waits until the file has been closed, after
84 // which it would be permissible to read and/or modify it. 95 // which it would be permissible to read and/or modify it.
85 virtual void StopLogging() = 0; 96 virtual void StopLogging() = 0;
86 97
98 // Log an RTC event (the type of event is determined by the subclass).
99 virtual void Log(std::unique_ptr<RtcEvent> event) = 0;
100
87 // Logs configuration information for a video receive stream. 101 // Logs configuration information for a video receive stream.
88 virtual void LogVideoReceiveStreamConfig( 102 RTC_DEPRECATED virtual void LogVideoReceiveStreamConfig(
89 const rtclog::StreamConfig& config) = 0; 103 const rtclog::StreamConfig& config) = 0;
90 104
91 // Logs configuration information for a video send stream. 105 // Logs configuration information for a video send stream.
92 virtual void LogVideoSendStreamConfig(const rtclog::StreamConfig& config) = 0; 106 RTC_DEPRECATED virtual void LogVideoSendStreamConfig(
107 const rtclog::StreamConfig& config) = 0;
93 108
94 // Logs configuration information for an audio receive stream. 109 // Logs configuration information for an audio receive stream.
95 virtual void LogAudioReceiveStreamConfig( 110 RTC_DEPRECATED virtual void LogAudioReceiveStreamConfig(
96 const rtclog::StreamConfig& config) = 0; 111 const rtclog::StreamConfig& config) = 0;
97 112
98 // Logs configuration information for an audio send stream. 113 // Logs configuration information for an audio send stream.
99 virtual void LogAudioSendStreamConfig(const rtclog::StreamConfig& config) = 0; 114 RTC_DEPRECATED virtual void LogAudioSendStreamConfig(
115 const rtclog::StreamConfig& config) = 0;
100 116
101 RTC_DEPRECATED virtual void LogRtpHeader(PacketDirection direction, 117 RTC_DEPRECATED virtual void LogRtpHeader(PacketDirection direction,
102 const uint8_t* header, 118 const uint8_t* header,
103 size_t packet_length) {} 119 size_t packet_length) {}
104 120
105 RTC_DEPRECATED virtual void LogRtpHeader(PacketDirection direction, 121 RTC_DEPRECATED virtual void LogRtpHeader(PacketDirection direction,
106 const uint8_t* header, 122 const uint8_t* header,
107 size_t packet_length, 123 size_t packet_length,
108 int probe_cluster_id) {} 124 int probe_cluster_id) {}
109 125
110 // Logs the header of an incoming RTP packet. |packet_length| 126 // Logs the header of an incoming RTP packet. |packet_length|
111 // is the total length of the packet, including both header and payload. 127 // is the total length of the packet, including both header and payload.
112 virtual void LogIncomingRtpHeader(const RtpPacketReceived& packet) = 0; 128 RTC_DEPRECATED virtual void LogIncomingRtpHeader(
129 const RtpPacketReceived& packet) = 0;
113 130
114 // Logs the header of an incoming RTP packet. |packet_length| 131 // Logs the header of an incoming RTP packet. |packet_length|
115 // is the total length of the packet, including both header and payload. 132 // is the total length of the packet, including both header and payload.
116 virtual void LogOutgoingRtpHeader(const RtpPacketToSend& packet, 133 RTC_DEPRECATED virtual void LogOutgoingRtpHeader(
117 int probe_cluster_id) = 0; 134 const RtpPacketToSend& packet,
135 int probe_cluster_id) = 0;
118 136
119 RTC_DEPRECATED virtual void LogRtcpPacket(PacketDirection direction, 137 RTC_DEPRECATED virtual void LogRtcpPacket(PacketDirection direction,
120 const uint8_t* header, 138 const uint8_t* header,
121 size_t packet_length) {} 139 size_t packet_length) {}
122 140
123 // Logs an incoming RTCP packet. 141 // Logs an incoming RTCP packet.
124 virtual void LogIncomingRtcpPacket(rtc::ArrayView<const uint8_t> packet) = 0; 142 RTC_DEPRECATED virtual void LogIncomingRtcpPacket(
143 rtc::ArrayView<const uint8_t> packet) = 0;
125 144
126 // Logs an outgoing RTCP packet. 145 // Logs an outgoing RTCP packet.
127 virtual void LogOutgoingRtcpPacket(rtc::ArrayView<const uint8_t> packet) = 0; 146 RTC_DEPRECATED virtual void LogOutgoingRtcpPacket(
147 rtc::ArrayView<const uint8_t> packet) = 0;
128 148
129 // Logs an audio playout event. 149 // Logs an audio playout event.
130 virtual void LogAudioPlayout(uint32_t ssrc) = 0; 150 RTC_DEPRECATED virtual void LogAudioPlayout(uint32_t ssrc) = 0;
131 151
132 // Logs a bitrate update from the bandwidth estimator based on packet loss. 152 // Logs a bitrate update from the bandwidth estimator based on packet loss.
133 virtual void LogLossBasedBweUpdate(int32_t bitrate_bps, 153 RTC_DEPRECATED virtual void LogLossBasedBweUpdate(int32_t bitrate_bps,
134 uint8_t fraction_loss, 154 uint8_t fraction_loss,
135 int32_t total_packets) = 0; 155 int32_t total_packets) = 0;
136 156
137 // Logs a bitrate update from the bandwidth estimator based on delay changes. 157 // Logs a bitrate update from the bandwidth estimator based on delay changes.
138 virtual void LogDelayBasedBweUpdate(int32_t bitrate_bps, 158 RTC_DEPRECATED virtual void LogDelayBasedBweUpdate(
139 BandwidthUsage detector_state) = 0; 159 int32_t bitrate_bps,
160 BandwidthUsage detector_state) = 0;
140 161
141 // Logs audio encoder re-configuration driven by audio network adaptor. 162 // Logs audio encoder re-configuration driven by audio network adaptor.
142 virtual void LogAudioNetworkAdaptation( 163 RTC_DEPRECATED virtual void LogAudioNetworkAdaptation(
143 const AudioEncoderRuntimeConfig& config) = 0; 164 const AudioEncoderRuntimeConfig& config) = 0;
144 165
145 // Logs when a probe cluster is created. 166 // Logs when a probe cluster is created.
146 virtual void LogProbeClusterCreated(int id, 167 RTC_DEPRECATED virtual void LogProbeClusterCreated(int id,
147 int bitrate_bps, 168 int bitrate_bps,
148 int min_probes, 169 int min_probes,
149 int min_bytes) = 0; 170 int min_bytes) = 0;
150 171
151 // Logs the result of a successful probing attempt. 172 // Logs the result of a successful probing attempt.
152 virtual void LogProbeResultSuccess(int id, int bitrate_bps) = 0; 173 RTC_DEPRECATED virtual void LogProbeResultSuccess(int id,
174 int bitrate_bps) = 0;
153 175
154 // Logs the result of an unsuccessful probing attempt. 176 // Logs the result of an unsuccessful probing attempt.
155 virtual void LogProbeResultFailure(int id, 177 RTC_DEPRECATED virtual void LogProbeResultFailure(
156 ProbeFailureReason failure_reason) = 0; 178 int id,
179 ProbeFailureReason failure_reason) = 0;
157 }; 180 };
158 181
159 // No-op implementation is used if flag is not set, or in tests. 182 // No-op implementation is used if flag is not set, or in tests.
160 class RtcEventLogNullImpl : public RtcEventLog { 183 class RtcEventLogNullImpl : public RtcEventLog {
161 public: 184 public:
162 bool StartLogging(const std::string& file_name, 185 bool StartLogging(const std::string& file_name,
163 int64_t max_size_bytes) override { 186 int64_t max_size_bytes) override {
164 return false; 187 return false;
165 } 188 }
166 bool StartLogging(rtc::PlatformFile platform_file, 189 bool StartLogging(rtc::PlatformFile platform_file,
167 int64_t max_size_bytes) override { 190 int64_t max_size_bytes) override {
168 return false; 191 return false;
169 } 192 }
170 void StopLogging() override {} 193 void StopLogging() override {}
194 void Log(std::unique_ptr<RtcEvent> event) override {}
171 void LogVideoReceiveStreamConfig( 195 void LogVideoReceiveStreamConfig(
172 const rtclog::StreamConfig& config) override {} 196 const rtclog::StreamConfig& config) override {}
173 void LogVideoSendStreamConfig(const rtclog::StreamConfig& config) override {} 197 void LogVideoSendStreamConfig(const rtclog::StreamConfig& config) override {}
174 void LogAudioReceiveStreamConfig( 198 void LogAudioReceiveStreamConfig(
175 const rtclog::StreamConfig& config) override {} 199 const rtclog::StreamConfig& config) override {}
176 void LogAudioSendStreamConfig(const rtclog::StreamConfig& config) override {} 200 void LogAudioSendStreamConfig(const rtclog::StreamConfig& config) override {}
177 void LogIncomingRtpHeader(const RtpPacketReceived& packet) override {} 201 void LogIncomingRtpHeader(const RtpPacketReceived& packet) override {}
178 void LogOutgoingRtpHeader(const RtpPacketToSend& packet, 202 void LogOutgoingRtpHeader(const RtpPacketToSend& packet,
179 int probe_cluster_id) override {} 203 int probe_cluster_id) override {}
180 void LogIncomingRtcpPacket(rtc::ArrayView<const uint8_t> packet) override {} 204 void LogIncomingRtcpPacket(rtc::ArrayView<const uint8_t> packet) override {}
(...skipping 11 matching lines...) Expand all
192 int min_probes, 216 int min_probes,
193 int min_bytes) override{}; 217 int min_bytes) override{};
194 void LogProbeResultSuccess(int id, int bitrate_bps) override{}; 218 void LogProbeResultSuccess(int id, int bitrate_bps) override{};
195 void LogProbeResultFailure(int id, 219 void LogProbeResultFailure(int id,
196 ProbeFailureReason failure_reason) override{}; 220 ProbeFailureReason failure_reason) override{};
197 }; 221 };
198 222
199 } // namespace webrtc 223 } // namespace webrtc
200 224
201 #endif // WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_H_ 225 #endif // WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_H_
OLDNEW
« no previous file with comments | « webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h ('k') | webrtc/logging/rtc_event_log/rtc_event_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698