| 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 |
| 11 | #ifndef API_STATS_RTCSTATS_OBJECTS_H_ |
| 12 | #define API_STATS_RTCSTATS_OBJECTS_H_ |
| 13 |
| 14 | #include <stdint.h> |
| 15 |
| 16 | #include <map> |
| 17 | #include <memory> |
| 18 | #include <string> |
| 19 | #include <vector> |
| 20 |
| 21 | #include "api/stats/rtc_stats.h" |
| 22 | #include "rtc_base/system/rtc_export.h" |
| 23 |
| 24 | namespace webrtc { |
| 25 |
| 26 | // https://w3c.github.io/webrtc-pc/#idl-def-rtcdatachannelstate |
| 27 | struct RTCDataChannelState { |
| 28 | static const char* const kConnecting; |
| 29 | static const char* const kOpen; |
| 30 | static const char* const kClosing; |
| 31 | static const char* const kClosed; |
| 32 | }; |
| 33 |
| 34 | // https://w3c.github.io/webrtc-stats/#dom-rtcstatsicecandidatepairstate |
| 35 | struct RTCStatsIceCandidatePairState { |
| 36 | static const char* const kFrozen; |
| 37 | static const char* const kWaiting; |
| 38 | static const char* const kInProgress; |
| 39 | static const char* const kFailed; |
| 40 | static const char* const kSucceeded; |
| 41 | }; |
| 42 |
| 43 | // https://w3c.github.io/webrtc-pc/#rtcicecandidatetype-enum |
| 44 | struct RTCIceCandidateType { |
| 45 | static const char* const kHost; |
| 46 | static const char* const kSrflx; |
| 47 | static const char* const kPrflx; |
| 48 | static const char* const kRelay; |
| 49 | }; |
| 50 |
| 51 | // https://w3c.github.io/webrtc-pc/#idl-def-rtcdtlstransportstate |
| 52 | struct RTCDtlsTransportState { |
| 53 | static const char* const kNew; |
| 54 | static const char* const kConnecting; |
| 55 | static const char* const kConnected; |
| 56 | static const char* const kClosed; |
| 57 | static const char* const kFailed; |
| 58 | }; |
| 59 |
| 60 | // `RTCMediaStreamTrackStats::kind` is not an enum in the spec but the only |
| 61 | // valid values are "audio" and "video". |
| 62 | // https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats-kind |
| 63 | struct RTCMediaStreamTrackKind { |
| 64 | static const char* const kAudio; |
| 65 | static const char* const kVideo; |
| 66 | }; |
| 67 |
| 68 | // https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype |
| 69 | struct RTCNetworkType { |
| 70 | static const char* const kBluetooth; |
| 71 | static const char* const kCellular; |
| 72 | static const char* const kEthernet; |
| 73 | static const char* const kWifi; |
| 74 | static const char* const kWimax; |
| 75 | static const char* const kVpn; |
| 76 | static const char* const kUnknown; |
| 77 | }; |
| 78 |
| 79 | // https://w3c.github.io/webrtc-stats/#dom-rtcqualitylimitationreason |
| 80 | struct RTCQualityLimitationReason { |
| 81 | static const char* const kNone; |
| 82 | static const char* const kCpu; |
| 83 | static const char* const kBandwidth; |
| 84 | static const char* const kOther; |
| 85 | }; |
| 86 |
| 87 | // https://webrtc.org/experiments/rtp-hdrext/video-content-type/ |
| 88 | struct RTCContentType { |
| 89 | static const char* const kUnspecified; |
| 90 | static const char* const kScreenshare; |
| 91 | }; |
| 92 |
| 93 | // https://w3c.github.io/webrtc-stats/#dom-rtcdtlsrole |
| 94 | struct RTCDtlsRole { |
| 95 | static const char* const kUnknown; |
| 96 | static const char* const kClient; |
| 97 | static const char* const kServer; |
| 98 | }; |
| 99 |
| 100 | // https://www.w3.org/TR/webrtc/#rtcicerole |
| 101 | struct RTCIceRole { |
| 102 | static const char* const kUnknown; |
| 103 | static const char* const kControlled; |
| 104 | static const char* const kControlling; |
| 105 | }; |
| 106 |
| 107 | // https://www.w3.org/TR/webrtc/#dom-rtcicetransportstate |
| 108 | struct RTCIceTransportState { |
| 109 | static const char* const kNew; |
| 110 | static const char* const kChecking; |
| 111 | static const char* const kConnected; |
| 112 | static const char* const kCompleted; |
| 113 | static const char* const kDisconnected; |
| 114 | static const char* const kFailed; |
| 115 | static const char* const kClosed; |
| 116 | }; |
| 117 |
| 118 | // https://w3c.github.io/webrtc-stats/#certificatestats-dict* |
| 119 | class RTC_EXPORT RTCCertificateStats final : public RTCStats { |
| 120 | public: |
| 121 | WEBRTC_RTCSTATS_DECL(); |
| 122 |
| 123 | RTCCertificateStats(const std::string& id, int64_t timestamp_us); |
| 124 | RTCCertificateStats(std::string&& id, int64_t timestamp_us); |
| 125 | RTCCertificateStats(const RTCCertificateStats& other); |
| 126 | ~RTCCertificateStats() override; |
| 127 |
| 128 | RTCStatsMember<std::string> fingerprint; |
| 129 | RTCStatsMember<std::string> fingerprint_algorithm; |
| 130 | RTCStatsMember<std::string> base64_certificate; |
| 131 | RTCStatsMember<std::string> issuer_certificate_id; |
| 132 | }; |
| 133 |
| 134 | // Non standard extension mapping to rtc::AdapterType |
| 135 | struct RTCNetworkAdapterType { |
| 136 | static constexpr char kUnknown[] = "unknown"; |
| 137 | static constexpr char kEthernet[] = "ethernet"; |
| 138 | static constexpr char kWifi[] = "wifi"; |
| 139 | static constexpr char kCellular[] = "cellular"; |
| 140 | static constexpr char kLoopback[] = "loopback"; |
| 141 | static constexpr char kAny[] = "any"; |
| 142 | static constexpr char kCellular2g[] = "cellular2g"; |
| 143 | static constexpr char kCellular3g[] = "cellular3g"; |
| 144 | static constexpr char kCellular4g[] = "cellular4g"; |
| 145 | static constexpr char kCellular5g[] = "cellular5g"; |
| 146 | }; |
| 147 |
| 148 | // https://w3c.github.io/webrtc-stats/#codec-dict* |
| 149 | class RTC_EXPORT RTCCodecStats final : public RTCStats { |
| 150 | public: |
| 151 | WEBRTC_RTCSTATS_DECL(); |
| 152 |
| 153 | RTCCodecStats(const std::string& id, int64_t timestamp_us); |
| 154 | RTCCodecStats(std::string&& id, int64_t timestamp_us); |
| 155 | RTCCodecStats(const RTCCodecStats& other); |
| 156 | ~RTCCodecStats() override; |
| 157 |
| 158 | RTCStatsMember<std::string> transport_id; |
| 159 | RTCStatsMember<uint32_t> payload_type; |
| 160 | RTCStatsMember<std::string> mime_type; |
| 161 | RTCStatsMember<uint32_t> clock_rate; |
| 162 | RTCStatsMember<uint32_t> channels; |
| 163 | RTCStatsMember<std::string> sdp_fmtp_line; |
| 164 | }; |
| 165 |
| 166 | // https://w3c.github.io/webrtc-stats/#dcstats-dict* |
| 167 | class RTC_EXPORT RTCDataChannelStats final : public RTCStats { |
| 168 | public: |
| 169 | WEBRTC_RTCSTATS_DECL(); |
| 170 |
| 171 | RTCDataChannelStats(const std::string& id, int64_t timestamp_us); |
| 172 | RTCDataChannelStats(std::string&& id, int64_t timestamp_us); |
| 173 | RTCDataChannelStats(const RTCDataChannelStats& other); |
| 174 | ~RTCDataChannelStats() override; |
| 175 |
| 176 | RTCStatsMember<std::string> label; |
| 177 | RTCStatsMember<std::string> protocol; |
| 178 | RTCStatsMember<int32_t> data_channel_identifier; |
| 179 | // Enum type RTCDataChannelState. |
| 180 | RTCStatsMember<std::string> state; |
| 181 | RTCStatsMember<uint32_t> messages_sent; |
| 182 | RTCStatsMember<uint64_t> bytes_sent; |
| 183 | RTCStatsMember<uint32_t> messages_received; |
| 184 | RTCStatsMember<uint64_t> bytes_received; |
| 185 | }; |
| 186 |
| 187 | // https://w3c.github.io/webrtc-stats/#candidatepair-dict* |
| 188 | class RTC_EXPORT RTCIceCandidatePairStats final : public RTCStats { |
| 189 | public: |
| 190 | WEBRTC_RTCSTATS_DECL(); |
| 191 |
| 192 | RTCIceCandidatePairStats(const std::string& id, int64_t timestamp_us); |
| 193 | RTCIceCandidatePairStats(std::string&& id, int64_t timestamp_us); |
| 194 | RTCIceCandidatePairStats(const RTCIceCandidatePairStats& other); |
| 195 | ~RTCIceCandidatePairStats() override; |
| 196 |
| 197 | RTCStatsMember<std::string> transport_id; |
| 198 | RTCStatsMember<std::string> local_candidate_id; |
| 199 | RTCStatsMember<std::string> remote_candidate_id; |
| 200 | // Enum type RTCStatsIceCandidatePairState. |
| 201 | RTCStatsMember<std::string> state; |
| 202 | // Obsolete: priority |
| 203 | RTCStatsMember<uint64_t> priority; |
| 204 | RTCStatsMember<bool> nominated; |
| 205 | // `writable` does not exist in the spec and old comments suggest it used to |
| 206 | // exist but was incorrectly implemented. |
| 207 | // TODO(https://crbug.com/webrtc/14171): Standardize and/or modify |
| 208 | // implementation. |
| 209 | RTCStatsMember<bool> writable; |
| 210 | RTCStatsMember<uint64_t> packets_sent; |
| 211 | RTCStatsMember<uint64_t> packets_received; |
| 212 | RTCStatsMember<uint64_t> bytes_sent; |
| 213 | RTCStatsMember<uint64_t> bytes_received; |
| 214 | RTCStatsMember<double> total_round_trip_time; |
| 215 | RTCStatsMember<double> current_round_trip_time; |
| 216 | RTCStatsMember<double> available_outgoing_bitrate; |
| 217 | RTCStatsMember<double> available_incoming_bitrate; |
| 218 | RTCStatsMember<uint64_t> requests_received; |
| 219 | RTCStatsMember<uint64_t> requests_sent; |
| 220 | RTCStatsMember<uint64_t> responses_received; |
| 221 | RTCStatsMember<uint64_t> responses_sent; |
| 222 | RTCStatsMember<uint64_t> consent_requests_sent; |
| 223 | RTCStatsMember<uint64_t> packets_discarded_on_send; |
| 224 | RTCStatsMember<uint64_t> bytes_discarded_on_send; |
| 225 | }; |
| 226 |
| 227 | // https://w3c.github.io/webrtc-stats/#icecandidate-dict* |
| 228 | class RTC_EXPORT RTCIceCandidateStats : public RTCStats { |
| 229 | public: |
| 230 | WEBRTC_RTCSTATS_DECL(); |
| 231 |
| 232 | RTCIceCandidateStats(const RTCIceCandidateStats& other); |
| 233 | ~RTCIceCandidateStats() override; |
| 234 |
| 235 | RTCStatsMember<std::string> transport_id; |
| 236 | // Obsolete: is_remote |
| 237 | RTCStatsMember<bool> is_remote; |
| 238 | RTCStatsMember<std::string> network_type; |
| 239 | RTCStatsMember<std::string> ip; |
| 240 | RTCStatsMember<std::string> address; |
| 241 | RTCStatsMember<int32_t> port; |
| 242 | RTCStatsMember<std::string> protocol; |
| 243 | RTCStatsMember<std::string> relay_protocol; |
| 244 | // Enum type RTCIceCandidateType. |
| 245 | RTCStatsMember<std::string> candidate_type; |
| 246 | RTCStatsMember<int32_t> priority; |
| 247 | RTCStatsMember<std::string> url; |
| 248 | RTCStatsMember<std::string> foundation; |
| 249 | RTCStatsMember<std::string> related_address; |
| 250 | RTCStatsMember<int32_t> related_port; |
| 251 | RTCStatsMember<std::string> username_fragment; |
| 252 | // Enum type RTCIceTcpCandidateType. |
| 253 | RTCStatsMember<std::string> tcp_type; |
| 254 |
| 255 | RTCNonStandardStatsMember<bool> vpn; |
| 256 | RTCNonStandardStatsMember<std::string> network_adapter_type; |
| 257 |
| 258 | protected: |
| 259 | RTCIceCandidateStats(const std::string& id, |
| 260 | int64_t timestamp_us, |
| 261 | bool is_remote); |
| 262 | RTCIceCandidateStats(std::string&& id, int64_t timestamp_us, bool is_remote); |
| 263 | }; |
| 264 |
| 265 | // In the spec both local and remote varieties are of type RTCIceCandidateStats. |
| 266 | // But here we define them as subclasses of `RTCIceCandidateStats` because the |
| 267 | // `kType` need to be different ("RTCStatsType type") in the local/remote case. |
| 268 | // https://w3c.github.io/webrtc-stats/#rtcstatstype-str* |
| 269 | // This forces us to have to override copy() and type(). |
| 270 | class RTC_EXPORT RTCLocalIceCandidateStats final : public RTCIceCandidateStats { |
| 271 | public: |
| 272 | static const char kType[]; |
| 273 | RTCLocalIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 274 | RTCLocalIceCandidateStats(std::string&& id, int64_t timestamp_us); |
| 275 | std::unique_ptr<RTCStats> copy() const override; |
| 276 | const char* type() const override; |
| 277 | }; |
| 278 |
| 279 | class RTC_EXPORT RTCRemoteIceCandidateStats final |
| 280 | : public RTCIceCandidateStats { |
| 281 | public: |
| 282 | static const char kType[]; |
| 283 | RTCRemoteIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 284 | RTCRemoteIceCandidateStats(std::string&& id, int64_t timestamp_us); |
| 285 | std::unique_ptr<RTCStats> copy() const override; |
| 286 | const char* type() const override; |
| 287 | }; |
| 288 |
| 289 | // TODO(https://crbug.com/webrtc/14419): Delete this class, it's deprecated. |
| 290 | class RTC_EXPORT DEPRECATED_RTCMediaStreamStats final : public RTCStats { |
| 291 | public: |
| 292 | WEBRTC_RTCSTATS_DECL(); |
| 293 |
| 294 | DEPRECATED_RTCMediaStreamStats(const std::string& id, int64_t timestamp_us); |
| 295 | DEPRECATED_RTCMediaStreamStats(std::string&& id, int64_t timestamp_us); |
| 296 | DEPRECATED_RTCMediaStreamStats(const DEPRECATED_RTCMediaStreamStats& other); |
| 297 | ~DEPRECATED_RTCMediaStreamStats() override; |
| 298 |
| 299 | RTCStatsMember<std::string> stream_identifier; |
| 300 | RTCStatsMember<std::vector<std::string>> track_ids; |
| 301 | }; |
| 302 | using RTCMediaStreamStats [[deprecated("bugs.webrtc.org/14419")]] = |
| 303 | DEPRECATED_RTCMediaStreamStats; |
| 304 |
| 305 | // TODO(https://crbug.com/webrtc/14175): Delete this class, it's deprecated. |
| 306 | class RTC_EXPORT DEPRECATED_RTCMediaStreamTrackStats final : public RTCStats { |
| 307 | public: |
| 308 | WEBRTC_RTCSTATS_DECL(); |
| 309 |
| 310 | DEPRECATED_RTCMediaStreamTrackStats(const std::string& id, |
| 311 | int64_t timestamp_us, |
| 312 | const char* kind); |
| 313 | DEPRECATED_RTCMediaStreamTrackStats(std::string&& id, |
| 314 | int64_t timestamp_us, |
| 315 | const char* kind); |
| 316 | DEPRECATED_RTCMediaStreamTrackStats( |
| 317 | const DEPRECATED_RTCMediaStreamTrackStats& other); |
| 318 | ~DEPRECATED_RTCMediaStreamTrackStats() override; |
| 319 |
| 320 | RTCStatsMember<std::string> track_identifier; |
| 321 | RTCStatsMember<std::string> media_source_id; |
| 322 | RTCStatsMember<bool> remote_source; |
| 323 | RTCStatsMember<bool> ended; |
| 324 | // TODO(https://crbug.com/webrtc/14173): Remove this obsolete metric. |
| 325 | RTCStatsMember<bool> detached; |
| 326 | // Enum type RTCMediaStreamTrackKind. |
| 327 | RTCStatsMember<std::string> kind; |
| 328 | RTCStatsMember<double> jitter_buffer_delay; |
| 329 | RTCStatsMember<uint64_t> jitter_buffer_emitted_count; |
| 330 | // Video-only members |
| 331 | RTCStatsMember<uint32_t> frame_width; |
| 332 | RTCStatsMember<uint32_t> frame_height; |
| 333 | RTCStatsMember<uint32_t> frames_sent; |
| 334 | RTCStatsMember<uint32_t> huge_frames_sent; |
| 335 | RTCStatsMember<uint32_t> frames_received; |
| 336 | RTCStatsMember<uint32_t> frames_decoded; |
| 337 | RTCStatsMember<uint32_t> frames_dropped; |
| 338 | // Audio-only members |
| 339 | RTCStatsMember<double> audio_level; // Receive-only |
| 340 | RTCStatsMember<double> total_audio_energy; // Receive-only |
| 341 | RTCStatsMember<double> echo_return_loss; |
| 342 | RTCStatsMember<double> echo_return_loss_enhancement; |
| 343 | RTCStatsMember<uint64_t> total_samples_received; |
| 344 | RTCStatsMember<double> total_samples_duration; // Receive-only |
| 345 | RTCStatsMember<uint64_t> concealed_samples; |
| 346 | RTCStatsMember<uint64_t> silent_concealed_samples; |
| 347 | RTCStatsMember<uint64_t> concealment_events; |
| 348 | RTCStatsMember<uint64_t> inserted_samples_for_deceleration; |
| 349 | RTCStatsMember<uint64_t> removed_samples_for_acceleration; |
| 350 | // TODO(crbug.com/webrtc/14524): These metrics have been moved, delete them. |
| 351 | RTCNonStandardStatsMember<uint64_t> jitter_buffer_flushes; |
| 352 | RTCNonStandardStatsMember<uint64_t> delayed_packet_outage_samples; |
| 353 | RTCNonStandardStatsMember<double> relative_packet_arrival_delay; |
| 354 | RTCNonStandardStatsMember<uint32_t> interruption_count; |
| 355 | RTCNonStandardStatsMember<double> total_interruption_duration; |
| 356 | // Non-standard video-only members. |
| 357 | // https://w3c.github.io/webrtc-provisional-stats/#dom-rtcvideoreceiverstats |
| 358 | RTCNonStandardStatsMember<double> total_frames_duration; |
| 359 | RTCNonStandardStatsMember<double> sum_squared_frame_durations; |
| 360 | // TODO(crbug.com/webrtc/14521): These metrics have been moved, delete them. |
| 361 | RTCNonStandardStatsMember<uint32_t> freeze_count; |
| 362 | RTCNonStandardStatsMember<uint32_t> pause_count; |
| 363 | RTCNonStandardStatsMember<double> total_freezes_duration; |
| 364 | RTCNonStandardStatsMember<double> total_pauses_duration; |
| 365 | }; |
| 366 | using RTCMediaStreamTrackStats [[deprecated("bugs.webrtc.org/14175")]] = |
| 367 | DEPRECATED_RTCMediaStreamTrackStats; |
| 368 |
| 369 | // https://w3c.github.io/webrtc-stats/#pcstats-dict* |
| 370 | class RTC_EXPORT RTCPeerConnectionStats final : public RTCStats { |
| 371 | public: |
| 372 | WEBRTC_RTCSTATS_DECL(); |
| 373 |
| 374 | RTCPeerConnectionStats(const std::string& id, int64_t timestamp_us); |
| 375 | RTCPeerConnectionStats(std::string&& id, int64_t timestamp_us); |
| 376 | RTCPeerConnectionStats(const RTCPeerConnectionStats& other); |
| 377 | ~RTCPeerConnectionStats() override; |
| 378 |
| 379 | RTCStatsMember<uint32_t> data_channels_opened; |
| 380 | RTCStatsMember<uint32_t> data_channels_closed; |
| 381 | }; |
| 382 |
| 383 | // https://w3c.github.io/webrtc-stats/#streamstats-dict* |
| 384 | class RTC_EXPORT RTCRTPStreamStats : public RTCStats { |
| 385 | public: |
| 386 | WEBRTC_RTCSTATS_DECL(); |
| 387 |
| 388 | RTCRTPStreamStats(const RTCRTPStreamStats& other); |
| 389 | ~RTCRTPStreamStats() override; |
| 390 |
| 391 | RTCStatsMember<uint32_t> ssrc; |
| 392 | RTCStatsMember<std::string> kind; |
| 393 | // Obsolete: track_id |
| 394 | RTCStatsMember<std::string> track_id; |
| 395 | RTCStatsMember<std::string> transport_id; |
| 396 | RTCStatsMember<std::string> codec_id; |
| 397 |
| 398 | // Obsolete |
| 399 | RTCStatsMember<std::string> media_type; // renamed to kind. |
| 400 |
| 401 | protected: |
| 402 | RTCRTPStreamStats(const std::string& id, int64_t timestamp_us); |
| 403 | RTCRTPStreamStats(std::string&& id, int64_t timestamp_us); |
| 404 | }; |
| 405 |
| 406 | // https://www.w3.org/TR/webrtc-stats/#receivedrtpstats-dict* |
| 407 | class RTC_EXPORT RTCReceivedRtpStreamStats : public RTCRTPStreamStats { |
| 408 | public: |
| 409 | WEBRTC_RTCSTATS_DECL(); |
| 410 |
| 411 | RTCReceivedRtpStreamStats(const RTCReceivedRtpStreamStats& other); |
| 412 | ~RTCReceivedRtpStreamStats() override; |
| 413 |
| 414 | RTCStatsMember<double> jitter; |
| 415 | RTCStatsMember<int32_t> packets_lost; // Signed per RFC 3550 |
| 416 |
| 417 | protected: |
| 418 | RTCReceivedRtpStreamStats(const std::string&& id, int64_t timestamp_us); |
| 419 | RTCReceivedRtpStreamStats(std::string&& id, int64_t timestamp_us); |
| 420 | }; |
| 421 |
| 422 | // https://www.w3.org/TR/webrtc-stats/#sentrtpstats-dict* |
| 423 | class RTC_EXPORT RTCSentRtpStreamStats : public RTCRTPStreamStats { |
| 424 | public: |
| 425 | WEBRTC_RTCSTATS_DECL(); |
| 426 |
| 427 | RTCSentRtpStreamStats(const RTCSentRtpStreamStats& other); |
| 428 | ~RTCSentRtpStreamStats() override; |
| 429 |
| 430 | RTCStatsMember<uint32_t> packets_sent; |
| 431 | RTCStatsMember<uint64_t> bytes_sent; |
| 432 |
| 433 | protected: |
| 434 | RTCSentRtpStreamStats(const std::string&& id, int64_t timestamp_us); |
| 435 | RTCSentRtpStreamStats(std::string&& id, int64_t timestamp_us); |
| 436 | }; |
| 437 |
| 438 | // https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict* |
| 439 | class RTC_EXPORT RTCInboundRTPStreamStats final |
| 440 | : public RTCReceivedRtpStreamStats { |
| 441 | public: |
| 442 | WEBRTC_RTCSTATS_DECL(); |
| 443 |
| 444 | RTCInboundRTPStreamStats(const std::string& id, int64_t timestamp_us); |
| 445 | RTCInboundRTPStreamStats(std::string&& id, int64_t timestamp_us); |
| 446 | RTCInboundRTPStreamStats(const RTCInboundRTPStreamStats& other); |
| 447 | ~RTCInboundRTPStreamStats() override; |
| 448 |
| 449 | // TODO(https://crbug.com/webrtc/14174): Implement trackIdentifier and kind. |
| 450 |
| 451 | RTCStatsMember<std::string> track_identifier; |
| 452 | RTCStatsMember<std::string> mid; |
| 453 | RTCStatsMember<std::string> remote_id; |
| 454 | RTCStatsMember<uint32_t> packets_received; |
| 455 | RTCStatsMember<uint64_t> packets_discarded; |
| 456 | RTCStatsMember<uint64_t> fec_packets_received; |
| 457 | RTCStatsMember<uint64_t> fec_packets_discarded; |
| 458 | RTCStatsMember<uint64_t> bytes_received; |
| 459 | RTCStatsMember<uint64_t> header_bytes_received; |
| 460 | RTCStatsMember<double> last_packet_received_timestamp; |
| 461 | RTCStatsMember<double> jitter_buffer_delay; |
| 462 | RTCStatsMember<double> jitter_buffer_target_delay; |
| 463 | RTCStatsMember<double> jitter_buffer_minimum_delay; |
| 464 | RTCStatsMember<uint64_t> jitter_buffer_emitted_count; |
| 465 | RTCStatsMember<uint64_t> total_samples_received; |
| 466 | RTCStatsMember<uint64_t> concealed_samples; |
| 467 | RTCStatsMember<uint64_t> silent_concealed_samples; |
| 468 | RTCStatsMember<uint64_t> concealment_events; |
| 469 | RTCStatsMember<uint64_t> inserted_samples_for_deceleration; |
| 470 | RTCStatsMember<uint64_t> removed_samples_for_acceleration; |
| 471 | RTCStatsMember<double> audio_level; |
| 472 | RTCStatsMember<double> total_audio_energy; |
| 473 | RTCStatsMember<double> total_samples_duration; |
| 474 | // Stats below are only implemented or defined for video. |
| 475 | RTCStatsMember<int32_t> frames_received; |
| 476 | RTCStatsMember<uint32_t> frame_width; |
| 477 | RTCStatsMember<uint32_t> frame_height; |
| 478 | RTCStatsMember<double> frames_per_second; |
| 479 | RTCStatsMember<uint32_t> frames_decoded; |
| 480 | RTCStatsMember<uint32_t> key_frames_decoded; |
| 481 | RTCStatsMember<uint32_t> frames_dropped; |
| 482 | RTCStatsMember<double> total_decode_time; |
| 483 | RTCStatsMember<double> total_processing_delay; |
| 484 | RTCStatsMember<double> total_assembly_time; |
| 485 | RTCStatsMember<uint32_t> frames_assembled_from_multiple_packets; |
| 486 | RTCStatsMember<double> total_inter_frame_delay; |
| 487 | RTCStatsMember<double> total_squared_inter_frame_delay; |
| 488 | RTCStatsMember<uint32_t> pause_count; |
| 489 | RTCStatsMember<double> total_pauses_duration; |
| 490 | RTCStatsMember<uint32_t> freeze_count; |
| 491 | RTCStatsMember<double> total_freezes_duration; |
| 492 | // https://w3c.github.io/webrtc-provisional-stats/#dom-rtcinboundrtpstreamstats-contenttype |
| 493 | RTCStatsMember<std::string> content_type; |
| 494 | // Only populated if audio/video sync is enabled. |
| 495 | // TODO(https://crbug.com/webrtc/14177): Expose even if A/V sync is off? |
| 496 | RTCStatsMember<double> estimated_playout_timestamp; |
| 497 | // Only implemented for video. |
| 498 | // TODO(https://crbug.com/webrtc/14178): Also implement for audio. |
| 499 | RTCStatsMember<std::string> decoder_implementation; |
| 500 | // FIR and PLI counts are only defined for |kind == "video"|. |
| 501 | RTCStatsMember<uint32_t> fir_count; |
| 502 | RTCStatsMember<uint32_t> pli_count; |
| 503 | RTCStatsMember<uint32_t> nack_count; |
| 504 | RTCStatsMember<uint64_t> qp_sum; |
| 505 | // This is a remnant of the legacy getStats() API. When the "video-timing" |
| 506 | // header extension is used, |
| 507 | // https://webrtc.github.io/webrtc-org/experiments/rtp-hdrext/video-timing/, |
| 508 | // `googTimingFrameInfo` is exposed with the value of |
| 509 | // TimingFrameInfo::ToString(). |
| 510 | // TODO(https://crbug.com/webrtc/14586): Unship or standardize this metric. |
| 511 | RTCStatsMember<std::string> goog_timing_frame_info; |
| 512 | // Non-standard audio metrics. |
| 513 | RTCNonStandardStatsMember<uint64_t> jitter_buffer_flushes; |
| 514 | RTCNonStandardStatsMember<uint64_t> delayed_packet_outage_samples; |
| 515 | RTCNonStandardStatsMember<double> relative_packet_arrival_delay; |
| 516 | RTCNonStandardStatsMember<uint32_t> interruption_count; |
| 517 | RTCNonStandardStatsMember<double> total_interruption_duration; |
| 518 |
| 519 | // The former googMinPlayoutDelayMs (in seconds). |
| 520 | RTCNonStandardStatsMember<double> min_playout_delay; |
| 521 | }; |
| 522 |
| 523 | // https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict* |
| 524 | class RTC_EXPORT RTCOutboundRTPStreamStats final : public RTCRTPStreamStats { |
| 525 | public: |
| 526 | WEBRTC_RTCSTATS_DECL(); |
| 527 |
| 528 | RTCOutboundRTPStreamStats(const std::string& id, int64_t timestamp_us); |
| 529 | RTCOutboundRTPStreamStats(std::string&& id, int64_t timestamp_us); |
| 530 | RTCOutboundRTPStreamStats(const RTCOutboundRTPStreamStats& other); |
| 531 | ~RTCOutboundRTPStreamStats() override; |
| 532 |
| 533 | RTCStatsMember<std::string> media_source_id; |
| 534 | RTCStatsMember<std::string> remote_id; |
| 535 | RTCStatsMember<std::string> mid; |
| 536 | RTCStatsMember<std::string> rid; |
| 537 | RTCStatsMember<uint32_t> packets_sent; |
| 538 | RTCStatsMember<uint64_t> retransmitted_packets_sent; |
| 539 | RTCStatsMember<uint64_t> bytes_sent; |
| 540 | RTCStatsMember<uint64_t> header_bytes_sent; |
| 541 | RTCStatsMember<uint64_t> retransmitted_bytes_sent; |
| 542 | RTCStatsMember<double> target_bitrate; |
| 543 | RTCStatsMember<uint32_t> frames_encoded; |
| 544 | RTCStatsMember<uint32_t> key_frames_encoded; |
| 545 | RTCStatsMember<double> total_encode_time; |
| 546 | RTCStatsMember<uint64_t> total_encoded_bytes_target; |
| 547 | RTCStatsMember<uint32_t> frame_width; |
| 548 | RTCStatsMember<uint32_t> frame_height; |
| 549 | RTCStatsMember<double> frames_per_second; |
| 550 | RTCStatsMember<uint32_t> frames_sent; |
| 551 | RTCStatsMember<uint32_t> huge_frames_sent; |
| 552 | RTCStatsMember<double> total_packet_send_delay; |
| 553 | // Enum type RTCQualityLimitationReason |
| 554 | RTCStatsMember<std::string> quality_limitation_reason; |
| 555 | RTCStatsMember<std::map<std::string, double>> quality_limitation_durations; |
| 556 | // https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationresolutionchanges |
| 557 | RTCStatsMember<uint32_t> quality_limitation_resolution_changes; |
| 558 | // https://w3c.github.io/webrtc-provisional-stats/#dom-rtcoutboundrtpstreamstats-contenttype |
| 559 | RTCStatsMember<std::string> content_type; |
| 560 | // Only implemented for video. |
| 561 | // TODO(https://crbug.com/webrtc/14178): Implement for audio as well. |
| 562 | RTCStatsMember<std::string> encoder_implementation; |
| 563 | // FIR and PLI counts are only defined for |kind == "video"|. |
| 564 | RTCStatsMember<uint32_t> fir_count; |
| 565 | RTCStatsMember<uint32_t> pli_count; |
| 566 | RTCStatsMember<uint32_t> nack_count; |
| 567 | RTCStatsMember<uint64_t> qp_sum; |
| 568 | RTCStatsMember<bool> active; |
| 569 | }; |
| 570 |
| 571 | // https://w3c.github.io/webrtc-stats/#remoteinboundrtpstats-dict* |
| 572 | class RTC_EXPORT RTCRemoteInboundRtpStreamStats final |
| 573 | : public RTCReceivedRtpStreamStats { |
| 574 | public: |
| 575 | WEBRTC_RTCSTATS_DECL(); |
| 576 |
| 577 | RTCRemoteInboundRtpStreamStats(const std::string& id, int64_t timestamp_us); |
| 578 | RTCRemoteInboundRtpStreamStats(std::string&& id, int64_t timestamp_us); |
| 579 | RTCRemoteInboundRtpStreamStats(const RTCRemoteInboundRtpStreamStats& other); |
| 580 | ~RTCRemoteInboundRtpStreamStats() override; |
| 581 |
| 582 | RTCStatsMember<std::string> local_id; |
| 583 | RTCStatsMember<double> round_trip_time; |
| 584 | RTCStatsMember<double> fraction_lost; |
| 585 | RTCStatsMember<double> total_round_trip_time; |
| 586 | RTCStatsMember<int32_t> round_trip_time_measurements; |
| 587 | }; |
| 588 |
| 589 | // https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict* |
| 590 | class RTC_EXPORT RTCRemoteOutboundRtpStreamStats final |
| 591 | : public RTCSentRtpStreamStats { |
| 592 | public: |
| 593 | WEBRTC_RTCSTATS_DECL(); |
| 594 |
| 595 | RTCRemoteOutboundRtpStreamStats(const std::string& id, int64_t timestamp_us); |
| 596 | RTCRemoteOutboundRtpStreamStats(std::string&& id, int64_t timestamp_us); |
| 597 | RTCRemoteOutboundRtpStreamStats(const RTCRemoteOutboundRtpStreamStats& other); |
| 598 | ~RTCRemoteOutboundRtpStreamStats() override; |
| 599 |
| 600 | RTCStatsMember<std::string> local_id; |
| 601 | RTCStatsMember<double> remote_timestamp; |
| 602 | RTCStatsMember<uint64_t> reports_sent; |
| 603 | RTCStatsMember<double> round_trip_time; |
| 604 | RTCStatsMember<uint64_t> round_trip_time_measurements; |
| 605 | RTCStatsMember<double> total_round_trip_time; |
| 606 | }; |
| 607 |
| 608 | // https://w3c.github.io/webrtc-stats/#dom-rtcmediasourcestats |
| 609 | class RTC_EXPORT RTCMediaSourceStats : public RTCStats { |
| 610 | public: |
| 611 | WEBRTC_RTCSTATS_DECL(); |
| 612 |
| 613 | RTCMediaSourceStats(const RTCMediaSourceStats& other); |
| 614 | ~RTCMediaSourceStats() override; |
| 615 |
| 616 | RTCStatsMember<std::string> track_identifier; |
| 617 | RTCStatsMember<std::string> kind; |
| 618 |
| 619 | protected: |
| 620 | RTCMediaSourceStats(const std::string& id, int64_t timestamp_us); |
| 621 | RTCMediaSourceStats(std::string&& id, int64_t timestamp_us); |
| 622 | }; |
| 623 |
| 624 | // https://w3c.github.io/webrtc-stats/#dom-rtcaudiosourcestats |
| 625 | class RTC_EXPORT RTCAudioSourceStats final : public RTCMediaSourceStats { |
| 626 | public: |
| 627 | WEBRTC_RTCSTATS_DECL(); |
| 628 |
| 629 | RTCAudioSourceStats(const std::string& id, int64_t timestamp_us); |
| 630 | RTCAudioSourceStats(std::string&& id, int64_t timestamp_us); |
| 631 | RTCAudioSourceStats(const RTCAudioSourceStats& other); |
| 632 | ~RTCAudioSourceStats() override; |
| 633 |
| 634 | RTCStatsMember<double> audio_level; |
| 635 | RTCStatsMember<double> total_audio_energy; |
| 636 | RTCStatsMember<double> total_samples_duration; |
| 637 | RTCStatsMember<double> echo_return_loss; |
| 638 | RTCStatsMember<double> echo_return_loss_enhancement; |
| 639 | }; |
| 640 |
| 641 | // https://w3c.github.io/webrtc-stats/#dom-rtcvideosourcestats |
| 642 | class RTC_EXPORT RTCVideoSourceStats final : public RTCMediaSourceStats { |
| 643 | public: |
| 644 | WEBRTC_RTCSTATS_DECL(); |
| 645 |
| 646 | RTCVideoSourceStats(const std::string& id, int64_t timestamp_us); |
| 647 | RTCVideoSourceStats(std::string&& id, int64_t timestamp_us); |
| 648 | RTCVideoSourceStats(const RTCVideoSourceStats& other); |
| 649 | ~RTCVideoSourceStats() override; |
| 650 |
| 651 | RTCStatsMember<uint32_t> width; |
| 652 | RTCStatsMember<uint32_t> height; |
| 653 | RTCStatsMember<uint32_t> frames; |
| 654 | RTCStatsMember<double> frames_per_second; |
| 655 | }; |
| 656 |
| 657 | // https://w3c.github.io/webrtc-stats/#transportstats-dict* |
| 658 | class RTC_EXPORT RTCTransportStats final : public RTCStats { |
| 659 | public: |
| 660 | WEBRTC_RTCSTATS_DECL(); |
| 661 |
| 662 | RTCTransportStats(const std::string& id, int64_t timestamp_us); |
| 663 | RTCTransportStats(std::string&& id, int64_t timestamp_us); |
| 664 | RTCTransportStats(const RTCTransportStats& other); |
| 665 | ~RTCTransportStats() override; |
| 666 |
| 667 | RTCStatsMember<uint64_t> bytes_sent; |
| 668 | RTCStatsMember<uint64_t> packets_sent; |
| 669 | RTCStatsMember<uint64_t> bytes_received; |
| 670 | RTCStatsMember<uint64_t> packets_received; |
| 671 | RTCStatsMember<std::string> rtcp_transport_stats_id; |
| 672 | // Enum type RTCDtlsTransportState. |
| 673 | RTCStatsMember<std::string> dtls_state; |
| 674 | RTCStatsMember<std::string> selected_candidate_pair_id; |
| 675 | RTCStatsMember<std::string> local_certificate_id; |
| 676 | RTCStatsMember<std::string> remote_certificate_id; |
| 677 | RTCStatsMember<std::string> tls_version; |
| 678 | RTCStatsMember<std::string> dtls_cipher; |
| 679 | RTCStatsMember<std::string> dtls_role; |
| 680 | RTCStatsMember<std::string> srtp_cipher; |
| 681 | RTCStatsMember<uint32_t> selected_candidate_pair_changes; |
| 682 | RTCStatsMember<std::string> ice_role; |
| 683 | RTCStatsMember<std::string> ice_local_username_fragment; |
| 684 | RTCStatsMember<std::string> ice_state; |
| 685 | }; |
| 686 |
| 687 | } // namespace webrtc |
| 688 |
| 689 | #endif // API_STATS_RTCSTATS_OBJECTS_H_ |
| 690 |