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 | |
Henrik Boström | 1df1bf8 | 2018-03-20 13:24:20 +0100 | [diff] [blame] | 14 | #include <memory> |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 15 | #include <string> |
oprypin | 803dc29 | 2017-02-01 01:55:59 -0800 | [diff] [blame] | 16 | #include <vector> |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 17 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 18 | #include "api/stats/rtcstats.h" |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 19 | |
| 20 | namespace webrtc { |
| 21 | |
hbos | cc555c5 | 2016-10-18 12:48:31 -0700 | [diff] [blame] | 22 | // https://w3c.github.io/webrtc-pc/#idl-def-rtcdatachannelstate |
| 23 | struct RTCDataChannelState { |
agrieve | 26622d3 | 2017-08-08 10:48:15 -0700 | [diff] [blame] | 24 | static const char* const kConnecting; |
| 25 | static const char* const kOpen; |
| 26 | static const char* const kClosing; |
| 27 | static const char* const kClosed; |
hbos | cc555c5 | 2016-10-18 12:48:31 -0700 | [diff] [blame] | 28 | }; |
| 29 | |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 30 | // https://w3c.github.io/webrtc-stats/#dom-rtcstatsicecandidatepairstate |
| 31 | struct RTCStatsIceCandidatePairState { |
agrieve | 26622d3 | 2017-08-08 10:48:15 -0700 | [diff] [blame] | 32 | static const char* const kFrozen; |
| 33 | static const char* const kWaiting; |
| 34 | static const char* const kInProgress; |
| 35 | static const char* const kFailed; |
| 36 | static const char* const kSucceeded; |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 37 | }; |
| 38 | |
hbos | cc555c5 | 2016-10-18 12:48:31 -0700 | [diff] [blame] | 39 | // https://w3c.github.io/webrtc-pc/#rtcicecandidatetype-enum |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 40 | struct RTCIceCandidateType { |
agrieve | 26622d3 | 2017-08-08 10:48:15 -0700 | [diff] [blame] | 41 | static const char* const kHost; |
| 42 | static const char* const kSrflx; |
| 43 | static const char* const kPrflx; |
| 44 | static const char* const kRelay; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 45 | }; |
| 46 | |
hbos | 7064d59 | 2017-01-16 07:38:02 -0800 | [diff] [blame] | 47 | // https://w3c.github.io/webrtc-pc/#idl-def-rtcdtlstransportstate |
| 48 | struct RTCDtlsTransportState { |
agrieve | 26622d3 | 2017-08-08 10:48:15 -0700 | [diff] [blame] | 49 | static const char* const kNew; |
| 50 | static const char* const kConnecting; |
| 51 | static const char* const kConnected; |
| 52 | static const char* const kClosed; |
| 53 | static const char* const kFailed; |
hbos | 7064d59 | 2017-01-16 07:38:02 -0800 | [diff] [blame] | 54 | }; |
| 55 | |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame] | 56 | // |RTCMediaStreamTrackStats::kind| is not an enum in the spec but the only |
| 57 | // valid values are "audio" and "video". |
| 58 | // https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats-kind |
| 59 | struct RTCMediaStreamTrackKind { |
agrieve | 26622d3 | 2017-08-08 10:48:15 -0700 | [diff] [blame] | 60 | static const char* const kAudio; |
| 61 | static const char* const kVideo; |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame] | 62 | }; |
| 63 | |
Gary Liu | 37e489c | 2017-11-21 10:49:36 -0800 | [diff] [blame] | 64 | // https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype |
| 65 | struct RTCNetworkType { |
| 66 | static const char* const kBluetooth; |
| 67 | static const char* const kCellular; |
| 68 | static const char* const kEthernet; |
| 69 | static const char* const kWifi; |
| 70 | static const char* const kWimax; |
| 71 | static const char* const kVpn; |
| 72 | static const char* const kUnknown; |
| 73 | }; |
| 74 | |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 75 | // https://w3c.github.io/webrtc-stats/#certificatestats-dict* |
| 76 | class RTCCertificateStats final : public RTCStats { |
| 77 | public: |
| 78 | WEBRTC_RTCSTATS_DECL(); |
| 79 | |
| 80 | RTCCertificateStats(const std::string& id, int64_t timestamp_us); |
| 81 | RTCCertificateStats(std::string&& id, int64_t timestamp_us); |
| 82 | RTCCertificateStats(const RTCCertificateStats& other); |
| 83 | ~RTCCertificateStats() override; |
| 84 | |
| 85 | RTCStatsMember<std::string> fingerprint; |
| 86 | RTCStatsMember<std::string> fingerprint_algorithm; |
| 87 | RTCStatsMember<std::string> base64_certificate; |
| 88 | RTCStatsMember<std::string> issuer_certificate_id; |
| 89 | }; |
| 90 | |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 91 | // https://w3c.github.io/webrtc-stats/#codec-dict* |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 92 | class RTCCodecStats final : public RTCStats { |
| 93 | public: |
| 94 | WEBRTC_RTCSTATS_DECL(); |
| 95 | |
| 96 | RTCCodecStats(const std::string& id, int64_t timestamp_us); |
| 97 | RTCCodecStats(std::string&& id, int64_t timestamp_us); |
| 98 | RTCCodecStats(const RTCCodecStats& other); |
| 99 | ~RTCCodecStats() override; |
| 100 | |
| 101 | RTCStatsMember<uint32_t> payload_type; |
hbos | 13f54b2 | 2017-02-28 06:56:04 -0800 | [diff] [blame] | 102 | RTCStatsMember<std::string> mime_type; |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 103 | RTCStatsMember<uint32_t> clock_rate; |
hbos | 585a9b1 | 2017-02-07 04:59:16 -0800 | [diff] [blame] | 104 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7061 |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 105 | RTCStatsMember<uint32_t> channels; |
hbos | 585a9b1 | 2017-02-07 04:59:16 -0800 | [diff] [blame] | 106 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7061 |
hbos | 13f54b2 | 2017-02-28 06:56:04 -0800 | [diff] [blame] | 107 | RTCStatsMember<std::string> sdp_fmtp_line; |
hbos | 585a9b1 | 2017-02-07 04:59:16 -0800 | [diff] [blame] | 108 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7061 |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 109 | RTCStatsMember<std::string> implementation; |
| 110 | }; |
| 111 | |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 112 | // https://w3c.github.io/webrtc-stats/#dcstats-dict* |
| 113 | class RTCDataChannelStats final : public RTCStats { |
| 114 | public: |
| 115 | WEBRTC_RTCSTATS_DECL(); |
| 116 | |
| 117 | RTCDataChannelStats(const std::string& id, int64_t timestamp_us); |
| 118 | RTCDataChannelStats(std::string&& id, int64_t timestamp_us); |
| 119 | RTCDataChannelStats(const RTCDataChannelStats& other); |
| 120 | ~RTCDataChannelStats() override; |
| 121 | |
| 122 | RTCStatsMember<std::string> label; |
| 123 | RTCStatsMember<std::string> protocol; |
| 124 | RTCStatsMember<int32_t> datachannelid; |
| 125 | // TODO(hbos): Support enum types? "RTCStatsMember<RTCDataChannelState>"? |
| 126 | RTCStatsMember<std::string> state; |
| 127 | RTCStatsMember<uint32_t> messages_sent; |
| 128 | RTCStatsMember<uint64_t> bytes_sent; |
| 129 | RTCStatsMember<uint32_t> messages_received; |
| 130 | RTCStatsMember<uint64_t> bytes_received; |
| 131 | }; |
| 132 | |
| 133 | // https://w3c.github.io/webrtc-stats/#candidatepair-dict* |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 134 | // TODO(hbos): Tracking bug https://bugs.webrtc.org/7062 |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 135 | class RTCIceCandidatePairStats final : public RTCStats { |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 136 | public: |
| 137 | WEBRTC_RTCSTATS_DECL(); |
| 138 | |
| 139 | RTCIceCandidatePairStats(const std::string& id, int64_t timestamp_us); |
| 140 | RTCIceCandidatePairStats(std::string&& id, int64_t timestamp_us); |
| 141 | RTCIceCandidatePairStats(const RTCIceCandidatePairStats& other); |
| 142 | ~RTCIceCandidatePairStats() override; |
| 143 | |
| 144 | RTCStatsMember<std::string> transport_id; |
| 145 | RTCStatsMember<std::string> local_candidate_id; |
| 146 | RTCStatsMember<std::string> remote_candidate_id; |
| 147 | // TODO(hbos): Support enum types? |
| 148 | // "RTCStatsMember<RTCStatsIceCandidatePairState>"? |
| 149 | RTCStatsMember<std::string> state; |
| 150 | RTCStatsMember<uint64_t> priority; |
| 151 | RTCStatsMember<bool> nominated; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 152 | // TODO(hbos): Collect this the way the spec describes it. We have a value for |
| 153 | // it but it is not spec-compliant. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 154 | RTCStatsMember<bool> writable; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 155 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 156 | RTCStatsMember<bool> readable; |
| 157 | RTCStatsMember<uint64_t> bytes_sent; |
| 158 | RTCStatsMember<uint64_t> bytes_received; |
hbos | 3168c7a | 2016-12-15 06:17:08 -0800 | [diff] [blame] | 159 | RTCStatsMember<double> total_round_trip_time; |
hbos | 3168c7a | 2016-12-15 06:17:08 -0800 | [diff] [blame] | 160 | RTCStatsMember<double> current_round_trip_time; |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 161 | RTCStatsMember<double> available_outgoing_bitrate; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 162 | // 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] | 163 | // "VideoBwe.googAvailableReceiveBandwidth" is, but that value is always |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 164 | // undefined. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 165 | RTCStatsMember<double> available_incoming_bitrate; |
| 166 | RTCStatsMember<uint64_t> requests_received; |
| 167 | RTCStatsMember<uint64_t> requests_sent; |
| 168 | RTCStatsMember<uint64_t> responses_received; |
| 169 | RTCStatsMember<uint64_t> responses_sent; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 170 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 171 | RTCStatsMember<uint64_t> retransmissions_received; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 172 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 173 | RTCStatsMember<uint64_t> retransmissions_sent; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 174 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 175 | RTCStatsMember<uint64_t> consent_requests_received; |
| 176 | RTCStatsMember<uint64_t> consent_requests_sent; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 177 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 178 | RTCStatsMember<uint64_t> consent_responses_received; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 179 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 180 | RTCStatsMember<uint64_t> consent_responses_sent; |
| 181 | }; |
| 182 | |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 183 | // https://w3c.github.io/webrtc-stats/#icecandidate-dict* |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 184 | // TODO(hbos): |RTCStatsCollector| only collects candidates that are part of |
| 185 | // ice candidate pairs, but there could be candidates not paired with anything. |
| 186 | // crbug.com/632723 |
Qingsi Wang | 72a43a1 | 2018-02-20 16:03:18 -0800 | [diff] [blame] | 187 | // TODO(qingsi): Add the stats of STUN binding requests (keepalives) and collect |
| 188 | // them in the new PeerConnection::GetStats. |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 189 | class RTCIceCandidateStats : public RTCStats { |
| 190 | public: |
| 191 | WEBRTC_RTCSTATS_DECL(); |
| 192 | |
| 193 | RTCIceCandidateStats(const RTCIceCandidateStats& other); |
| 194 | ~RTCIceCandidateStats() override; |
| 195 | |
hbos | b4e426e | 2017-01-02 09:59:31 -0800 | [diff] [blame] | 196 | RTCStatsMember<std::string> transport_id; |
hbos | c3a2b7f | 2017-01-02 04:46:15 -0800 | [diff] [blame] | 197 | RTCStatsMember<bool> is_remote; |
Gary Liu | 37e489c | 2017-11-21 10:49:36 -0800 | [diff] [blame] | 198 | RTCStatsMember<std::string> network_type; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 199 | RTCStatsMember<std::string> ip; |
| 200 | RTCStatsMember<int32_t> port; |
| 201 | RTCStatsMember<std::string> protocol; |
Philipp Hancke | 9551375 | 2018-09-27 14:40:08 +0200 | [diff] [blame] | 202 | RTCStatsMember<std::string> relay_protocol; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 203 | // TODO(hbos): Support enum types? "RTCStatsMember<RTCIceCandidateType>"? |
| 204 | RTCStatsMember<std::string> candidate_type; |
| 205 | RTCStatsMember<int32_t> priority; |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 206 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/632723 |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 207 | RTCStatsMember<std::string> url; |
hbos | d17a5a7 | 2017-01-02 08:09:59 -0800 | [diff] [blame] | 208 | // TODO(hbos): |deleted = true| case is not supported by |RTCStatsCollector|. |
| 209 | // crbug.com/632723 |
| 210 | RTCStatsMember<bool> deleted; // = false |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 211 | |
| 212 | protected: |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 213 | RTCIceCandidateStats(const std::string& id, |
| 214 | int64_t timestamp_us, |
| 215 | bool is_remote); |
hbos | c3a2b7f | 2017-01-02 04:46:15 -0800 | [diff] [blame] | 216 | RTCIceCandidateStats(std::string&& id, int64_t timestamp_us, bool is_remote); |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 217 | }; |
| 218 | |
| 219 | // In the spec both local and remote varieties are of type RTCIceCandidateStats. |
| 220 | // But here we define them as subclasses of |RTCIceCandidateStats| because the |
| 221 | // |kType| need to be different ("RTCStatsType type") in the local/remote case. |
| 222 | // https://w3c.github.io/webrtc-stats/#rtcstatstype-str* |
Henrik Boström | 1df1bf8 | 2018-03-20 13:24:20 +0100 | [diff] [blame] | 223 | // This forces us to have to override copy() and type(). |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 224 | class RTCLocalIceCandidateStats final : public RTCIceCandidateStats { |
| 225 | public: |
| 226 | static const char kType[]; |
| 227 | RTCLocalIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 228 | RTCLocalIceCandidateStats(std::string&& id, int64_t timestamp_us); |
Henrik Boström | 1df1bf8 | 2018-03-20 13:24:20 +0100 | [diff] [blame] | 229 | std::unique_ptr<RTCStats> copy() const override; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 230 | const char* type() const override; |
| 231 | }; |
| 232 | |
| 233 | class RTCRemoteIceCandidateStats final : public RTCIceCandidateStats { |
| 234 | public: |
| 235 | static const char kType[]; |
| 236 | RTCRemoteIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 237 | RTCRemoteIceCandidateStats(std::string&& id, int64_t timestamp_us); |
Henrik Boström | 1df1bf8 | 2018-03-20 13:24:20 +0100 | [diff] [blame] | 238 | std::unique_ptr<RTCStats> copy() const override; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 239 | const char* type() const override; |
| 240 | }; |
| 241 | |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 242 | // https://w3c.github.io/webrtc-stats/#msstats-dict* |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 243 | // TODO(hbos): Tracking bug crbug.com/660827 |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 244 | class RTCMediaStreamStats final : public RTCStats { |
| 245 | public: |
| 246 | WEBRTC_RTCSTATS_DECL(); |
| 247 | |
| 248 | RTCMediaStreamStats(const std::string& id, int64_t timestamp_us); |
| 249 | RTCMediaStreamStats(std::string&& id, int64_t timestamp_us); |
| 250 | RTCMediaStreamStats(const RTCMediaStreamStats& other); |
| 251 | ~RTCMediaStreamStats() override; |
| 252 | |
| 253 | RTCStatsMember<std::string> stream_identifier; |
| 254 | RTCStatsMember<std::vector<std::string>> track_ids; |
| 255 | }; |
| 256 | |
| 257 | // https://w3c.github.io/webrtc-stats/#mststats-dict* |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 258 | // TODO(hbos): Tracking bug crbug.com/659137 |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 259 | class RTCMediaStreamTrackStats final : public RTCStats { |
| 260 | public: |
| 261 | WEBRTC_RTCSTATS_DECL(); |
| 262 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 263 | RTCMediaStreamTrackStats(const std::string& id, |
| 264 | int64_t timestamp_us, |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame] | 265 | const char* kind); |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 266 | RTCMediaStreamTrackStats(std::string&& id, |
| 267 | int64_t timestamp_us, |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame] | 268 | const char* kind); |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 269 | RTCMediaStreamTrackStats(const RTCMediaStreamTrackStats& other); |
| 270 | ~RTCMediaStreamTrackStats() override; |
| 271 | |
| 272 | RTCStatsMember<std::string> track_identifier; |
| 273 | RTCStatsMember<bool> remote_source; |
| 274 | RTCStatsMember<bool> ended; |
| 275 | // TODO(hbos): |RTCStatsCollector| does not return stats for detached tracks. |
| 276 | // crbug.com/659137 |
| 277 | RTCStatsMember<bool> detached; |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame] | 278 | // See |RTCMediaStreamTrackKind| for valid values. |
| 279 | RTCStatsMember<std::string> kind; |
Gustaf Ullberg | b0a0207 | 2017-10-02 12:00:34 +0200 | [diff] [blame] | 280 | // TODO(gustaf): Implement jitter_buffer_delay for video (currently |
| 281 | // implemented for audio only). |
| 282 | // https://crbug.com/webrtc/8318 |
| 283 | RTCStatsMember<double> jitter_buffer_delay; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 284 | // Video-only members |
| 285 | RTCStatsMember<uint32_t> frame_width; |
| 286 | RTCStatsMember<uint32_t> frame_height; |
| 287 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 288 | RTCStatsMember<double> frames_per_second; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 289 | RTCStatsMember<uint32_t> frames_sent; |
Ilya Nikolaevskiy | 70473fc | 2018-02-28 16:35:03 +0100 | [diff] [blame] | 290 | RTCStatsMember<uint32_t> huge_frames_sent; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 291 | RTCStatsMember<uint32_t> frames_received; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 292 | RTCStatsMember<uint32_t> frames_decoded; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 293 | RTCStatsMember<uint32_t> frames_dropped; |
| 294 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 295 | RTCStatsMember<uint32_t> frames_corrupted; |
| 296 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 297 | RTCStatsMember<uint32_t> partial_frames_lost; |
| 298 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 299 | RTCStatsMember<uint32_t> full_frames_lost; |
| 300 | // Audio-only members |
| 301 | RTCStatsMember<double> audio_level; |
zstein | e76bd3a | 2017-07-14 12:17:49 -0700 | [diff] [blame] | 302 | RTCStatsMember<double> total_audio_energy; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 303 | RTCStatsMember<double> echo_return_loss; |
| 304 | RTCStatsMember<double> echo_return_loss_enhancement; |
Steve Anton | 2dbc69f | 2017-08-24 17:15:13 -0700 | [diff] [blame] | 305 | RTCStatsMember<uint64_t> total_samples_received; |
| 306 | RTCStatsMember<double> total_samples_duration; |
| 307 | RTCStatsMember<uint64_t> concealed_samples; |
Gustaf Ullberg | 9a2e906 | 2017-09-18 09:28:20 +0200 | [diff] [blame] | 308 | RTCStatsMember<uint64_t> concealment_events; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 309 | }; |
| 310 | |
hbos | 6ab97ce | 2016-10-03 14:16:56 -0700 | [diff] [blame] | 311 | // https://w3c.github.io/webrtc-stats/#pcstats-dict* |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 312 | class RTCPeerConnectionStats final : public RTCStats { |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 313 | public: |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 314 | WEBRTC_RTCSTATS_DECL(); |
| 315 | |
hbos | 0e6758d | 2016-08-31 07:57:36 -0700 | [diff] [blame] | 316 | RTCPeerConnectionStats(const std::string& id, int64_t timestamp_us); |
| 317 | RTCPeerConnectionStats(std::string&& id, int64_t timestamp_us); |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 318 | RTCPeerConnectionStats(const RTCPeerConnectionStats& other); |
| 319 | ~RTCPeerConnectionStats() override; |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 320 | |
| 321 | RTCStatsMember<uint32_t> data_channels_opened; |
| 322 | RTCStatsMember<uint32_t> data_channels_closed; |
| 323 | }; |
| 324 | |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 325 | // https://w3c.github.io/webrtc-stats/#streamstats-dict* |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 326 | // TODO(hbos): Tracking bug crbug.com/657854 |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 327 | class RTCRTPStreamStats : public RTCStats { |
| 328 | public: |
| 329 | WEBRTC_RTCSTATS_DECL(); |
| 330 | |
| 331 | RTCRTPStreamStats(const RTCRTPStreamStats& other); |
| 332 | ~RTCRTPStreamStats() override; |
| 333 | |
hbos | 3443bb7 | 2017-02-07 06:28:11 -0800 | [diff] [blame] | 334 | RTCStatsMember<uint32_t> ssrc; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 335 | // TODO(hbos): When the remote case is supported |RTCStatsCollector| needs to |
| 336 | // set this. crbug.com/657855, 657856 |
| 337 | RTCStatsMember<std::string> associate_stats_id; |
| 338 | // TODO(hbos): Remote case not supported by |RTCStatsCollector|. |
| 339 | // crbug.com/657855, 657856 |
| 340 | RTCStatsMember<bool> is_remote; // = false |
Philipp Hancke | 3bc0166 | 2018-08-28 14:55:03 +0200 | [diff] [blame] | 341 | RTCStatsMember<std::string> media_type; // renamed to kind. |
| 342 | RTCStatsMember<std::string> kind; |
hbos | b0ae920 | 2017-01-27 06:35:16 -0800 | [diff] [blame] | 343 | RTCStatsMember<std::string> track_id; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 344 | RTCStatsMember<std::string> transport_id; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 345 | RTCStatsMember<std::string> codec_id; |
| 346 | // FIR and PLI counts are only defined for |media_type == "video"|. |
| 347 | RTCStatsMember<uint32_t> fir_count; |
| 348 | RTCStatsMember<uint32_t> pli_count; |
| 349 | // TODO(hbos): NACK count should be collected by |RTCStatsCollector| for both |
| 350 | // audio and video but is only defined in the "video" case. crbug.com/657856 |
| 351 | RTCStatsMember<uint32_t> nack_count; |
| 352 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657854 |
| 353 | // SLI count is only defined for |media_type == "video"|. |
| 354 | RTCStatsMember<uint32_t> sli_count; |
hbos | 6769c49 | 2017-01-02 08:35:13 -0800 | [diff] [blame] | 355 | RTCStatsMember<uint64_t> qp_sum; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 356 | |
| 357 | protected: |
| 358 | RTCRTPStreamStats(const std::string& id, int64_t timestamp_us); |
| 359 | RTCRTPStreamStats(std::string&& id, int64_t timestamp_us); |
| 360 | }; |
| 361 | |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 362 | // https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict* |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 363 | // TODO(hbos): Support the remote case |is_remote = true|. |
| 364 | // https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 365 | class RTCInboundRTPStreamStats final : public RTCRTPStreamStats { |
| 366 | public: |
| 367 | WEBRTC_RTCSTATS_DECL(); |
| 368 | |
| 369 | RTCInboundRTPStreamStats(const std::string& id, int64_t timestamp_us); |
| 370 | RTCInboundRTPStreamStats(std::string&& id, int64_t timestamp_us); |
| 371 | RTCInboundRTPStreamStats(const RTCInboundRTPStreamStats& other); |
| 372 | ~RTCInboundRTPStreamStats() override; |
| 373 | |
| 374 | RTCStatsMember<uint32_t> packets_received; |
| 375 | RTCStatsMember<uint64_t> bytes_received; |
Harald Alvestrand | 719487e | 2017-12-13 12:26:04 +0100 | [diff] [blame] | 376 | RTCStatsMember<int32_t> packets_lost; // Signed per RFC 3550 |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 377 | // TODO(hbos): Collect and populate this value for both "audio" and "video", |
| 378 | // currently not collected for "video". https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 379 | RTCStatsMember<double> jitter; |
| 380 | RTCStatsMember<double> fraction_lost; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 381 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
| 382 | RTCStatsMember<double> round_trip_time; |
| 383 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 384 | RTCStatsMember<uint32_t> packets_discarded; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 385 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 386 | RTCStatsMember<uint32_t> packets_repaired; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 387 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 388 | RTCStatsMember<uint32_t> burst_packets_lost; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 389 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 390 | RTCStatsMember<uint32_t> burst_packets_discarded; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 391 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 392 | RTCStatsMember<uint32_t> burst_loss_count; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 393 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 394 | RTCStatsMember<uint32_t> burst_discard_count; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 395 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 396 | RTCStatsMember<double> burst_loss_rate; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 397 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 398 | RTCStatsMember<double> burst_discard_rate; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 399 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 400 | RTCStatsMember<double> gap_loss_rate; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 401 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 402 | RTCStatsMember<double> gap_discard_rate; |
hbos | 6769c49 | 2017-01-02 08:35:13 -0800 | [diff] [blame] | 403 | RTCStatsMember<uint32_t> frames_decoded; |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 404 | }; |
| 405 | |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 406 | // https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict* |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 407 | // TODO(hbos): Support the remote case |is_remote = true|. |
| 408 | // https://bugs.webrtc.org/7066 |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 409 | class RTCOutboundRTPStreamStats final : public RTCRTPStreamStats { |
| 410 | public: |
| 411 | WEBRTC_RTCSTATS_DECL(); |
| 412 | |
| 413 | RTCOutboundRTPStreamStats(const std::string& id, int64_t timestamp_us); |
| 414 | RTCOutboundRTPStreamStats(std::string&& id, int64_t timestamp_us); |
| 415 | RTCOutboundRTPStreamStats(const RTCOutboundRTPStreamStats& other); |
| 416 | ~RTCOutboundRTPStreamStats() override; |
| 417 | |
| 418 | RTCStatsMember<uint32_t> packets_sent; |
| 419 | RTCStatsMember<uint64_t> bytes_sent; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 420 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7066 |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 421 | RTCStatsMember<double> target_bitrate; |
hbos | 6769c49 | 2017-01-02 08:35:13 -0800 | [diff] [blame] | 422 | RTCStatsMember<uint32_t> frames_encoded; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 423 | }; |
| 424 | |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 425 | // https://w3c.github.io/webrtc-stats/#transportstats-dict* |
| 426 | class RTCTransportStats final : public RTCStats { |
| 427 | public: |
| 428 | WEBRTC_RTCSTATS_DECL(); |
| 429 | |
| 430 | RTCTransportStats(const std::string& id, int64_t timestamp_us); |
| 431 | RTCTransportStats(std::string&& id, int64_t timestamp_us); |
| 432 | RTCTransportStats(const RTCTransportStats& other); |
| 433 | ~RTCTransportStats() override; |
| 434 | |
| 435 | RTCStatsMember<uint64_t> bytes_sent; |
| 436 | RTCStatsMember<uint64_t> bytes_received; |
| 437 | RTCStatsMember<std::string> rtcp_transport_stats_id; |
hbos | 7064d59 | 2017-01-16 07:38:02 -0800 | [diff] [blame] | 438 | // TODO(hbos): Support enum types? "RTCStatsMember<RTCDtlsTransportState>"? |
| 439 | RTCStatsMember<std::string> dtls_state; |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 440 | RTCStatsMember<std::string> selected_candidate_pair_id; |
| 441 | RTCStatsMember<std::string> local_certificate_id; |
| 442 | RTCStatsMember<std::string> remote_certificate_id; |
| 443 | }; |
| 444 | |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 445 | } // namespace webrtc |
| 446 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 447 | #endif // API_STATS_RTCSTATS_OBJECTS_H_ |