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 | |
Henrik Boström | 1df1bf8 | 2018-03-20 13:24:20 +0100 | [diff] [blame] | 16 | #include <memory> |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 17 | #include <string> |
oprypin | 803dc29 | 2017-02-01 01:55:59 -0800 | [diff] [blame] | 18 | #include <vector> |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 19 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 20 | #include "api/stats/rtc_stats.h" |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 21 | #include "rtc_base/system/rtc_export.h" |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 22 | |
| 23 | namespace webrtc { |
| 24 | |
hbos | cc555c5 | 2016-10-18 12:48:31 -0700 | [diff] [blame] | 25 | // https://w3c.github.io/webrtc-pc/#idl-def-rtcdatachannelstate |
| 26 | struct RTCDataChannelState { |
agrieve | 26622d3 | 2017-08-08 10:48:15 -0700 | [diff] [blame] | 27 | static const char* const kConnecting; |
| 28 | static const char* const kOpen; |
| 29 | static const char* const kClosing; |
| 30 | static const char* const kClosed; |
hbos | cc555c5 | 2016-10-18 12:48:31 -0700 | [diff] [blame] | 31 | }; |
| 32 | |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 33 | // https://w3c.github.io/webrtc-stats/#dom-rtcstatsicecandidatepairstate |
| 34 | struct RTCStatsIceCandidatePairState { |
agrieve | 26622d3 | 2017-08-08 10:48:15 -0700 | [diff] [blame] | 35 | static const char* const kFrozen; |
| 36 | static const char* const kWaiting; |
| 37 | static const char* const kInProgress; |
| 38 | static const char* const kFailed; |
| 39 | static const char* const kSucceeded; |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 40 | }; |
| 41 | |
hbos | cc555c5 | 2016-10-18 12:48:31 -0700 | [diff] [blame] | 42 | // https://w3c.github.io/webrtc-pc/#rtcicecandidatetype-enum |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 43 | struct RTCIceCandidateType { |
agrieve | 26622d3 | 2017-08-08 10:48:15 -0700 | [diff] [blame] | 44 | static const char* const kHost; |
| 45 | static const char* const kSrflx; |
| 46 | static const char* const kPrflx; |
| 47 | static const char* const kRelay; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 48 | }; |
| 49 | |
hbos | 7064d59 | 2017-01-16 07:38:02 -0800 | [diff] [blame] | 50 | // https://w3c.github.io/webrtc-pc/#idl-def-rtcdtlstransportstate |
| 51 | struct RTCDtlsTransportState { |
agrieve | 26622d3 | 2017-08-08 10:48:15 -0700 | [diff] [blame] | 52 | static const char* const kNew; |
| 53 | static const char* const kConnecting; |
| 54 | static const char* const kConnected; |
| 55 | static const char* const kClosed; |
| 56 | static const char* const kFailed; |
hbos | 7064d59 | 2017-01-16 07:38:02 -0800 | [diff] [blame] | 57 | }; |
| 58 | |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame] | 59 | // |RTCMediaStreamTrackStats::kind| is not an enum in the spec but the only |
| 60 | // valid values are "audio" and "video". |
| 61 | // https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats-kind |
| 62 | struct RTCMediaStreamTrackKind { |
agrieve | 26622d3 | 2017-08-08 10:48:15 -0700 | [diff] [blame] | 63 | static const char* const kAudio; |
| 64 | static const char* const kVideo; |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame] | 65 | }; |
| 66 | |
Gary Liu | 37e489c | 2017-11-21 10:49:36 -0800 | [diff] [blame] | 67 | // https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype |
| 68 | struct RTCNetworkType { |
| 69 | static const char* const kBluetooth; |
| 70 | static const char* const kCellular; |
| 71 | static const char* const kEthernet; |
| 72 | static const char* const kWifi; |
| 73 | static const char* const kWimax; |
| 74 | static const char* const kVpn; |
| 75 | static const char* const kUnknown; |
| 76 | }; |
| 77 | |
Henrik Boström | ce33b6a | 2019-05-28 17:42:38 +0200 | [diff] [blame] | 78 | // https://w3c.github.io/webrtc-stats/#dom-rtcqualitylimitationreason |
| 79 | struct RTCQualityLimitationReason { |
| 80 | static const char* const kNone; |
| 81 | static const char* const kCpu; |
| 82 | static const char* const kBandwidth; |
| 83 | static const char* const kOther; |
| 84 | }; |
| 85 | |
Henrik Boström | 2e06926 | 2019-04-09 13:59:31 +0200 | [diff] [blame] | 86 | // https://webrtc.org/experiments/rtp-hdrext/video-content-type/ |
| 87 | struct RTCContentType { |
| 88 | static const char* const kUnspecified; |
| 89 | static const char* const kScreenshare; |
| 90 | }; |
| 91 | |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 92 | // https://w3c.github.io/webrtc-stats/#certificatestats-dict* |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 93 | class RTC_EXPORT RTCCertificateStats final : public RTCStats { |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 94 | public: |
| 95 | WEBRTC_RTCSTATS_DECL(); |
| 96 | |
| 97 | RTCCertificateStats(const std::string& id, int64_t timestamp_us); |
| 98 | RTCCertificateStats(std::string&& id, int64_t timestamp_us); |
| 99 | RTCCertificateStats(const RTCCertificateStats& other); |
| 100 | ~RTCCertificateStats() override; |
| 101 | |
| 102 | RTCStatsMember<std::string> fingerprint; |
| 103 | RTCStatsMember<std::string> fingerprint_algorithm; |
| 104 | RTCStatsMember<std::string> base64_certificate; |
| 105 | RTCStatsMember<std::string> issuer_certificate_id; |
| 106 | }; |
| 107 | |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 108 | // https://w3c.github.io/webrtc-stats/#codec-dict* |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 109 | class RTC_EXPORT RTCCodecStats final : public RTCStats { |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 110 | public: |
| 111 | WEBRTC_RTCSTATS_DECL(); |
| 112 | |
| 113 | RTCCodecStats(const std::string& id, int64_t timestamp_us); |
| 114 | RTCCodecStats(std::string&& id, int64_t timestamp_us); |
| 115 | RTCCodecStats(const RTCCodecStats& other); |
| 116 | ~RTCCodecStats() override; |
| 117 | |
| 118 | RTCStatsMember<uint32_t> payload_type; |
hbos | 13f54b2 | 2017-02-28 06:56:04 -0800 | [diff] [blame] | 119 | RTCStatsMember<std::string> mime_type; |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 120 | RTCStatsMember<uint32_t> clock_rate; |
hbos | 585a9b1 | 2017-02-07 04:59:16 -0800 | [diff] [blame] | 121 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7061 |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 122 | RTCStatsMember<uint32_t> channels; |
hbos | 585a9b1 | 2017-02-07 04:59:16 -0800 | [diff] [blame] | 123 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7061 |
hbos | 13f54b2 | 2017-02-28 06:56:04 -0800 | [diff] [blame] | 124 | RTCStatsMember<std::string> sdp_fmtp_line; |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 125 | }; |
| 126 | |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 127 | // https://w3c.github.io/webrtc-stats/#dcstats-dict* |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 128 | class RTC_EXPORT RTCDataChannelStats final : public RTCStats { |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 129 | public: |
| 130 | WEBRTC_RTCSTATS_DECL(); |
| 131 | |
| 132 | RTCDataChannelStats(const std::string& id, int64_t timestamp_us); |
| 133 | RTCDataChannelStats(std::string&& id, int64_t timestamp_us); |
| 134 | RTCDataChannelStats(const RTCDataChannelStats& other); |
| 135 | ~RTCDataChannelStats() override; |
| 136 | |
| 137 | RTCStatsMember<std::string> label; |
| 138 | RTCStatsMember<std::string> protocol; |
| 139 | RTCStatsMember<int32_t> datachannelid; |
| 140 | // TODO(hbos): Support enum types? "RTCStatsMember<RTCDataChannelState>"? |
| 141 | RTCStatsMember<std::string> state; |
| 142 | RTCStatsMember<uint32_t> messages_sent; |
| 143 | RTCStatsMember<uint64_t> bytes_sent; |
| 144 | RTCStatsMember<uint32_t> messages_received; |
| 145 | RTCStatsMember<uint64_t> bytes_received; |
| 146 | }; |
| 147 | |
| 148 | // https://w3c.github.io/webrtc-stats/#candidatepair-dict* |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 149 | // TODO(hbos): Tracking bug https://bugs.webrtc.org/7062 |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 150 | class RTC_EXPORT RTCIceCandidatePairStats final : public RTCStats { |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 151 | public: |
| 152 | WEBRTC_RTCSTATS_DECL(); |
| 153 | |
| 154 | RTCIceCandidatePairStats(const std::string& id, int64_t timestamp_us); |
| 155 | RTCIceCandidatePairStats(std::string&& id, int64_t timestamp_us); |
| 156 | RTCIceCandidatePairStats(const RTCIceCandidatePairStats& other); |
| 157 | ~RTCIceCandidatePairStats() override; |
| 158 | |
| 159 | RTCStatsMember<std::string> transport_id; |
| 160 | RTCStatsMember<std::string> local_candidate_id; |
| 161 | RTCStatsMember<std::string> remote_candidate_id; |
| 162 | // TODO(hbos): Support enum types? |
| 163 | // "RTCStatsMember<RTCStatsIceCandidatePairState>"? |
| 164 | RTCStatsMember<std::string> state; |
| 165 | RTCStatsMember<uint64_t> priority; |
| 166 | RTCStatsMember<bool> nominated; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 167 | // TODO(hbos): Collect this the way the spec describes it. We have a value for |
| 168 | // it but it is not spec-compliant. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 169 | RTCStatsMember<bool> writable; |
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<bool> readable; |
| 172 | RTCStatsMember<uint64_t> bytes_sent; |
| 173 | RTCStatsMember<uint64_t> bytes_received; |
hbos | 3168c7a | 2016-12-15 06:17:08 -0800 | [diff] [blame] | 174 | RTCStatsMember<double> total_round_trip_time; |
hbos | 3168c7a | 2016-12-15 06:17:08 -0800 | [diff] [blame] | 175 | RTCStatsMember<double> current_round_trip_time; |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 176 | RTCStatsMember<double> available_outgoing_bitrate; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 177 | // 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] | 178 | // "VideoBwe.googAvailableReceiveBandwidth" is, but that value is always |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 179 | // undefined. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 180 | RTCStatsMember<double> available_incoming_bitrate; |
| 181 | RTCStatsMember<uint64_t> requests_received; |
| 182 | RTCStatsMember<uint64_t> requests_sent; |
| 183 | RTCStatsMember<uint64_t> responses_received; |
| 184 | RTCStatsMember<uint64_t> responses_sent; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 185 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 186 | RTCStatsMember<uint64_t> retransmissions_received; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 187 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 188 | RTCStatsMember<uint64_t> retransmissions_sent; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 189 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 190 | RTCStatsMember<uint64_t> consent_requests_received; |
| 191 | RTCStatsMember<uint64_t> consent_requests_sent; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 192 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 193 | RTCStatsMember<uint64_t> consent_responses_received; |
hbos | 338f78a | 2017-02-07 06:41:21 -0800 | [diff] [blame] | 194 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 195 | RTCStatsMember<uint64_t> consent_responses_sent; |
| 196 | }; |
| 197 | |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 198 | // https://w3c.github.io/webrtc-stats/#icecandidate-dict* |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 199 | // TODO(hbos): |RTCStatsCollector| only collects candidates that are part of |
| 200 | // ice candidate pairs, but there could be candidates not paired with anything. |
| 201 | // crbug.com/632723 |
Qingsi Wang | 72a43a1 | 2018-02-20 16:03:18 -0800 | [diff] [blame] | 202 | // TODO(qingsi): Add the stats of STUN binding requests (keepalives) and collect |
| 203 | // them in the new PeerConnection::GetStats. |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 204 | class RTC_EXPORT RTCIceCandidateStats : public RTCStats { |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 205 | public: |
| 206 | WEBRTC_RTCSTATS_DECL(); |
| 207 | |
| 208 | RTCIceCandidateStats(const RTCIceCandidateStats& other); |
| 209 | ~RTCIceCandidateStats() override; |
| 210 | |
hbos | b4e426e | 2017-01-02 09:59:31 -0800 | [diff] [blame] | 211 | RTCStatsMember<std::string> transport_id; |
hbos | c3a2b7f | 2017-01-02 04:46:15 -0800 | [diff] [blame] | 212 | RTCStatsMember<bool> is_remote; |
Gary Liu | 37e489c | 2017-11-21 10:49:36 -0800 | [diff] [blame] | 213 | RTCStatsMember<std::string> network_type; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 214 | RTCStatsMember<std::string> ip; |
| 215 | RTCStatsMember<int32_t> port; |
| 216 | RTCStatsMember<std::string> protocol; |
Philipp Hancke | 9551375 | 2018-09-27 14:40:08 +0200 | [diff] [blame] | 217 | RTCStatsMember<std::string> relay_protocol; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 218 | // TODO(hbos): Support enum types? "RTCStatsMember<RTCIceCandidateType>"? |
| 219 | RTCStatsMember<std::string> candidate_type; |
| 220 | RTCStatsMember<int32_t> priority; |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 221 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/632723 |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 222 | RTCStatsMember<std::string> url; |
hbos | d17a5a7 | 2017-01-02 08:09:59 -0800 | [diff] [blame] | 223 | // TODO(hbos): |deleted = true| case is not supported by |RTCStatsCollector|. |
| 224 | // crbug.com/632723 |
| 225 | RTCStatsMember<bool> deleted; // = false |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 226 | |
| 227 | protected: |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 228 | RTCIceCandidateStats(const std::string& id, |
| 229 | int64_t timestamp_us, |
| 230 | bool is_remote); |
hbos | c3a2b7f | 2017-01-02 04:46:15 -0800 | [diff] [blame] | 231 | RTCIceCandidateStats(std::string&& id, int64_t timestamp_us, bool is_remote); |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 232 | }; |
| 233 | |
| 234 | // In the spec both local and remote varieties are of type RTCIceCandidateStats. |
| 235 | // But here we define them as subclasses of |RTCIceCandidateStats| because the |
| 236 | // |kType| need to be different ("RTCStatsType type") in the local/remote case. |
| 237 | // https://w3c.github.io/webrtc-stats/#rtcstatstype-str* |
Henrik Boström | 1df1bf8 | 2018-03-20 13:24:20 +0100 | [diff] [blame] | 238 | // This forces us to have to override copy() and type(). |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 239 | class RTC_EXPORT RTCLocalIceCandidateStats final : public RTCIceCandidateStats { |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 240 | public: |
| 241 | static const char kType[]; |
| 242 | RTCLocalIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 243 | RTCLocalIceCandidateStats(std::string&& id, int64_t timestamp_us); |
Henrik Boström | 1df1bf8 | 2018-03-20 13:24:20 +0100 | [diff] [blame] | 244 | std::unique_ptr<RTCStats> copy() const override; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 245 | const char* type() const override; |
| 246 | }; |
| 247 | |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 248 | class RTC_EXPORT RTCRemoteIceCandidateStats final |
| 249 | : public RTCIceCandidateStats { |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 250 | public: |
| 251 | static const char kType[]; |
| 252 | RTCRemoteIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 253 | RTCRemoteIceCandidateStats(std::string&& id, int64_t timestamp_us); |
Henrik Boström | 1df1bf8 | 2018-03-20 13:24:20 +0100 | [diff] [blame] | 254 | std::unique_ptr<RTCStats> copy() const override; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 255 | const char* type() const override; |
| 256 | }; |
| 257 | |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 258 | // https://w3c.github.io/webrtc-stats/#msstats-dict* |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 259 | // TODO(hbos): Tracking bug crbug.com/660827 |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 260 | class RTC_EXPORT RTCMediaStreamStats final : public RTCStats { |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 261 | public: |
| 262 | WEBRTC_RTCSTATS_DECL(); |
| 263 | |
| 264 | RTCMediaStreamStats(const std::string& id, int64_t timestamp_us); |
| 265 | RTCMediaStreamStats(std::string&& id, int64_t timestamp_us); |
| 266 | RTCMediaStreamStats(const RTCMediaStreamStats& other); |
| 267 | ~RTCMediaStreamStats() override; |
| 268 | |
| 269 | RTCStatsMember<std::string> stream_identifier; |
| 270 | RTCStatsMember<std::vector<std::string>> track_ids; |
| 271 | }; |
| 272 | |
| 273 | // https://w3c.github.io/webrtc-stats/#mststats-dict* |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 274 | // TODO(hbos): Tracking bug crbug.com/659137 |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 275 | class RTC_EXPORT RTCMediaStreamTrackStats final : public RTCStats { |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 276 | public: |
| 277 | WEBRTC_RTCSTATS_DECL(); |
| 278 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 279 | RTCMediaStreamTrackStats(const std::string& id, |
| 280 | int64_t timestamp_us, |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame] | 281 | const char* kind); |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 282 | RTCMediaStreamTrackStats(std::string&& id, |
| 283 | int64_t timestamp_us, |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame] | 284 | const char* kind); |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 285 | RTCMediaStreamTrackStats(const RTCMediaStreamTrackStats& other); |
| 286 | ~RTCMediaStreamTrackStats() override; |
| 287 | |
| 288 | RTCStatsMember<std::string> track_identifier; |
Henrik Boström | 646fda0 | 2019-05-22 15:49:42 +0200 | [diff] [blame] | 289 | RTCStatsMember<std::string> media_source_id; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 290 | RTCStatsMember<bool> remote_source; |
| 291 | RTCStatsMember<bool> ended; |
| 292 | // TODO(hbos): |RTCStatsCollector| does not return stats for detached tracks. |
| 293 | // crbug.com/659137 |
| 294 | RTCStatsMember<bool> detached; |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame] | 295 | // See |RTCMediaStreamTrackKind| for valid values. |
| 296 | RTCStatsMember<std::string> kind; |
Gustaf Ullberg | b0a0207 | 2017-10-02 12:00:34 +0200 | [diff] [blame] | 297 | // TODO(gustaf): Implement jitter_buffer_delay for video (currently |
| 298 | // implemented for audio only). |
| 299 | // https://crbug.com/webrtc/8318 |
| 300 | RTCStatsMember<double> jitter_buffer_delay; |
Chen Xing | 0acffb5 | 2019-01-15 15:46:29 +0100 | [diff] [blame] | 301 | RTCStatsMember<uint64_t> jitter_buffer_emitted_count; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 302 | // Video-only members |
| 303 | RTCStatsMember<uint32_t> frame_width; |
| 304 | RTCStatsMember<uint32_t> frame_height; |
| 305 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 306 | RTCStatsMember<double> frames_per_second; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 307 | RTCStatsMember<uint32_t> frames_sent; |
Ilya Nikolaevskiy | 70473fc | 2018-02-28 16:35:03 +0100 | [diff] [blame] | 308 | RTCStatsMember<uint32_t> huge_frames_sent; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 309 | RTCStatsMember<uint32_t> frames_received; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 310 | RTCStatsMember<uint32_t> frames_decoded; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 311 | RTCStatsMember<uint32_t> frames_dropped; |
| 312 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 313 | RTCStatsMember<uint32_t> frames_corrupted; |
| 314 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 315 | RTCStatsMember<uint32_t> partial_frames_lost; |
| 316 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 317 | RTCStatsMember<uint32_t> full_frames_lost; |
| 318 | // Audio-only members |
Henrik Boström | d2c336f | 2019-07-03 17:11:10 +0200 | [diff] [blame] | 319 | RTCStatsMember<double> audio_level; // Receive-only |
| 320 | RTCStatsMember<double> total_audio_energy; // Receive-only |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 321 | RTCStatsMember<double> echo_return_loss; |
| 322 | RTCStatsMember<double> echo_return_loss_enhancement; |
Steve Anton | 2dbc69f | 2017-08-24 17:15:13 -0700 | [diff] [blame] | 323 | RTCStatsMember<uint64_t> total_samples_received; |
Henrik Boström | d2c336f | 2019-07-03 17:11:10 +0200 | [diff] [blame] | 324 | RTCStatsMember<double> total_samples_duration; // Receive-only |
Steve Anton | 2dbc69f | 2017-08-24 17:15:13 -0700 | [diff] [blame] | 325 | RTCStatsMember<uint64_t> concealed_samples; |
Ivo Creusen | 8d8ffdb | 2019-04-30 09:45:21 +0200 | [diff] [blame] | 326 | RTCStatsMember<uint64_t> silent_concealed_samples; |
Gustaf Ullberg | 9a2e906 | 2017-09-18 09:28:20 +0200 | [diff] [blame] | 327 | RTCStatsMember<uint64_t> concealment_events; |
Ivo Creusen | 8d8ffdb | 2019-04-30 09:45:21 +0200 | [diff] [blame] | 328 | RTCStatsMember<uint64_t> inserted_samples_for_deceleration; |
| 329 | RTCStatsMember<uint64_t> removed_samples_for_acceleration; |
Ruslan Burakov | 8af8896 | 2018-11-22 17:21:10 +0100 | [diff] [blame] | 330 | // Non-standard audio-only member |
Jakob Ivarsson | 352ce5c | 2018-11-27 12:52:16 +0100 | [diff] [blame] | 331 | // TODO(kuddai): Add description to standard. crbug.com/webrtc/10042 |
Ruslan Burakov | 8af8896 | 2018-11-22 17:21:10 +0100 | [diff] [blame] | 332 | RTCNonStandardStatsMember<uint64_t> jitter_buffer_flushes; |
Jakob Ivarsson | 352ce5c | 2018-11-27 12:52:16 +0100 | [diff] [blame] | 333 | RTCNonStandardStatsMember<uint64_t> delayed_packet_outage_samples; |
Jakob Ivarsson | 232b3fd | 2019-03-06 09:18:40 +0100 | [diff] [blame] | 334 | RTCNonStandardStatsMember<double> relative_packet_arrival_delay; |
Henrik Lundin | 44125fa | 2019-04-29 17:00:46 +0200 | [diff] [blame] | 335 | // TODO(henrik.lundin): Add description of the interruption metrics at |
| 336 | // https://github.com/henbos/webrtc-provisional-stats/issues/17 |
| 337 | RTCNonStandardStatsMember<uint32_t> interruption_count; |
| 338 | RTCNonStandardStatsMember<double> total_interruption_duration; |
Sergey Silkin | 0237106 | 2019-01-31 16:45:42 +0100 | [diff] [blame] | 339 | // Non-standard video-only members. |
| 340 | // https://henbos.github.io/webrtc-provisional-stats/#RTCVideoReceiverStats-dict* |
| 341 | RTCNonStandardStatsMember<uint32_t> freeze_count; |
| 342 | RTCNonStandardStatsMember<uint32_t> pause_count; |
| 343 | RTCNonStandardStatsMember<double> total_freezes_duration; |
| 344 | RTCNonStandardStatsMember<double> total_pauses_duration; |
| 345 | RTCNonStandardStatsMember<double> total_frames_duration; |
| 346 | RTCNonStandardStatsMember<double> sum_squared_frame_durations; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 347 | }; |
| 348 | |
hbos | 6ab97ce | 2016-10-03 14:16:56 -0700 | [diff] [blame] | 349 | // https://w3c.github.io/webrtc-stats/#pcstats-dict* |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 350 | class RTC_EXPORT RTCPeerConnectionStats final : public RTCStats { |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 351 | public: |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 352 | WEBRTC_RTCSTATS_DECL(); |
| 353 | |
hbos | 0e6758d | 2016-08-31 07:57:36 -0700 | [diff] [blame] | 354 | RTCPeerConnectionStats(const std::string& id, int64_t timestamp_us); |
| 355 | RTCPeerConnectionStats(std::string&& id, int64_t timestamp_us); |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 356 | RTCPeerConnectionStats(const RTCPeerConnectionStats& other); |
| 357 | ~RTCPeerConnectionStats() override; |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 358 | |
| 359 | RTCStatsMember<uint32_t> data_channels_opened; |
| 360 | RTCStatsMember<uint32_t> data_channels_closed; |
| 361 | }; |
| 362 | |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 363 | // https://w3c.github.io/webrtc-stats/#streamstats-dict* |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 364 | // TODO(hbos): Tracking bug crbug.com/657854 |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 365 | class RTC_EXPORT RTCRTPStreamStats : public RTCStats { |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 366 | public: |
| 367 | WEBRTC_RTCSTATS_DECL(); |
| 368 | |
| 369 | RTCRTPStreamStats(const RTCRTPStreamStats& other); |
| 370 | ~RTCRTPStreamStats() override; |
| 371 | |
hbos | 3443bb7 | 2017-02-07 06:28:11 -0800 | [diff] [blame] | 372 | RTCStatsMember<uint32_t> ssrc; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 373 | // TODO(hbos): When the remote case is supported |RTCStatsCollector| needs to |
| 374 | // set this. crbug.com/657855, 657856 |
| 375 | RTCStatsMember<std::string> associate_stats_id; |
| 376 | // TODO(hbos): Remote case not supported by |RTCStatsCollector|. |
| 377 | // crbug.com/657855, 657856 |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 378 | RTCStatsMember<bool> is_remote; // = false |
Philipp Hancke | 3bc0166 | 2018-08-28 14:55:03 +0200 | [diff] [blame] | 379 | RTCStatsMember<std::string> media_type; // renamed to kind. |
| 380 | RTCStatsMember<std::string> kind; |
hbos | b0ae920 | 2017-01-27 06:35:16 -0800 | [diff] [blame] | 381 | RTCStatsMember<std::string> track_id; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 382 | RTCStatsMember<std::string> transport_id; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 383 | RTCStatsMember<std::string> codec_id; |
| 384 | // FIR and PLI counts are only defined for |media_type == "video"|. |
| 385 | RTCStatsMember<uint32_t> fir_count; |
| 386 | RTCStatsMember<uint32_t> pli_count; |
| 387 | // TODO(hbos): NACK count should be collected by |RTCStatsCollector| for both |
| 388 | // audio and video but is only defined in the "video" case. crbug.com/657856 |
| 389 | RTCStatsMember<uint32_t> nack_count; |
| 390 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657854 |
| 391 | // SLI count is only defined for |media_type == "video"|. |
| 392 | RTCStatsMember<uint32_t> sli_count; |
hbos | 6769c49 | 2017-01-02 08:35:13 -0800 | [diff] [blame] | 393 | RTCStatsMember<uint64_t> qp_sum; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 394 | |
| 395 | protected: |
| 396 | RTCRTPStreamStats(const std::string& id, int64_t timestamp_us); |
| 397 | RTCRTPStreamStats(std::string&& id, int64_t timestamp_us); |
| 398 | }; |
| 399 | |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 400 | // https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict* |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 401 | // TODO(hbos): Support the remote case |is_remote = true|. |
| 402 | // https://bugs.webrtc.org/7065 |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 403 | class RTC_EXPORT RTCInboundRTPStreamStats final : public RTCRTPStreamStats { |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 404 | public: |
| 405 | WEBRTC_RTCSTATS_DECL(); |
| 406 | |
| 407 | RTCInboundRTPStreamStats(const std::string& id, int64_t timestamp_us); |
| 408 | RTCInboundRTPStreamStats(std::string&& id, int64_t timestamp_us); |
| 409 | RTCInboundRTPStreamStats(const RTCInboundRTPStreamStats& other); |
| 410 | ~RTCInboundRTPStreamStats() override; |
| 411 | |
| 412 | RTCStatsMember<uint32_t> packets_received; |
Ivo Creusen | 8d8ffdb | 2019-04-30 09:45:21 +0200 | [diff] [blame] | 413 | RTCStatsMember<uint64_t> fec_packets_received; |
| 414 | RTCStatsMember<uint64_t> fec_packets_discarded; |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 415 | RTCStatsMember<uint64_t> bytes_received; |
Niels Möller | ac0a4cb | 2019-10-09 15:01:33 +0200 | [diff] [blame] | 416 | RTCStatsMember<uint64_t> header_bytes_received; |
Harald Alvestrand | 719487e | 2017-12-13 12:26:04 +0100 | [diff] [blame] | 417 | RTCStatsMember<int32_t> packets_lost; // Signed per RFC 3550 |
Henrik Boström | 01738c6 | 2019-04-15 17:32:00 +0200 | [diff] [blame] | 418 | RTCStatsMember<double> last_packet_received_timestamp; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 419 | // TODO(hbos): Collect and populate this value for both "audio" and "video", |
| 420 | // currently not collected for "video". https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 421 | RTCStatsMember<double> jitter; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 422 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
| 423 | RTCStatsMember<double> round_trip_time; |
| 424 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 425 | RTCStatsMember<uint32_t> packets_discarded; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 426 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 427 | RTCStatsMember<uint32_t> packets_repaired; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 428 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 429 | RTCStatsMember<uint32_t> burst_packets_lost; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 430 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 431 | RTCStatsMember<uint32_t> burst_packets_discarded; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 432 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 433 | RTCStatsMember<uint32_t> burst_loss_count; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 434 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 435 | RTCStatsMember<uint32_t> burst_discard_count; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 436 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 437 | RTCStatsMember<double> burst_loss_rate; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 438 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 439 | RTCStatsMember<double> burst_discard_rate; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 440 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 441 | RTCStatsMember<double> gap_loss_rate; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 442 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 443 | RTCStatsMember<double> gap_discard_rate; |
hbos | 6769c49 | 2017-01-02 08:35:13 -0800 | [diff] [blame] | 444 | RTCStatsMember<uint32_t> frames_decoded; |
Rasmus Brandt | 2efae77 | 2019-06-27 14:29:34 +0200 | [diff] [blame] | 445 | RTCStatsMember<uint32_t> key_frames_decoded; |
Johannes Kron | bfd343b | 2019-07-01 10:07:50 +0200 | [diff] [blame] | 446 | RTCStatsMember<double> total_decode_time; |
Henrik Boström | 2e06926 | 2019-04-09 13:59:31 +0200 | [diff] [blame] | 447 | // https://henbos.github.io/webrtc-provisional-stats/#dom-rtcinboundrtpstreamstats-contenttype |
| 448 | RTCStatsMember<std::string> content_type; |
Henrik Boström | 6b43086 | 2019-08-16 13:09:51 +0200 | [diff] [blame] | 449 | // TODO(hbos): This is only implemented for video; implement it for audio as |
| 450 | // well. |
| 451 | RTCStatsMember<std::string> decoder_implementation; |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 452 | }; |
| 453 | |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 454 | // https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict* |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 455 | // TODO(hbos): Support the remote case |is_remote = true|. |
| 456 | // https://bugs.webrtc.org/7066 |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 457 | class RTC_EXPORT RTCOutboundRTPStreamStats final : public RTCRTPStreamStats { |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 458 | public: |
| 459 | WEBRTC_RTCSTATS_DECL(); |
| 460 | |
| 461 | RTCOutboundRTPStreamStats(const std::string& id, int64_t timestamp_us); |
| 462 | RTCOutboundRTPStreamStats(std::string&& id, int64_t timestamp_us); |
| 463 | RTCOutboundRTPStreamStats(const RTCOutboundRTPStreamStats& other); |
| 464 | ~RTCOutboundRTPStreamStats() override; |
| 465 | |
Henrik Boström | 646fda0 | 2019-05-22 15:49:42 +0200 | [diff] [blame] | 466 | RTCStatsMember<std::string> media_source_id; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 467 | RTCStatsMember<uint32_t> packets_sent; |
Henrik Boström | cf96e0f | 2019-04-17 13:51:53 +0200 | [diff] [blame] | 468 | RTCStatsMember<uint64_t> retransmitted_packets_sent; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 469 | RTCStatsMember<uint64_t> bytes_sent; |
Niels Möller | ac0a4cb | 2019-10-09 15:01:33 +0200 | [diff] [blame] | 470 | RTCStatsMember<uint64_t> header_bytes_sent; |
Henrik Boström | cf96e0f | 2019-04-17 13:51:53 +0200 | [diff] [blame] | 471 | RTCStatsMember<uint64_t> retransmitted_bytes_sent; |
hbos | a7a9be1 | 2017-03-01 01:02:45 -0800 | [diff] [blame] | 472 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7066 |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 473 | RTCStatsMember<double> target_bitrate; |
hbos | 6769c49 | 2017-01-02 08:35:13 -0800 | [diff] [blame] | 474 | RTCStatsMember<uint32_t> frames_encoded; |
Rasmus Brandt | 2efae77 | 2019-06-27 14:29:34 +0200 | [diff] [blame] | 475 | RTCStatsMember<uint32_t> key_frames_encoded; |
Henrik Boström | f71362f | 2019-04-08 16:14:23 +0200 | [diff] [blame] | 476 | RTCStatsMember<double> total_encode_time; |
Henrik Boström | 23aff9b | 2019-05-20 15:15:38 +0200 | [diff] [blame] | 477 | RTCStatsMember<uint64_t> total_encoded_bytes_target; |
Henrik Boström | 9fe1834 | 2019-05-16 18:38:20 +0200 | [diff] [blame] | 478 | // TODO(https://crbug.com/webrtc/10635): This is only implemented for video; |
| 479 | // implement it for audio as well. |
| 480 | RTCStatsMember<double> total_packet_send_delay; |
Henrik Boström | ce33b6a | 2019-05-28 17:42:38 +0200 | [diff] [blame] | 481 | // Enum type RTCQualityLimitationReason |
| 482 | // TODO(https://crbug.com/webrtc/10686): Also expose |
| 483 | // qualityLimitationDurations. Requires RTCStatsMember support for |
| 484 | // "record<DOMString, double>", see https://crbug.com/webrtc/10685. |
| 485 | RTCStatsMember<std::string> quality_limitation_reason; |
Evan Shrubsole | cc62b16 | 2019-09-09 11:26:45 +0200 | [diff] [blame] | 486 | // https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationresolutionchanges |
| 487 | RTCStatsMember<uint32_t> quality_limitation_resolution_changes; |
Henrik Boström | 2e06926 | 2019-04-09 13:59:31 +0200 | [diff] [blame] | 488 | // https://henbos.github.io/webrtc-provisional-stats/#dom-rtcoutboundrtpstreamstats-contenttype |
| 489 | RTCStatsMember<std::string> content_type; |
Henrik Boström | 6b43086 | 2019-08-16 13:09:51 +0200 | [diff] [blame] | 490 | // TODO(hbos): This is only implemented for video; implement it for audio as |
| 491 | // well. |
| 492 | RTCStatsMember<std::string> encoder_implementation; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 493 | }; |
| 494 | |
Henrik Boström | 883eefc | 2019-05-27 13:40:25 +0200 | [diff] [blame] | 495 | // TODO(https://crbug.com/webrtc/10671): Refactor the stats dictionaries to have |
| 496 | // the same hierarchy as in the spec; implement RTCReceivedRtpStreamStats. |
| 497 | // Several metrics are shared between "outbound-rtp", "remote-inbound-rtp", |
| 498 | // "inbound-rtp" and "remote-outbound-rtp". In the spec there is a hierarchy of |
| 499 | // dictionaries that minimizes defining the same metrics in multiple places. |
| 500 | // From JavaScript this hierarchy is not observable and the spec's hierarchy is |
| 501 | // purely editorial. In C++ non-final classes in the hierarchy could be used to |
| 502 | // refer to different stats objects within the hierarchy. |
| 503 | // https://w3c.github.io/webrtc-stats/#remoteinboundrtpstats-dict* |
| 504 | class RTC_EXPORT RTCRemoteInboundRtpStreamStats final : public RTCStats { |
| 505 | public: |
| 506 | WEBRTC_RTCSTATS_DECL(); |
| 507 | |
| 508 | RTCRemoteInboundRtpStreamStats(const std::string& id, int64_t timestamp_us); |
| 509 | RTCRemoteInboundRtpStreamStats(std::string&& id, int64_t timestamp_us); |
| 510 | RTCRemoteInboundRtpStreamStats(const RTCRemoteInboundRtpStreamStats& other); |
| 511 | ~RTCRemoteInboundRtpStreamStats() override; |
| 512 | |
| 513 | // In the spec RTCRemoteInboundRtpStreamStats inherits from RTCRtpStreamStats |
| 514 | // and RTCReceivedRtpStreamStats. The members here are listed based on where |
| 515 | // they are defined in the spec. |
| 516 | // RTCRtpStreamStats |
| 517 | RTCStatsMember<uint32_t> ssrc; |
| 518 | RTCStatsMember<std::string> kind; |
| 519 | RTCStatsMember<std::string> transport_id; |
| 520 | RTCStatsMember<std::string> codec_id; |
| 521 | // RTCReceivedRtpStreamStats |
| 522 | RTCStatsMember<int32_t> packets_lost; |
| 523 | RTCStatsMember<double> jitter; |
| 524 | // TODO(hbos): The following RTCReceivedRtpStreamStats metrics should also be |
| 525 | // implemented: packetsReceived, packetsDiscarded, packetsRepaired, |
| 526 | // burstPacketsLost, burstPacketsDiscarded, burstLossCount, burstDiscardCount, |
| 527 | // burstLossRate, burstDiscardRate, gapLossRate and gapDiscardRate. |
| 528 | // RTCRemoteInboundRtpStreamStats |
| 529 | RTCStatsMember<std::string> local_id; |
| 530 | RTCStatsMember<double> round_trip_time; |
| 531 | // TODO(hbos): The following RTCRemoteInboundRtpStreamStats metric should also |
| 532 | // be implemented: fractionLost. |
| 533 | }; |
| 534 | |
Henrik Boström | 646fda0 | 2019-05-22 15:49:42 +0200 | [diff] [blame] | 535 | // https://w3c.github.io/webrtc-stats/#dom-rtcmediasourcestats |
| 536 | class RTC_EXPORT RTCMediaSourceStats : public RTCStats { |
| 537 | public: |
| 538 | WEBRTC_RTCSTATS_DECL(); |
| 539 | |
| 540 | RTCMediaSourceStats(const RTCMediaSourceStats& other); |
| 541 | ~RTCMediaSourceStats() override; |
| 542 | |
| 543 | RTCStatsMember<std::string> track_identifier; |
| 544 | RTCStatsMember<std::string> kind; |
| 545 | |
| 546 | protected: |
| 547 | RTCMediaSourceStats(const std::string& id, int64_t timestamp_us); |
| 548 | RTCMediaSourceStats(std::string&& id, int64_t timestamp_us); |
| 549 | }; |
| 550 | |
| 551 | // https://w3c.github.io/webrtc-stats/#dom-rtcaudiosourcestats |
| 552 | class RTC_EXPORT RTCAudioSourceStats final : public RTCMediaSourceStats { |
| 553 | public: |
| 554 | WEBRTC_RTCSTATS_DECL(); |
| 555 | |
| 556 | RTCAudioSourceStats(const std::string& id, int64_t timestamp_us); |
| 557 | RTCAudioSourceStats(std::string&& id, int64_t timestamp_us); |
| 558 | RTCAudioSourceStats(const RTCAudioSourceStats& other); |
| 559 | ~RTCAudioSourceStats() override; |
Henrik Boström | d2c336f | 2019-07-03 17:11:10 +0200 | [diff] [blame] | 560 | |
| 561 | RTCStatsMember<double> audio_level; |
| 562 | RTCStatsMember<double> total_audio_energy; |
| 563 | RTCStatsMember<double> total_samples_duration; |
Henrik Boström | 646fda0 | 2019-05-22 15:49:42 +0200 | [diff] [blame] | 564 | }; |
| 565 | |
| 566 | // https://w3c.github.io/webrtc-stats/#dom-rtcvideosourcestats |
| 567 | class RTC_EXPORT RTCVideoSourceStats final : public RTCMediaSourceStats { |
| 568 | public: |
| 569 | WEBRTC_RTCSTATS_DECL(); |
| 570 | |
| 571 | RTCVideoSourceStats(const std::string& id, int64_t timestamp_us); |
| 572 | RTCVideoSourceStats(std::string&& id, int64_t timestamp_us); |
| 573 | RTCVideoSourceStats(const RTCVideoSourceStats& other); |
| 574 | ~RTCVideoSourceStats() override; |
| 575 | |
| 576 | RTCStatsMember<uint32_t> width; |
| 577 | RTCStatsMember<uint32_t> height; |
| 578 | // TODO(hbos): Implement this metric. |
| 579 | RTCStatsMember<uint32_t> frames; |
| 580 | RTCStatsMember<uint32_t> frames_per_second; |
| 581 | }; |
| 582 | |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 583 | // https://w3c.github.io/webrtc-stats/#transportstats-dict* |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 584 | class RTC_EXPORT RTCTransportStats final : public RTCStats { |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 585 | public: |
| 586 | WEBRTC_RTCSTATS_DECL(); |
| 587 | |
| 588 | RTCTransportStats(const std::string& id, int64_t timestamp_us); |
| 589 | RTCTransportStats(std::string&& id, int64_t timestamp_us); |
| 590 | RTCTransportStats(const RTCTransportStats& other); |
| 591 | ~RTCTransportStats() override; |
| 592 | |
| 593 | RTCStatsMember<uint64_t> bytes_sent; |
| 594 | RTCStatsMember<uint64_t> bytes_received; |
| 595 | RTCStatsMember<std::string> rtcp_transport_stats_id; |
hbos | 7064d59 | 2017-01-16 07:38:02 -0800 | [diff] [blame] | 596 | // TODO(hbos): Support enum types? "RTCStatsMember<RTCDtlsTransportState>"? |
| 597 | RTCStatsMember<std::string> dtls_state; |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 598 | RTCStatsMember<std::string> selected_candidate_pair_id; |
| 599 | RTCStatsMember<std::string> local_certificate_id; |
| 600 | RTCStatsMember<std::string> remote_certificate_id; |
Jonas Oreland | 149dc72 | 2019-08-28 08:10:27 +0200 | [diff] [blame] | 601 | RTCStatsMember<uint32_t> selected_candidate_pair_changes; |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 602 | }; |
| 603 | |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 604 | } // namespace webrtc |
| 605 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 606 | #endif // API_STATS_RTCSTATS_OBJECTS_H_ |