blob: a6d78f8ddba105a40a3a3720e319a7d0dcd74267 [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
Yves Gerey3e707812018-11-28 16:47:49 +010014#include <stdint.h>
Jonas Olssona4d87372019-07-05 19:08:33 +020015
Byoungchan Lee7d235352021-05-28 21:32:04 +090016#include <map>
Henrik Boström1df1bf82018-03-20 13:24:20 +010017#include <memory>
hbosd565b732016-08-30 14:04:35 -070018#include <string>
oprypin803dc292017-02-01 01:55:59 -080019#include <vector>
hbosd565b732016-08-30 14:04:35 -070020
Steve Anton10542f22019-01-11 09:11:00 -080021#include "api/stats/rtc_stats.h"
Mirko Bonadei276827c2018-10-16 14:13:50 +020022#include "rtc_base/system/rtc_export.h"
hbosd565b732016-08-30 14:04:35 -070023
24namespace webrtc {
25
hboscc555c52016-10-18 12:48:31 -070026// https://w3c.github.io/webrtc-pc/#idl-def-rtcdatachannelstate
27struct RTCDataChannelState {
agrieve26622d32017-08-08 10:48:15 -070028 static const char* const kConnecting;
29 static const char* const kOpen;
30 static const char* const kClosing;
31 static const char* const kClosed;
hboscc555c52016-10-18 12:48:31 -070032};
33
hbosc47a0c32016-10-11 14:54:49 -070034// https://w3c.github.io/webrtc-stats/#dom-rtcstatsicecandidatepairstate
35struct RTCStatsIceCandidatePairState {
agrieve26622d32017-08-08 10:48:15 -070036 static const char* const kFrozen;
37 static const char* const kWaiting;
38 static const char* const kInProgress;
39 static const char* const kFailed;
40 static const char* const kSucceeded;
hbosc47a0c32016-10-11 14:54:49 -070041};
42
hboscc555c52016-10-18 12:48:31 -070043// https://w3c.github.io/webrtc-pc/#rtcicecandidatetype-enum
hbosab9f6e42016-10-07 02:18:47 -070044struct RTCIceCandidateType {
agrieve26622d32017-08-08 10:48:15 -070045 static const char* const kHost;
46 static const char* const kSrflx;
47 static const char* const kPrflx;
48 static const char* const kRelay;
hbosab9f6e42016-10-07 02:18:47 -070049};
50
hbos7064d592017-01-16 07:38:02 -080051// https://w3c.github.io/webrtc-pc/#idl-def-rtcdtlstransportstate
52struct RTCDtlsTransportState {
agrieve26622d32017-08-08 10:48:15 -070053 static const char* const kNew;
54 static const char* const kConnecting;
55 static const char* const kConnected;
56 static const char* const kClosed;
57 static const char* const kFailed;
hbos7064d592017-01-16 07:38:02 -080058};
59
Artem Titovcfea2182021-08-10 01:22:31 +020060// `RTCMediaStreamTrackStats::kind` is not an enum in the spec but the only
hbos160e4a72017-01-17 02:53:23 -080061// valid values are "audio" and "video".
62// https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats-kind
63struct RTCMediaStreamTrackKind {
agrieve26622d32017-08-08 10:48:15 -070064 static const char* const kAudio;
65 static const char* const kVideo;
hbos160e4a72017-01-17 02:53:23 -080066};
67
Gary Liu37e489c2017-11-21 10:49:36 -080068// https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype
69struct RTCNetworkType {
70 static const char* const kBluetooth;
71 static const char* const kCellular;
72 static const char* const kEthernet;
73 static const char* const kWifi;
74 static const char* const kWimax;
75 static const char* const kVpn;
76 static const char* const kUnknown;
77};
78
Henrik Boströmce33b6a2019-05-28 17:42:38 +020079// https://w3c.github.io/webrtc-stats/#dom-rtcqualitylimitationreason
80struct RTCQualityLimitationReason {
81 static const char* const kNone;
82 static const char* const kCpu;
83 static const char* const kBandwidth;
84 static const char* const kOther;
85};
86
Henrik Boström2e069262019-04-09 13:59:31 +020087// https://webrtc.org/experiments/rtp-hdrext/video-content-type/
88struct RTCContentType {
89 static const char* const kUnspecified;
90 static const char* const kScreenshare;
91};
92
Philipp Hancke69c1df22022-04-22 15:46:24 +020093// https://w3c.github.io/webrtc-stats/#dom-rtcdtlsrole
94struct RTCDtlsRole {
95 static const char* const kUnknown;
96 static const char* const kClient;
97 static const char* const kServer;
98};
99
hbos2fa7c672016-10-24 04:00:05 -0700100// https://w3c.github.io/webrtc-stats/#certificatestats-dict*
Mirko Bonadei276827c2018-10-16 14:13:50 +0200101class RTC_EXPORT RTCCertificateStats final : public RTCStats {
hbos2fa7c672016-10-24 04:00:05 -0700102 public:
103 WEBRTC_RTCSTATS_DECL();
104
105 RTCCertificateStats(const std::string& id, int64_t timestamp_us);
106 RTCCertificateStats(std::string&& id, int64_t timestamp_us);
107 RTCCertificateStats(const RTCCertificateStats& other);
108 ~RTCCertificateStats() override;
109
110 RTCStatsMember<std::string> fingerprint;
111 RTCStatsMember<std::string> fingerprint_algorithm;
112 RTCStatsMember<std::string> base64_certificate;
113 RTCStatsMember<std::string> issuer_certificate_id;
114};
115
Jonas Oreland0d13bbd2022-03-02 11:17:36 +0100116// Non standard extension mapping to rtc::AdapterType
117struct RTCNetworkAdapterType {
118 static constexpr char kUnknown[] = "unknown";
119 static constexpr char kEthernet[] = "ethernet";
120 static constexpr char kWifi[] = "wifi";
121 static constexpr char kCellular[] = "cellular";
122 static constexpr char kLoopback[] = "loopback";
123 static constexpr char kAny[] = "any";
124 static constexpr char kCellular2g[] = "cellular2g";
125 static constexpr char kCellular3g[] = "cellular3g";
126 static constexpr char kCellular4g[] = "cellular4g";
127 static constexpr char kCellular5g[] = "cellular5g";
128};
129
hbos0adb8282016-11-23 02:32:06 -0800130// https://w3c.github.io/webrtc-stats/#codec-dict*
Mirko Bonadei276827c2018-10-16 14:13:50 +0200131class RTC_EXPORT RTCCodecStats final : public RTCStats {
hbos0adb8282016-11-23 02:32:06 -0800132 public:
133 WEBRTC_RTCSTATS_DECL();
134
135 RTCCodecStats(const std::string& id, int64_t timestamp_us);
136 RTCCodecStats(std::string&& id, int64_t timestamp_us);
137 RTCCodecStats(const RTCCodecStats& other);
138 ~RTCCodecStats() override;
139
Philipp Hancke95157a02020-11-16 20:08:27 +0100140 RTCStatsMember<std::string> transport_id;
hbos0adb8282016-11-23 02:32:06 -0800141 RTCStatsMember<uint32_t> payload_type;
hbos13f54b22017-02-28 06:56:04 -0800142 RTCStatsMember<std::string> mime_type;
hbos0adb8282016-11-23 02:32:06 -0800143 RTCStatsMember<uint32_t> clock_rate;
hbos0adb8282016-11-23 02:32:06 -0800144 RTCStatsMember<uint32_t> channels;
hbos13f54b22017-02-28 06:56:04 -0800145 RTCStatsMember<std::string> sdp_fmtp_line;
hbos0adb8282016-11-23 02:32:06 -0800146};
147
hbos2fa7c672016-10-24 04:00:05 -0700148// https://w3c.github.io/webrtc-stats/#dcstats-dict*
Mirko Bonadei276827c2018-10-16 14:13:50 +0200149class RTC_EXPORT RTCDataChannelStats final : public RTCStats {
hbos2fa7c672016-10-24 04:00:05 -0700150 public:
151 WEBRTC_RTCSTATS_DECL();
152
153 RTCDataChannelStats(const std::string& id, int64_t timestamp_us);
154 RTCDataChannelStats(std::string&& id, int64_t timestamp_us);
155 RTCDataChannelStats(const RTCDataChannelStats& other);
156 ~RTCDataChannelStats() override;
157
158 RTCStatsMember<std::string> label;
159 RTCStatsMember<std::string> protocol;
Harald Alvestrand10ef8472020-06-05 15:38:51 +0200160 RTCStatsMember<int32_t> data_channel_identifier;
hbos2fa7c672016-10-24 04:00:05 -0700161 // TODO(hbos): Support enum types? "RTCStatsMember<RTCDataChannelState>"?
162 RTCStatsMember<std::string> state;
163 RTCStatsMember<uint32_t> messages_sent;
164 RTCStatsMember<uint64_t> bytes_sent;
165 RTCStatsMember<uint32_t> messages_received;
166 RTCStatsMember<uint64_t> bytes_received;
167};
168
169// https://w3c.github.io/webrtc-stats/#candidatepair-dict*
hbos338f78a2017-02-07 06:41:21 -0800170// TODO(hbos): Tracking bug https://bugs.webrtc.org/7062
Mirko Bonadei276827c2018-10-16 14:13:50 +0200171class RTC_EXPORT RTCIceCandidatePairStats final : public RTCStats {
hbosc47a0c32016-10-11 14:54:49 -0700172 public:
173 WEBRTC_RTCSTATS_DECL();
174
175 RTCIceCandidatePairStats(const std::string& id, int64_t timestamp_us);
176 RTCIceCandidatePairStats(std::string&& id, int64_t timestamp_us);
177 RTCIceCandidatePairStats(const RTCIceCandidatePairStats& other);
178 ~RTCIceCandidatePairStats() override;
179
180 RTCStatsMember<std::string> transport_id;
181 RTCStatsMember<std::string> local_candidate_id;
182 RTCStatsMember<std::string> remote_candidate_id;
183 // TODO(hbos): Support enum types?
184 // "RTCStatsMember<RTCStatsIceCandidatePairState>"?
185 RTCStatsMember<std::string> state;
Di Wuef036cd2021-03-19 08:24:41 -0700186 // Obsolete: priority
hbosc47a0c32016-10-11 14:54:49 -0700187 RTCStatsMember<uint64_t> priority;
188 RTCStatsMember<bool> nominated;
hbos338f78a2017-02-07 06:41:21 -0800189 // TODO(hbos): Collect this the way the spec describes it. We have a value for
190 // it but it is not spec-compliant. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700191 RTCStatsMember<bool> writable;
hbos338f78a2017-02-07 06:41:21 -0800192 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700193 RTCStatsMember<bool> readable;
Taylor Brandstetter79326ea2021-09-28 15:09:53 -0700194 RTCStatsMember<uint64_t> packets_sent;
195 RTCStatsMember<uint64_t> packets_received;
hbosc47a0c32016-10-11 14:54:49 -0700196 RTCStatsMember<uint64_t> bytes_sent;
197 RTCStatsMember<uint64_t> bytes_received;
hbos3168c7a2016-12-15 06:17:08 -0800198 RTCStatsMember<double> total_round_trip_time;
hbos3168c7a2016-12-15 06:17:08 -0800199 RTCStatsMember<double> current_round_trip_time;
hbosc47a0c32016-10-11 14:54:49 -0700200 RTCStatsMember<double> available_outgoing_bitrate;
hbos338f78a2017-02-07 06:41:21 -0800201 // TODO(hbos): Populate this value. It is wired up and collected the same way
hbosbf8d3e52017-02-28 06:34:47 -0800202 // "VideoBwe.googAvailableReceiveBandwidth" is, but that value is always
hbos338f78a2017-02-07 06:41:21 -0800203 // undefined. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700204 RTCStatsMember<double> available_incoming_bitrate;
205 RTCStatsMember<uint64_t> requests_received;
206 RTCStatsMember<uint64_t> requests_sent;
207 RTCStatsMember<uint64_t> responses_received;
208 RTCStatsMember<uint64_t> responses_sent;
hbos338f78a2017-02-07 06:41:21 -0800209 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700210 RTCStatsMember<uint64_t> retransmissions_received;
hbos338f78a2017-02-07 06:41:21 -0800211 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700212 RTCStatsMember<uint64_t> retransmissions_sent;
hbos338f78a2017-02-07 06:41:21 -0800213 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700214 RTCStatsMember<uint64_t> consent_requests_received;
215 RTCStatsMember<uint64_t> consent_requests_sent;
hbos338f78a2017-02-07 06:41:21 -0800216 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700217 RTCStatsMember<uint64_t> consent_responses_received;
hbos338f78a2017-02-07 06:41:21 -0800218 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062
hbosc47a0c32016-10-11 14:54:49 -0700219 RTCStatsMember<uint64_t> consent_responses_sent;
Taylor Brandstetter79326ea2021-09-28 15:09:53 -0700220 RTCStatsMember<uint64_t> packets_discarded_on_send;
221 RTCStatsMember<uint64_t> bytes_discarded_on_send;
hbosc47a0c32016-10-11 14:54:49 -0700222};
223
hbosab9f6e42016-10-07 02:18:47 -0700224// https://w3c.github.io/webrtc-stats/#icecandidate-dict*
Artem Titov0e61fdd2021-07-25 21:50:14 +0200225// TODO(hbos): `RTCStatsCollector` only collects candidates that are part of
hbos5d79a7c2016-10-24 09:27:10 -0700226// ice candidate pairs, but there could be candidates not paired with anything.
227// crbug.com/632723
Qingsi Wang72a43a12018-02-20 16:03:18 -0800228// TODO(qingsi): Add the stats of STUN binding requests (keepalives) and collect
229// them in the new PeerConnection::GetStats.
Mirko Bonadei276827c2018-10-16 14:13:50 +0200230class RTC_EXPORT RTCIceCandidateStats : public RTCStats {
hbosab9f6e42016-10-07 02:18:47 -0700231 public:
232 WEBRTC_RTCSTATS_DECL();
233
234 RTCIceCandidateStats(const RTCIceCandidateStats& other);
235 ~RTCIceCandidateStats() override;
236
hbosb4e426e2017-01-02 09:59:31 -0800237 RTCStatsMember<std::string> transport_id;
Di Wuef036cd2021-03-19 08:24:41 -0700238 // Obsolete: is_remote
hbosc3a2b7f2017-01-02 04:46:15 -0800239 RTCStatsMember<bool> is_remote;
Gary Liu37e489c2017-11-21 10:49:36 -0800240 RTCStatsMember<std::string> network_type;
hbosab9f6e42016-10-07 02:18:47 -0700241 RTCStatsMember<std::string> ip;
Philipp Hanckea9ba4502021-03-22 13:22:54 +0100242 RTCStatsMember<std::string> address;
hbosab9f6e42016-10-07 02:18:47 -0700243 RTCStatsMember<int32_t> port;
244 RTCStatsMember<std::string> protocol;
Philipp Hancke95513752018-09-27 14:40:08 +0200245 RTCStatsMember<std::string> relay_protocol;
hbosab9f6e42016-10-07 02:18:47 -0700246 // TODO(hbos): Support enum types? "RTCStatsMember<RTCIceCandidateType>"?
247 RTCStatsMember<std::string> candidate_type;
248 RTCStatsMember<int32_t> priority;
249 RTCStatsMember<std::string> url;
250
Jonas Oreland0d13bbd2022-03-02 11:17:36 +0100251 RTCNonStandardStatsMember<bool> vpn;
252 RTCNonStandardStatsMember<std::string> network_adapter_type;
253
hbosab9f6e42016-10-07 02:18:47 -0700254 protected:
Yves Gerey665174f2018-06-19 15:03:05 +0200255 RTCIceCandidateStats(const std::string& id,
256 int64_t timestamp_us,
257 bool is_remote);
hbosc3a2b7f2017-01-02 04:46:15 -0800258 RTCIceCandidateStats(std::string&& id, int64_t timestamp_us, bool is_remote);
hbosab9f6e42016-10-07 02:18:47 -0700259};
260
261// In the spec both local and remote varieties are of type RTCIceCandidateStats.
Artem Titov0e61fdd2021-07-25 21:50:14 +0200262// But here we define them as subclasses of `RTCIceCandidateStats` because the
263// `kType` need to be different ("RTCStatsType type") in the local/remote case.
hbosab9f6e42016-10-07 02:18:47 -0700264// https://w3c.github.io/webrtc-stats/#rtcstatstype-str*
Henrik Boström1df1bf82018-03-20 13:24:20 +0100265// This forces us to have to override copy() and type().
Mirko Bonadei276827c2018-10-16 14:13:50 +0200266class RTC_EXPORT RTCLocalIceCandidateStats final : public RTCIceCandidateStats {
hbosab9f6e42016-10-07 02:18:47 -0700267 public:
268 static const char kType[];
269 RTCLocalIceCandidateStats(const std::string& id, int64_t timestamp_us);
270 RTCLocalIceCandidateStats(std::string&& id, int64_t timestamp_us);
Henrik Boström1df1bf82018-03-20 13:24:20 +0100271 std::unique_ptr<RTCStats> copy() const override;
hbosab9f6e42016-10-07 02:18:47 -0700272 const char* type() const override;
273};
274
Mirko Bonadei276827c2018-10-16 14:13:50 +0200275class RTC_EXPORT RTCRemoteIceCandidateStats final
276 : public RTCIceCandidateStats {
hbosab9f6e42016-10-07 02:18:47 -0700277 public:
278 static const char kType[];
279 RTCRemoteIceCandidateStats(const std::string& id, int64_t timestamp_us);
280 RTCRemoteIceCandidateStats(std::string&& id, int64_t timestamp_us);
Henrik Boström1df1bf82018-03-20 13:24:20 +0100281 std::unique_ptr<RTCStats> copy() const override;
hbosab9f6e42016-10-07 02:18:47 -0700282 const char* type() const override;
283};
284
hbos09bc1282016-11-08 06:29:22 -0800285// https://w3c.github.io/webrtc-stats/#msstats-dict*
hbos0adb8282016-11-23 02:32:06 -0800286// TODO(hbos): Tracking bug crbug.com/660827
Mirko Bonadei276827c2018-10-16 14:13:50 +0200287class RTC_EXPORT RTCMediaStreamStats final : public RTCStats {
hbos09bc1282016-11-08 06:29:22 -0800288 public:
289 WEBRTC_RTCSTATS_DECL();
290
291 RTCMediaStreamStats(const std::string& id, int64_t timestamp_us);
292 RTCMediaStreamStats(std::string&& id, int64_t timestamp_us);
293 RTCMediaStreamStats(const RTCMediaStreamStats& other);
294 ~RTCMediaStreamStats() override;
295
296 RTCStatsMember<std::string> stream_identifier;
297 RTCStatsMember<std::vector<std::string>> track_ids;
298};
299
300// https://w3c.github.io/webrtc-stats/#mststats-dict*
hbos0adb8282016-11-23 02:32:06 -0800301// TODO(hbos): Tracking bug crbug.com/659137
Mirko Bonadei276827c2018-10-16 14:13:50 +0200302class RTC_EXPORT RTCMediaStreamTrackStats final : public RTCStats {
hbos09bc1282016-11-08 06:29:22 -0800303 public:
304 WEBRTC_RTCSTATS_DECL();
305
Yves Gerey665174f2018-06-19 15:03:05 +0200306 RTCMediaStreamTrackStats(const std::string& id,
307 int64_t timestamp_us,
hbos160e4a72017-01-17 02:53:23 -0800308 const char* kind);
Yves Gerey665174f2018-06-19 15:03:05 +0200309 RTCMediaStreamTrackStats(std::string&& id,
310 int64_t timestamp_us,
hbos160e4a72017-01-17 02:53:23 -0800311 const char* kind);
hbos09bc1282016-11-08 06:29:22 -0800312 RTCMediaStreamTrackStats(const RTCMediaStreamTrackStats& other);
313 ~RTCMediaStreamTrackStats() override;
314
315 RTCStatsMember<std::string> track_identifier;
Henrik Boström646fda02019-05-22 15:49:42 +0200316 RTCStatsMember<std::string> media_source_id;
hbos09bc1282016-11-08 06:29:22 -0800317 RTCStatsMember<bool> remote_source;
318 RTCStatsMember<bool> ended;
Artem Titov0e61fdd2021-07-25 21:50:14 +0200319 // TODO(hbos): `RTCStatsCollector` does not return stats for detached tracks.
hbos09bc1282016-11-08 06:29:22 -0800320 // crbug.com/659137
321 RTCStatsMember<bool> detached;
Artem Titov0e61fdd2021-07-25 21:50:14 +0200322 // See `RTCMediaStreamTrackKind` for valid values.
hbos160e4a72017-01-17 02:53:23 -0800323 RTCStatsMember<std::string> kind;
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200324 RTCStatsMember<double> jitter_buffer_delay;
Chen Xing0acffb52019-01-15 15:46:29 +0100325 RTCStatsMember<uint64_t> jitter_buffer_emitted_count;
hbos09bc1282016-11-08 06:29:22 -0800326 // Video-only members
327 RTCStatsMember<uint32_t> frame_width;
328 RTCStatsMember<uint32_t> frame_height;
Artem Titov0e61fdd2021-07-25 21:50:14 +0200329 // TODO(hbos): Not collected by `RTCStatsCollector`. crbug.com/659137
hbos09bc1282016-11-08 06:29:22 -0800330 RTCStatsMember<double> frames_per_second;
hbos09bc1282016-11-08 06:29:22 -0800331 RTCStatsMember<uint32_t> frames_sent;
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100332 RTCStatsMember<uint32_t> huge_frames_sent;
hbos09bc1282016-11-08 06:29:22 -0800333 RTCStatsMember<uint32_t> frames_received;
hbos09bc1282016-11-08 06:29:22 -0800334 RTCStatsMember<uint32_t> frames_decoded;
hbos09bc1282016-11-08 06:29:22 -0800335 RTCStatsMember<uint32_t> frames_dropped;
Artem Titov0e61fdd2021-07-25 21:50:14 +0200336 // TODO(hbos): Not collected by `RTCStatsCollector`. crbug.com/659137
hbos09bc1282016-11-08 06:29:22 -0800337 RTCStatsMember<uint32_t> frames_corrupted;
Artem Titov0e61fdd2021-07-25 21:50:14 +0200338 // TODO(hbos): Not collected by `RTCStatsCollector`. crbug.com/659137
hbos09bc1282016-11-08 06:29:22 -0800339 RTCStatsMember<uint32_t> partial_frames_lost;
Artem Titov0e61fdd2021-07-25 21:50:14 +0200340 // TODO(hbos): Not collected by `RTCStatsCollector`. crbug.com/659137
hbos09bc1282016-11-08 06:29:22 -0800341 RTCStatsMember<uint32_t> full_frames_lost;
342 // Audio-only members
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200343 RTCStatsMember<double> audio_level; // Receive-only
344 RTCStatsMember<double> total_audio_energy; // Receive-only
hbos09bc1282016-11-08 06:29:22 -0800345 RTCStatsMember<double> echo_return_loss;
346 RTCStatsMember<double> echo_return_loss_enhancement;
Steve Anton2dbc69f2017-08-24 17:15:13 -0700347 RTCStatsMember<uint64_t> total_samples_received;
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200348 RTCStatsMember<double> total_samples_duration; // Receive-only
Steve Anton2dbc69f2017-08-24 17:15:13 -0700349 RTCStatsMember<uint64_t> concealed_samples;
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200350 RTCStatsMember<uint64_t> silent_concealed_samples;
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200351 RTCStatsMember<uint64_t> concealment_events;
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200352 RTCStatsMember<uint64_t> inserted_samples_for_deceleration;
353 RTCStatsMember<uint64_t> removed_samples_for_acceleration;
Ruslan Burakov8af88962018-11-22 17:21:10 +0100354 // Non-standard audio-only member
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100355 // TODO(kuddai): Add description to standard. crbug.com/webrtc/10042
Ruslan Burakov8af88962018-11-22 17:21:10 +0100356 RTCNonStandardStatsMember<uint64_t> jitter_buffer_flushes;
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100357 RTCNonStandardStatsMember<uint64_t> delayed_packet_outage_samples;
Jakob Ivarsson232b3fd2019-03-06 09:18:40 +0100358 RTCNonStandardStatsMember<double> relative_packet_arrival_delay;
Artem Titove618cc92020-03-11 11:18:54 +0100359 // Non-standard metric showing target delay of jitter buffer.
360 // This value is increased by the target jitter buffer delay every time a
361 // sample is emitted by the jitter buffer. The added target is the target
362 // delay, in seconds, at the time that the sample was emitted from the jitter
363 // buffer. (https://github.com/w3c/webrtc-provisional-stats/pull/20)
364 // Currently it is implemented only for audio.
365 // TODO(titovartem) implement for video streams when will be requested.
366 RTCNonStandardStatsMember<double> jitter_buffer_target_delay;
Henrik Lundin44125fa2019-04-29 17:00:46 +0200367 // TODO(henrik.lundin): Add description of the interruption metrics at
368 // https://github.com/henbos/webrtc-provisional-stats/issues/17
369 RTCNonStandardStatsMember<uint32_t> interruption_count;
370 RTCNonStandardStatsMember<double> total_interruption_duration;
Sergey Silkin02371062019-01-31 16:45:42 +0100371 // Non-standard video-only members.
372 // https://henbos.github.io/webrtc-provisional-stats/#RTCVideoReceiverStats-dict*
373 RTCNonStandardStatsMember<uint32_t> freeze_count;
374 RTCNonStandardStatsMember<uint32_t> pause_count;
375 RTCNonStandardStatsMember<double> total_freezes_duration;
376 RTCNonStandardStatsMember<double> total_pauses_duration;
377 RTCNonStandardStatsMember<double> total_frames_duration;
378 RTCNonStandardStatsMember<double> sum_squared_frame_durations;
hbos09bc1282016-11-08 06:29:22 -0800379};
380
hbos6ab97ce2016-10-03 14:16:56 -0700381// https://w3c.github.io/webrtc-stats/#pcstats-dict*
Mirko Bonadei276827c2018-10-16 14:13:50 +0200382class RTC_EXPORT RTCPeerConnectionStats final : public RTCStats {
hbosd565b732016-08-30 14:04:35 -0700383 public:
hbosfc5e0502016-10-06 02:06:10 -0700384 WEBRTC_RTCSTATS_DECL();
385
hbos0e6758d2016-08-31 07:57:36 -0700386 RTCPeerConnectionStats(const std::string& id, int64_t timestamp_us);
387 RTCPeerConnectionStats(std::string&& id, int64_t timestamp_us);
hbosfc5e0502016-10-06 02:06:10 -0700388 RTCPeerConnectionStats(const RTCPeerConnectionStats& other);
389 ~RTCPeerConnectionStats() override;
hbosd565b732016-08-30 14:04:35 -0700390
391 RTCStatsMember<uint32_t> data_channels_opened;
392 RTCStatsMember<uint32_t> data_channels_closed;
393};
394
hbos6ded1902016-11-01 01:50:46 -0700395// https://w3c.github.io/webrtc-stats/#streamstats-dict*
hbos0adb8282016-11-23 02:32:06 -0800396// TODO(hbos): Tracking bug crbug.com/657854
Mirko Bonadei276827c2018-10-16 14:13:50 +0200397class RTC_EXPORT RTCRTPStreamStats : public RTCStats {
hbos6ded1902016-11-01 01:50:46 -0700398 public:
399 WEBRTC_RTCSTATS_DECL();
400
401 RTCRTPStreamStats(const RTCRTPStreamStats& other);
402 ~RTCRTPStreamStats() override;
403
hbos3443bb72017-02-07 06:28:11 -0800404 RTCStatsMember<uint32_t> ssrc;
Philipp Hancke3bc01662018-08-28 14:55:03 +0200405 RTCStatsMember<std::string> kind;
Di Wuef036cd2021-03-19 08:24:41 -0700406 // Obsolete: track_id
hbosb0ae9202017-01-27 06:35:16 -0800407 RTCStatsMember<std::string> track_id;
hbos6ded1902016-11-01 01:50:46 -0700408 RTCStatsMember<std::string> transport_id;
hbos6ded1902016-11-01 01:50:46 -0700409 RTCStatsMember<std::string> codec_id;
Di Wufd1e9d12021-03-09 09:25:28 -0800410
411 // Obsolete
412 RTCStatsMember<std::string> media_type; // renamed to kind.
hbos6ded1902016-11-01 01:50:46 -0700413
414 protected:
415 RTCRTPStreamStats(const std::string& id, int64_t timestamp_us);
416 RTCRTPStreamStats(std::string&& id, int64_t timestamp_us);
417};
418
Alessio Bazzicaf7b1b952021-03-23 17:23:04 +0100419// https://www.w3.org/TR/webrtc-stats/#receivedrtpstats-dict*
Di Wufd1e9d12021-03-09 09:25:28 -0800420class RTC_EXPORT RTCReceivedRtpStreamStats : public RTCRTPStreamStats {
421 public:
422 WEBRTC_RTCSTATS_DECL();
423
424 RTCReceivedRtpStreamStats(const RTCReceivedRtpStreamStats& other);
425 ~RTCReceivedRtpStreamStats() override;
426
427 // TODO(hbos) The following fields need to be added and migrated
428 // both from RTCInboundRtpStreamStats and RTCRemoteInboundRtpStreamStats:
Minyue Li28a2c632021-07-07 15:53:38 +0200429 // packetsReceived, packetsRepaired, burstPacketsLost,
Di Wufd1e9d12021-03-09 09:25:28 -0800430 // burstPacketDiscarded, burstLossCount, burstDiscardCount, burstLossRate,
431 // burstDiscardRate, gapLossRate, gapDiscardRate, framesDropped,
432 // partialFramesLost, fullFramesLost
433 // crbug.com/webrtc/12532
434 RTCStatsMember<double> jitter;
435 RTCStatsMember<int32_t> packets_lost; // Signed per RFC 3550
Minyue Li28a2c632021-07-07 15:53:38 +0200436 RTCStatsMember<uint64_t> packets_discarded;
Di Wufd1e9d12021-03-09 09:25:28 -0800437
438 protected:
439 RTCReceivedRtpStreamStats(const std::string&& id, int64_t timestamp_us);
440 RTCReceivedRtpStreamStats(std::string&& id, int64_t timestamp_us);
441};
442
Alessio Bazzicaf7b1b952021-03-23 17:23:04 +0100443// https://www.w3.org/TR/webrtc-stats/#sentrtpstats-dict*
444class RTC_EXPORT RTCSentRtpStreamStats : public RTCRTPStreamStats {
445 public:
446 WEBRTC_RTCSTATS_DECL();
447
448 RTCSentRtpStreamStats(const RTCSentRtpStreamStats& other);
449 ~RTCSentRtpStreamStats() override;
450
451 RTCStatsMember<uint32_t> packets_sent;
452 RTCStatsMember<uint64_t> bytes_sent;
453
454 protected:
455 RTCSentRtpStreamStats(const std::string&& id, int64_t timestamp_us);
456 RTCSentRtpStreamStats(std::string&& id, int64_t timestamp_us);
457};
458
hboseeafe942016-11-01 03:00:17 -0700459// https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict*
hbosa7a9be12017-03-01 01:02:45 -0800460// TODO(hbos): Support the remote case |is_remote = true|.
461// https://bugs.webrtc.org/7065
Di Wufd1e9d12021-03-09 09:25:28 -0800462class RTC_EXPORT RTCInboundRTPStreamStats final
463 : public RTCReceivedRtpStreamStats {
hboseeafe942016-11-01 03:00:17 -0700464 public:
465 WEBRTC_RTCSTATS_DECL();
466
467 RTCInboundRTPStreamStats(const std::string& id, int64_t timestamp_us);
468 RTCInboundRTPStreamStats(std::string&& id, int64_t timestamp_us);
469 RTCInboundRTPStreamStats(const RTCInboundRTPStreamStats& other);
470 ~RTCInboundRTPStreamStats() override;
471
Alessio Bazzicaf7b1b952021-03-23 17:23:04 +0100472 RTCStatsMember<std::string> remote_id;
hboseeafe942016-11-01 03:00:17 -0700473 RTCStatsMember<uint32_t> packets_received;
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200474 RTCStatsMember<uint64_t> fec_packets_received;
475 RTCStatsMember<uint64_t> fec_packets_discarded;
hboseeafe942016-11-01 03:00:17 -0700476 RTCStatsMember<uint64_t> bytes_received;
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200477 RTCStatsMember<uint64_t> header_bytes_received;
Henrik Boström01738c62019-04-15 17:32:00 +0200478 RTCStatsMember<double> last_packet_received_timestamp;
Eldar Rello4e5bc9f2020-07-06 14:18:07 +0300479 RTCStatsMember<double> jitter_buffer_delay;
480 RTCStatsMember<uint64_t> jitter_buffer_emitted_count;
481 RTCStatsMember<uint64_t> total_samples_received;
482 RTCStatsMember<uint64_t> concealed_samples;
483 RTCStatsMember<uint64_t> silent_concealed_samples;
484 RTCStatsMember<uint64_t> concealment_events;
485 RTCStatsMember<uint64_t> inserted_samples_for_deceleration;
486 RTCStatsMember<uint64_t> removed_samples_for_acceleration;
487 RTCStatsMember<double> audio_level;
488 RTCStatsMember<double> total_audio_energy;
489 RTCStatsMember<double> total_samples_duration;
490 RTCStatsMember<int32_t> frames_received;
hbosa7a9be12017-03-01 01:02:45 -0800491 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
492 RTCStatsMember<double> round_trip_time;
493 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700494 RTCStatsMember<uint32_t> packets_repaired;
hbosa7a9be12017-03-01 01:02:45 -0800495 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700496 RTCStatsMember<uint32_t> burst_packets_lost;
hbosa7a9be12017-03-01 01:02:45 -0800497 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700498 RTCStatsMember<uint32_t> burst_packets_discarded;
hbosa7a9be12017-03-01 01:02:45 -0800499 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700500 RTCStatsMember<uint32_t> burst_loss_count;
hbosa7a9be12017-03-01 01:02:45 -0800501 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700502 RTCStatsMember<uint32_t> burst_discard_count;
hbosa7a9be12017-03-01 01:02:45 -0800503 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700504 RTCStatsMember<double> burst_loss_rate;
hbosa7a9be12017-03-01 01:02:45 -0800505 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700506 RTCStatsMember<double> burst_discard_rate;
hbosa7a9be12017-03-01 01:02:45 -0800507 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700508 RTCStatsMember<double> gap_loss_rate;
hbosa7a9be12017-03-01 01:02:45 -0800509 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
hboseeafe942016-11-01 03:00:17 -0700510 RTCStatsMember<double> gap_discard_rate;
Eldar Rello4e5bc9f2020-07-06 14:18:07 +0300511 RTCStatsMember<uint32_t> frame_width;
512 RTCStatsMember<uint32_t> frame_height;
513 RTCStatsMember<uint32_t> frame_bit_depth;
514 RTCStatsMember<double> frames_per_second;
hbos6769c492017-01-02 08:35:13 -0800515 RTCStatsMember<uint32_t> frames_decoded;
Rasmus Brandt2efae772019-06-27 14:29:34 +0200516 RTCStatsMember<uint32_t> key_frames_decoded;
Eldar Rello4e5bc9f2020-07-06 14:18:07 +0300517 RTCStatsMember<uint32_t> frames_dropped;
Johannes Kronbfd343b2019-07-01 10:07:50 +0200518 RTCStatsMember<double> total_decode_time;
Johannes Kron00376e12019-11-25 10:25:42 +0100519 RTCStatsMember<double> total_inter_frame_delay;
520 RTCStatsMember<double> total_squared_inter_frame_delay;
Henrik Boström2e069262019-04-09 13:59:31 +0200521 // https://henbos.github.io/webrtc-provisional-stats/#dom-rtcinboundrtpstreamstats-contenttype
522 RTCStatsMember<std::string> content_type;
Åsa Perssonfcf79cc2019-10-22 15:23:44 +0200523 // TODO(asapersson): Currently only populated if audio/video sync is enabled.
524 RTCStatsMember<double> estimated_playout_timestamp;
Henrik Boström6b430862019-08-16 13:09:51 +0200525 // TODO(hbos): This is only implemented for video; implement it for audio as
526 // well.
527 RTCStatsMember<std::string> decoder_implementation;
Philipp Hanckea3b5c4e2022-04-22 15:09:54 +0200528 // FIR and PLI counts are only defined for |kind == "video"|.
Di Wufd1e9d12021-03-09 09:25:28 -0800529 RTCStatsMember<uint32_t> fir_count;
530 RTCStatsMember<uint32_t> pli_count;
Di Wufd1e9d12021-03-09 09:25:28 -0800531 RTCStatsMember<uint32_t> nack_count;
532 RTCStatsMember<uint64_t> qp_sum;
hboseeafe942016-11-01 03:00:17 -0700533};
534
hbos6ded1902016-11-01 01:50:46 -0700535// https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict*
hbosa7a9be12017-03-01 01:02:45 -0800536// TODO(hbos): Support the remote case |is_remote = true|.
537// https://bugs.webrtc.org/7066
Mirko Bonadei276827c2018-10-16 14:13:50 +0200538class RTC_EXPORT RTCOutboundRTPStreamStats final : public RTCRTPStreamStats {
hbos6ded1902016-11-01 01:50:46 -0700539 public:
540 WEBRTC_RTCSTATS_DECL();
541
542 RTCOutboundRTPStreamStats(const std::string& id, int64_t timestamp_us);
543 RTCOutboundRTPStreamStats(std::string&& id, int64_t timestamp_us);
544 RTCOutboundRTPStreamStats(const RTCOutboundRTPStreamStats& other);
545 ~RTCOutboundRTPStreamStats() override;
546
Henrik Boström646fda02019-05-22 15:49:42 +0200547 RTCStatsMember<std::string> media_source_id;
Henrik Boström4f40fa52019-12-19 13:27:27 +0100548 RTCStatsMember<std::string> remote_id;
Henrik Boströma0ff50c2020-05-05 15:54:46 +0200549 RTCStatsMember<std::string> rid;
hbos6ded1902016-11-01 01:50:46 -0700550 RTCStatsMember<uint32_t> packets_sent;
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200551 RTCStatsMember<uint64_t> retransmitted_packets_sent;
hbos6ded1902016-11-01 01:50:46 -0700552 RTCStatsMember<uint64_t> bytes_sent;
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200553 RTCStatsMember<uint64_t> header_bytes_sent;
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200554 RTCStatsMember<uint64_t> retransmitted_bytes_sent;
Jakob Ivarssonbf087452021-11-11 13:43:49 +0100555 // TODO(https://crbug.com/webrtc/13394): Also collect this metric for video.
hbos6ded1902016-11-01 01:50:46 -0700556 RTCStatsMember<double> target_bitrate;
hbos6769c492017-01-02 08:35:13 -0800557 RTCStatsMember<uint32_t> frames_encoded;
Rasmus Brandt2efae772019-06-27 14:29:34 +0200558 RTCStatsMember<uint32_t> key_frames_encoded;
Henrik Boströmf71362f2019-04-08 16:14:23 +0200559 RTCStatsMember<double> total_encode_time;
Henrik Boström23aff9b2019-05-20 15:15:38 +0200560 RTCStatsMember<uint64_t> total_encoded_bytes_target;
Henrik Boströma0ff50c2020-05-05 15:54:46 +0200561 RTCStatsMember<uint32_t> frame_width;
562 RTCStatsMember<uint32_t> frame_height;
563 RTCStatsMember<double> frames_per_second;
564 RTCStatsMember<uint32_t> frames_sent;
565 RTCStatsMember<uint32_t> huge_frames_sent;
Henrik Boström9fe18342019-05-16 18:38:20 +0200566 // TODO(https://crbug.com/webrtc/10635): This is only implemented for video;
567 // implement it for audio as well.
568 RTCStatsMember<double> total_packet_send_delay;
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200569 // Enum type RTCQualityLimitationReason
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200570 RTCStatsMember<std::string> quality_limitation_reason;
Byoungchan Lee7d235352021-05-28 21:32:04 +0900571 RTCStatsMember<std::map<std::string, double>> quality_limitation_durations;
Evan Shrubsolecc62b162019-09-09 11:26:45 +0200572 // https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationresolutionchanges
573 RTCStatsMember<uint32_t> quality_limitation_resolution_changes;
Henrik Boström2e069262019-04-09 13:59:31 +0200574 // https://henbos.github.io/webrtc-provisional-stats/#dom-rtcoutboundrtpstreamstats-contenttype
575 RTCStatsMember<std::string> content_type;
Henrik Boström6b430862019-08-16 13:09:51 +0200576 // TODO(hbos): This is only implemented for video; implement it for audio as
577 // well.
578 RTCStatsMember<std::string> encoder_implementation;
Philipp Hanckea3b5c4e2022-04-22 15:09:54 +0200579 // FIR and PLI counts are only defined for |kind == "video"|.
Di Wufd1e9d12021-03-09 09:25:28 -0800580 RTCStatsMember<uint32_t> fir_count;
581 RTCStatsMember<uint32_t> pli_count;
Di Wufd1e9d12021-03-09 09:25:28 -0800582 RTCStatsMember<uint32_t> nack_count;
583 RTCStatsMember<uint64_t> qp_sum;
hbos6ded1902016-11-01 01:50:46 -0700584};
585
Henrik Boström883eefc2019-05-27 13:40:25 +0200586// https://w3c.github.io/webrtc-stats/#remoteinboundrtpstats-dict*
Di Wufd1e9d12021-03-09 09:25:28 -0800587class RTC_EXPORT RTCRemoteInboundRtpStreamStats final
588 : public RTCReceivedRtpStreamStats {
Henrik Boström883eefc2019-05-27 13:40:25 +0200589 public:
590 WEBRTC_RTCSTATS_DECL();
591
592 RTCRemoteInboundRtpStreamStats(const std::string& id, int64_t timestamp_us);
593 RTCRemoteInboundRtpStreamStats(std::string&& id, int64_t timestamp_us);
594 RTCRemoteInboundRtpStreamStats(const RTCRemoteInboundRtpStreamStats& other);
595 ~RTCRemoteInboundRtpStreamStats() override;
596
Henrik Boström883eefc2019-05-27 13:40:25 +0200597 // TODO(hbos): The following RTCReceivedRtpStreamStats metrics should also be
Minyue Li28a2c632021-07-07 15:53:38 +0200598 // implemented: packetsReceived, packetsRepaired,
Henrik Boström883eefc2019-05-27 13:40:25 +0200599 // burstPacketsLost, burstPacketsDiscarded, burstLossCount, burstDiscardCount,
600 // burstLossRate, burstDiscardRate, gapLossRate and gapDiscardRate.
601 // RTCRemoteInboundRtpStreamStats
602 RTCStatsMember<std::string> local_id;
603 RTCStatsMember<double> round_trip_time;
Di Wu86f04ad2021-02-28 23:36:03 -0800604 RTCStatsMember<double> fraction_lost;
Di Wu88a51b22021-03-01 11:22:06 -0800605 RTCStatsMember<double> total_round_trip_time;
606 RTCStatsMember<int32_t> round_trip_time_measurements;
Henrik Boström883eefc2019-05-27 13:40:25 +0200607};
608
Alessio Bazzicaf7b1b952021-03-23 17:23:04 +0100609// https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict*
610class RTC_EXPORT RTCRemoteOutboundRtpStreamStats final
611 : public RTCSentRtpStreamStats {
612 public:
613 WEBRTC_RTCSTATS_DECL();
614
615 RTCRemoteOutboundRtpStreamStats(const std::string& id, int64_t timestamp_us);
616 RTCRemoteOutboundRtpStreamStats(std::string&& id, int64_t timestamp_us);
617 RTCRemoteOutboundRtpStreamStats(const RTCRemoteOutboundRtpStreamStats& other);
618 ~RTCRemoteOutboundRtpStreamStats() override;
619
620 RTCStatsMember<std::string> local_id;
621 RTCStatsMember<double> remote_timestamp;
622 RTCStatsMember<uint64_t> reports_sent;
Ivo Creusen2562cf02021-09-03 14:51:22 +0000623 RTCStatsMember<double> round_trip_time;
624 RTCStatsMember<uint64_t> round_trip_time_measurements;
625 RTCStatsMember<double> total_round_trip_time;
Alessio Bazzicaf7b1b952021-03-23 17:23:04 +0100626};
627
Henrik Boström646fda02019-05-22 15:49:42 +0200628// https://w3c.github.io/webrtc-stats/#dom-rtcmediasourcestats
629class RTC_EXPORT RTCMediaSourceStats : public RTCStats {
630 public:
631 WEBRTC_RTCSTATS_DECL();
632
633 RTCMediaSourceStats(const RTCMediaSourceStats& other);
634 ~RTCMediaSourceStats() override;
635
636 RTCStatsMember<std::string> track_identifier;
637 RTCStatsMember<std::string> kind;
638
639 protected:
640 RTCMediaSourceStats(const std::string& id, int64_t timestamp_us);
641 RTCMediaSourceStats(std::string&& id, int64_t timestamp_us);
642};
643
644// https://w3c.github.io/webrtc-stats/#dom-rtcaudiosourcestats
645class RTC_EXPORT RTCAudioSourceStats final : public RTCMediaSourceStats {
646 public:
647 WEBRTC_RTCSTATS_DECL();
648
649 RTCAudioSourceStats(const std::string& id, int64_t timestamp_us);
650 RTCAudioSourceStats(std::string&& id, int64_t timestamp_us);
651 RTCAudioSourceStats(const RTCAudioSourceStats& other);
652 ~RTCAudioSourceStats() override;
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200653
654 RTCStatsMember<double> audio_level;
655 RTCStatsMember<double> total_audio_energy;
656 RTCStatsMember<double> total_samples_duration;
Taylor Brandstetter64851c02021-06-24 13:32:50 -0700657 RTCStatsMember<double> echo_return_loss;
658 RTCStatsMember<double> echo_return_loss_enhancement;
Henrik Boström646fda02019-05-22 15:49:42 +0200659};
660
661// https://w3c.github.io/webrtc-stats/#dom-rtcvideosourcestats
662class RTC_EXPORT RTCVideoSourceStats final : public RTCMediaSourceStats {
663 public:
664 WEBRTC_RTCSTATS_DECL();
665
666 RTCVideoSourceStats(const std::string& id, int64_t timestamp_us);
667 RTCVideoSourceStats(std::string&& id, int64_t timestamp_us);
668 RTCVideoSourceStats(const RTCVideoSourceStats& other);
669 ~RTCVideoSourceStats() override;
670
671 RTCStatsMember<uint32_t> width;
672 RTCStatsMember<uint32_t> height;
Henrik Boström646fda02019-05-22 15:49:42 +0200673 RTCStatsMember<uint32_t> frames;
Byoungchan Leeefe46b62021-11-10 11:23:56 +0900674 RTCStatsMember<double> frames_per_second;
Henrik Boström646fda02019-05-22 15:49:42 +0200675};
676
hbos2fa7c672016-10-24 04:00:05 -0700677// https://w3c.github.io/webrtc-stats/#transportstats-dict*
Mirko Bonadei276827c2018-10-16 14:13:50 +0200678class RTC_EXPORT RTCTransportStats final : public RTCStats {
hbos2fa7c672016-10-24 04:00:05 -0700679 public:
680 WEBRTC_RTCSTATS_DECL();
681
682 RTCTransportStats(const std::string& id, int64_t timestamp_us);
683 RTCTransportStats(std::string&& id, int64_t timestamp_us);
684 RTCTransportStats(const RTCTransportStats& other);
685 ~RTCTransportStats() override;
686
687 RTCStatsMember<uint64_t> bytes_sent;
Artem Titovedacbd52020-07-06 16:06:37 +0200688 RTCStatsMember<uint64_t> packets_sent;
hbos2fa7c672016-10-24 04:00:05 -0700689 RTCStatsMember<uint64_t> bytes_received;
Artem Titovedacbd52020-07-06 16:06:37 +0200690 RTCStatsMember<uint64_t> packets_received;
hbos2fa7c672016-10-24 04:00:05 -0700691 RTCStatsMember<std::string> rtcp_transport_stats_id;
hbos7064d592017-01-16 07:38:02 -0800692 // TODO(hbos): Support enum types? "RTCStatsMember<RTCDtlsTransportState>"?
693 RTCStatsMember<std::string> dtls_state;
hbos2fa7c672016-10-24 04:00:05 -0700694 RTCStatsMember<std::string> selected_candidate_pair_id;
695 RTCStatsMember<std::string> local_certificate_id;
696 RTCStatsMember<std::string> remote_certificate_id;
Harald Alvestrand5cb78072019-10-28 09:51:17 +0100697 RTCStatsMember<std::string> tls_version;
698 RTCStatsMember<std::string> dtls_cipher;
Philipp Hancke69c1df22022-04-22 15:46:24 +0200699 RTCStatsMember<std::string> dtls_role;
Harald Alvestrand5cb78072019-10-28 09:51:17 +0100700 RTCStatsMember<std::string> srtp_cipher;
Jonas Oreland149dc722019-08-28 08:10:27 +0200701 RTCStatsMember<uint32_t> selected_candidate_pair_changes;
hbos2fa7c672016-10-24 04:00:05 -0700702};
703
hbosd565b732016-08-30 14:04:35 -0700704} // namespace webrtc
705
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200706#endif // API_STATS_RTCSTATS_OBJECTS_H_