blob: 7e6bcd3228b885565483dcff683fc664d87ef68c [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"
hbosd565b732016-08-30 14:04:35 -070019
20namespace webrtc {
21
hboscc555c52016-10-18 12:48:31 -070022// https://w3c.github.io/webrtc-pc/#idl-def-rtcdatachannelstate
23struct RTCDataChannelState {
agrieve26622d32017-08-08 10:48:15 -070024 static const char* const kConnecting;
25 static const char* const kOpen;
26 static const char* const kClosing;
27 static const char* const kClosed;
hboscc555c52016-10-18 12:48:31 -070028};
29
hbosc47a0c32016-10-11 14:54:49 -070030// https://w3c.github.io/webrtc-stats/#dom-rtcstatsicecandidatepairstate
31struct RTCStatsIceCandidatePairState {
agrieve26622d32017-08-08 10:48:15 -070032 static const char* const kFrozen;
33 static const char* const kWaiting;
34 static const char* const kInProgress;
35 static const char* const kFailed;
36 static const char* const kSucceeded;
hbosc47a0c32016-10-11 14:54:49 -070037};
38
hboscc555c52016-10-18 12:48:31 -070039// https://w3c.github.io/webrtc-pc/#rtcicecandidatetype-enum
hbosab9f6e42016-10-07 02:18:47 -070040struct RTCIceCandidateType {
agrieve26622d32017-08-08 10:48:15 -070041 static const char* const kHost;
42 static const char* const kSrflx;
43 static const char* const kPrflx;
44 static const char* const kRelay;
hbosab9f6e42016-10-07 02:18:47 -070045};
46
hbos7064d592017-01-16 07:38:02 -080047// https://w3c.github.io/webrtc-pc/#idl-def-rtcdtlstransportstate
48struct RTCDtlsTransportState {
agrieve26622d32017-08-08 10:48:15 -070049 static const char* const kNew;
50 static const char* const kConnecting;
51 static const char* const kConnected;
52 static const char* const kClosed;
53 static const char* const kFailed;
hbos7064d592017-01-16 07:38:02 -080054};
55
hbos160e4a72017-01-17 02:53:23 -080056// |RTCMediaStreamTrackStats::kind| is not an enum in the spec but the only
57// valid values are "audio" and "video".
58// https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats-kind
59struct RTCMediaStreamTrackKind {
agrieve26622d32017-08-08 10:48:15 -070060 static const char* const kAudio;
61 static const char* const kVideo;
hbos160e4a72017-01-17 02:53:23 -080062};
63
Gary Liu37e489c2017-11-21 10:49:36 -080064// https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype
65struct RTCNetworkType {
66 static const char* const kBluetooth;
67 static const char* const kCellular;
68 static const char* const kEthernet;
69 static const char* const kWifi;
70 static const char* const kWimax;
71 static const char* const kVpn;
72 static const char* const kUnknown;
73};
74
hbos2fa7c672016-10-24 04:00:05 -070075// https://w3c.github.io/webrtc-stats/#certificatestats-dict*
76class RTCCertificateStats final : public RTCStats {
77 public:
78 WEBRTC_RTCSTATS_DECL();
79
80 RTCCertificateStats(const std::string& id, int64_t timestamp_us);
81 RTCCertificateStats(std::string&& id, int64_t timestamp_us);
82 RTCCertificateStats(const RTCCertificateStats& other);
83 ~RTCCertificateStats() override;
84
85 RTCStatsMember<std::string> fingerprint;
86 RTCStatsMember<std::string> fingerprint_algorithm;
87 RTCStatsMember<std::string> base64_certificate;
88 RTCStatsMember<std::string> issuer_certificate_id;
89};
90
hbos0adb8282016-11-23 02:32:06 -080091// https://w3c.github.io/webrtc-stats/#codec-dict*
hbos0adb8282016-11-23 02:32:06 -080092class RTCCodecStats final : public RTCStats {
93 public:
94 WEBRTC_RTCSTATS_DECL();
95
96 RTCCodecStats(const std::string& id, int64_t timestamp_us);
97 RTCCodecStats(std::string&& id, int64_t timestamp_us);
98 RTCCodecStats(const RTCCodecStats& other);
99 ~RTCCodecStats() override;
100
101 RTCStatsMember<uint32_t> payload_type;
hbos13f54b22017-02-28 06:56:04 -0800102 RTCStatsMember<std::string> mime_type;
hbos0adb8282016-11-23 02:32:06 -0800103 RTCStatsMember<uint32_t> clock_rate;
hbos585a9b12017-02-07 04:59:16 -0800104 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7061
hbos0adb8282016-11-23 02:32:06 -0800105 RTCStatsMember<uint32_t> channels;
hbos585a9b12017-02-07 04:59:16 -0800106 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7061
hbos13f54b22017-02-28 06:56:04 -0800107 RTCStatsMember<std::string> sdp_fmtp_line;
hbos585a9b12017-02-07 04:59:16 -0800108 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7061
hbos0adb8282016-11-23 02:32:06 -0800109 RTCStatsMember<std::string> implementation;
110};
111
hbos2fa7c672016-10-24 04:00:05 -0700112// https://w3c.github.io/webrtc-stats/#dcstats-dict*
113class RTCDataChannelStats final : public RTCStats {
114 public:
115 WEBRTC_RTCSTATS_DECL();
116
117 RTCDataChannelStats(const std::string& id, int64_t timestamp_us);
118 RTCDataChannelStats(std::string&& id, int64_t timestamp_us);
119 RTCDataChannelStats(const RTCDataChannelStats& other);
120 ~RTCDataChannelStats() override;
121
122 RTCStatsMember<std::string> label;
123 RTCStatsMember<std::string> protocol;
124 RTCStatsMember<int32_t> datachannelid;
125 // TODO(hbos): Support enum types? "RTCStatsMember<RTCDataChannelState>"?
126 RTCStatsMember<std::string> state;
127 RTCStatsMember<uint32_t> messages_sent;
128 RTCStatsMember<uint64_t> bytes_sent;
129 RTCStatsMember<uint32_t> messages_received;
130 RTCStatsMember<uint64_t> bytes_received;
131};
132
133// https://w3c.github.io/webrtc-stats/#candidatepair-dict*
hbos338f78a2017-02-07 06:41:21 -0800134// TODO(hbos): Tracking bug https://bugs.webrtc.org/7062
hbos6ded1902016-11-01 01:50:46 -0700135class RTCIceCandidatePairStats final : public RTCStats {
hbosc47a0c32016-10-11 14:54:49 -0700136 public:
137 WEBRTC_RTCSTATS_DECL();
138
139 RTCIceCandidatePairStats(const std::string& id, int64_t timestamp_us);
140 RTCIceCandidatePairStats(std::string&& id, int64_t timestamp_us);
141 RTCIceCandidatePairStats(const RTCIceCandidatePairStats& other);
142 ~RTCIceCandidatePairStats() override;
143
144 RTCStatsMember<std::string> transport_id;
145 RTCStatsMember<std::string> local_candidate_id;
146 RTCStatsMember<std::string> remote_candidate_id;
147 // TODO(hbos): Support enum types?
148 // "RTCStatsMember<RTCStatsIceCandidatePairState>"?
149 RTCStatsMember<std::string> state;
150 RTCStatsMember<uint64_t> priority;
151 RTCStatsMember<bool> nominated;
hbos338f78a2017-02-07 06:41:21 -0800152 // TODO(hbos): Collect this the way the spec describes it. We have a value for
153 // it but it is not spec-compliant. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700154 RTCStatsMember<bool> writable;
hbos338f78a2017-02-07 06:41:21 -0800155 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700156 RTCStatsMember<bool> readable;
157 RTCStatsMember<uint64_t> bytes_sent;
158 RTCStatsMember<uint64_t> bytes_received;
hbos3168c7a2016-12-15 06:17:08 -0800159 RTCStatsMember<double> total_round_trip_time;
hbos3168c7a2016-12-15 06:17:08 -0800160 RTCStatsMember<double> current_round_trip_time;
hbosc47a0c32016-10-11 14:54:49 -0700161 RTCStatsMember<double> available_outgoing_bitrate;
hbos338f78a2017-02-07 06:41:21 -0800162 // TODO(hbos): Populate this value. It is wired up and collected the same way
hbosbf8d3e52017-02-28 06:34:47 -0800163 // "VideoBwe.googAvailableReceiveBandwidth" is, but that value is always
hbos338f78a2017-02-07 06:41:21 -0800164 // undefined. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700165 RTCStatsMember<double> available_incoming_bitrate;
166 RTCStatsMember<uint64_t> requests_received;
167 RTCStatsMember<uint64_t> requests_sent;
168 RTCStatsMember<uint64_t> responses_received;
169 RTCStatsMember<uint64_t> responses_sent;
hbos338f78a2017-02-07 06:41:21 -0800170 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700171 RTCStatsMember<uint64_t> retransmissions_received;
hbos338f78a2017-02-07 06:41:21 -0800172 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700173 RTCStatsMember<uint64_t> retransmissions_sent;
hbos338f78a2017-02-07 06:41:21 -0800174 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700175 RTCStatsMember<uint64_t> consent_requests_received;
176 RTCStatsMember<uint64_t> consent_requests_sent;
hbos338f78a2017-02-07 06:41:21 -0800177 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700178 RTCStatsMember<uint64_t> consent_responses_received;
hbos338f78a2017-02-07 06:41:21 -0800179 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700180 RTCStatsMember<uint64_t> consent_responses_sent;
181};
182
hbosab9f6e42016-10-07 02:18:47 -0700183// https://w3c.github.io/webrtc-stats/#icecandidate-dict*
hbos5d79a7c2016-10-24 09:27:10 -0700184// TODO(hbos): |RTCStatsCollector| only collects candidates that are part of
185// ice candidate pairs, but there could be candidates not paired with anything.
186// crbug.com/632723
Qingsi Wang72a43a12018-02-20 16:03:18 -0800187// TODO(qingsi): Add the stats of STUN binding requests (keepalives) and collect
188// them in the new PeerConnection::GetStats.
hbosab9f6e42016-10-07 02:18:47 -0700189class RTCIceCandidateStats : public RTCStats {
190 public:
191 WEBRTC_RTCSTATS_DECL();
192
193 RTCIceCandidateStats(const RTCIceCandidateStats& other);
194 ~RTCIceCandidateStats() override;
195
hbosb4e426e2017-01-02 09:59:31 -0800196 RTCStatsMember<std::string> transport_id;
hbosc3a2b7f2017-01-02 04:46:15 -0800197 RTCStatsMember<bool> is_remote;
Gary Liu37e489c2017-11-21 10:49:36 -0800198 RTCStatsMember<std::string> network_type;
hbosab9f6e42016-10-07 02:18:47 -0700199 RTCStatsMember<std::string> ip;
200 RTCStatsMember<int32_t> port;
201 RTCStatsMember<std::string> protocol;
202 // TODO(hbos): Support enum types? "RTCStatsMember<RTCIceCandidateType>"?
203 RTCStatsMember<std::string> candidate_type;
204 RTCStatsMember<int32_t> priority;
hbos5d79a7c2016-10-24 09:27:10 -0700205 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/632723
hbosab9f6e42016-10-07 02:18:47 -0700206 RTCStatsMember<std::string> url;
hbosd17a5a72017-01-02 08:09:59 -0800207 // TODO(hbos): |deleted = true| case is not supported by |RTCStatsCollector|.
208 // crbug.com/632723
209 RTCStatsMember<bool> deleted; // = false
hbosab9f6e42016-10-07 02:18:47 -0700210
211 protected:
Yves Gerey665174f2018-06-19 15:03:05 +0200212 RTCIceCandidateStats(const std::string& id,
213 int64_t timestamp_us,
214 bool is_remote);
hbosc3a2b7f2017-01-02 04:46:15 -0800215 RTCIceCandidateStats(std::string&& id, int64_t timestamp_us, bool is_remote);
hbosab9f6e42016-10-07 02:18:47 -0700216};
217
218// In the spec both local and remote varieties are of type RTCIceCandidateStats.
219// But here we define them as subclasses of |RTCIceCandidateStats| because the
220// |kType| need to be different ("RTCStatsType type") in the local/remote case.
221// https://w3c.github.io/webrtc-stats/#rtcstatstype-str*
Henrik Boström1df1bf82018-03-20 13:24:20 +0100222// This forces us to have to override copy() and type().
hbosab9f6e42016-10-07 02:18:47 -0700223class RTCLocalIceCandidateStats final : public RTCIceCandidateStats {
224 public:
225 static const char kType[];
226 RTCLocalIceCandidateStats(const std::string& id, int64_t timestamp_us);
227 RTCLocalIceCandidateStats(std::string&& id, int64_t timestamp_us);
Henrik Boström1df1bf82018-03-20 13:24:20 +0100228 std::unique_ptr<RTCStats> copy() const override;
hbosab9f6e42016-10-07 02:18:47 -0700229 const char* type() const override;
230};
231
232class RTCRemoteIceCandidateStats final : public RTCIceCandidateStats {
233 public:
234 static const char kType[];
235 RTCRemoteIceCandidateStats(const std::string& id, int64_t timestamp_us);
236 RTCRemoteIceCandidateStats(std::string&& id, int64_t timestamp_us);
Henrik Boström1df1bf82018-03-20 13:24:20 +0100237 std::unique_ptr<RTCStats> copy() const override;
hbosab9f6e42016-10-07 02:18:47 -0700238 const char* type() const override;
239};
240
hbos09bc1282016-11-08 06:29:22 -0800241// https://w3c.github.io/webrtc-stats/#msstats-dict*
hbos0adb8282016-11-23 02:32:06 -0800242// TODO(hbos): Tracking bug crbug.com/660827
hbos09bc1282016-11-08 06:29:22 -0800243class RTCMediaStreamStats final : public RTCStats {
244 public:
245 WEBRTC_RTCSTATS_DECL();
246
247 RTCMediaStreamStats(const std::string& id, int64_t timestamp_us);
248 RTCMediaStreamStats(std::string&& id, int64_t timestamp_us);
249 RTCMediaStreamStats(const RTCMediaStreamStats& other);
250 ~RTCMediaStreamStats() override;
251
252 RTCStatsMember<std::string> stream_identifier;
253 RTCStatsMember<std::vector<std::string>> track_ids;
254};
255
256// https://w3c.github.io/webrtc-stats/#mststats-dict*
hbos0adb8282016-11-23 02:32:06 -0800257// TODO(hbos): Tracking bug crbug.com/659137
hbos09bc1282016-11-08 06:29:22 -0800258class RTCMediaStreamTrackStats final : public RTCStats {
259 public:
260 WEBRTC_RTCSTATS_DECL();
261
Yves Gerey665174f2018-06-19 15:03:05 +0200262 RTCMediaStreamTrackStats(const std::string& id,
263 int64_t timestamp_us,
hbos160e4a72017-01-17 02:53:23 -0800264 const char* kind);
Yves Gerey665174f2018-06-19 15:03:05 +0200265 RTCMediaStreamTrackStats(std::string&& id,
266 int64_t timestamp_us,
hbos160e4a72017-01-17 02:53:23 -0800267 const char* kind);
hbos09bc1282016-11-08 06:29:22 -0800268 RTCMediaStreamTrackStats(const RTCMediaStreamTrackStats& other);
269 ~RTCMediaStreamTrackStats() override;
270
271 RTCStatsMember<std::string> track_identifier;
272 RTCStatsMember<bool> remote_source;
273 RTCStatsMember<bool> ended;
274 // TODO(hbos): |RTCStatsCollector| does not return stats for detached tracks.
275 // crbug.com/659137
276 RTCStatsMember<bool> detached;
hbos160e4a72017-01-17 02:53:23 -0800277 // See |RTCMediaStreamTrackKind| for valid values.
278 RTCStatsMember<std::string> kind;
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200279 // TODO(gustaf): Implement jitter_buffer_delay for video (currently
280 // implemented for audio only).
281 // https://crbug.com/webrtc/8318
282 RTCStatsMember<double> jitter_buffer_delay;
hbos09bc1282016-11-08 06:29:22 -0800283 // Video-only members
284 RTCStatsMember<uint32_t> frame_width;
285 RTCStatsMember<uint32_t> frame_height;
286 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137
287 RTCStatsMember<double> frames_per_second;
hbos09bc1282016-11-08 06:29:22 -0800288 RTCStatsMember<uint32_t> frames_sent;
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100289 RTCStatsMember<uint32_t> huge_frames_sent;
hbos09bc1282016-11-08 06:29:22 -0800290 RTCStatsMember<uint32_t> frames_received;
hbos09bc1282016-11-08 06:29:22 -0800291 RTCStatsMember<uint32_t> frames_decoded;
hbos09bc1282016-11-08 06:29:22 -0800292 RTCStatsMember<uint32_t> frames_dropped;
293 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137
294 RTCStatsMember<uint32_t> frames_corrupted;
295 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137
296 RTCStatsMember<uint32_t> partial_frames_lost;
297 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137
298 RTCStatsMember<uint32_t> full_frames_lost;
299 // Audio-only members
300 RTCStatsMember<double> audio_level;
zsteine76bd3a2017-07-14 12:17:49 -0700301 RTCStatsMember<double> total_audio_energy;
hbos09bc1282016-11-08 06:29:22 -0800302 RTCStatsMember<double> echo_return_loss;
303 RTCStatsMember<double> echo_return_loss_enhancement;
Steve Anton2dbc69f2017-08-24 17:15:13 -0700304 RTCStatsMember<uint64_t> total_samples_received;
305 RTCStatsMember<double> total_samples_duration;
306 RTCStatsMember<uint64_t> concealed_samples;
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200307 RTCStatsMember<uint64_t> concealment_events;
hbos09bc1282016-11-08 06:29:22 -0800308};
309
hbos6ab97ce2016-10-03 14:16:56 -0700310// https://w3c.github.io/webrtc-stats/#pcstats-dict*
hbosab9f6e42016-10-07 02:18:47 -0700311class RTCPeerConnectionStats final : public RTCStats {
hbosd565b732016-08-30 14:04:35 -0700312 public:
hbosfc5e0502016-10-06 02:06:10 -0700313 WEBRTC_RTCSTATS_DECL();
314
hbos0e6758d2016-08-31 07:57:36 -0700315 RTCPeerConnectionStats(const std::string& id, int64_t timestamp_us);
316 RTCPeerConnectionStats(std::string&& id, int64_t timestamp_us);
hbosfc5e0502016-10-06 02:06:10 -0700317 RTCPeerConnectionStats(const RTCPeerConnectionStats& other);
318 ~RTCPeerConnectionStats() override;
hbosd565b732016-08-30 14:04:35 -0700319
320 RTCStatsMember<uint32_t> data_channels_opened;
321 RTCStatsMember<uint32_t> data_channels_closed;
322};
323
hbos6ded1902016-11-01 01:50:46 -0700324// https://w3c.github.io/webrtc-stats/#streamstats-dict*
hbos0adb8282016-11-23 02:32:06 -0800325// TODO(hbos): Tracking bug crbug.com/657854
hbos6ded1902016-11-01 01:50:46 -0700326class RTCRTPStreamStats : public RTCStats {
327 public:
328 WEBRTC_RTCSTATS_DECL();
329
330 RTCRTPStreamStats(const RTCRTPStreamStats& other);
331 ~RTCRTPStreamStats() override;
332
hbos3443bb72017-02-07 06:28:11 -0800333 RTCStatsMember<uint32_t> ssrc;
hbos6ded1902016-11-01 01:50:46 -0700334 // TODO(hbos): When the remote case is supported |RTCStatsCollector| needs to
335 // set this. crbug.com/657855, 657856
336 RTCStatsMember<std::string> associate_stats_id;
337 // TODO(hbos): Remote case not supported by |RTCStatsCollector|.
338 // crbug.com/657855, 657856
339 RTCStatsMember<bool> is_remote; // = false
340 RTCStatsMember<std::string> media_type;
hbosb0ae9202017-01-27 06:35:16 -0800341 RTCStatsMember<std::string> track_id;
hbos6ded1902016-11-01 01:50:46 -0700342 RTCStatsMember<std::string> transport_id;
hbos6ded1902016-11-01 01:50:46 -0700343 RTCStatsMember<std::string> codec_id;
344 // FIR and PLI counts are only defined for |media_type == "video"|.
345 RTCStatsMember<uint32_t> fir_count;
346 RTCStatsMember<uint32_t> pli_count;
347 // TODO(hbos): NACK count should be collected by |RTCStatsCollector| for both
348 // audio and video but is only defined in the "video" case. crbug.com/657856
349 RTCStatsMember<uint32_t> nack_count;
350 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657854
351 // SLI count is only defined for |media_type == "video"|.
352 RTCStatsMember<uint32_t> sli_count;
hbos6769c492017-01-02 08:35:13 -0800353 RTCStatsMember<uint64_t> qp_sum;
hbos6ded1902016-11-01 01:50:46 -0700354
355 protected:
356 RTCRTPStreamStats(const std::string& id, int64_t timestamp_us);
357 RTCRTPStreamStats(std::string&& id, int64_t timestamp_us);
358};
359
hboseeafe942016-11-01 03:00:17 -0700360// https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict*
hbosa7a9be12017-03-01 01:02:45 -0800361// TODO(hbos): Support the remote case |is_remote = true|.
362// https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700363class RTCInboundRTPStreamStats final : public RTCRTPStreamStats {
364 public:
365 WEBRTC_RTCSTATS_DECL();
366
367 RTCInboundRTPStreamStats(const std::string& id, int64_t timestamp_us);
368 RTCInboundRTPStreamStats(std::string&& id, int64_t timestamp_us);
369 RTCInboundRTPStreamStats(const RTCInboundRTPStreamStats& other);
370 ~RTCInboundRTPStreamStats() override;
371
372 RTCStatsMember<uint32_t> packets_received;
373 RTCStatsMember<uint64_t> bytes_received;
Harald Alvestrand719487e2017-12-13 12:26:04 +0100374 RTCStatsMember<int32_t> packets_lost; // Signed per RFC 3550
hbosa7a9be12017-03-01 01:02:45 -0800375 // TODO(hbos): Collect and populate this value for both "audio" and "video",
376 // currently not collected for "video". https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700377 RTCStatsMember<double> jitter;
378 RTCStatsMember<double> fraction_lost;
hbosa7a9be12017-03-01 01:02:45 -0800379 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
380 RTCStatsMember<double> round_trip_time;
381 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700382 RTCStatsMember<uint32_t> packets_discarded;
hbosa7a9be12017-03-01 01:02:45 -0800383 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700384 RTCStatsMember<uint32_t> packets_repaired;
hbosa7a9be12017-03-01 01:02:45 -0800385 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700386 RTCStatsMember<uint32_t> burst_packets_lost;
hbosa7a9be12017-03-01 01:02:45 -0800387 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700388 RTCStatsMember<uint32_t> burst_packets_discarded;
hbosa7a9be12017-03-01 01:02:45 -0800389 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700390 RTCStatsMember<uint32_t> burst_loss_count;
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> burst_discard_count;
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<double> burst_loss_rate;
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<double> burst_discard_rate;
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<double> gap_loss_rate;
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<double> gap_discard_rate;
hbos6769c492017-01-02 08:35:13 -0800401 RTCStatsMember<uint32_t> frames_decoded;
hboseeafe942016-11-01 03:00:17 -0700402};
403
hbos6ded1902016-11-01 01:50:46 -0700404// https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict*
hbosa7a9be12017-03-01 01:02:45 -0800405// TODO(hbos): Support the remote case |is_remote = true|.
406// https://bugs.webrtc.org/7066
hbos6ded1902016-11-01 01:50:46 -0700407class RTCOutboundRTPStreamStats final : public RTCRTPStreamStats {
408 public:
409 WEBRTC_RTCSTATS_DECL();
410
411 RTCOutboundRTPStreamStats(const std::string& id, int64_t timestamp_us);
412 RTCOutboundRTPStreamStats(std::string&& id, int64_t timestamp_us);
413 RTCOutboundRTPStreamStats(const RTCOutboundRTPStreamStats& other);
414 ~RTCOutboundRTPStreamStats() override;
415
416 RTCStatsMember<uint32_t> packets_sent;
417 RTCStatsMember<uint64_t> bytes_sent;
hbosa7a9be12017-03-01 01:02:45 -0800418 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7066
hbos6ded1902016-11-01 01:50:46 -0700419 RTCStatsMember<double> target_bitrate;
hbos6769c492017-01-02 08:35:13 -0800420 RTCStatsMember<uint32_t> frames_encoded;
hbos6ded1902016-11-01 01:50:46 -0700421};
422
hbos2fa7c672016-10-24 04:00:05 -0700423// https://w3c.github.io/webrtc-stats/#transportstats-dict*
424class RTCTransportStats final : public RTCStats {
425 public:
426 WEBRTC_RTCSTATS_DECL();
427
428 RTCTransportStats(const std::string& id, int64_t timestamp_us);
429 RTCTransportStats(std::string&& id, int64_t timestamp_us);
430 RTCTransportStats(const RTCTransportStats& other);
431 ~RTCTransportStats() override;
432
433 RTCStatsMember<uint64_t> bytes_sent;
434 RTCStatsMember<uint64_t> bytes_received;
435 RTCStatsMember<std::string> rtcp_transport_stats_id;
hbos7064d592017-01-16 07:38:02 -0800436 // TODO(hbos): Support enum types? "RTCStatsMember<RTCDtlsTransportState>"?
437 RTCStatsMember<std::string> dtls_state;
hbos2fa7c672016-10-24 04:00:05 -0700438 RTCStatsMember<std::string> selected_candidate_pair_id;
439 RTCStatsMember<std::string> local_certificate_id;
440 RTCStatsMember<std::string> remote_certificate_id;
441};
442
hbosd565b732016-08-30 14:04:35 -0700443} // namespace webrtc
444
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200445#endif // API_STATS_RTCSTATS_OBJECTS_H_