blob: 8392231218953331da532ed8d2914fb554e8217f [file] [log] [blame]
hbosd565b732016-08-30 14:04:35 -07001/*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef API_STATS_RTCSTATS_OBJECTS_H_
12#define API_STATS_RTCSTATS_OBJECTS_H_
hbosd565b732016-08-30 14:04:35 -070013
Henrik Boström1df1bf82018-03-20 13:24:20 +010014#include <memory>
hbosd565b732016-08-30 14:04:35 -070015#include <string>
oprypin803dc292017-02-01 01:55:59 -080016#include <vector>
hbosd565b732016-08-30 14:04:35 -070017
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020018#include "api/stats/rtcstats.h"
Mirko Bonadei276827c2018-10-16 14:13:50 +020019#include "rtc_base/system/rtc_export.h"
hbosd565b732016-08-30 14:04:35 -070020
21namespace webrtc {
22
hboscc555c52016-10-18 12:48:31 -070023// https://w3c.github.io/webrtc-pc/#idl-def-rtcdatachannelstate
24struct RTCDataChannelState {
agrieve26622d32017-08-08 10:48:15 -070025 static const char* const kConnecting;
26 static const char* const kOpen;
27 static const char* const kClosing;
28 static const char* const kClosed;
hboscc555c52016-10-18 12:48:31 -070029};
30
hbosc47a0c32016-10-11 14:54:49 -070031// https://w3c.github.io/webrtc-stats/#dom-rtcstatsicecandidatepairstate
32struct RTCStatsIceCandidatePairState {
agrieve26622d32017-08-08 10:48:15 -070033 static const char* const kFrozen;
34 static const char* const kWaiting;
35 static const char* const kInProgress;
36 static const char* const kFailed;
37 static const char* const kSucceeded;
hbosc47a0c32016-10-11 14:54:49 -070038};
39
hboscc555c52016-10-18 12:48:31 -070040// https://w3c.github.io/webrtc-pc/#rtcicecandidatetype-enum
hbosab9f6e42016-10-07 02:18:47 -070041struct RTCIceCandidateType {
agrieve26622d32017-08-08 10:48:15 -070042 static const char* const kHost;
43 static const char* const kSrflx;
44 static const char* const kPrflx;
45 static const char* const kRelay;
hbosab9f6e42016-10-07 02:18:47 -070046};
47
hbos7064d592017-01-16 07:38:02 -080048// https://w3c.github.io/webrtc-pc/#idl-def-rtcdtlstransportstate
49struct RTCDtlsTransportState {
agrieve26622d32017-08-08 10:48:15 -070050 static const char* const kNew;
51 static const char* const kConnecting;
52 static const char* const kConnected;
53 static const char* const kClosed;
54 static const char* const kFailed;
hbos7064d592017-01-16 07:38:02 -080055};
56
hbos160e4a72017-01-17 02:53:23 -080057// |RTCMediaStreamTrackStats::kind| is not an enum in the spec but the only
58// valid values are "audio" and "video".
59// https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats-kind
60struct RTCMediaStreamTrackKind {
agrieve26622d32017-08-08 10:48:15 -070061 static const char* const kAudio;
62 static const char* const kVideo;
hbos160e4a72017-01-17 02:53:23 -080063};
64
Gary Liu37e489c2017-11-21 10:49:36 -080065// https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype
66struct RTCNetworkType {
67 static const char* const kBluetooth;
68 static const char* const kCellular;
69 static const char* const kEthernet;
70 static const char* const kWifi;
71 static const char* const kWimax;
72 static const char* const kVpn;
73 static const char* const kUnknown;
74};
75
hbos2fa7c672016-10-24 04:00:05 -070076// https://w3c.github.io/webrtc-stats/#certificatestats-dict*
Mirko Bonadei276827c2018-10-16 14:13:50 +020077class RTC_EXPORT RTCCertificateStats final : public RTCStats {
hbos2fa7c672016-10-24 04:00:05 -070078 public:
79 WEBRTC_RTCSTATS_DECL();
80
81 RTCCertificateStats(const std::string& id, int64_t timestamp_us);
82 RTCCertificateStats(std::string&& id, int64_t timestamp_us);
83 RTCCertificateStats(const RTCCertificateStats& other);
84 ~RTCCertificateStats() override;
85
86 RTCStatsMember<std::string> fingerprint;
87 RTCStatsMember<std::string> fingerprint_algorithm;
88 RTCStatsMember<std::string> base64_certificate;
89 RTCStatsMember<std::string> issuer_certificate_id;
90};
91
hbos0adb8282016-11-23 02:32:06 -080092// https://w3c.github.io/webrtc-stats/#codec-dict*
Mirko Bonadei276827c2018-10-16 14:13:50 +020093class RTC_EXPORT RTCCodecStats final : public RTCStats {
hbos0adb8282016-11-23 02:32:06 -080094 public:
95 WEBRTC_RTCSTATS_DECL();
96
97 RTCCodecStats(const std::string& id, int64_t timestamp_us);
98 RTCCodecStats(std::string&& id, int64_t timestamp_us);
99 RTCCodecStats(const RTCCodecStats& other);
100 ~RTCCodecStats() override;
101
102 RTCStatsMember<uint32_t> payload_type;
hbos13f54b22017-02-28 06:56:04 -0800103 RTCStatsMember<std::string> mime_type;
hbos0adb8282016-11-23 02:32:06 -0800104 RTCStatsMember<uint32_t> clock_rate;
hbos585a9b12017-02-07 04:59:16 -0800105 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7061
hbos0adb8282016-11-23 02:32:06 -0800106 RTCStatsMember<uint32_t> channels;
hbos585a9b12017-02-07 04:59:16 -0800107 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7061
hbos13f54b22017-02-28 06:56:04 -0800108 RTCStatsMember<std::string> sdp_fmtp_line;
hbos585a9b12017-02-07 04:59:16 -0800109 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7061
hbos0adb8282016-11-23 02:32:06 -0800110 RTCStatsMember<std::string> implementation;
111};
112
hbos2fa7c672016-10-24 04:00:05 -0700113// https://w3c.github.io/webrtc-stats/#dcstats-dict*
Mirko Bonadei276827c2018-10-16 14:13:50 +0200114class RTC_EXPORT RTCDataChannelStats final : public RTCStats {
hbos2fa7c672016-10-24 04:00:05 -0700115 public:
116 WEBRTC_RTCSTATS_DECL();
117
118 RTCDataChannelStats(const std::string& id, int64_t timestamp_us);
119 RTCDataChannelStats(std::string&& id, int64_t timestamp_us);
120 RTCDataChannelStats(const RTCDataChannelStats& other);
121 ~RTCDataChannelStats() override;
122
123 RTCStatsMember<std::string> label;
124 RTCStatsMember<std::string> protocol;
125 RTCStatsMember<int32_t> datachannelid;
126 // TODO(hbos): Support enum types? "RTCStatsMember<RTCDataChannelState>"?
127 RTCStatsMember<std::string> state;
128 RTCStatsMember<uint32_t> messages_sent;
129 RTCStatsMember<uint64_t> bytes_sent;
130 RTCStatsMember<uint32_t> messages_received;
131 RTCStatsMember<uint64_t> bytes_received;
132};
133
134// https://w3c.github.io/webrtc-stats/#candidatepair-dict*
hbos338f78a2017-02-07 06:41:21 -0800135// TODO(hbos): Tracking bug https://bugs.webrtc.org/7062
Mirko Bonadei276827c2018-10-16 14:13:50 +0200136class RTC_EXPORT RTCIceCandidatePairStats final : public RTCStats {
hbosc47a0c32016-10-11 14:54:49 -0700137 public:
138 WEBRTC_RTCSTATS_DECL();
139
140 RTCIceCandidatePairStats(const std::string& id, int64_t timestamp_us);
141 RTCIceCandidatePairStats(std::string&& id, int64_t timestamp_us);
142 RTCIceCandidatePairStats(const RTCIceCandidatePairStats& other);
143 ~RTCIceCandidatePairStats() override;
144
145 RTCStatsMember<std::string> transport_id;
146 RTCStatsMember<std::string> local_candidate_id;
147 RTCStatsMember<std::string> remote_candidate_id;
148 // TODO(hbos): Support enum types?
149 // "RTCStatsMember<RTCStatsIceCandidatePairState>"?
150 RTCStatsMember<std::string> state;
151 RTCStatsMember<uint64_t> priority;
152 RTCStatsMember<bool> nominated;
hbos338f78a2017-02-07 06:41:21 -0800153 // TODO(hbos): Collect this the way the spec describes it. We have a value for
154 // it but it is not spec-compliant. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700155 RTCStatsMember<bool> writable;
hbos338f78a2017-02-07 06:41:21 -0800156 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700157 RTCStatsMember<bool> readable;
158 RTCStatsMember<uint64_t> bytes_sent;
159 RTCStatsMember<uint64_t> bytes_received;
hbos3168c7a2016-12-15 06:17:08 -0800160 RTCStatsMember<double> total_round_trip_time;
hbos3168c7a2016-12-15 06:17:08 -0800161 RTCStatsMember<double> current_round_trip_time;
hbosc47a0c32016-10-11 14:54:49 -0700162 RTCStatsMember<double> available_outgoing_bitrate;
hbos338f78a2017-02-07 06:41:21 -0800163 // TODO(hbos): Populate this value. It is wired up and collected the same way
hbosbf8d3e52017-02-28 06:34:47 -0800164 // "VideoBwe.googAvailableReceiveBandwidth" is, but that value is always
hbos338f78a2017-02-07 06:41:21 -0800165 // undefined. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700166 RTCStatsMember<double> available_incoming_bitrate;
167 RTCStatsMember<uint64_t> requests_received;
168 RTCStatsMember<uint64_t> requests_sent;
169 RTCStatsMember<uint64_t> responses_received;
170 RTCStatsMember<uint64_t> responses_sent;
hbos338f78a2017-02-07 06:41:21 -0800171 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700172 RTCStatsMember<uint64_t> retransmissions_received;
hbos338f78a2017-02-07 06:41:21 -0800173 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700174 RTCStatsMember<uint64_t> retransmissions_sent;
hbos338f78a2017-02-07 06:41:21 -0800175 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700176 RTCStatsMember<uint64_t> consent_requests_received;
177 RTCStatsMember<uint64_t> consent_requests_sent;
hbos338f78a2017-02-07 06:41:21 -0800178 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700179 RTCStatsMember<uint64_t> consent_responses_received;
hbos338f78a2017-02-07 06:41:21 -0800180 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700181 RTCStatsMember<uint64_t> consent_responses_sent;
182};
183
hbosab9f6e42016-10-07 02:18:47 -0700184// https://w3c.github.io/webrtc-stats/#icecandidate-dict*
hbos5d79a7c2016-10-24 09:27:10 -0700185// TODO(hbos): |RTCStatsCollector| only collects candidates that are part of
186// ice candidate pairs, but there could be candidates not paired with anything.
187// crbug.com/632723
Qingsi Wang72a43a12018-02-20 16:03:18 -0800188// TODO(qingsi): Add the stats of STUN binding requests (keepalives) and collect
189// them in the new PeerConnection::GetStats.
Mirko Bonadei276827c2018-10-16 14:13:50 +0200190class RTC_EXPORT RTCIceCandidateStats : public RTCStats {
hbosab9f6e42016-10-07 02:18:47 -0700191 public:
192 WEBRTC_RTCSTATS_DECL();
193
194 RTCIceCandidateStats(const RTCIceCandidateStats& other);
195 ~RTCIceCandidateStats() override;
196
hbosb4e426e2017-01-02 09:59:31 -0800197 RTCStatsMember<std::string> transport_id;
hbosc3a2b7f2017-01-02 04:46:15 -0800198 RTCStatsMember<bool> is_remote;
Gary Liu37e489c2017-11-21 10:49:36 -0800199 RTCStatsMember<std::string> network_type;
hbosab9f6e42016-10-07 02:18:47 -0700200 RTCStatsMember<std::string> ip;
201 RTCStatsMember<int32_t> port;
202 RTCStatsMember<std::string> protocol;
Philipp Hancke95513752018-09-27 14:40:08 +0200203 RTCStatsMember<std::string> relay_protocol;
hbosab9f6e42016-10-07 02:18:47 -0700204 // TODO(hbos): Support enum types? "RTCStatsMember<RTCIceCandidateType>"?
205 RTCStatsMember<std::string> candidate_type;
206 RTCStatsMember<int32_t> priority;
hbos5d79a7c2016-10-24 09:27:10 -0700207 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/632723
hbosab9f6e42016-10-07 02:18:47 -0700208 RTCStatsMember<std::string> url;
hbosd17a5a72017-01-02 08:09:59 -0800209 // TODO(hbos): |deleted = true| case is not supported by |RTCStatsCollector|.
210 // crbug.com/632723
211 RTCStatsMember<bool> deleted; // = false
hbosab9f6e42016-10-07 02:18:47 -0700212
213 protected:
Yves Gerey665174f2018-06-19 15:03:05 +0200214 RTCIceCandidateStats(const std::string& id,
215 int64_t timestamp_us,
216 bool is_remote);
hbosc3a2b7f2017-01-02 04:46:15 -0800217 RTCIceCandidateStats(std::string&& id, int64_t timestamp_us, bool is_remote);
hbosab9f6e42016-10-07 02:18:47 -0700218};
219
220// In the spec both local and remote varieties are of type RTCIceCandidateStats.
221// But here we define them as subclasses of |RTCIceCandidateStats| because the
222// |kType| need to be different ("RTCStatsType type") in the local/remote case.
223// https://w3c.github.io/webrtc-stats/#rtcstatstype-str*
Henrik Boström1df1bf82018-03-20 13:24:20 +0100224// This forces us to have to override copy() and type().
Mirko Bonadei276827c2018-10-16 14:13:50 +0200225class RTC_EXPORT RTCLocalIceCandidateStats final : public RTCIceCandidateStats {
hbosab9f6e42016-10-07 02:18:47 -0700226 public:
227 static const char kType[];
228 RTCLocalIceCandidateStats(const std::string& id, int64_t timestamp_us);
229 RTCLocalIceCandidateStats(std::string&& id, int64_t timestamp_us);
Henrik Boström1df1bf82018-03-20 13:24:20 +0100230 std::unique_ptr<RTCStats> copy() const override;
hbosab9f6e42016-10-07 02:18:47 -0700231 const char* type() const override;
232};
233
Mirko Bonadei276827c2018-10-16 14:13:50 +0200234class RTC_EXPORT RTCRemoteIceCandidateStats final
235 : public RTCIceCandidateStats {
hbosab9f6e42016-10-07 02:18:47 -0700236 public:
237 static const char kType[];
238 RTCRemoteIceCandidateStats(const std::string& id, int64_t timestamp_us);
239 RTCRemoteIceCandidateStats(std::string&& id, int64_t timestamp_us);
Henrik Boström1df1bf82018-03-20 13:24:20 +0100240 std::unique_ptr<RTCStats> copy() const override;
hbosab9f6e42016-10-07 02:18:47 -0700241 const char* type() const override;
242};
243
hbos09bc1282016-11-08 06:29:22 -0800244// https://w3c.github.io/webrtc-stats/#msstats-dict*
hbos0adb8282016-11-23 02:32:06 -0800245// TODO(hbos): Tracking bug crbug.com/660827
Mirko Bonadei276827c2018-10-16 14:13:50 +0200246class RTC_EXPORT RTCMediaStreamStats final : public RTCStats {
hbos09bc1282016-11-08 06:29:22 -0800247 public:
248 WEBRTC_RTCSTATS_DECL();
249
250 RTCMediaStreamStats(const std::string& id, int64_t timestamp_us);
251 RTCMediaStreamStats(std::string&& id, int64_t timestamp_us);
252 RTCMediaStreamStats(const RTCMediaStreamStats& other);
253 ~RTCMediaStreamStats() override;
254
255 RTCStatsMember<std::string> stream_identifier;
256 RTCStatsMember<std::vector<std::string>> track_ids;
257};
258
259// https://w3c.github.io/webrtc-stats/#mststats-dict*
hbos0adb8282016-11-23 02:32:06 -0800260// TODO(hbos): Tracking bug crbug.com/659137
Mirko Bonadei276827c2018-10-16 14:13:50 +0200261class RTC_EXPORT RTCMediaStreamTrackStats final : public RTCStats {
hbos09bc1282016-11-08 06:29:22 -0800262 public:
263 WEBRTC_RTCSTATS_DECL();
264
Yves Gerey665174f2018-06-19 15:03:05 +0200265 RTCMediaStreamTrackStats(const std::string& id,
266 int64_t timestamp_us,
hbos160e4a72017-01-17 02:53:23 -0800267 const char* kind);
Yves Gerey665174f2018-06-19 15:03:05 +0200268 RTCMediaStreamTrackStats(std::string&& id,
269 int64_t timestamp_us,
hbos160e4a72017-01-17 02:53:23 -0800270 const char* kind);
hbos09bc1282016-11-08 06:29:22 -0800271 RTCMediaStreamTrackStats(const RTCMediaStreamTrackStats& other);
272 ~RTCMediaStreamTrackStats() override;
273
274 RTCStatsMember<std::string> track_identifier;
275 RTCStatsMember<bool> remote_source;
276 RTCStatsMember<bool> ended;
277 // TODO(hbos): |RTCStatsCollector| does not return stats for detached tracks.
278 // crbug.com/659137
279 RTCStatsMember<bool> detached;
hbos160e4a72017-01-17 02:53:23 -0800280 // See |RTCMediaStreamTrackKind| for valid values.
281 RTCStatsMember<std::string> kind;
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200282 // TODO(gustaf): Implement jitter_buffer_delay for video (currently
283 // implemented for audio only).
284 // https://crbug.com/webrtc/8318
285 RTCStatsMember<double> jitter_buffer_delay;
hbos09bc1282016-11-08 06:29:22 -0800286 // Video-only members
287 RTCStatsMember<uint32_t> frame_width;
288 RTCStatsMember<uint32_t> frame_height;
289 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137
290 RTCStatsMember<double> frames_per_second;
hbos09bc1282016-11-08 06:29:22 -0800291 RTCStatsMember<uint32_t> frames_sent;
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100292 RTCStatsMember<uint32_t> huge_frames_sent;
hbos09bc1282016-11-08 06:29:22 -0800293 RTCStatsMember<uint32_t> frames_received;
hbos09bc1282016-11-08 06:29:22 -0800294 RTCStatsMember<uint32_t> frames_decoded;
hbos09bc1282016-11-08 06:29:22 -0800295 RTCStatsMember<uint32_t> frames_dropped;
296 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137
297 RTCStatsMember<uint32_t> frames_corrupted;
298 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137
299 RTCStatsMember<uint32_t> partial_frames_lost;
300 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137
301 RTCStatsMember<uint32_t> full_frames_lost;
302 // Audio-only members
303 RTCStatsMember<double> audio_level;
zsteine76bd3a2017-07-14 12:17:49 -0700304 RTCStatsMember<double> total_audio_energy;
hbos09bc1282016-11-08 06:29:22 -0800305 RTCStatsMember<double> echo_return_loss;
306 RTCStatsMember<double> echo_return_loss_enhancement;
Steve Anton2dbc69f2017-08-24 17:15:13 -0700307 RTCStatsMember<uint64_t> total_samples_received;
308 RTCStatsMember<double> total_samples_duration;
309 RTCStatsMember<uint64_t> concealed_samples;
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200310 RTCStatsMember<uint64_t> concealment_events;
Ruslan Burakov8af88962018-11-22 17:21:10 +0100311 // Non-standard audio-only member
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100312 // TODO(kuddai): Add description to standard. crbug.com/webrtc/10042
Ruslan Burakov8af88962018-11-22 17:21:10 +0100313 RTCNonStandardStatsMember<uint64_t> jitter_buffer_flushes;
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100314 RTCNonStandardStatsMember<uint64_t> delayed_packet_outage_samples;
hbos09bc1282016-11-08 06:29:22 -0800315};
316
hbos6ab97ce2016-10-03 14:16:56 -0700317// https://w3c.github.io/webrtc-stats/#pcstats-dict*
Mirko Bonadei276827c2018-10-16 14:13:50 +0200318class RTC_EXPORT RTCPeerConnectionStats final : public RTCStats {
hbosd565b732016-08-30 14:04:35 -0700319 public:
hbosfc5e0502016-10-06 02:06:10 -0700320 WEBRTC_RTCSTATS_DECL();
321
hbos0e6758d2016-08-31 07:57:36 -0700322 RTCPeerConnectionStats(const std::string& id, int64_t timestamp_us);
323 RTCPeerConnectionStats(std::string&& id, int64_t timestamp_us);
hbosfc5e0502016-10-06 02:06:10 -0700324 RTCPeerConnectionStats(const RTCPeerConnectionStats& other);
325 ~RTCPeerConnectionStats() override;
hbosd565b732016-08-30 14:04:35 -0700326
327 RTCStatsMember<uint32_t> data_channels_opened;
328 RTCStatsMember<uint32_t> data_channels_closed;
329};
330
hbos6ded1902016-11-01 01:50:46 -0700331// https://w3c.github.io/webrtc-stats/#streamstats-dict*
hbos0adb8282016-11-23 02:32:06 -0800332// TODO(hbos): Tracking bug crbug.com/657854
Mirko Bonadei276827c2018-10-16 14:13:50 +0200333class RTC_EXPORT RTCRTPStreamStats : public RTCStats {
hbos6ded1902016-11-01 01:50:46 -0700334 public:
335 WEBRTC_RTCSTATS_DECL();
336
337 RTCRTPStreamStats(const RTCRTPStreamStats& other);
338 ~RTCRTPStreamStats() override;
339
hbos3443bb72017-02-07 06:28:11 -0800340 RTCStatsMember<uint32_t> ssrc;
hbos6ded1902016-11-01 01:50:46 -0700341 // TODO(hbos): When the remote case is supported |RTCStatsCollector| needs to
342 // set this. crbug.com/657855, 657856
343 RTCStatsMember<std::string> associate_stats_id;
344 // TODO(hbos): Remote case not supported by |RTCStatsCollector|.
345 // crbug.com/657855, 657856
346 RTCStatsMember<bool> is_remote; // = false
Philipp Hancke3bc01662018-08-28 14:55:03 +0200347 RTCStatsMember<std::string> media_type; // renamed to kind.
348 RTCStatsMember<std::string> kind;
hbosb0ae9202017-01-27 06:35:16 -0800349 RTCStatsMember<std::string> track_id;
hbos6ded1902016-11-01 01:50:46 -0700350 RTCStatsMember<std::string> transport_id;
hbos6ded1902016-11-01 01:50:46 -0700351 RTCStatsMember<std::string> codec_id;
352 // FIR and PLI counts are only defined for |media_type == "video"|.
353 RTCStatsMember<uint32_t> fir_count;
354 RTCStatsMember<uint32_t> pli_count;
355 // TODO(hbos): NACK count should be collected by |RTCStatsCollector| for both
356 // audio and video but is only defined in the "video" case. crbug.com/657856
357 RTCStatsMember<uint32_t> nack_count;
358 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657854
359 // SLI count is only defined for |media_type == "video"|.
360 RTCStatsMember<uint32_t> sli_count;
hbos6769c492017-01-02 08:35:13 -0800361 RTCStatsMember<uint64_t> qp_sum;
hbos6ded1902016-11-01 01:50:46 -0700362
363 protected:
364 RTCRTPStreamStats(const std::string& id, int64_t timestamp_us);
365 RTCRTPStreamStats(std::string&& id, int64_t timestamp_us);
366};
367
hboseeafe942016-11-01 03:00:17 -0700368// https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict*
hbosa7a9be12017-03-01 01:02:45 -0800369// TODO(hbos): Support the remote case |is_remote = true|.
370// https://bugs.webrtc.org/7065
Mirko Bonadei276827c2018-10-16 14:13:50 +0200371class RTC_EXPORT RTCInboundRTPStreamStats final : public RTCRTPStreamStats {
hboseeafe942016-11-01 03:00:17 -0700372 public:
373 WEBRTC_RTCSTATS_DECL();
374
375 RTCInboundRTPStreamStats(const std::string& id, int64_t timestamp_us);
376 RTCInboundRTPStreamStats(std::string&& id, int64_t timestamp_us);
377 RTCInboundRTPStreamStats(const RTCInboundRTPStreamStats& other);
378 ~RTCInboundRTPStreamStats() override;
379
380 RTCStatsMember<uint32_t> packets_received;
381 RTCStatsMember<uint64_t> bytes_received;
Harald Alvestrand719487e2017-12-13 12:26:04 +0100382 RTCStatsMember<int32_t> packets_lost; // Signed per RFC 3550
hbosa7a9be12017-03-01 01:02:45 -0800383 // TODO(hbos): Collect and populate this value for both "audio" and "video",
384 // currently not collected for "video". https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700385 RTCStatsMember<double> jitter;
386 RTCStatsMember<double> fraction_lost;
hbosa7a9be12017-03-01 01:02:45 -0800387 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
388 RTCStatsMember<double> round_trip_time;
389 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700390 RTCStatsMember<uint32_t> packets_discarded;
hbosa7a9be12017-03-01 01:02:45 -0800391 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700392 RTCStatsMember<uint32_t> packets_repaired;
hbosa7a9be12017-03-01 01:02:45 -0800393 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700394 RTCStatsMember<uint32_t> burst_packets_lost;
hbosa7a9be12017-03-01 01:02:45 -0800395 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700396 RTCStatsMember<uint32_t> burst_packets_discarded;
hbosa7a9be12017-03-01 01:02:45 -0800397 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700398 RTCStatsMember<uint32_t> burst_loss_count;
hbosa7a9be12017-03-01 01:02:45 -0800399 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700400 RTCStatsMember<uint32_t> burst_discard_count;
hbosa7a9be12017-03-01 01:02:45 -0800401 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700402 RTCStatsMember<double> burst_loss_rate;
hbosa7a9be12017-03-01 01:02:45 -0800403 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700404 RTCStatsMember<double> burst_discard_rate;
hbosa7a9be12017-03-01 01:02:45 -0800405 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700406 RTCStatsMember<double> gap_loss_rate;
hbosa7a9be12017-03-01 01:02:45 -0800407 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700408 RTCStatsMember<double> gap_discard_rate;
hbos6769c492017-01-02 08:35:13 -0800409 RTCStatsMember<uint32_t> frames_decoded;
hboseeafe942016-11-01 03:00:17 -0700410};
411
hbos6ded1902016-11-01 01:50:46 -0700412// https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict*
hbosa7a9be12017-03-01 01:02:45 -0800413// TODO(hbos): Support the remote case |is_remote = true|.
414// https://bugs.webrtc.org/7066
Mirko Bonadei276827c2018-10-16 14:13:50 +0200415class RTC_EXPORT RTCOutboundRTPStreamStats final : public RTCRTPStreamStats {
hbos6ded1902016-11-01 01:50:46 -0700416 public:
417 WEBRTC_RTCSTATS_DECL();
418
419 RTCOutboundRTPStreamStats(const std::string& id, int64_t timestamp_us);
420 RTCOutboundRTPStreamStats(std::string&& id, int64_t timestamp_us);
421 RTCOutboundRTPStreamStats(const RTCOutboundRTPStreamStats& other);
422 ~RTCOutboundRTPStreamStats() override;
423
424 RTCStatsMember<uint32_t> packets_sent;
425 RTCStatsMember<uint64_t> bytes_sent;
hbosa7a9be12017-03-01 01:02:45 -0800426 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7066
hbos6ded1902016-11-01 01:50:46 -0700427 RTCStatsMember<double> target_bitrate;
hbos6769c492017-01-02 08:35:13 -0800428 RTCStatsMember<uint32_t> frames_encoded;
hbos6ded1902016-11-01 01:50:46 -0700429};
430
hbos2fa7c672016-10-24 04:00:05 -0700431// https://w3c.github.io/webrtc-stats/#transportstats-dict*
Mirko Bonadei276827c2018-10-16 14:13:50 +0200432class RTC_EXPORT RTCTransportStats final : public RTCStats {
hbos2fa7c672016-10-24 04:00:05 -0700433 public:
434 WEBRTC_RTCSTATS_DECL();
435
436 RTCTransportStats(const std::string& id, int64_t timestamp_us);
437 RTCTransportStats(std::string&& id, int64_t timestamp_us);
438 RTCTransportStats(const RTCTransportStats& other);
439 ~RTCTransportStats() override;
440
441 RTCStatsMember<uint64_t> bytes_sent;
442 RTCStatsMember<uint64_t> bytes_received;
443 RTCStatsMember<std::string> rtcp_transport_stats_id;
hbos7064d592017-01-16 07:38:02 -0800444 // TODO(hbos): Support enum types? "RTCStatsMember<RTCDtlsTransportState>"?
445 RTCStatsMember<std::string> dtls_state;
hbos2fa7c672016-10-24 04:00:05 -0700446 RTCStatsMember<std::string> selected_candidate_pair_id;
447 RTCStatsMember<std::string> local_certificate_id;
448 RTCStatsMember<std::string> remote_certificate_id;
449};
450
hbosd565b732016-08-30 14:04:35 -0700451} // namespace webrtc
452
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200453#endif // API_STATS_RTCSTATS_OBJECTS_H_