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