hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 1 | /* |
| 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 Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef API_STATS_RTCSTATS_OBJECTS_H_ |
| 12 | #define API_STATS_RTCSTATS_OBJECTS_H_ |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 13 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 14 | #include <stdint.h> |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 15 | |
Byoungchan Lee | 7d23535 | 2021-05-28 21:32:04 +0900 | [diff] [blame] | 16 | #include <map> |
Henrik Boström | 1df1bf8 | 2018-03-20 13:24:20 +0100 | [diff] [blame] | 17 | #include <memory> |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 18 | #include <string> |
oprypin | 803dc29 | 2017-02-01 01:55:59 -0800 | [diff] [blame] | 19 | #include <vector> |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 20 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 21 | #include "api/stats/rtc_stats.h" |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 22 | #include "rtc_base/system/rtc_export.h" |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 23 | |
| 24 | namespace webrtc { |
| 25 | |
hbos | cc555c5 | 2016-10-18 12:48:31 -0700 | [diff] [blame] | 26 | // https://w3c.github.io/webrtc-pc/#idl-def-rtcdatachannelstate |
| 27 | struct RTCDataChannelState { |
agrieve | 26622d3 | 2017-08-08 10:48:15 -0700 | [diff] [blame] | 28 | static const char* const kConnecting; |
| 29 | static const char* const kOpen; |
| 30 | static const char* const kClosing; |
| 31 | static const char* const kClosed; |
hbos | cc555c5 | 2016-10-18 12:48:31 -0700 | [diff] [blame] | 32 | }; |
| 33 | |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 34 | // https://w3c.github.io/webrtc-stats/#dom-rtcstatsicecandidatepairstate |
| 35 | struct RTCStatsIceCandidatePairState { |
agrieve | 26622d3 | 2017-08-08 10:48:15 -0700 | [diff] [blame] | 36 | 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; |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 41 | }; |
| 42 | |
hbos | cc555c5 | 2016-10-18 12:48:31 -0700 | [diff] [blame] | 43 | // https://w3c.github.io/webrtc-pc/#rtcicecandidatetype-enum |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 44 | struct RTCIceCandidateType { |
agrieve | 26622d3 | 2017-08-08 10:48:15 -0700 | [diff] [blame] | 45 | static const char* const kHost; |
| 46 | static const char* const kSrflx; |
| 47 | static const char* const kPrflx; |
| 48 | static const char* const kRelay; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 49 | }; |
| 50 | |
hbos | 7064d59 | 2017-01-16 07:38:02 -0800 | [diff] [blame] | 51 | // https://w3c.github.io/webrtc-pc/#idl-def-rtcdtlstransportstate |
| 52 | struct RTCDtlsTransportState { |
agrieve | 26622d3 | 2017-08-08 10:48:15 -0700 | [diff] [blame] | 53 | 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; |
hbos | 7064d59 | 2017-01-16 07:38:02 -0800 | [diff] [blame] | 58 | }; |
| 59 | |
Artem Titov | cfea218 | 2021-08-10 01:22:31 +0200 | [diff] [blame] | 60 | // `RTCMediaStreamTrackStats::kind` is not an enum in the spec but the only |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame] | 61 | // valid values are "audio" and "video". |
| 62 | // https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats-kind |
| 63 | struct RTCMediaStreamTrackKind { |
agrieve | 26622d3 | 2017-08-08 10:48:15 -0700 | [diff] [blame] | 64 | static const char* const kAudio; |
| 65 | static const char* const kVideo; |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame] | 66 | }; |
| 67 | |
Gary Liu | 37e489c | 2017-11-21 10:49:36 -0800 | [diff] [blame] | 68 | // https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype |
| 69 | struct 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öm | ce33b6a | 2019-05-28 17:42:38 +0200 | [diff] [blame] | 79 | // https://w3c.github.io/webrtc-stats/#dom-rtcqualitylimitationreason |
| 80 | struct 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öm | 2e06926 | 2019-04-09 13:59:31 +0200 | [diff] [blame] | 87 | // https://webrtc.org/experiments/rtp-hdrext/video-content-type/ |
| 88 | struct RTCContentType { |
| 89 | static const char* const kUnspecified; |
| 90 | static const char* const kScreenshare; |
| 91 | }; |
| 92 | |
Philipp Hancke | 69c1df2 | 2022-04-22 15:46:24 +0200 | [diff] [blame] | 93 | // https://w3c.github.io/webrtc-stats/#dom-rtcdtlsrole |
| 94 | struct RTCDtlsRole { |
| 95 | static const char* const kUnknown; |
| 96 | static const char* const kClient; |
| 97 | static const char* const kServer; |
| 98 | }; |
| 99 | |
Philipp Hancke | cc1b9b0 | 2022-05-04 18:58:26 +0200 | [diff] [blame] | 100 | // https://www.w3.org/TR/webrtc/#rtcicerole |
| 101 | struct RTCIceRole { |
| 102 | static const char* const kUnknown; |
| 103 | static const char* const kControlled; |
| 104 | static const char* const kControlling; |
| 105 | }; |
| 106 | |
Philipp Hancke | 1f49157 | 2022-05-09 17:43:31 +0200 | [diff] [blame] | 107 | // https://www.w3.org/TR/webrtc/#dom-rtcicetransportstate |
| 108 | struct RTCIceTransportState { |
| 109 | static const char* const kNew; |
| 110 | static const char* const kChecking; |
| 111 | static const char* const kConnected; |
| 112 | static const char* const kCompleted; |
| 113 | static const char* const kDisconnected; |
| 114 | static const char* const kFailed; |
| 115 | static const char* const kClosed; |
| 116 | }; |
| 117 | |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 118 | // https://w3c.github.io/webrtc-stats/#certificatestats-dict* |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 119 | class RTC_EXPORT RTCCertificateStats final : public RTCStats { |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 120 | public: |
| 121 | WEBRTC_RTCSTATS_DECL(); |
| 122 | |
| 123 | RTCCertificateStats(const std::string& id, int64_t timestamp_us); |
| 124 | RTCCertificateStats(std::string&& id, int64_t timestamp_us); |
| 125 | RTCCertificateStats(const RTCCertificateStats& other); |
| 126 | ~RTCCertificateStats() override; |
| 127 | |
| 128 | RTCStatsMember<std::string> fingerprint; |
| 129 | RTCStatsMember<std::string> fingerprint_algorithm; |
| 130 | RTCStatsMember<std::string> base64_certificate; |
| 131 | RTCStatsMember<std::string> issuer_certificate_id; |
| 132 | }; |
| 133 | |
Jonas Oreland | 0d13bbd | 2022-03-02 11:17:36 +0100 | [diff] [blame] | 134 | // Non standard extension mapping to rtc::AdapterType |
| 135 | struct RTCNetworkAdapterType { |
| 136 | static constexpr char kUnknown[] = "unknown"; |
| 137 | static constexpr char kEthernet[] = "ethernet"; |
| 138 | static constexpr char kWifi[] = "wifi"; |
| 139 | static constexpr char kCellular[] = "cellular"; |
| 140 | static constexpr char kLoopback[] = "loopback"; |
| 141 | static constexpr char kAny[] = "any"; |
| 142 | static constexpr char kCellular2g[] = "cellular2g"; |
| 143 | static constexpr char kCellular3g[] = "cellular3g"; |
| 144 | static constexpr char kCellular4g[] = "cellular4g"; |
| 145 | static constexpr char kCellular5g[] = "cellular5g"; |
| 146 | }; |
| 147 | |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 148 | // https://w3c.github.io/webrtc-stats/#codec-dict* |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 149 | class RTC_EXPORT RTCCodecStats final : public RTCStats { |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 150 | public: |
| 151 | WEBRTC_RTCSTATS_DECL(); |
| 152 | |
| 153 | RTCCodecStats(const std::string& id, int64_t timestamp_us); |
| 154 | RTCCodecStats(std::string&& id, int64_t timestamp_us); |
| 155 | RTCCodecStats(const RTCCodecStats& other); |
| 156 | ~RTCCodecStats() override; |
| 157 | |
Philipp Hancke | 95157a0 | 2020-11-16 20:08:27 +0100 | [diff] [blame] | 158 | RTCStatsMember<std::string> transport_id; |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 159 | RTCStatsMember<uint32_t> payload_type; |
hbos | 13f54b2 | 2017-02-28 06:56:04 -0800 | [diff] [blame] | 160 | RTCStatsMember<std::string> mime_type; |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 161 | RTCStatsMember<uint32_t> clock_rate; |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 162 | RTCStatsMember<uint32_t> channels; |
hbos | 13f54b2 | 2017-02-28 06:56:04 -0800 | [diff] [blame] | 163 | RTCStatsMember<std::string> sdp_fmtp_line; |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 164 | }; |
| 165 | |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 166 | // https://w3c.github.io/webrtc-stats/#dcstats-dict* |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 167 | class RTC_EXPORT RTCDataChannelStats final : public RTCStats { |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 168 | public: |
| 169 | WEBRTC_RTCSTATS_DECL(); |
| 170 | |
| 171 | RTCDataChannelStats(const std::string& id, int64_t timestamp_us); |
| 172 | RTCDataChannelStats(std::string&& id, int64_t timestamp_us); |
| 173 | RTCDataChannelStats(const RTCDataChannelStats& other); |
| 174 | ~RTCDataChannelStats() override; |
| 175 | |
| 176 | RTCStatsMember<std::string> label; |
| 177 | RTCStatsMember<std::string> protocol; |
Harald Alvestrand | 10ef847 | 2020-06-05 15:38:51 +0200 | [diff] [blame] | 178 | RTCStatsMember<int32_t> data_channel_identifier; |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 179 | // TODO(hbos): Support enum types? "RTCStatsMember<RTCDataChannelState>"? |
| 180 | RTCStatsMember<std::string> state; |
| 181 | RTCStatsMember<uint32_t> messages_sent; |
| 182 | RTCStatsMember<uint64_t> bytes_sent; |
| 183 | RTCStatsMember<uint32_t> messages_received; |
| 184 | RTCStatsMember<uint64_t> bytes_received; |
| 185 | }; |
| 186 | |
| 187 | // https://w3c.github.io/webrtc-stats/#candidatepair-dict* |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 188 | // TODO(hbos): Tracking bug https://bugs.webrtc.org/7062 |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 189 | class RTC_EXPORT RTCIceCandidatePairStats final : public RTCStats { |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 190 | public: |
| 191 | WEBRTC_RTCSTATS_DECL(); |
| 192 | |
| 193 | RTCIceCandidatePairStats(const std::string& id, int64_t timestamp_us); |
| 194 | RTCIceCandidatePairStats(std::string&& id, int64_t timestamp_us); |
| 195 | RTCIceCandidatePairStats(const RTCIceCandidatePairStats& other); |
| 196 | ~RTCIceCandidatePairStats() override; |
| 197 | |
| 198 | RTCStatsMember<std::string> transport_id; |
| 199 | RTCStatsMember<std::string> local_candidate_id; |
| 200 | RTCStatsMember<std::string> remote_candidate_id; |
| 201 | // TODO(hbos): Support enum types? |
| 202 | // "RTCStatsMember<RTCStatsIceCandidatePairState>"? |
| 203 | RTCStatsMember<std::string> state; |
Di Wu | ef036cd | 2021-03-19 08:24:41 -0700 | [diff] [blame] | 204 | // Obsolete: priority |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 205 | RTCStatsMember<uint64_t> priority; |
| 206 | RTCStatsMember<bool> nominated; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 207 | // TODO(hbos): Collect this the way the spec describes it. We have a value for |
| 208 | // it but it is not spec-compliant. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 209 | RTCStatsMember<bool> writable; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 210 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 211 | RTCStatsMember<bool> readable; |
Taylor Brandstetter | 79326ea | 2021-09-28 15:09:53 -0700 | [diff] [blame] | 212 | RTCStatsMember<uint64_t> packets_sent; |
| 213 | RTCStatsMember<uint64_t> packets_received; |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 214 | RTCStatsMember<uint64_t> bytes_sent; |
| 215 | RTCStatsMember<uint64_t> bytes_received; |
hbos | 3168c7a | 2016-12-15 06:17:08 -0800 | [diff] [blame] | 216 | RTCStatsMember<double> total_round_trip_time; |
hbos | 3168c7a | 2016-12-15 06:17:08 -0800 | [diff] [blame] | 217 | RTCStatsMember<double> current_round_trip_time; |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 218 | RTCStatsMember<double> available_outgoing_bitrate; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 219 | // TODO(hbos): Populate this value. It is wired up and collected the same way |
hbos | bf8d3e5 | 2017-02-28 06:34:47 -0800 | [diff] [blame] | 220 | // "VideoBwe.googAvailableReceiveBandwidth" is, but that value is always |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 221 | // undefined. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 222 | RTCStatsMember<double> available_incoming_bitrate; |
| 223 | RTCStatsMember<uint64_t> requests_received; |
| 224 | RTCStatsMember<uint64_t> requests_sent; |
| 225 | RTCStatsMember<uint64_t> responses_received; |
| 226 | RTCStatsMember<uint64_t> responses_sent; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 227 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 228 | RTCStatsMember<uint64_t> retransmissions_received; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 229 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 230 | RTCStatsMember<uint64_t> retransmissions_sent; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 231 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 232 | RTCStatsMember<uint64_t> consent_requests_received; |
| 233 | RTCStatsMember<uint64_t> consent_requests_sent; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 234 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 235 | RTCStatsMember<uint64_t> consent_responses_received; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 236 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 237 | RTCStatsMember<uint64_t> consent_responses_sent; |
Taylor Brandstetter | 79326ea | 2021-09-28 15:09:53 -0700 | [diff] [blame] | 238 | RTCStatsMember<uint64_t> packets_discarded_on_send; |
| 239 | RTCStatsMember<uint64_t> bytes_discarded_on_send; |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 240 | }; |
| 241 | |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 242 | // https://w3c.github.io/webrtc-stats/#icecandidate-dict* |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 243 | // TODO(hbos): `RTCStatsCollector` only collects candidates that are part of |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 244 | // ice candidate pairs, but there could be candidates not paired with anything. |
| 245 | // crbug.com/632723 |
Qingsi Wang | 72a43a1 | 2018-02-20 16:03:18 -0800 | [diff] [blame] | 246 | // TODO(qingsi): Add the stats of STUN binding requests (keepalives) and collect |
| 247 | // them in the new PeerConnection::GetStats. |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 248 | class RTC_EXPORT RTCIceCandidateStats : public RTCStats { |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 249 | public: |
| 250 | WEBRTC_RTCSTATS_DECL(); |
| 251 | |
| 252 | RTCIceCandidateStats(const RTCIceCandidateStats& other); |
| 253 | ~RTCIceCandidateStats() override; |
| 254 | |
hbos | b4e426e | 2017-01-02 09:59:31 -0800 | [diff] [blame] | 255 | RTCStatsMember<std::string> transport_id; |
Di Wu | ef036cd | 2021-03-19 08:24:41 -0700 | [diff] [blame] | 256 | // Obsolete: is_remote |
hbos | c3a2b7f | 2017-01-02 04:46:15 -0800 | [diff] [blame] | 257 | RTCStatsMember<bool> is_remote; |
Gary Liu | 37e489c | 2017-11-21 10:49:36 -0800 | [diff] [blame] | 258 | RTCStatsMember<std::string> network_type; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 259 | RTCStatsMember<std::string> ip; |
Philipp Hancke | a9ba450 | 2021-03-22 13:22:54 +0100 | [diff] [blame] | 260 | RTCStatsMember<std::string> address; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 261 | RTCStatsMember<int32_t> port; |
| 262 | RTCStatsMember<std::string> protocol; |
Philipp Hancke | 9551375 | 2018-09-27 14:40:08 +0200 | [diff] [blame] | 263 | RTCStatsMember<std::string> relay_protocol; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 264 | // TODO(hbos): Support enum types? "RTCStatsMember<RTCIceCandidateType>"? |
| 265 | RTCStatsMember<std::string> candidate_type; |
| 266 | RTCStatsMember<int32_t> priority; |
| 267 | RTCStatsMember<std::string> url; |
| 268 | |
Jonas Oreland | 0d13bbd | 2022-03-02 11:17:36 +0100 | [diff] [blame] | 269 | RTCNonStandardStatsMember<bool> vpn; |
| 270 | RTCNonStandardStatsMember<std::string> network_adapter_type; |
| 271 | |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 272 | protected: |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 273 | RTCIceCandidateStats(const std::string& id, |
| 274 | int64_t timestamp_us, |
| 275 | bool is_remote); |
hbos | c3a2b7f | 2017-01-02 04:46:15 -0800 | [diff] [blame] | 276 | RTCIceCandidateStats(std::string&& id, int64_t timestamp_us, bool is_remote); |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 277 | }; |
| 278 | |
| 279 | // In the spec both local and remote varieties are of type RTCIceCandidateStats. |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 280 | // But here we define them as subclasses of `RTCIceCandidateStats` because the |
| 281 | // `kType` need to be different ("RTCStatsType type") in the local/remote case. |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 282 | // https://w3c.github.io/webrtc-stats/#rtcstatstype-str* |
Henrik Boström | 1df1bf8 | 2018-03-20 13:24:20 +0100 | [diff] [blame] | 283 | // This forces us to have to override copy() and type(). |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 284 | class RTC_EXPORT RTCLocalIceCandidateStats final : public RTCIceCandidateStats { |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 285 | public: |
| 286 | static const char kType[]; |
| 287 | RTCLocalIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 288 | RTCLocalIceCandidateStats(std::string&& id, int64_t timestamp_us); |
Henrik Boström | 1df1bf8 | 2018-03-20 13:24:20 +0100 | [diff] [blame] | 289 | std::unique_ptr<RTCStats> copy() const override; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 290 | const char* type() const override; |
| 291 | }; |
| 292 | |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 293 | class RTC_EXPORT RTCRemoteIceCandidateStats final |
| 294 | : public RTCIceCandidateStats { |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 295 | public: |
| 296 | static const char kType[]; |
| 297 | RTCRemoteIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 298 | RTCRemoteIceCandidateStats(std::string&& id, int64_t timestamp_us); |
Henrik Boström | 1df1bf8 | 2018-03-20 13:24:20 +0100 | [diff] [blame] | 299 | std::unique_ptr<RTCStats> copy() const override; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 300 | const char* type() const override; |
| 301 | }; |
| 302 | |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 303 | // https://w3c.github.io/webrtc-stats/#msstats-dict* |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 304 | // TODO(hbos): Tracking bug crbug.com/660827 |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 305 | class RTC_EXPORT RTCMediaStreamStats final : public RTCStats { |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 306 | public: |
| 307 | WEBRTC_RTCSTATS_DECL(); |
| 308 | |
| 309 | RTCMediaStreamStats(const std::string& id, int64_t timestamp_us); |
| 310 | RTCMediaStreamStats(std::string&& id, int64_t timestamp_us); |
| 311 | RTCMediaStreamStats(const RTCMediaStreamStats& other); |
| 312 | ~RTCMediaStreamStats() override; |
| 313 | |
| 314 | RTCStatsMember<std::string> stream_identifier; |
| 315 | RTCStatsMember<std::vector<std::string>> track_ids; |
| 316 | }; |
| 317 | |
| 318 | // https://w3c.github.io/webrtc-stats/#mststats-dict* |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 319 | // TODO(hbos): Tracking bug crbug.com/659137 |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 320 | class RTC_EXPORT RTCMediaStreamTrackStats final : public RTCStats { |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 321 | public: |
| 322 | WEBRTC_RTCSTATS_DECL(); |
| 323 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 324 | RTCMediaStreamTrackStats(const std::string& id, |
| 325 | int64_t timestamp_us, |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame] | 326 | const char* kind); |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 327 | RTCMediaStreamTrackStats(std::string&& id, |
| 328 | int64_t timestamp_us, |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame] | 329 | const char* kind); |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 330 | RTCMediaStreamTrackStats(const RTCMediaStreamTrackStats& other); |
| 331 | ~RTCMediaStreamTrackStats() override; |
| 332 | |
| 333 | RTCStatsMember<std::string> track_identifier; |
Henrik Boström | 646fda0 | 2019-05-22 15:49:42 +0200 | [diff] [blame] | 334 | RTCStatsMember<std::string> media_source_id; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 335 | RTCStatsMember<bool> remote_source; |
| 336 | RTCStatsMember<bool> ended; |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 337 | // TODO(hbos): `RTCStatsCollector` does not return stats for detached tracks. |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 338 | // crbug.com/659137 |
| 339 | RTCStatsMember<bool> detached; |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 340 | // See `RTCMediaStreamTrackKind` for valid values. |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame] | 341 | RTCStatsMember<std::string> kind; |
Gustaf Ullberg | b0a0207 | 2017-10-02 12:00:34 +0200 | [diff] [blame] | 342 | RTCStatsMember<double> jitter_buffer_delay; |
Chen Xing | 0acffb5 | 2019-01-15 15:46:29 +0100 | [diff] [blame] | 343 | RTCStatsMember<uint64_t> jitter_buffer_emitted_count; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 344 | // Video-only members |
| 345 | RTCStatsMember<uint32_t> frame_width; |
| 346 | RTCStatsMember<uint32_t> frame_height; |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 347 | // TODO(hbos): Not collected by `RTCStatsCollector`. crbug.com/659137 |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 348 | RTCStatsMember<double> frames_per_second; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 349 | RTCStatsMember<uint32_t> frames_sent; |
Ilya Nikolaevskiy | 70473fc | 2018-02-28 16:35:03 +0100 | [diff] [blame] | 350 | RTCStatsMember<uint32_t> huge_frames_sent; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 351 | RTCStatsMember<uint32_t> frames_received; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 352 | RTCStatsMember<uint32_t> frames_decoded; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 353 | RTCStatsMember<uint32_t> frames_dropped; |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 354 | // TODO(hbos): Not collected by `RTCStatsCollector`. crbug.com/659137 |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 355 | RTCStatsMember<uint32_t> frames_corrupted; |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 356 | // TODO(hbos): Not collected by `RTCStatsCollector`. crbug.com/659137 |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 357 | RTCStatsMember<uint32_t> partial_frames_lost; |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 358 | // TODO(hbos): Not collected by `RTCStatsCollector`. crbug.com/659137 |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 359 | RTCStatsMember<uint32_t> full_frames_lost; |
| 360 | // Audio-only members |
Henrik Boström | d2c336f | 2019-07-03 17:11:10 +0200 | [diff] [blame] | 361 | RTCStatsMember<double> audio_level; // Receive-only |
| 362 | RTCStatsMember<double> total_audio_energy; // Receive-only |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 363 | RTCStatsMember<double> echo_return_loss; |
| 364 | RTCStatsMember<double> echo_return_loss_enhancement; |
Steve Anton | 2dbc69f | 2017-08-24 17:15:13 -0700 | [diff] [blame] | 365 | RTCStatsMember<uint64_t> total_samples_received; |
Henrik Boström | d2c336f | 2019-07-03 17:11:10 +0200 | [diff] [blame] | 366 | RTCStatsMember<double> total_samples_duration; // Receive-only |
Steve Anton | 2dbc69f | 2017-08-24 17:15:13 -0700 | [diff] [blame] | 367 | RTCStatsMember<uint64_t> concealed_samples; |
Ivo Creusen | 8d8ffdb | 2019-04-30 09:45:21 +0200 | [diff] [blame] | 368 | RTCStatsMember<uint64_t> silent_concealed_samples; |
Gustaf Ullberg | 9a2e906 | 2017-09-18 09:28:20 +0200 | [diff] [blame] | 369 | RTCStatsMember<uint64_t> concealment_events; |
Ivo Creusen | 8d8ffdb | 2019-04-30 09:45:21 +0200 | [diff] [blame] | 370 | RTCStatsMember<uint64_t> inserted_samples_for_deceleration; |
| 371 | RTCStatsMember<uint64_t> removed_samples_for_acceleration; |
Ruslan Burakov | 8af8896 | 2018-11-22 17:21:10 +0100 | [diff] [blame] | 372 | // Non-standard audio-only member |
Jakob Ivarsson | 352ce5c | 2018-11-27 12:52:16 +0100 | [diff] [blame] | 373 | // TODO(kuddai): Add description to standard. crbug.com/webrtc/10042 |
Ruslan Burakov | 8af8896 | 2018-11-22 17:21:10 +0100 | [diff] [blame] | 374 | RTCNonStandardStatsMember<uint64_t> jitter_buffer_flushes; |
Jakob Ivarsson | 352ce5c | 2018-11-27 12:52:16 +0100 | [diff] [blame] | 375 | RTCNonStandardStatsMember<uint64_t> delayed_packet_outage_samples; |
Jakob Ivarsson | 232b3fd | 2019-03-06 09:18:40 +0100 | [diff] [blame] | 376 | RTCNonStandardStatsMember<double> relative_packet_arrival_delay; |
Artem Titov | e618cc9 | 2020-03-11 11:18:54 +0100 | [diff] [blame] | 377 | // Non-standard metric showing target delay of jitter buffer. |
| 378 | // This value is increased by the target jitter buffer delay every time a |
| 379 | // sample is emitted by the jitter buffer. The added target is the target |
| 380 | // delay, in seconds, at the time that the sample was emitted from the jitter |
| 381 | // buffer. (https://github.com/w3c/webrtc-provisional-stats/pull/20) |
| 382 | // Currently it is implemented only for audio. |
| 383 | // TODO(titovartem) implement for video streams when will be requested. |
| 384 | RTCNonStandardStatsMember<double> jitter_buffer_target_delay; |
Henrik Lundin | 44125fa | 2019-04-29 17:00:46 +0200 | [diff] [blame] | 385 | // TODO(henrik.lundin): Add description of the interruption metrics at |
| 386 | // https://github.com/henbos/webrtc-provisional-stats/issues/17 |
| 387 | RTCNonStandardStatsMember<uint32_t> interruption_count; |
| 388 | RTCNonStandardStatsMember<double> total_interruption_duration; |
Sergey Silkin | 0237106 | 2019-01-31 16:45:42 +0100 | [diff] [blame] | 389 | // Non-standard video-only members. |
| 390 | // https://henbos.github.io/webrtc-provisional-stats/#RTCVideoReceiverStats-dict* |
| 391 | RTCNonStandardStatsMember<uint32_t> freeze_count; |
| 392 | RTCNonStandardStatsMember<uint32_t> pause_count; |
| 393 | RTCNonStandardStatsMember<double> total_freezes_duration; |
| 394 | RTCNonStandardStatsMember<double> total_pauses_duration; |
| 395 | RTCNonStandardStatsMember<double> total_frames_duration; |
| 396 | RTCNonStandardStatsMember<double> sum_squared_frame_durations; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 397 | }; |
| 398 | |
hbos | 6ab97ce | 2016-10-03 14:16:56 -0700 | [diff] [blame] | 399 | // https://w3c.github.io/webrtc-stats/#pcstats-dict* |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 400 | class RTC_EXPORT RTCPeerConnectionStats final : public RTCStats { |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 401 | public: |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 402 | WEBRTC_RTCSTATS_DECL(); |
| 403 | |
hbos | 0e6758d | 2016-08-31 07:57:36 -0700 | [diff] [blame] | 404 | RTCPeerConnectionStats(const std::string& id, int64_t timestamp_us); |
| 405 | RTCPeerConnectionStats(std::string&& id, int64_t timestamp_us); |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 406 | RTCPeerConnectionStats(const RTCPeerConnectionStats& other); |
| 407 | ~RTCPeerConnectionStats() override; |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 408 | |
| 409 | RTCStatsMember<uint32_t> data_channels_opened; |
| 410 | RTCStatsMember<uint32_t> data_channels_closed; |
| 411 | }; |
| 412 | |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 413 | // https://w3c.github.io/webrtc-stats/#streamstats-dict* |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 414 | // TODO(hbos): Tracking bug crbug.com/657854 |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 415 | class RTC_EXPORT RTCRTPStreamStats : public RTCStats { |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 416 | public: |
| 417 | WEBRTC_RTCSTATS_DECL(); |
| 418 | |
| 419 | RTCRTPStreamStats(const RTCRTPStreamStats& other); |
| 420 | ~RTCRTPStreamStats() override; |
| 421 | |
hbos | 3443bb7 | 2017-02-07 06:28:11 -0800 | [diff] [blame] | 422 | RTCStatsMember<uint32_t> ssrc; |
Philipp Hancke | 3bc0166 | 2018-08-28 14:55:03 +0200 | [diff] [blame] | 423 | RTCStatsMember<std::string> kind; |
Di Wu | ef036cd | 2021-03-19 08:24:41 -0700 | [diff] [blame] | 424 | // Obsolete: track_id |
hbos | b0ae920 | 2017-01-27 06:35:16 -0800 | [diff] [blame] | 425 | RTCStatsMember<std::string> track_id; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 426 | RTCStatsMember<std::string> transport_id; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 427 | RTCStatsMember<std::string> codec_id; |
Di Wu | fd1e9d1 | 2021-03-09 09:25:28 -0800 | [diff] [blame] | 428 | |
| 429 | // Obsolete |
| 430 | RTCStatsMember<std::string> media_type; // renamed to kind. |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 431 | |
| 432 | protected: |
| 433 | RTCRTPStreamStats(const std::string& id, int64_t timestamp_us); |
| 434 | RTCRTPStreamStats(std::string&& id, int64_t timestamp_us); |
| 435 | }; |
| 436 | |
Alessio Bazzica | f7b1b95 | 2021-03-23 17:23:04 +0100 | [diff] [blame] | 437 | // https://www.w3.org/TR/webrtc-stats/#receivedrtpstats-dict* |
Di Wu | fd1e9d1 | 2021-03-09 09:25:28 -0800 | [diff] [blame] | 438 | class RTC_EXPORT RTCReceivedRtpStreamStats : public RTCRTPStreamStats { |
| 439 | public: |
| 440 | WEBRTC_RTCSTATS_DECL(); |
| 441 | |
| 442 | RTCReceivedRtpStreamStats(const RTCReceivedRtpStreamStats& other); |
| 443 | ~RTCReceivedRtpStreamStats() override; |
| 444 | |
| 445 | // TODO(hbos) The following fields need to be added and migrated |
| 446 | // both from RTCInboundRtpStreamStats and RTCRemoteInboundRtpStreamStats: |
Minyue Li | 28a2c63 | 2021-07-07 15:53:38 +0200 | [diff] [blame] | 447 | // packetsReceived, packetsRepaired, burstPacketsLost, |
Di Wu | fd1e9d1 | 2021-03-09 09:25:28 -0800 | [diff] [blame] | 448 | // burstPacketDiscarded, burstLossCount, burstDiscardCount, burstLossRate, |
| 449 | // burstDiscardRate, gapLossRate, gapDiscardRate, framesDropped, |
| 450 | // partialFramesLost, fullFramesLost |
| 451 | // crbug.com/webrtc/12532 |
| 452 | RTCStatsMember<double> jitter; |
| 453 | RTCStatsMember<int32_t> packets_lost; // Signed per RFC 3550 |
Minyue Li | 28a2c63 | 2021-07-07 15:53:38 +0200 | [diff] [blame] | 454 | RTCStatsMember<uint64_t> packets_discarded; |
Di Wu | fd1e9d1 | 2021-03-09 09:25:28 -0800 | [diff] [blame] | 455 | |
| 456 | protected: |
| 457 | RTCReceivedRtpStreamStats(const std::string&& id, int64_t timestamp_us); |
| 458 | RTCReceivedRtpStreamStats(std::string&& id, int64_t timestamp_us); |
| 459 | }; |
| 460 | |
Alessio Bazzica | f7b1b95 | 2021-03-23 17:23:04 +0100 | [diff] [blame] | 461 | // https://www.w3.org/TR/webrtc-stats/#sentrtpstats-dict* |
| 462 | class RTC_EXPORT RTCSentRtpStreamStats : public RTCRTPStreamStats { |
| 463 | public: |
| 464 | WEBRTC_RTCSTATS_DECL(); |
| 465 | |
| 466 | RTCSentRtpStreamStats(const RTCSentRtpStreamStats& other); |
| 467 | ~RTCSentRtpStreamStats() override; |
| 468 | |
| 469 | RTCStatsMember<uint32_t> packets_sent; |
| 470 | RTCStatsMember<uint64_t> bytes_sent; |
| 471 | |
| 472 | protected: |
| 473 | RTCSentRtpStreamStats(const std::string&& id, int64_t timestamp_us); |
| 474 | RTCSentRtpStreamStats(std::string&& id, int64_t timestamp_us); |
| 475 | }; |
| 476 | |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 477 | // https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict* |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 478 | // TODO(hbos): Support the remote case |is_remote = true|. |
| 479 | // https://bugs.webrtc.org/7065 |
Di Wu | fd1e9d1 | 2021-03-09 09:25:28 -0800 | [diff] [blame] | 480 | class RTC_EXPORT RTCInboundRTPStreamStats final |
| 481 | : public RTCReceivedRtpStreamStats { |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 482 | public: |
| 483 | WEBRTC_RTCSTATS_DECL(); |
| 484 | |
| 485 | RTCInboundRTPStreamStats(const std::string& id, int64_t timestamp_us); |
| 486 | RTCInboundRTPStreamStats(std::string&& id, int64_t timestamp_us); |
| 487 | RTCInboundRTPStreamStats(const RTCInboundRTPStreamStats& other); |
| 488 | ~RTCInboundRTPStreamStats() override; |
| 489 | |
Alessio Bazzica | f7b1b95 | 2021-03-23 17:23:04 +0100 | [diff] [blame] | 490 | RTCStatsMember<std::string> remote_id; |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 491 | RTCStatsMember<uint32_t> packets_received; |
Ivo Creusen | 8d8ffdb | 2019-04-30 09:45:21 +0200 | [diff] [blame] | 492 | RTCStatsMember<uint64_t> fec_packets_received; |
| 493 | RTCStatsMember<uint64_t> fec_packets_discarded; |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 494 | RTCStatsMember<uint64_t> bytes_received; |
Niels Möller | ac0a4cb | 2019-10-09 15:01:33 +0200 | [diff] [blame] | 495 | RTCStatsMember<uint64_t> header_bytes_received; |
Henrik Boström | 01738c6 | 2019-04-15 17:32:00 +0200 | [diff] [blame] | 496 | RTCStatsMember<double> last_packet_received_timestamp; |
Eldar Rello | 4e5bc9f | 2020-07-06 14:18:07 +0300 | [diff] [blame] | 497 | RTCStatsMember<double> jitter_buffer_delay; |
| 498 | RTCStatsMember<uint64_t> jitter_buffer_emitted_count; |
| 499 | RTCStatsMember<uint64_t> total_samples_received; |
| 500 | RTCStatsMember<uint64_t> concealed_samples; |
| 501 | RTCStatsMember<uint64_t> silent_concealed_samples; |
| 502 | RTCStatsMember<uint64_t> concealment_events; |
| 503 | RTCStatsMember<uint64_t> inserted_samples_for_deceleration; |
| 504 | RTCStatsMember<uint64_t> removed_samples_for_acceleration; |
| 505 | RTCStatsMember<double> audio_level; |
| 506 | RTCStatsMember<double> total_audio_energy; |
| 507 | RTCStatsMember<double> total_samples_duration; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 508 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
| 509 | RTCStatsMember<double> round_trip_time; |
| 510 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 511 | RTCStatsMember<uint32_t> packets_repaired; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 512 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 513 | RTCStatsMember<uint32_t> burst_packets_lost; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 514 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 515 | RTCStatsMember<uint32_t> burst_packets_discarded; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 516 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 517 | RTCStatsMember<uint32_t> burst_loss_count; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 518 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 519 | RTCStatsMember<uint32_t> burst_discard_count; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 520 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 521 | RTCStatsMember<double> burst_loss_rate; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 522 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 523 | RTCStatsMember<double> burst_discard_rate; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 524 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 525 | RTCStatsMember<double> gap_loss_rate; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 526 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 527 | RTCStatsMember<double> gap_discard_rate; |
Philipp Hancke | a16a6a6 | 2022-04-25 12:21:30 +0200 | [diff] [blame] | 528 | // Stats below are only implemented or defined for video. |
| 529 | RTCStatsMember<int32_t> frames_received; |
Eldar Rello | 4e5bc9f | 2020-07-06 14:18:07 +0300 | [diff] [blame] | 530 | RTCStatsMember<uint32_t> frame_width; |
| 531 | RTCStatsMember<uint32_t> frame_height; |
| 532 | RTCStatsMember<uint32_t> frame_bit_depth; |
| 533 | RTCStatsMember<double> frames_per_second; |
hbos | 6769c49 | 2017-01-02 08:35:13 -0800 | [diff] [blame] | 534 | RTCStatsMember<uint32_t> frames_decoded; |
Rasmus Brandt | 2efae77 | 2019-06-27 14:29:34 +0200 | [diff] [blame] | 535 | RTCStatsMember<uint32_t> key_frames_decoded; |
Eldar Rello | 4e5bc9f | 2020-07-06 14:18:07 +0300 | [diff] [blame] | 536 | RTCStatsMember<uint32_t> frames_dropped; |
Johannes Kron | bfd343b | 2019-07-01 10:07:50 +0200 | [diff] [blame] | 537 | RTCStatsMember<double> total_decode_time; |
Philipp Hancke | a16a6a6 | 2022-04-25 12:21:30 +0200 | [diff] [blame] | 538 | RTCStatsMember<double> total_processing_delay; |
Johannes Kron | 00376e1 | 2019-11-25 10:25:42 +0100 | [diff] [blame] | 539 | RTCStatsMember<double> total_inter_frame_delay; |
| 540 | RTCStatsMember<double> total_squared_inter_frame_delay; |
Henrik Boström | 2e06926 | 2019-04-09 13:59:31 +0200 | [diff] [blame] | 541 | // https://henbos.github.io/webrtc-provisional-stats/#dom-rtcinboundrtpstreamstats-contenttype |
| 542 | RTCStatsMember<std::string> content_type; |
Åsa Persson | fcf79cc | 2019-10-22 15:23:44 +0200 | [diff] [blame] | 543 | // TODO(asapersson): Currently only populated if audio/video sync is enabled. |
| 544 | RTCStatsMember<double> estimated_playout_timestamp; |
Henrik Boström | 6b43086 | 2019-08-16 13:09:51 +0200 | [diff] [blame] | 545 | // TODO(hbos): This is only implemented for video; implement it for audio as |
| 546 | // well. |
| 547 | RTCStatsMember<std::string> decoder_implementation; |
Philipp Hancke | a3b5c4e | 2022-04-22 15:09:54 +0200 | [diff] [blame] | 548 | // FIR and PLI counts are only defined for |kind == "video"|. |
Di Wu | fd1e9d1 | 2021-03-09 09:25:28 -0800 | [diff] [blame] | 549 | RTCStatsMember<uint32_t> fir_count; |
| 550 | RTCStatsMember<uint32_t> pli_count; |
Di Wu | fd1e9d1 | 2021-03-09 09:25:28 -0800 | [diff] [blame] | 551 | RTCStatsMember<uint32_t> nack_count; |
| 552 | RTCStatsMember<uint64_t> qp_sum; |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 553 | }; |
| 554 | |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 555 | // https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict* |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 556 | // TODO(hbos): Support the remote case |is_remote = true|. |
| 557 | // https://bugs.webrtc.org/7066 |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 558 | class RTC_EXPORT RTCOutboundRTPStreamStats final : public RTCRTPStreamStats { |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 559 | public: |
| 560 | WEBRTC_RTCSTATS_DECL(); |
| 561 | |
| 562 | RTCOutboundRTPStreamStats(const std::string& id, int64_t timestamp_us); |
| 563 | RTCOutboundRTPStreamStats(std::string&& id, int64_t timestamp_us); |
| 564 | RTCOutboundRTPStreamStats(const RTCOutboundRTPStreamStats& other); |
| 565 | ~RTCOutboundRTPStreamStats() override; |
| 566 | |
Henrik Boström | 646fda0 | 2019-05-22 15:49:42 +0200 | [diff] [blame] | 567 | RTCStatsMember<std::string> media_source_id; |
Henrik Boström | 4f40fa5 | 2019-12-19 13:27:27 +0100 | [diff] [blame] | 568 | RTCStatsMember<std::string> remote_id; |
Henrik Boström | a0ff50c | 2020-05-05 15:54:46 +0200 | [diff] [blame] | 569 | RTCStatsMember<std::string> rid; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 570 | RTCStatsMember<uint32_t> packets_sent; |
Henrik Boström | cf96e0f | 2019-04-17 13:51:53 +0200 | [diff] [blame] | 571 | RTCStatsMember<uint64_t> retransmitted_packets_sent; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 572 | RTCStatsMember<uint64_t> bytes_sent; |
Niels Möller | ac0a4cb | 2019-10-09 15:01:33 +0200 | [diff] [blame] | 573 | RTCStatsMember<uint64_t> header_bytes_sent; |
Henrik Boström | cf96e0f | 2019-04-17 13:51:53 +0200 | [diff] [blame] | 574 | RTCStatsMember<uint64_t> retransmitted_bytes_sent; |
Jakob Ivarsson | bf08745 | 2021-11-11 13:43:49 +0100 | [diff] [blame] | 575 | // TODO(https://crbug.com/webrtc/13394): Also collect this metric for video. |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 576 | RTCStatsMember<double> target_bitrate; |
hbos | 6769c49 | 2017-01-02 08:35:13 -0800 | [diff] [blame] | 577 | RTCStatsMember<uint32_t> frames_encoded; |
Rasmus Brandt | 2efae77 | 2019-06-27 14:29:34 +0200 | [diff] [blame] | 578 | RTCStatsMember<uint32_t> key_frames_encoded; |
Henrik Boström | f71362f | 2019-04-08 16:14:23 +0200 | [diff] [blame] | 579 | RTCStatsMember<double> total_encode_time; |
Henrik Boström | 23aff9b | 2019-05-20 15:15:38 +0200 | [diff] [blame] | 580 | RTCStatsMember<uint64_t> total_encoded_bytes_target; |
Henrik Boström | a0ff50c | 2020-05-05 15:54:46 +0200 | [diff] [blame] | 581 | RTCStatsMember<uint32_t> frame_width; |
| 582 | RTCStatsMember<uint32_t> frame_height; |
| 583 | RTCStatsMember<double> frames_per_second; |
| 584 | RTCStatsMember<uint32_t> frames_sent; |
| 585 | RTCStatsMember<uint32_t> huge_frames_sent; |
Henrik Boström | 9fe1834 | 2019-05-16 18:38:20 +0200 | [diff] [blame] | 586 | // TODO(https://crbug.com/webrtc/10635): This is only implemented for video; |
| 587 | // implement it for audio as well. |
| 588 | RTCStatsMember<double> total_packet_send_delay; |
Henrik Boström | ce33b6a | 2019-05-28 17:42:38 +0200 | [diff] [blame] | 589 | // Enum type RTCQualityLimitationReason |
Henrik Boström | ce33b6a | 2019-05-28 17:42:38 +0200 | [diff] [blame] | 590 | RTCStatsMember<std::string> quality_limitation_reason; |
Byoungchan Lee | 7d23535 | 2021-05-28 21:32:04 +0900 | [diff] [blame] | 591 | RTCStatsMember<std::map<std::string, double>> quality_limitation_durations; |
Evan Shrubsole | cc62b16 | 2019-09-09 11:26:45 +0200 | [diff] [blame] | 592 | // https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationresolutionchanges |
| 593 | RTCStatsMember<uint32_t> quality_limitation_resolution_changes; |
Henrik Boström | 2e06926 | 2019-04-09 13:59:31 +0200 | [diff] [blame] | 594 | // https://henbos.github.io/webrtc-provisional-stats/#dom-rtcoutboundrtpstreamstats-contenttype |
| 595 | RTCStatsMember<std::string> content_type; |
Henrik Boström | 6b43086 | 2019-08-16 13:09:51 +0200 | [diff] [blame] | 596 | // TODO(hbos): This is only implemented for video; implement it for audio as |
| 597 | // well. |
| 598 | RTCStatsMember<std::string> encoder_implementation; |
Philipp Hancke | a3b5c4e | 2022-04-22 15:09:54 +0200 | [diff] [blame] | 599 | // FIR and PLI counts are only defined for |kind == "video"|. |
Di Wu | fd1e9d1 | 2021-03-09 09:25:28 -0800 | [diff] [blame] | 600 | RTCStatsMember<uint32_t> fir_count; |
| 601 | RTCStatsMember<uint32_t> pli_count; |
Di Wu | fd1e9d1 | 2021-03-09 09:25:28 -0800 | [diff] [blame] | 602 | RTCStatsMember<uint32_t> nack_count; |
| 603 | RTCStatsMember<uint64_t> qp_sum; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 604 | }; |
| 605 | |
Henrik Boström | 883eefc | 2019-05-27 13:40:25 +0200 | [diff] [blame] | 606 | // https://w3c.github.io/webrtc-stats/#remoteinboundrtpstats-dict* |
Di Wu | fd1e9d1 | 2021-03-09 09:25:28 -0800 | [diff] [blame] | 607 | class RTC_EXPORT RTCRemoteInboundRtpStreamStats final |
| 608 | : public RTCReceivedRtpStreamStats { |
Henrik Boström | 883eefc | 2019-05-27 13:40:25 +0200 | [diff] [blame] | 609 | public: |
| 610 | WEBRTC_RTCSTATS_DECL(); |
| 611 | |
| 612 | RTCRemoteInboundRtpStreamStats(const std::string& id, int64_t timestamp_us); |
| 613 | RTCRemoteInboundRtpStreamStats(std::string&& id, int64_t timestamp_us); |
| 614 | RTCRemoteInboundRtpStreamStats(const RTCRemoteInboundRtpStreamStats& other); |
| 615 | ~RTCRemoteInboundRtpStreamStats() override; |
| 616 | |
Henrik Boström | 883eefc | 2019-05-27 13:40:25 +0200 | [diff] [blame] | 617 | // TODO(hbos): The following RTCReceivedRtpStreamStats metrics should also be |
Minyue Li | 28a2c63 | 2021-07-07 15:53:38 +0200 | [diff] [blame] | 618 | // implemented: packetsReceived, packetsRepaired, |
Henrik Boström | 883eefc | 2019-05-27 13:40:25 +0200 | [diff] [blame] | 619 | // burstPacketsLost, burstPacketsDiscarded, burstLossCount, burstDiscardCount, |
| 620 | // burstLossRate, burstDiscardRate, gapLossRate and gapDiscardRate. |
| 621 | // RTCRemoteInboundRtpStreamStats |
| 622 | RTCStatsMember<std::string> local_id; |
| 623 | RTCStatsMember<double> round_trip_time; |
Di Wu | 86f04ad | 2021-02-28 23:36:03 -0800 | [diff] [blame] | 624 | RTCStatsMember<double> fraction_lost; |
Di Wu | 88a51b2 | 2021-03-01 11:22:06 -0800 | [diff] [blame] | 625 | RTCStatsMember<double> total_round_trip_time; |
| 626 | RTCStatsMember<int32_t> round_trip_time_measurements; |
Henrik Boström | 883eefc | 2019-05-27 13:40:25 +0200 | [diff] [blame] | 627 | }; |
| 628 | |
Alessio Bazzica | f7b1b95 | 2021-03-23 17:23:04 +0100 | [diff] [blame] | 629 | // https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict* |
| 630 | class RTC_EXPORT RTCRemoteOutboundRtpStreamStats final |
| 631 | : public RTCSentRtpStreamStats { |
| 632 | public: |
| 633 | WEBRTC_RTCSTATS_DECL(); |
| 634 | |
| 635 | RTCRemoteOutboundRtpStreamStats(const std::string& id, int64_t timestamp_us); |
| 636 | RTCRemoteOutboundRtpStreamStats(std::string&& id, int64_t timestamp_us); |
| 637 | RTCRemoteOutboundRtpStreamStats(const RTCRemoteOutboundRtpStreamStats& other); |
| 638 | ~RTCRemoteOutboundRtpStreamStats() override; |
| 639 | |
| 640 | RTCStatsMember<std::string> local_id; |
| 641 | RTCStatsMember<double> remote_timestamp; |
| 642 | RTCStatsMember<uint64_t> reports_sent; |
Ivo Creusen | 2562cf0 | 2021-09-03 14:51:22 +0000 | [diff] [blame] | 643 | RTCStatsMember<double> round_trip_time; |
| 644 | RTCStatsMember<uint64_t> round_trip_time_measurements; |
| 645 | RTCStatsMember<double> total_round_trip_time; |
Alessio Bazzica | f7b1b95 | 2021-03-23 17:23:04 +0100 | [diff] [blame] | 646 | }; |
| 647 | |
Henrik Boström | 646fda0 | 2019-05-22 15:49:42 +0200 | [diff] [blame] | 648 | // https://w3c.github.io/webrtc-stats/#dom-rtcmediasourcestats |
| 649 | class RTC_EXPORT RTCMediaSourceStats : public RTCStats { |
| 650 | public: |
| 651 | WEBRTC_RTCSTATS_DECL(); |
| 652 | |
| 653 | RTCMediaSourceStats(const RTCMediaSourceStats& other); |
| 654 | ~RTCMediaSourceStats() override; |
| 655 | |
| 656 | RTCStatsMember<std::string> track_identifier; |
| 657 | RTCStatsMember<std::string> kind; |
| 658 | |
| 659 | protected: |
| 660 | RTCMediaSourceStats(const std::string& id, int64_t timestamp_us); |
| 661 | RTCMediaSourceStats(std::string&& id, int64_t timestamp_us); |
| 662 | }; |
| 663 | |
| 664 | // https://w3c.github.io/webrtc-stats/#dom-rtcaudiosourcestats |
| 665 | class RTC_EXPORT RTCAudioSourceStats final : public RTCMediaSourceStats { |
| 666 | public: |
| 667 | WEBRTC_RTCSTATS_DECL(); |
| 668 | |
| 669 | RTCAudioSourceStats(const std::string& id, int64_t timestamp_us); |
| 670 | RTCAudioSourceStats(std::string&& id, int64_t timestamp_us); |
| 671 | RTCAudioSourceStats(const RTCAudioSourceStats& other); |
| 672 | ~RTCAudioSourceStats() override; |
Henrik Boström | d2c336f | 2019-07-03 17:11:10 +0200 | [diff] [blame] | 673 | |
| 674 | RTCStatsMember<double> audio_level; |
| 675 | RTCStatsMember<double> total_audio_energy; |
| 676 | RTCStatsMember<double> total_samples_duration; |
Taylor Brandstetter | 64851c0 | 2021-06-24 13:32:50 -0700 | [diff] [blame] | 677 | RTCStatsMember<double> echo_return_loss; |
| 678 | RTCStatsMember<double> echo_return_loss_enhancement; |
Henrik Boström | 646fda0 | 2019-05-22 15:49:42 +0200 | [diff] [blame] | 679 | }; |
| 680 | |
| 681 | // https://w3c.github.io/webrtc-stats/#dom-rtcvideosourcestats |
| 682 | class RTC_EXPORT RTCVideoSourceStats final : public RTCMediaSourceStats { |
| 683 | public: |
| 684 | WEBRTC_RTCSTATS_DECL(); |
| 685 | |
| 686 | RTCVideoSourceStats(const std::string& id, int64_t timestamp_us); |
| 687 | RTCVideoSourceStats(std::string&& id, int64_t timestamp_us); |
| 688 | RTCVideoSourceStats(const RTCVideoSourceStats& other); |
| 689 | ~RTCVideoSourceStats() override; |
| 690 | |
| 691 | RTCStatsMember<uint32_t> width; |
| 692 | RTCStatsMember<uint32_t> height; |
Henrik Boström | 646fda0 | 2019-05-22 15:49:42 +0200 | [diff] [blame] | 693 | RTCStatsMember<uint32_t> frames; |
Byoungchan Lee | efe46b6 | 2021-11-10 11:23:56 +0900 | [diff] [blame] | 694 | RTCStatsMember<double> frames_per_second; |
Henrik Boström | 646fda0 | 2019-05-22 15:49:42 +0200 | [diff] [blame] | 695 | }; |
| 696 | |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 697 | // https://w3c.github.io/webrtc-stats/#transportstats-dict* |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 698 | class RTC_EXPORT RTCTransportStats final : public RTCStats { |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 699 | public: |
| 700 | WEBRTC_RTCSTATS_DECL(); |
| 701 | |
| 702 | RTCTransportStats(const std::string& id, int64_t timestamp_us); |
| 703 | RTCTransportStats(std::string&& id, int64_t timestamp_us); |
| 704 | RTCTransportStats(const RTCTransportStats& other); |
| 705 | ~RTCTransportStats() override; |
| 706 | |
| 707 | RTCStatsMember<uint64_t> bytes_sent; |
Artem Titov | edacbd5 | 2020-07-06 16:06:37 +0200 | [diff] [blame] | 708 | RTCStatsMember<uint64_t> packets_sent; |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 709 | RTCStatsMember<uint64_t> bytes_received; |
Artem Titov | edacbd5 | 2020-07-06 16:06:37 +0200 | [diff] [blame] | 710 | RTCStatsMember<uint64_t> packets_received; |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 711 | RTCStatsMember<std::string> rtcp_transport_stats_id; |
hbos | 7064d59 | 2017-01-16 07:38:02 -0800 | [diff] [blame] | 712 | // TODO(hbos): Support enum types? "RTCStatsMember<RTCDtlsTransportState>"? |
| 713 | RTCStatsMember<std::string> dtls_state; |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 714 | RTCStatsMember<std::string> selected_candidate_pair_id; |
| 715 | RTCStatsMember<std::string> local_certificate_id; |
| 716 | RTCStatsMember<std::string> remote_certificate_id; |
Harald Alvestrand | 5cb7807 | 2019-10-28 09:51:17 +0100 | [diff] [blame] | 717 | RTCStatsMember<std::string> tls_version; |
| 718 | RTCStatsMember<std::string> dtls_cipher; |
Philipp Hancke | 69c1df2 | 2022-04-22 15:46:24 +0200 | [diff] [blame] | 719 | RTCStatsMember<std::string> dtls_role; |
Harald Alvestrand | 5cb7807 | 2019-10-28 09:51:17 +0100 | [diff] [blame] | 720 | RTCStatsMember<std::string> srtp_cipher; |
Jonas Oreland | 149dc72 | 2019-08-28 08:10:27 +0200 | [diff] [blame] | 721 | RTCStatsMember<uint32_t> selected_candidate_pair_changes; |
Philipp Hancke | cc1b9b0 | 2022-05-04 18:58:26 +0200 | [diff] [blame] | 722 | RTCStatsMember<std::string> ice_role; |
Philipp Hancke | 95b1a34 | 2022-05-05 07:53:54 +0200 | [diff] [blame] | 723 | RTCStatsMember<std::string> ice_local_username_fragment; |
Philipp Hancke | 1f49157 | 2022-05-09 17:43:31 +0200 | [diff] [blame] | 724 | RTCStatsMember<std::string> ice_state; |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 725 | }; |
| 726 | |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 727 | } // namespace webrtc |
| 728 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 729 | #endif // API_STATS_RTCSTATS_OBJECTS_H_ |