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 | |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 11 | #ifndef WEBRTC_API_STATS_RTCSTATS_OBJECTS_H_ |
| 12 | #define WEBRTC_API_STATS_RTCSTATS_OBJECTS_H_ |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 13 | |
| 14 | #include <string> |
| 15 | |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 16 | #include "webrtc/api/stats/rtcstats.h" |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 17 | |
| 18 | namespace webrtc { |
| 19 | |
hbos | cc555c5 | 2016-10-18 12:48:31 -0700 | [diff] [blame] | 20 | // https://w3c.github.io/webrtc-pc/#idl-def-rtcdatachannelstate |
| 21 | struct RTCDataChannelState { |
| 22 | static const char* kConnecting; |
| 23 | static const char* kOpen; |
| 24 | static const char* kClosing; |
| 25 | static const char* kClosed; |
| 26 | }; |
| 27 | |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 28 | // https://w3c.github.io/webrtc-stats/#dom-rtcstatsicecandidatepairstate |
| 29 | struct RTCStatsIceCandidatePairState { |
| 30 | static const char* kFrozen; |
| 31 | static const char* kWaiting; |
| 32 | static const char* kInProgress; |
| 33 | static const char* kFailed; |
| 34 | static const char* kSucceeded; |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 35 | }; |
| 36 | |
hbos | cc555c5 | 2016-10-18 12:48:31 -0700 | [diff] [blame] | 37 | // https://w3c.github.io/webrtc-pc/#rtcicecandidatetype-enum |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 38 | struct RTCIceCandidateType { |
| 39 | static const char* kHost; |
| 40 | static const char* kSrflx; |
| 41 | static const char* kPrflx; |
| 42 | static const char* kRelay; |
| 43 | }; |
| 44 | |
hbos | 7064d59 | 2017-01-16 07:38:02 -0800 | [diff] [blame] | 45 | // https://w3c.github.io/webrtc-pc/#idl-def-rtcdtlstransportstate |
| 46 | struct RTCDtlsTransportState { |
| 47 | static const char* kNew; |
| 48 | static const char* kConnecting; |
| 49 | static const char* kConnected; |
| 50 | static const char* kClosed; |
| 51 | static const char* kFailed; |
| 52 | }; |
| 53 | |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame^] | 54 | // |RTCMediaStreamTrackStats::kind| is not an enum in the spec but the only |
| 55 | // valid values are "audio" and "video". |
| 56 | // https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats-kind |
| 57 | struct RTCMediaStreamTrackKind { |
| 58 | static const char* kAudio; |
| 59 | static const char* kVideo; |
| 60 | }; |
| 61 | |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 62 | // https://w3c.github.io/webrtc-stats/#certificatestats-dict* |
| 63 | class RTCCertificateStats final : public RTCStats { |
| 64 | public: |
| 65 | WEBRTC_RTCSTATS_DECL(); |
| 66 | |
| 67 | RTCCertificateStats(const std::string& id, int64_t timestamp_us); |
| 68 | RTCCertificateStats(std::string&& id, int64_t timestamp_us); |
| 69 | RTCCertificateStats(const RTCCertificateStats& other); |
| 70 | ~RTCCertificateStats() override; |
| 71 | |
| 72 | RTCStatsMember<std::string> fingerprint; |
| 73 | RTCStatsMember<std::string> fingerprint_algorithm; |
| 74 | RTCStatsMember<std::string> base64_certificate; |
| 75 | RTCStatsMember<std::string> issuer_certificate_id; |
| 76 | }; |
| 77 | |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 78 | // https://w3c.github.io/webrtc-stats/#codec-dict* |
| 79 | // Tracking bug crbug.com/659117 |
| 80 | // TODO(hbos): The present codec ID assignment is not sufficient to support |
| 81 | // Unified Plan or unbundled connections in all cases. crbug.com/659117 |
| 82 | class RTCCodecStats final : public RTCStats { |
| 83 | public: |
| 84 | WEBRTC_RTCSTATS_DECL(); |
| 85 | |
| 86 | RTCCodecStats(const std::string& id, int64_t timestamp_us); |
| 87 | RTCCodecStats(std::string&& id, int64_t timestamp_us); |
| 88 | RTCCodecStats(const RTCCodecStats& other); |
| 89 | ~RTCCodecStats() override; |
| 90 | |
| 91 | RTCStatsMember<uint32_t> payload_type; |
| 92 | RTCStatsMember<std::string> codec; |
| 93 | RTCStatsMember<uint32_t> clock_rate; |
| 94 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659117 |
| 95 | RTCStatsMember<uint32_t> channels; |
| 96 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659117 |
| 97 | RTCStatsMember<std::string> parameters; |
| 98 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659117 |
| 99 | RTCStatsMember<std::string> implementation; |
| 100 | }; |
| 101 | |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 102 | // https://w3c.github.io/webrtc-stats/#dcstats-dict* |
| 103 | class RTCDataChannelStats final : public RTCStats { |
| 104 | public: |
| 105 | WEBRTC_RTCSTATS_DECL(); |
| 106 | |
| 107 | RTCDataChannelStats(const std::string& id, int64_t timestamp_us); |
| 108 | RTCDataChannelStats(std::string&& id, int64_t timestamp_us); |
| 109 | RTCDataChannelStats(const RTCDataChannelStats& other); |
| 110 | ~RTCDataChannelStats() override; |
| 111 | |
| 112 | RTCStatsMember<std::string> label; |
| 113 | RTCStatsMember<std::string> protocol; |
| 114 | RTCStatsMember<int32_t> datachannelid; |
| 115 | // TODO(hbos): Support enum types? "RTCStatsMember<RTCDataChannelState>"? |
| 116 | RTCStatsMember<std::string> state; |
| 117 | RTCStatsMember<uint32_t> messages_sent; |
| 118 | RTCStatsMember<uint64_t> bytes_sent; |
| 119 | RTCStatsMember<uint32_t> messages_received; |
| 120 | RTCStatsMember<uint64_t> bytes_received; |
| 121 | }; |
| 122 | |
| 123 | // https://w3c.github.io/webrtc-stats/#candidatepair-dict* |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 124 | // TODO(hbos): Tracking bug crbug.com/633550 |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 125 | class RTCIceCandidatePairStats final : public RTCStats { |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 126 | public: |
| 127 | WEBRTC_RTCSTATS_DECL(); |
| 128 | |
| 129 | RTCIceCandidatePairStats(const std::string& id, int64_t timestamp_us); |
| 130 | RTCIceCandidatePairStats(std::string&& id, int64_t timestamp_us); |
| 131 | RTCIceCandidatePairStats(const RTCIceCandidatePairStats& other); |
| 132 | ~RTCIceCandidatePairStats() override; |
| 133 | |
| 134 | RTCStatsMember<std::string> transport_id; |
| 135 | RTCStatsMember<std::string> local_candidate_id; |
| 136 | RTCStatsMember<std::string> remote_candidate_id; |
| 137 | // TODO(hbos): Support enum types? |
| 138 | // "RTCStatsMember<RTCStatsIceCandidatePairState>"? |
| 139 | RTCStatsMember<std::string> state; |
| 140 | RTCStatsMember<uint64_t> priority; |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 141 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/633550 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 142 | RTCStatsMember<bool> nominated; |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 143 | // TODO(hbos): Collected by |RTCStatsCollector| but different than the spec. |
| 144 | // crbug.com/633550 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 145 | RTCStatsMember<bool> writable; |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 146 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/633550 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 147 | RTCStatsMember<bool> readable; |
| 148 | RTCStatsMember<uint64_t> bytes_sent; |
| 149 | RTCStatsMember<uint64_t> bytes_received; |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 150 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/633550 |
hbos | 3168c7a | 2016-12-15 06:17:08 -0800 | [diff] [blame] | 151 | RTCStatsMember<double> total_round_trip_time; |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 152 | // TODO(hbos): Collected by |RTCStatsCollector| but different than the spec. |
| 153 | // crbug.com/633550 |
hbos | 3168c7a | 2016-12-15 06:17:08 -0800 | [diff] [blame] | 154 | RTCStatsMember<double> current_round_trip_time; |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 155 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/633550 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 156 | RTCStatsMember<double> available_outgoing_bitrate; |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 157 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/633550 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 158 | RTCStatsMember<double> available_incoming_bitrate; |
| 159 | RTCStatsMember<uint64_t> requests_received; |
| 160 | RTCStatsMember<uint64_t> requests_sent; |
| 161 | RTCStatsMember<uint64_t> responses_received; |
| 162 | RTCStatsMember<uint64_t> responses_sent; |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 163 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/633550 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 164 | RTCStatsMember<uint64_t> retransmissions_received; |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 165 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/633550 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 166 | RTCStatsMember<uint64_t> retransmissions_sent; |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 167 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/633550 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 168 | RTCStatsMember<uint64_t> consent_requests_received; |
| 169 | RTCStatsMember<uint64_t> consent_requests_sent; |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 170 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/633550 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 171 | RTCStatsMember<uint64_t> consent_responses_received; |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 172 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/633550 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 173 | RTCStatsMember<uint64_t> consent_responses_sent; |
| 174 | }; |
| 175 | |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 176 | // https://w3c.github.io/webrtc-stats/#icecandidate-dict* |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 177 | // TODO(hbos): |RTCStatsCollector| only collects candidates that are part of |
| 178 | // ice candidate pairs, but there could be candidates not paired with anything. |
| 179 | // crbug.com/632723 |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 180 | class RTCIceCandidateStats : public RTCStats { |
| 181 | public: |
| 182 | WEBRTC_RTCSTATS_DECL(); |
| 183 | |
| 184 | RTCIceCandidateStats(const RTCIceCandidateStats& other); |
| 185 | ~RTCIceCandidateStats() override; |
| 186 | |
hbos | b4e426e | 2017-01-02 09:59:31 -0800 | [diff] [blame] | 187 | RTCStatsMember<std::string> transport_id; |
hbos | c3a2b7f | 2017-01-02 04:46:15 -0800 | [diff] [blame] | 188 | RTCStatsMember<bool> is_remote; |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 189 | RTCStatsMember<std::string> ip; |
| 190 | RTCStatsMember<int32_t> port; |
| 191 | RTCStatsMember<std::string> protocol; |
| 192 | // TODO(hbos): Support enum types? "RTCStatsMember<RTCIceCandidateType>"? |
| 193 | RTCStatsMember<std::string> candidate_type; |
| 194 | RTCStatsMember<int32_t> priority; |
hbos | 5d79a7c | 2016-10-24 09:27:10 -0700 | [diff] [blame] | 195 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/632723 |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 196 | RTCStatsMember<std::string> url; |
hbos | d17a5a7 | 2017-01-02 08:09:59 -0800 | [diff] [blame] | 197 | // TODO(hbos): |deleted = true| case is not supported by |RTCStatsCollector|. |
| 198 | // crbug.com/632723 |
| 199 | RTCStatsMember<bool> deleted; // = false |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 200 | |
| 201 | protected: |
hbos | c3a2b7f | 2017-01-02 04:46:15 -0800 | [diff] [blame] | 202 | RTCIceCandidateStats( |
| 203 | const std::string& id, int64_t timestamp_us, bool is_remote); |
| 204 | RTCIceCandidateStats(std::string&& id, int64_t timestamp_us, bool is_remote); |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 205 | }; |
| 206 | |
| 207 | // In the spec both local and remote varieties are of type RTCIceCandidateStats. |
| 208 | // But here we define them as subclasses of |RTCIceCandidateStats| because the |
| 209 | // |kType| need to be different ("RTCStatsType type") in the local/remote case. |
| 210 | // https://w3c.github.io/webrtc-stats/#rtcstatstype-str* |
| 211 | class RTCLocalIceCandidateStats final : public RTCIceCandidateStats { |
| 212 | public: |
| 213 | static const char kType[]; |
| 214 | RTCLocalIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 215 | RTCLocalIceCandidateStats(std::string&& id, int64_t timestamp_us); |
| 216 | const char* type() const override; |
| 217 | }; |
| 218 | |
| 219 | class RTCRemoteIceCandidateStats final : public RTCIceCandidateStats { |
| 220 | public: |
| 221 | static const char kType[]; |
| 222 | RTCRemoteIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 223 | RTCRemoteIceCandidateStats(std::string&& id, int64_t timestamp_us); |
| 224 | const char* type() const override; |
| 225 | }; |
| 226 | |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 227 | // https://w3c.github.io/webrtc-stats/#msstats-dict* |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 228 | // TODO(hbos): Tracking bug crbug.com/660827 |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 229 | class RTCMediaStreamStats final : public RTCStats { |
| 230 | public: |
| 231 | WEBRTC_RTCSTATS_DECL(); |
| 232 | |
| 233 | RTCMediaStreamStats(const std::string& id, int64_t timestamp_us); |
| 234 | RTCMediaStreamStats(std::string&& id, int64_t timestamp_us); |
| 235 | RTCMediaStreamStats(const RTCMediaStreamStats& other); |
| 236 | ~RTCMediaStreamStats() override; |
| 237 | |
| 238 | RTCStatsMember<std::string> stream_identifier; |
| 239 | RTCStatsMember<std::vector<std::string>> track_ids; |
| 240 | }; |
| 241 | |
| 242 | // https://w3c.github.io/webrtc-stats/#mststats-dict* |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 243 | // TODO(hbos): Tracking bug crbug.com/659137 |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 244 | class RTCMediaStreamTrackStats final : public RTCStats { |
| 245 | public: |
| 246 | WEBRTC_RTCSTATS_DECL(); |
| 247 | |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame^] | 248 | RTCMediaStreamTrackStats(const std::string& id, int64_t timestamp_us, |
| 249 | const char* kind); |
| 250 | RTCMediaStreamTrackStats(std::string&& id, int64_t timestamp_us, |
| 251 | const char* kind); |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 252 | RTCMediaStreamTrackStats(const RTCMediaStreamTrackStats& other); |
| 253 | ~RTCMediaStreamTrackStats() override; |
| 254 | |
| 255 | RTCStatsMember<std::string> track_identifier; |
| 256 | RTCStatsMember<bool> remote_source; |
| 257 | RTCStatsMember<bool> ended; |
| 258 | // TODO(hbos): |RTCStatsCollector| does not return stats for detached tracks. |
| 259 | // crbug.com/659137 |
| 260 | RTCStatsMember<bool> detached; |
hbos | 160e4a7 | 2017-01-17 02:53:23 -0800 | [diff] [blame^] | 261 | // See |RTCMediaStreamTrackKind| for valid values. |
| 262 | RTCStatsMember<std::string> kind; |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 263 | // Video-only members |
| 264 | RTCStatsMember<uint32_t> frame_width; |
| 265 | RTCStatsMember<uint32_t> frame_height; |
| 266 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 267 | RTCStatsMember<double> frames_per_second; |
| 268 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 269 | RTCStatsMember<uint32_t> frames_sent; |
| 270 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 271 | RTCStatsMember<uint32_t> frames_received; |
| 272 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 273 | RTCStatsMember<uint32_t> frames_decoded; |
| 274 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 275 | RTCStatsMember<uint32_t> frames_dropped; |
| 276 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 277 | RTCStatsMember<uint32_t> frames_corrupted; |
| 278 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 279 | RTCStatsMember<uint32_t> partial_frames_lost; |
| 280 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 281 | RTCStatsMember<uint32_t> full_frames_lost; |
| 282 | // Audio-only members |
| 283 | RTCStatsMember<double> audio_level; |
| 284 | RTCStatsMember<double> echo_return_loss; |
| 285 | RTCStatsMember<double> echo_return_loss_enhancement; |
| 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 | |
| 311 | RTCStatsMember<std::string> ssrc; |
| 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 | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 319 | RTCStatsMember<std::string> media_track_id; |
| 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 | // TODO(hbos): Only collected for the outbound case, should also be collected |
| 332 | // for inbound case by |RTCStatsCollector|. crbug.com/657854, crbug.com/657855 |
| 333 | RTCStatsMember<uint64_t> qp_sum; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 334 | |
| 335 | protected: |
| 336 | RTCRTPStreamStats(const std::string& id, int64_t timestamp_us); |
| 337 | RTCRTPStreamStats(std::string&& id, int64_t timestamp_us); |
| 338 | }; |
| 339 | |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 340 | // https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict* |
hbos | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 341 | // Tracking bug crbug.com/657855 |
| 342 | // TODO(hbos): Support the remote case |is_remote = true|. crbug.com/657855 |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 343 | class RTCInboundRTPStreamStats final : public RTCRTPStreamStats { |
| 344 | public: |
| 345 | WEBRTC_RTCSTATS_DECL(); |
| 346 | |
| 347 | RTCInboundRTPStreamStats(const std::string& id, int64_t timestamp_us); |
| 348 | RTCInboundRTPStreamStats(std::string&& id, int64_t timestamp_us); |
| 349 | RTCInboundRTPStreamStats(const RTCInboundRTPStreamStats& other); |
| 350 | ~RTCInboundRTPStreamStats() override; |
| 351 | |
| 352 | RTCStatsMember<uint32_t> packets_received; |
| 353 | RTCStatsMember<uint64_t> bytes_received; |
hbos | eeafe94 | 2016-11-01 03:00:17 -0700 | [diff] [blame] | 354 | RTCStatsMember<uint32_t> packets_lost; |
| 355 | // TODO(hbos): Not collected in the "video" case by |RTCStatsCollector|. |
| 356 | // crbug.com/657855 |
| 357 | RTCStatsMember<double> jitter; |
| 358 | RTCStatsMember<double> fraction_lost; |
| 359 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657855 |
| 360 | RTCStatsMember<uint32_t> packets_discarded; |
| 361 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657855 |
| 362 | RTCStatsMember<uint32_t> packets_repaired; |
| 363 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657855 |
| 364 | RTCStatsMember<uint32_t> burst_packets_lost; |
| 365 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657855 |
| 366 | RTCStatsMember<uint32_t> burst_packets_discarded; |
| 367 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657855 |
| 368 | RTCStatsMember<uint32_t> burst_loss_count; |
| 369 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657855 |
| 370 | RTCStatsMember<uint32_t> burst_discard_count; |
| 371 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657855 |
| 372 | RTCStatsMember<double> burst_loss_rate; |
| 373 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657855 |
| 374 | RTCStatsMember<double> burst_discard_rate; |
| 375 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657855 |
| 376 | RTCStatsMember<double> gap_loss_rate; |
| 377 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657855 |
| 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 | 0adb828 | 2016-11-23 02:32:06 -0800 | [diff] [blame] | 383 | // Tracking bug crbug.com/657856 |
| 384 | // TODO(hbos): Support the remote case |is_remote = true|. crbug.com/657856 |
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; |
| 396 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657856 |
| 397 | RTCStatsMember<double> target_bitrate; |
| 398 | RTCStatsMember<double> round_trip_time; |
hbos | 6769c49 | 2017-01-02 08:35:13 -0800 | [diff] [blame] | 399 | RTCStatsMember<uint32_t> frames_encoded; |
hbos | 6ded190 | 2016-11-01 01:50:46 -0700 | [diff] [blame] | 400 | }; |
| 401 | |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 402 | // https://w3c.github.io/webrtc-stats/#transportstats-dict* |
| 403 | class RTCTransportStats final : public RTCStats { |
| 404 | public: |
| 405 | WEBRTC_RTCSTATS_DECL(); |
| 406 | |
| 407 | RTCTransportStats(const std::string& id, int64_t timestamp_us); |
| 408 | RTCTransportStats(std::string&& id, int64_t timestamp_us); |
| 409 | RTCTransportStats(const RTCTransportStats& other); |
| 410 | ~RTCTransportStats() override; |
| 411 | |
| 412 | RTCStatsMember<uint64_t> bytes_sent; |
| 413 | RTCStatsMember<uint64_t> bytes_received; |
| 414 | RTCStatsMember<std::string> rtcp_transport_stats_id; |
hbos | 7064d59 | 2017-01-16 07:38:02 -0800 | [diff] [blame] | 415 | // TODO(hbos): Support enum types? "RTCStatsMember<RTCDtlsTransportState>"? |
| 416 | RTCStatsMember<std::string> dtls_state; |
hbos | 2fa7c67 | 2016-10-24 04:00:05 -0700 | [diff] [blame] | 417 | RTCStatsMember<std::string> selected_candidate_pair_id; |
| 418 | RTCStatsMember<std::string> local_certificate_id; |
| 419 | RTCStatsMember<std::string> remote_certificate_id; |
| 420 | }; |
| 421 | |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 422 | } // namespace webrtc |
| 423 | |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 424 | #endif // WEBRTC_API_STATS_RTCSTATS_OBJECTS_H_ |