blob: 208a3001daffbd35b3e8b516a5c771ab3a1bb65c [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
14#include <string>
oprypin803dc292017-02-01 01:55:59 -080015#include <vector>
hbosd565b732016-08-30 14:04:35 -070016
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "api/stats/rtcstats.h"
hbosd565b732016-08-30 14:04:35 -070018
19namespace webrtc {
20
hboscc555c52016-10-18 12:48:31 -070021// https://w3c.github.io/webrtc-pc/#idl-def-rtcdatachannelstate
22struct RTCDataChannelState {
agrieve26622d32017-08-08 10:48:15 -070023 static const char* const kConnecting;
24 static const char* const kOpen;
25 static const char* const kClosing;
26 static const char* const kClosed;
hboscc555c52016-10-18 12:48:31 -070027};
28
hbosc47a0c32016-10-11 14:54:49 -070029// https://w3c.github.io/webrtc-stats/#dom-rtcstatsicecandidatepairstate
30struct RTCStatsIceCandidatePairState {
agrieve26622d32017-08-08 10:48:15 -070031 static const char* const kFrozen;
32 static const char* const kWaiting;
33 static const char* const kInProgress;
34 static const char* const kFailed;
35 static const char* const kSucceeded;
hbosc47a0c32016-10-11 14:54:49 -070036};
37
hboscc555c52016-10-18 12:48:31 -070038// https://w3c.github.io/webrtc-pc/#rtcicecandidatetype-enum
hbosab9f6e42016-10-07 02:18:47 -070039struct RTCIceCandidateType {
agrieve26622d32017-08-08 10:48:15 -070040 static const char* const kHost;
41 static const char* const kSrflx;
42 static const char* const kPrflx;
43 static const char* const kRelay;
hbosab9f6e42016-10-07 02:18:47 -070044};
45
hbos7064d592017-01-16 07:38:02 -080046// https://w3c.github.io/webrtc-pc/#idl-def-rtcdtlstransportstate
47struct RTCDtlsTransportState {
agrieve26622d32017-08-08 10:48:15 -070048 static const char* const kNew;
49 static const char* const kConnecting;
50 static const char* const kConnected;
51 static const char* const kClosed;
52 static const char* const kFailed;
hbos7064d592017-01-16 07:38:02 -080053};
54
hbos160e4a72017-01-17 02:53:23 -080055// |RTCMediaStreamTrackStats::kind| is not an enum in the spec but the only
56// valid values are "audio" and "video".
57// https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats-kind
58struct RTCMediaStreamTrackKind {
agrieve26622d32017-08-08 10:48:15 -070059 static const char* const kAudio;
60 static const char* const kVideo;
hbos160e4a72017-01-17 02:53:23 -080061};
62
Gary Liu37e489c2017-11-21 10:49:36 -080063// https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype
64struct RTCNetworkType {
65 static const char* const kBluetooth;
66 static const char* const kCellular;
67 static const char* const kEthernet;
68 static const char* const kWifi;
69 static const char* const kWimax;
70 static const char* const kVpn;
71 static const char* const kUnknown;
72};
73
hbos2fa7c672016-10-24 04:00:05 -070074// https://w3c.github.io/webrtc-stats/#certificatestats-dict*
75class RTCCertificateStats final : public RTCStats {
76 public:
77 WEBRTC_RTCSTATS_DECL();
78
79 RTCCertificateStats(const std::string& id, int64_t timestamp_us);
80 RTCCertificateStats(std::string&& id, int64_t timestamp_us);
81 RTCCertificateStats(const RTCCertificateStats& other);
82 ~RTCCertificateStats() override;
83
84 RTCStatsMember<std::string> fingerprint;
85 RTCStatsMember<std::string> fingerprint_algorithm;
86 RTCStatsMember<std::string> base64_certificate;
87 RTCStatsMember<std::string> issuer_certificate_id;
88};
89
hbos0adb8282016-11-23 02:32:06 -080090// https://w3c.github.io/webrtc-stats/#codec-dict*
hbos0adb8282016-11-23 02:32:06 -080091class RTCCodecStats final : public RTCStats {
92 public:
93 WEBRTC_RTCSTATS_DECL();
94
95 RTCCodecStats(const std::string& id, int64_t timestamp_us);
96 RTCCodecStats(std::string&& id, int64_t timestamp_us);
97 RTCCodecStats(const RTCCodecStats& other);
98 ~RTCCodecStats() override;
99
100 RTCStatsMember<uint32_t> payload_type;
hbos13f54b22017-02-28 06:56:04 -0800101 RTCStatsMember<std::string> mime_type;
hbos0adb8282016-11-23 02:32:06 -0800102 RTCStatsMember<uint32_t> clock_rate;
hbos585a9b12017-02-07 04:59:16 -0800103 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7061
hbos0adb8282016-11-23 02:32:06 -0800104 RTCStatsMember<uint32_t> channels;
hbos585a9b12017-02-07 04:59:16 -0800105 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7061
hbos13f54b22017-02-28 06:56:04 -0800106 RTCStatsMember<std::string> sdp_fmtp_line;
hbos585a9b12017-02-07 04:59:16 -0800107 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7061
hbos0adb8282016-11-23 02:32:06 -0800108 RTCStatsMember<std::string> implementation;
109};
110
hbos2fa7c672016-10-24 04:00:05 -0700111// https://w3c.github.io/webrtc-stats/#dcstats-dict*
112class RTCDataChannelStats final : public RTCStats {
113 public:
114 WEBRTC_RTCSTATS_DECL();
115
116 RTCDataChannelStats(const std::string& id, int64_t timestamp_us);
117 RTCDataChannelStats(std::string&& id, int64_t timestamp_us);
118 RTCDataChannelStats(const RTCDataChannelStats& other);
119 ~RTCDataChannelStats() override;
120
121 RTCStatsMember<std::string> label;
122 RTCStatsMember<std::string> protocol;
123 RTCStatsMember<int32_t> datachannelid;
124 // TODO(hbos): Support enum types? "RTCStatsMember<RTCDataChannelState>"?
125 RTCStatsMember<std::string> state;
126 RTCStatsMember<uint32_t> messages_sent;
127 RTCStatsMember<uint64_t> bytes_sent;
128 RTCStatsMember<uint32_t> messages_received;
129 RTCStatsMember<uint64_t> bytes_received;
130};
131
132// https://w3c.github.io/webrtc-stats/#candidatepair-dict*
hbos338f78a2017-02-07 06:41:21 -0800133// TODO(hbos): Tracking bug https://bugs.webrtc.org/7062
hbos6ded1902016-11-01 01:50:46 -0700134class RTCIceCandidatePairStats final : public RTCStats {
hbosc47a0c32016-10-11 14:54:49 -0700135 public:
136 WEBRTC_RTCSTATS_DECL();
137
138 RTCIceCandidatePairStats(const std::string& id, int64_t timestamp_us);
139 RTCIceCandidatePairStats(std::string&& id, int64_t timestamp_us);
140 RTCIceCandidatePairStats(const RTCIceCandidatePairStats& other);
141 ~RTCIceCandidatePairStats() override;
142
143 RTCStatsMember<std::string> transport_id;
144 RTCStatsMember<std::string> local_candidate_id;
145 RTCStatsMember<std::string> remote_candidate_id;
146 // TODO(hbos): Support enum types?
147 // "RTCStatsMember<RTCStatsIceCandidatePairState>"?
148 RTCStatsMember<std::string> state;
149 RTCStatsMember<uint64_t> priority;
150 RTCStatsMember<bool> nominated;
hbos338f78a2017-02-07 06:41:21 -0800151 // TODO(hbos): Collect this the way the spec describes it. We have a value for
152 // it but it is not spec-compliant. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700153 RTCStatsMember<bool> writable;
hbos338f78a2017-02-07 06:41:21 -0800154 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700155 RTCStatsMember<bool> readable;
156 RTCStatsMember<uint64_t> bytes_sent;
157 RTCStatsMember<uint64_t> bytes_received;
hbos3168c7a2016-12-15 06:17:08 -0800158 RTCStatsMember<double> total_round_trip_time;
hbos3168c7a2016-12-15 06:17:08 -0800159 RTCStatsMember<double> current_round_trip_time;
hbosc47a0c32016-10-11 14:54:49 -0700160 RTCStatsMember<double> available_outgoing_bitrate;
hbos338f78a2017-02-07 06:41:21 -0800161 // TODO(hbos): Populate this value. It is wired up and collected the same way
hbosbf8d3e52017-02-28 06:34:47 -0800162 // "VideoBwe.googAvailableReceiveBandwidth" is, but that value is always
hbos338f78a2017-02-07 06:41:21 -0800163 // undefined. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700164 RTCStatsMember<double> available_incoming_bitrate;
165 RTCStatsMember<uint64_t> requests_received;
166 RTCStatsMember<uint64_t> requests_sent;
167 RTCStatsMember<uint64_t> responses_received;
168 RTCStatsMember<uint64_t> responses_sent;
hbos338f78a2017-02-07 06:41:21 -0800169 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700170 RTCStatsMember<uint64_t> retransmissions_received;
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_sent;
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> consent_requests_received;
175 RTCStatsMember<uint64_t> consent_requests_sent;
hbos338f78a2017-02-07 06:41:21 -0800176 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700177 RTCStatsMember<uint64_t> consent_responses_received;
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_sent;
180};
181
hbosab9f6e42016-10-07 02:18:47 -0700182// https://w3c.github.io/webrtc-stats/#icecandidate-dict*
hbos5d79a7c2016-10-24 09:27:10 -0700183// TODO(hbos): |RTCStatsCollector| only collects candidates that are part of
184// ice candidate pairs, but there could be candidates not paired with anything.
185// crbug.com/632723
Qingsi Wang72a43a12018-02-20 16:03:18 -0800186// TODO(qingsi): Add the stats of STUN binding requests (keepalives) and collect
187// them in the new PeerConnection::GetStats.
hbosab9f6e42016-10-07 02:18:47 -0700188class RTCIceCandidateStats : public RTCStats {
189 public:
190 WEBRTC_RTCSTATS_DECL();
191
192 RTCIceCandidateStats(const RTCIceCandidateStats& other);
193 ~RTCIceCandidateStats() override;
194
hbosb4e426e2017-01-02 09:59:31 -0800195 RTCStatsMember<std::string> transport_id;
hbosc3a2b7f2017-01-02 04:46:15 -0800196 RTCStatsMember<bool> is_remote;
Gary Liu37e489c2017-11-21 10:49:36 -0800197 RTCStatsMember<std::string> network_type;
hbosab9f6e42016-10-07 02:18:47 -0700198 RTCStatsMember<std::string> ip;
199 RTCStatsMember<int32_t> port;
200 RTCStatsMember<std::string> protocol;
201 // TODO(hbos): Support enum types? "RTCStatsMember<RTCIceCandidateType>"?
202 RTCStatsMember<std::string> candidate_type;
203 RTCStatsMember<int32_t> priority;
hbos5d79a7c2016-10-24 09:27:10 -0700204 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/632723
hbosab9f6e42016-10-07 02:18:47 -0700205 RTCStatsMember<std::string> url;
hbosd17a5a72017-01-02 08:09:59 -0800206 // TODO(hbos): |deleted = true| case is not supported by |RTCStatsCollector|.
207 // crbug.com/632723
208 RTCStatsMember<bool> deleted; // = false
hbosab9f6e42016-10-07 02:18:47 -0700209
210 protected:
hbosc3a2b7f2017-01-02 04:46:15 -0800211 RTCIceCandidateStats(
212 const std::string& id, int64_t timestamp_us, bool is_remote);
213 RTCIceCandidateStats(std::string&& id, int64_t timestamp_us, bool is_remote);
hbosab9f6e42016-10-07 02:18:47 -0700214};
215
216// In the spec both local and remote varieties are of type RTCIceCandidateStats.
217// But here we define them as subclasses of |RTCIceCandidateStats| because the
218// |kType| need to be different ("RTCStatsType type") in the local/remote case.
219// https://w3c.github.io/webrtc-stats/#rtcstatstype-str*
220class RTCLocalIceCandidateStats final : public RTCIceCandidateStats {
221 public:
222 static const char kType[];
223 RTCLocalIceCandidateStats(const std::string& id, int64_t timestamp_us);
224 RTCLocalIceCandidateStats(std::string&& id, int64_t timestamp_us);
225 const char* type() const override;
226};
227
228class RTCRemoteIceCandidateStats final : public RTCIceCandidateStats {
229 public:
230 static const char kType[];
231 RTCRemoteIceCandidateStats(const std::string& id, int64_t timestamp_us);
232 RTCRemoteIceCandidateStats(std::string&& id, int64_t timestamp_us);
233 const char* type() const override;
234};
235
hbos09bc1282016-11-08 06:29:22 -0800236// https://w3c.github.io/webrtc-stats/#msstats-dict*
hbos0adb8282016-11-23 02:32:06 -0800237// TODO(hbos): Tracking bug crbug.com/660827
hbos09bc1282016-11-08 06:29:22 -0800238class RTCMediaStreamStats final : public RTCStats {
239 public:
240 WEBRTC_RTCSTATS_DECL();
241
242 RTCMediaStreamStats(const std::string& id, int64_t timestamp_us);
243 RTCMediaStreamStats(std::string&& id, int64_t timestamp_us);
244 RTCMediaStreamStats(const RTCMediaStreamStats& other);
245 ~RTCMediaStreamStats() override;
246
247 RTCStatsMember<std::string> stream_identifier;
248 RTCStatsMember<std::vector<std::string>> track_ids;
249};
250
251// https://w3c.github.io/webrtc-stats/#mststats-dict*
hbos0adb8282016-11-23 02:32:06 -0800252// TODO(hbos): Tracking bug crbug.com/659137
hbos09bc1282016-11-08 06:29:22 -0800253class RTCMediaStreamTrackStats final : public RTCStats {
254 public:
255 WEBRTC_RTCSTATS_DECL();
256
hbos160e4a72017-01-17 02:53:23 -0800257 RTCMediaStreamTrackStats(const std::string& id, int64_t timestamp_us,
258 const char* kind);
259 RTCMediaStreamTrackStats(std::string&& id, int64_t timestamp_us,
260 const char* kind);
hbos09bc1282016-11-08 06:29:22 -0800261 RTCMediaStreamTrackStats(const RTCMediaStreamTrackStats& other);
262 ~RTCMediaStreamTrackStats() override;
263
264 RTCStatsMember<std::string> track_identifier;
265 RTCStatsMember<bool> remote_source;
266 RTCStatsMember<bool> ended;
267 // TODO(hbos): |RTCStatsCollector| does not return stats for detached tracks.
268 // crbug.com/659137
269 RTCStatsMember<bool> detached;
hbos160e4a72017-01-17 02:53:23 -0800270 // See |RTCMediaStreamTrackKind| for valid values.
271 RTCStatsMember<std::string> kind;
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200272 // TODO(gustaf): Implement jitter_buffer_delay for video (currently
273 // implemented for audio only).
274 // https://crbug.com/webrtc/8318
275 RTCStatsMember<double> jitter_buffer_delay;
hbos09bc1282016-11-08 06:29:22 -0800276 // Video-only members
277 RTCStatsMember<uint32_t> frame_width;
278 RTCStatsMember<uint32_t> frame_height;
279 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137
280 RTCStatsMember<double> frames_per_second;
hbos09bc1282016-11-08 06:29:22 -0800281 RTCStatsMember<uint32_t> frames_sent;
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100282 RTCStatsMember<uint32_t> huge_frames_sent;
hbos09bc1282016-11-08 06:29:22 -0800283 RTCStatsMember<uint32_t> frames_received;
hbos09bc1282016-11-08 06:29:22 -0800284 RTCStatsMember<uint32_t> frames_decoded;
hbos09bc1282016-11-08 06:29:22 -0800285 RTCStatsMember<uint32_t> frames_dropped;
286 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137
287 RTCStatsMember<uint32_t> frames_corrupted;
288 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137
289 RTCStatsMember<uint32_t> partial_frames_lost;
290 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137
291 RTCStatsMember<uint32_t> full_frames_lost;
292 // Audio-only members
293 RTCStatsMember<double> audio_level;
zsteine76bd3a2017-07-14 12:17:49 -0700294 RTCStatsMember<double> total_audio_energy;
hbos09bc1282016-11-08 06:29:22 -0800295 RTCStatsMember<double> echo_return_loss;
296 RTCStatsMember<double> echo_return_loss_enhancement;
Steve Anton2dbc69f2017-08-24 17:15:13 -0700297 RTCStatsMember<uint64_t> total_samples_received;
298 RTCStatsMember<double> total_samples_duration;
299 RTCStatsMember<uint64_t> concealed_samples;
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200300 RTCStatsMember<uint64_t> concealment_events;
hbos09bc1282016-11-08 06:29:22 -0800301};
302
hbos6ab97ce2016-10-03 14:16:56 -0700303// https://w3c.github.io/webrtc-stats/#pcstats-dict*
hbosab9f6e42016-10-07 02:18:47 -0700304class RTCPeerConnectionStats final : public RTCStats {
hbosd565b732016-08-30 14:04:35 -0700305 public:
hbosfc5e0502016-10-06 02:06:10 -0700306 WEBRTC_RTCSTATS_DECL();
307
hbos0e6758d2016-08-31 07:57:36 -0700308 RTCPeerConnectionStats(const std::string& id, int64_t timestamp_us);
309 RTCPeerConnectionStats(std::string&& id, int64_t timestamp_us);
hbosfc5e0502016-10-06 02:06:10 -0700310 RTCPeerConnectionStats(const RTCPeerConnectionStats& other);
311 ~RTCPeerConnectionStats() override;
hbosd565b732016-08-30 14:04:35 -0700312
313 RTCStatsMember<uint32_t> data_channels_opened;
314 RTCStatsMember<uint32_t> data_channels_closed;
315};
316
hbos6ded1902016-11-01 01:50:46 -0700317// https://w3c.github.io/webrtc-stats/#streamstats-dict*
hbos0adb8282016-11-23 02:32:06 -0800318// TODO(hbos): Tracking bug crbug.com/657854
hbos6ded1902016-11-01 01:50:46 -0700319class RTCRTPStreamStats : public RTCStats {
320 public:
321 WEBRTC_RTCSTATS_DECL();
322
323 RTCRTPStreamStats(const RTCRTPStreamStats& other);
324 ~RTCRTPStreamStats() override;
325
hbos3443bb72017-02-07 06:28:11 -0800326 RTCStatsMember<uint32_t> ssrc;
hbos6ded1902016-11-01 01:50:46 -0700327 // TODO(hbos): When the remote case is supported |RTCStatsCollector| needs to
328 // set this. crbug.com/657855, 657856
329 RTCStatsMember<std::string> associate_stats_id;
330 // TODO(hbos): Remote case not supported by |RTCStatsCollector|.
331 // crbug.com/657855, 657856
332 RTCStatsMember<bool> is_remote; // = false
333 RTCStatsMember<std::string> media_type;
hbosb0ae9202017-01-27 06:35:16 -0800334 RTCStatsMember<std::string> track_id;
hbos6ded1902016-11-01 01:50:46 -0700335 RTCStatsMember<std::string> transport_id;
hbos6ded1902016-11-01 01:50:46 -0700336 RTCStatsMember<std::string> codec_id;
337 // FIR and PLI counts are only defined for |media_type == "video"|.
338 RTCStatsMember<uint32_t> fir_count;
339 RTCStatsMember<uint32_t> pli_count;
340 // TODO(hbos): NACK count should be collected by |RTCStatsCollector| for both
341 // audio and video but is only defined in the "video" case. crbug.com/657856
342 RTCStatsMember<uint32_t> nack_count;
343 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657854
344 // SLI count is only defined for |media_type == "video"|.
345 RTCStatsMember<uint32_t> sli_count;
hbos6769c492017-01-02 08:35:13 -0800346 RTCStatsMember<uint64_t> qp_sum;
hbos6ded1902016-11-01 01:50:46 -0700347
348 protected:
349 RTCRTPStreamStats(const std::string& id, int64_t timestamp_us);
350 RTCRTPStreamStats(std::string&& id, int64_t timestamp_us);
351};
352
hboseeafe942016-11-01 03:00:17 -0700353// https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict*
hbosa7a9be12017-03-01 01:02:45 -0800354// TODO(hbos): Support the remote case |is_remote = true|.
355// https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700356class RTCInboundRTPStreamStats final : public RTCRTPStreamStats {
357 public:
358 WEBRTC_RTCSTATS_DECL();
359
360 RTCInboundRTPStreamStats(const std::string& id, int64_t timestamp_us);
361 RTCInboundRTPStreamStats(std::string&& id, int64_t timestamp_us);
362 RTCInboundRTPStreamStats(const RTCInboundRTPStreamStats& other);
363 ~RTCInboundRTPStreamStats() override;
364
365 RTCStatsMember<uint32_t> packets_received;
366 RTCStatsMember<uint64_t> bytes_received;
Harald Alvestrand719487e2017-12-13 12:26:04 +0100367 RTCStatsMember<int32_t> packets_lost; // Signed per RFC 3550
hbosa7a9be12017-03-01 01:02:45 -0800368 // TODO(hbos): Collect and populate this value for both "audio" and "video",
369 // currently not collected for "video". https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700370 RTCStatsMember<double> jitter;
371 RTCStatsMember<double> fraction_lost;
hbosa7a9be12017-03-01 01:02:45 -0800372 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
373 RTCStatsMember<double> round_trip_time;
374 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700375 RTCStatsMember<uint32_t> packets_discarded;
hbosa7a9be12017-03-01 01:02:45 -0800376 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700377 RTCStatsMember<uint32_t> packets_repaired;
hbosa7a9be12017-03-01 01:02:45 -0800378 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700379 RTCStatsMember<uint32_t> burst_packets_lost;
hbosa7a9be12017-03-01 01:02:45 -0800380 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700381 RTCStatsMember<uint32_t> burst_packets_discarded;
hbosa7a9be12017-03-01 01:02:45 -0800382 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700383 RTCStatsMember<uint32_t> burst_loss_count;
hbosa7a9be12017-03-01 01:02:45 -0800384 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700385 RTCStatsMember<uint32_t> burst_discard_count;
hbosa7a9be12017-03-01 01:02:45 -0800386 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700387 RTCStatsMember<double> burst_loss_rate;
hbosa7a9be12017-03-01 01:02:45 -0800388 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700389 RTCStatsMember<double> burst_discard_rate;
hbosa7a9be12017-03-01 01:02:45 -0800390 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700391 RTCStatsMember<double> gap_loss_rate;
hbosa7a9be12017-03-01 01:02:45 -0800392 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700393 RTCStatsMember<double> gap_discard_rate;
hbos6769c492017-01-02 08:35:13 -0800394 RTCStatsMember<uint32_t> frames_decoded;
hboseeafe942016-11-01 03:00:17 -0700395};
396
hbos6ded1902016-11-01 01:50:46 -0700397// https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict*
hbosa7a9be12017-03-01 01:02:45 -0800398// TODO(hbos): Support the remote case |is_remote = true|.
399// https://bugs.webrtc.org/7066
hbos6ded1902016-11-01 01:50:46 -0700400class RTCOutboundRTPStreamStats final : public RTCRTPStreamStats {
401 public:
402 WEBRTC_RTCSTATS_DECL();
403
404 RTCOutboundRTPStreamStats(const std::string& id, int64_t timestamp_us);
405 RTCOutboundRTPStreamStats(std::string&& id, int64_t timestamp_us);
406 RTCOutboundRTPStreamStats(const RTCOutboundRTPStreamStats& other);
407 ~RTCOutboundRTPStreamStats() override;
408
409 RTCStatsMember<uint32_t> packets_sent;
410 RTCStatsMember<uint64_t> bytes_sent;
hbosa7a9be12017-03-01 01:02:45 -0800411 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7066
hbos6ded1902016-11-01 01:50:46 -0700412 RTCStatsMember<double> target_bitrate;
hbos6769c492017-01-02 08:35:13 -0800413 RTCStatsMember<uint32_t> frames_encoded;
hbos6ded1902016-11-01 01:50:46 -0700414};
415
hbos2fa7c672016-10-24 04:00:05 -0700416// https://w3c.github.io/webrtc-stats/#transportstats-dict*
417class RTCTransportStats final : public RTCStats {
418 public:
419 WEBRTC_RTCSTATS_DECL();
420
421 RTCTransportStats(const std::string& id, int64_t timestamp_us);
422 RTCTransportStats(std::string&& id, int64_t timestamp_us);
423 RTCTransportStats(const RTCTransportStats& other);
424 ~RTCTransportStats() override;
425
426 RTCStatsMember<uint64_t> bytes_sent;
427 RTCStatsMember<uint64_t> bytes_received;
428 RTCStatsMember<std::string> rtcp_transport_stats_id;
hbos7064d592017-01-16 07:38:02 -0800429 // TODO(hbos): Support enum types? "RTCStatsMember<RTCDtlsTransportState>"?
430 RTCStatsMember<std::string> dtls_state;
hbos2fa7c672016-10-24 04:00:05 -0700431 RTCStatsMember<std::string> selected_candidate_pair_id;
432 RTCStatsMember<std::string> local_certificate_id;
433 RTCStatsMember<std::string> remote_certificate_id;
434};
435
hbosd565b732016-08-30 14:04:35 -0700436} // namespace webrtc
437
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200438#endif // API_STATS_RTCSTATS_OBJECTS_H_