| 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 <memory> |
| 17 | #include <string> |
| 18 | #include <vector> |
| 19 |
| 20 | #include "api/stats/rtc_stats.h" |
| 21 | #include "rtc_base/system/rtc_export.h" |
| 22 |
| 23 | namespace webrtc { |
| 24 |
| 25 | // https://w3c.github.io/webrtc-pc/#idl-def-rtcdatachannelstate |
| 26 | struct RTCDataChannelState { |
| 27 | static const char* const kConnecting; |
| 28 | static const char* const kOpen; |
| 29 | static const char* const kClosing; |
| 30 | static const char* const kClosed; |
| 31 | }; |
| 32 |
| 33 | // https://w3c.github.io/webrtc-stats/#dom-rtcstatsicecandidatepairstate |
| 34 | struct RTCStatsIceCandidatePairState { |
| 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; |
| 40 | }; |
| 41 |
| 42 | // https://w3c.github.io/webrtc-pc/#rtcicecandidatetype-enum |
| 43 | struct RTCIceCandidateType { |
| 44 | static const char* const kHost; |
| 45 | static const char* const kSrflx; |
| 46 | static const char* const kPrflx; |
| 47 | static const char* const kRelay; |
| 48 | }; |
| 49 |
| 50 | // https://w3c.github.io/webrtc-pc/#idl-def-rtcdtlstransportstate |
| 51 | struct RTCDtlsTransportState { |
| 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; |
| 57 | }; |
| 58 |
| 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 { |
| 63 | static const char* const kAudio; |
| 64 | static const char* const kVideo; |
| 65 | }; |
| 66 |
| 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 |
| 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 |
| 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 |
| 92 | // https://w3c.github.io/webrtc-stats/#certificatestats-dict* |
| 93 | class RTC_EXPORT RTCCertificateStats final : public RTCStats { |
| 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 |
| 108 | // https://w3c.github.io/webrtc-stats/#codec-dict* |
| 109 | class RTC_EXPORT RTCCodecStats final : public RTCStats { |
| 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; |
| 119 | RTCStatsMember<std::string> mime_type; |
| 120 | RTCStatsMember<uint32_t> clock_rate; |
| 121 | RTCStatsMember<uint32_t> channels; |
| 122 | RTCStatsMember<std::string> sdp_fmtp_line; |
| 123 | }; |
| 124 |
| 125 | // https://w3c.github.io/webrtc-stats/#dcstats-dict* |
| 126 | class RTC_EXPORT RTCDataChannelStats final : public RTCStats { |
| 127 | public: |
| 128 | WEBRTC_RTCSTATS_DECL(); |
| 129 |
| 130 | RTCDataChannelStats(const std::string& id, int64_t timestamp_us); |
| 131 | RTCDataChannelStats(std::string&& id, int64_t timestamp_us); |
| 132 | RTCDataChannelStats(const RTCDataChannelStats& other); |
| 133 | ~RTCDataChannelStats() override; |
| 134 |
| 135 | RTCStatsMember<std::string> label; |
| 136 | RTCStatsMember<std::string> protocol; |
| 137 | RTCStatsMember<int32_t> data_channel_identifier; |
| 138 | // TODO(hbos): Support enum types? "RTCStatsMember<RTCDataChannelState>"? |
| 139 | RTCStatsMember<std::string> state; |
| 140 | RTCStatsMember<uint32_t> messages_sent; |
| 141 | RTCStatsMember<uint64_t> bytes_sent; |
| 142 | RTCStatsMember<uint32_t> messages_received; |
| 143 | RTCStatsMember<uint64_t> bytes_received; |
| 144 | }; |
| 145 |
| 146 | // https://w3c.github.io/webrtc-stats/#candidatepair-dict* |
| 147 | // TODO(hbos): Tracking bug https://bugs.webrtc.org/7062 |
| 148 | class RTC_EXPORT RTCIceCandidatePairStats final : public RTCStats { |
| 149 | public: |
| 150 | WEBRTC_RTCSTATS_DECL(); |
| 151 |
| 152 | RTCIceCandidatePairStats(const std::string& id, int64_t timestamp_us); |
| 153 | RTCIceCandidatePairStats(std::string&& id, int64_t timestamp_us); |
| 154 | RTCIceCandidatePairStats(const RTCIceCandidatePairStats& other); |
| 155 | ~RTCIceCandidatePairStats() override; |
| 156 |
| 157 | RTCStatsMember<std::string> transport_id; |
| 158 | RTCStatsMember<std::string> local_candidate_id; |
| 159 | RTCStatsMember<std::string> remote_candidate_id; |
| 160 | // TODO(hbos): Support enum types? |
| 161 | // "RTCStatsMember<RTCStatsIceCandidatePairState>"? |
| 162 | RTCStatsMember<std::string> state; |
| 163 | RTCStatsMember<uint64_t> priority; |
| 164 | RTCStatsMember<bool> nominated; |
| 165 | // TODO(hbos): Collect this the way the spec describes it. We have a value for |
| 166 | // it but it is not spec-compliant. https://bugs.webrtc.org/7062 |
| 167 | RTCStatsMember<bool> writable; |
| 168 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
| 169 | RTCStatsMember<bool> readable; |
| 170 | RTCStatsMember<uint64_t> bytes_sent; |
| 171 | RTCStatsMember<uint64_t> bytes_received; |
| 172 | RTCStatsMember<double> total_round_trip_time; |
| 173 | RTCStatsMember<double> current_round_trip_time; |
| 174 | RTCStatsMember<double> available_outgoing_bitrate; |
| 175 | // TODO(hbos): Populate this value. It is wired up and collected the same way |
| 176 | // "VideoBwe.googAvailableReceiveBandwidth" is, but that value is always |
| 177 | // undefined. https://bugs.webrtc.org/7062 |
| 178 | RTCStatsMember<double> available_incoming_bitrate; |
| 179 | RTCStatsMember<uint64_t> requests_received; |
| 180 | RTCStatsMember<uint64_t> requests_sent; |
| 181 | RTCStatsMember<uint64_t> responses_received; |
| 182 | RTCStatsMember<uint64_t> responses_sent; |
| 183 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
| 184 | RTCStatsMember<uint64_t> retransmissions_received; |
| 185 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
| 186 | RTCStatsMember<uint64_t> retransmissions_sent; |
| 187 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
| 188 | RTCStatsMember<uint64_t> consent_requests_received; |
| 189 | RTCStatsMember<uint64_t> consent_requests_sent; |
| 190 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
| 191 | RTCStatsMember<uint64_t> consent_responses_received; |
| 192 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7062 |
| 193 | RTCStatsMember<uint64_t> consent_responses_sent; |
| 194 | }; |
| 195 |
| 196 | // https://w3c.github.io/webrtc-stats/#icecandidate-dict* |
| 197 | // TODO(hbos): |RTCStatsCollector| only collects candidates that are part of |
| 198 | // ice candidate pairs, but there could be candidates not paired with anything. |
| 199 | // crbug.com/632723 |
| 200 | // TODO(qingsi): Add the stats of STUN binding requests (keepalives) and collect |
| 201 | // them in the new PeerConnection::GetStats. |
| 202 | class RTC_EXPORT RTCIceCandidateStats : public RTCStats { |
| 203 | public: |
| 204 | WEBRTC_RTCSTATS_DECL(); |
| 205 |
| 206 | RTCIceCandidateStats(const RTCIceCandidateStats& other); |
| 207 | ~RTCIceCandidateStats() override; |
| 208 |
| 209 | RTCStatsMember<std::string> transport_id; |
| 210 | RTCStatsMember<bool> is_remote; |
| 211 | RTCStatsMember<std::string> network_type; |
| 212 | RTCStatsMember<std::string> ip; |
| 213 | RTCStatsMember<int32_t> port; |
| 214 | RTCStatsMember<std::string> protocol; |
| 215 | RTCStatsMember<std::string> relay_protocol; |
| 216 | // TODO(hbos): Support enum types? "RTCStatsMember<RTCIceCandidateType>"? |
| 217 | RTCStatsMember<std::string> candidate_type; |
| 218 | RTCStatsMember<int32_t> priority; |
| 219 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/632723 |
| 220 | RTCStatsMember<std::string> url; |
| 221 | // TODO(hbos): |deleted = true| case is not supported by |RTCStatsCollector|. |
| 222 | // crbug.com/632723 |
| 223 | RTCStatsMember<bool> deleted; // = false |
| 224 |
| 225 | protected: |
| 226 | RTCIceCandidateStats(const std::string& id, |
| 227 | int64_t timestamp_us, |
| 228 | bool is_remote); |
| 229 | RTCIceCandidateStats(std::string&& id, int64_t timestamp_us, bool is_remote); |
| 230 | }; |
| 231 |
| 232 | // In the spec both local and remote varieties are of type RTCIceCandidateStats. |
| 233 | // But here we define them as subclasses of |RTCIceCandidateStats| because the |
| 234 | // |kType| need to be different ("RTCStatsType type") in the local/remote case. |
| 235 | // https://w3c.github.io/webrtc-stats/#rtcstatstype-str* |
| 236 | // This forces us to have to override copy() and type(). |
| 237 | class RTC_EXPORT RTCLocalIceCandidateStats final : public RTCIceCandidateStats { |
| 238 | public: |
| 239 | static const char kType[]; |
| 240 | RTCLocalIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 241 | RTCLocalIceCandidateStats(std::string&& id, int64_t timestamp_us); |
| 242 | std::unique_ptr<RTCStats> copy() const override; |
| 243 | const char* type() const override; |
| 244 | }; |
| 245 |
| 246 | class RTC_EXPORT RTCRemoteIceCandidateStats final |
| 247 | : public RTCIceCandidateStats { |
| 248 | public: |
| 249 | static const char kType[]; |
| 250 | RTCRemoteIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 251 | RTCRemoteIceCandidateStats(std::string&& id, int64_t timestamp_us); |
| 252 | std::unique_ptr<RTCStats> copy() const override; |
| 253 | const char* type() const override; |
| 254 | }; |
| 255 |
| 256 | // https://w3c.github.io/webrtc-stats/#msstats-dict* |
| 257 | // TODO(hbos): Tracking bug crbug.com/660827 |
| 258 | class RTC_EXPORT RTCMediaStreamStats final : public RTCStats { |
| 259 | public: |
| 260 | WEBRTC_RTCSTATS_DECL(); |
| 261 |
| 262 | RTCMediaStreamStats(const std::string& id, int64_t timestamp_us); |
| 263 | RTCMediaStreamStats(std::string&& id, int64_t timestamp_us); |
| 264 | RTCMediaStreamStats(const RTCMediaStreamStats& other); |
| 265 | ~RTCMediaStreamStats() override; |
| 266 |
| 267 | RTCStatsMember<std::string> stream_identifier; |
| 268 | RTCStatsMember<std::vector<std::string>> track_ids; |
| 269 | }; |
| 270 |
| 271 | // https://w3c.github.io/webrtc-stats/#mststats-dict* |
| 272 | // TODO(hbos): Tracking bug crbug.com/659137 |
| 273 | class RTC_EXPORT RTCMediaStreamTrackStats final : public RTCStats { |
| 274 | public: |
| 275 | WEBRTC_RTCSTATS_DECL(); |
| 276 |
| 277 | RTCMediaStreamTrackStats(const std::string& id, |
| 278 | int64_t timestamp_us, |
| 279 | const char* kind); |
| 280 | RTCMediaStreamTrackStats(std::string&& id, |
| 281 | int64_t timestamp_us, |
| 282 | const char* kind); |
| 283 | RTCMediaStreamTrackStats(const RTCMediaStreamTrackStats& other); |
| 284 | ~RTCMediaStreamTrackStats() override; |
| 285 |
| 286 | RTCStatsMember<std::string> track_identifier; |
| 287 | RTCStatsMember<std::string> media_source_id; |
| 288 | RTCStatsMember<bool> remote_source; |
| 289 | RTCStatsMember<bool> ended; |
| 290 | // TODO(hbos): |RTCStatsCollector| does not return stats for detached tracks. |
| 291 | // crbug.com/659137 |
| 292 | RTCStatsMember<bool> detached; |
| 293 | // See |RTCMediaStreamTrackKind| for valid values. |
| 294 | RTCStatsMember<std::string> kind; |
| 295 | RTCStatsMember<double> jitter_buffer_delay; |
| 296 | RTCStatsMember<uint64_t> jitter_buffer_emitted_count; |
| 297 | // Video-only members |
| 298 | RTCStatsMember<uint32_t> frame_width; |
| 299 | RTCStatsMember<uint32_t> frame_height; |
| 300 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 301 | RTCStatsMember<double> frames_per_second; |
| 302 | RTCStatsMember<uint32_t> frames_sent; |
| 303 | RTCStatsMember<uint32_t> huge_frames_sent; |
| 304 | RTCStatsMember<uint32_t> frames_received; |
| 305 | RTCStatsMember<uint32_t> frames_decoded; |
| 306 | RTCStatsMember<uint32_t> frames_dropped; |
| 307 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 308 | RTCStatsMember<uint32_t> frames_corrupted; |
| 309 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 310 | RTCStatsMember<uint32_t> partial_frames_lost; |
| 311 | // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/659137 |
| 312 | RTCStatsMember<uint32_t> full_frames_lost; |
| 313 | // Audio-only members |
| 314 | RTCStatsMember<double> audio_level; // Receive-only |
| 315 | RTCStatsMember<double> total_audio_energy; // Receive-only |
| 316 | RTCStatsMember<double> echo_return_loss; |
| 317 | RTCStatsMember<double> echo_return_loss_enhancement; |
| 318 | RTCStatsMember<uint64_t> total_samples_received; |
| 319 | RTCStatsMember<double> total_samples_duration; // Receive-only |
| 320 | RTCStatsMember<uint64_t> concealed_samples; |
| 321 | RTCStatsMember<uint64_t> silent_concealed_samples; |
| 322 | RTCStatsMember<uint64_t> concealment_events; |
| 323 | RTCStatsMember<uint64_t> inserted_samples_for_deceleration; |
| 324 | RTCStatsMember<uint64_t> removed_samples_for_acceleration; |
| 325 | // Non-standard audio-only member |
| 326 | // TODO(kuddai): Add description to standard. crbug.com/webrtc/10042 |
| 327 | RTCNonStandardStatsMember<uint64_t> jitter_buffer_flushes; |
| 328 | RTCNonStandardStatsMember<uint64_t> delayed_packet_outage_samples; |
| 329 | RTCNonStandardStatsMember<double> relative_packet_arrival_delay; |
| 330 | // Non-standard metric showing target delay of jitter buffer. |
| 331 | // This value is increased by the target jitter buffer delay every time a |
| 332 | // sample is emitted by the jitter buffer. The added target is the target |
| 333 | // delay, in seconds, at the time that the sample was emitted from the jitter |
| 334 | // buffer. (https://github.com/w3c/webrtc-provisional-stats/pull/20) |
| 335 | // Currently it is implemented only for audio. |
| 336 | // TODO(titovartem) implement for video streams when will be requested. |
| 337 | RTCNonStandardStatsMember<double> jitter_buffer_target_delay; |
| 338 | // TODO(henrik.lundin): Add description of the interruption metrics at |
| 339 | // https://github.com/henbos/webrtc-provisional-stats/issues/17 |
| 340 | RTCNonStandardStatsMember<uint32_t> interruption_count; |
| 341 | RTCNonStandardStatsMember<double> total_interruption_duration; |
| 342 | // Non-standard video-only members. |
| 343 | // https://henbos.github.io/webrtc-provisional-stats/#RTCVideoReceiverStats-dict* |
| 344 | RTCNonStandardStatsMember<uint32_t> freeze_count; |
| 345 | RTCNonStandardStatsMember<uint32_t> pause_count; |
| 346 | RTCNonStandardStatsMember<double> total_freezes_duration; |
| 347 | RTCNonStandardStatsMember<double> total_pauses_duration; |
| 348 | RTCNonStandardStatsMember<double> total_frames_duration; |
| 349 | RTCNonStandardStatsMember<double> sum_squared_frame_durations; |
| 350 | }; |
| 351 |
| 352 | // https://w3c.github.io/webrtc-stats/#pcstats-dict* |
| 353 | class RTC_EXPORT RTCPeerConnectionStats final : public RTCStats { |
| 354 | public: |
| 355 | WEBRTC_RTCSTATS_DECL(); |
| 356 |
| 357 | RTCPeerConnectionStats(const std::string& id, int64_t timestamp_us); |
| 358 | RTCPeerConnectionStats(std::string&& id, int64_t timestamp_us); |
| 359 | RTCPeerConnectionStats(const RTCPeerConnectionStats& other); |
| 360 | ~RTCPeerConnectionStats() override; |
| 361 |
| 362 | RTCStatsMember<uint32_t> data_channels_opened; |
| 363 | RTCStatsMember<uint32_t> data_channels_closed; |
| 364 | }; |
| 365 |
| 366 | // https://w3c.github.io/webrtc-stats/#streamstats-dict* |
| 367 | // TODO(hbos): Tracking bug crbug.com/657854 |
| 368 | class RTC_EXPORT RTCRTPStreamStats : public RTCStats { |
| 369 | public: |
| 370 | WEBRTC_RTCSTATS_DECL(); |
| 371 |
| 372 | RTCRTPStreamStats(const RTCRTPStreamStats& other); |
| 373 | ~RTCRTPStreamStats() override; |
| 374 |
| 375 | RTCStatsMember<uint32_t> ssrc; |
| 376 | // TODO(hbos): Remote case not supported by |RTCStatsCollector|. |
| 377 | // crbug.com/657855, 657856 |
| 378 | RTCStatsMember<bool> is_remote; // = false |
| 379 | RTCStatsMember<std::string> media_type; // renamed to kind. |
| 380 | RTCStatsMember<std::string> kind; |
| 381 | RTCStatsMember<std::string> track_id; |
| 382 | RTCStatsMember<std::string> transport_id; |
| 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; |
| 393 | RTCStatsMember<uint64_t> qp_sum; |
| 394 |
| 395 | protected: |
| 396 | RTCRTPStreamStats(const std::string& id, int64_t timestamp_us); |
| 397 | RTCRTPStreamStats(std::string&& id, int64_t timestamp_us); |
| 398 | }; |
| 399 |
| 400 | // https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict* |
| 401 | // TODO(hbos): Support the remote case |is_remote = true|. |
| 402 | // https://bugs.webrtc.org/7065 |
| 403 | class RTC_EXPORT RTCInboundRTPStreamStats final : public RTCRTPStreamStats { |
| 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; |
| 413 | RTCStatsMember<uint64_t> fec_packets_received; |
| 414 | RTCStatsMember<uint64_t> fec_packets_discarded; |
| 415 | RTCStatsMember<uint64_t> bytes_received; |
| 416 | RTCStatsMember<uint64_t> header_bytes_received; |
| 417 | RTCStatsMember<int32_t> packets_lost; // Signed per RFC 3550 |
| 418 | RTCStatsMember<double> last_packet_received_timestamp; |
| 419 | // TODO(hbos): Collect and populate this value for both "audio" and "video", |
| 420 | // currently not collected for "video". https://bugs.webrtc.org/7065 |
| 421 | RTCStatsMember<double> jitter; |
| 422 | RTCStatsMember<double> jitter_buffer_delay; |
| 423 | RTCStatsMember<uint64_t> jitter_buffer_emitted_count; |
| 424 | RTCStatsMember<uint64_t> total_samples_received; |
| 425 | RTCStatsMember<uint64_t> concealed_samples; |
| 426 | RTCStatsMember<uint64_t> silent_concealed_samples; |
| 427 | RTCStatsMember<uint64_t> concealment_events; |
| 428 | RTCStatsMember<uint64_t> inserted_samples_for_deceleration; |
| 429 | RTCStatsMember<uint64_t> removed_samples_for_acceleration; |
| 430 | RTCStatsMember<double> audio_level; |
| 431 | RTCStatsMember<double> total_audio_energy; |
| 432 | RTCStatsMember<double> total_samples_duration; |
| 433 | RTCStatsMember<int32_t> frames_received; |
| 434 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
| 435 | RTCStatsMember<double> round_trip_time; |
| 436 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
| 437 | RTCStatsMember<uint32_t> packets_discarded; |
| 438 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
| 439 | RTCStatsMember<uint32_t> packets_repaired; |
| 440 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
| 441 | RTCStatsMember<uint32_t> burst_packets_lost; |
| 442 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
| 443 | RTCStatsMember<uint32_t> burst_packets_discarded; |
| 444 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
| 445 | RTCStatsMember<uint32_t> burst_loss_count; |
| 446 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
| 447 | RTCStatsMember<uint32_t> burst_discard_count; |
| 448 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
| 449 | RTCStatsMember<double> burst_loss_rate; |
| 450 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
| 451 | RTCStatsMember<double> burst_discard_rate; |
| 452 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
| 453 | RTCStatsMember<double> gap_loss_rate; |
| 454 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 |
| 455 | RTCStatsMember<double> gap_discard_rate; |
| 456 | RTCStatsMember<uint32_t> frame_width; |
| 457 | RTCStatsMember<uint32_t> frame_height; |
| 458 | RTCStatsMember<uint32_t> frame_bit_depth; |
| 459 | RTCStatsMember<double> frames_per_second; |
| 460 | RTCStatsMember<uint32_t> frames_decoded; |
| 461 | RTCStatsMember<uint32_t> key_frames_decoded; |
| 462 | RTCStatsMember<uint32_t> frames_dropped; |
| 463 | RTCStatsMember<double> total_decode_time; |
| 464 | RTCStatsMember<double> total_inter_frame_delay; |
| 465 | RTCStatsMember<double> total_squared_inter_frame_delay; |
| 466 | // https://henbos.github.io/webrtc-provisional-stats/#dom-rtcinboundrtpstreamstats-contenttype |
| 467 | RTCStatsMember<std::string> content_type; |
| 468 | // TODO(asapersson): Currently only populated if audio/video sync is enabled. |
| 469 | RTCStatsMember<double> estimated_playout_timestamp; |
| 470 | // TODO(hbos): This is only implemented for video; implement it for audio as |
| 471 | // well. |
| 472 | RTCStatsMember<std::string> decoder_implementation; |
| 473 | }; |
| 474 |
| 475 | // https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict* |
| 476 | // TODO(hbos): Support the remote case |is_remote = true|. |
| 477 | // https://bugs.webrtc.org/7066 |
| 478 | class RTC_EXPORT RTCOutboundRTPStreamStats final : public RTCRTPStreamStats { |
| 479 | public: |
| 480 | WEBRTC_RTCSTATS_DECL(); |
| 481 |
| 482 | RTCOutboundRTPStreamStats(const std::string& id, int64_t timestamp_us); |
| 483 | RTCOutboundRTPStreamStats(std::string&& id, int64_t timestamp_us); |
| 484 | RTCOutboundRTPStreamStats(const RTCOutboundRTPStreamStats& other); |
| 485 | ~RTCOutboundRTPStreamStats() override; |
| 486 |
| 487 | RTCStatsMember<std::string> media_source_id; |
| 488 | RTCStatsMember<std::string> remote_id; |
| 489 | RTCStatsMember<std::string> rid; |
| 490 | RTCStatsMember<uint32_t> packets_sent; |
| 491 | RTCStatsMember<uint64_t> retransmitted_packets_sent; |
| 492 | RTCStatsMember<uint64_t> bytes_sent; |
| 493 | RTCStatsMember<uint64_t> header_bytes_sent; |
| 494 | RTCStatsMember<uint64_t> retransmitted_bytes_sent; |
| 495 | // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7066 |
| 496 | RTCStatsMember<double> target_bitrate; |
| 497 | RTCStatsMember<uint32_t> frames_encoded; |
| 498 | RTCStatsMember<uint32_t> key_frames_encoded; |
| 499 | RTCStatsMember<double> total_encode_time; |
| 500 | RTCStatsMember<uint64_t> total_encoded_bytes_target; |
| 501 | RTCStatsMember<uint32_t> frame_width; |
| 502 | RTCStatsMember<uint32_t> frame_height; |
| 503 | RTCStatsMember<double> frames_per_second; |
| 504 | RTCStatsMember<uint32_t> frames_sent; |
| 505 | RTCStatsMember<uint32_t> huge_frames_sent; |
| 506 | // TODO(https://crbug.com/webrtc/10635): This is only implemented for video; |
| 507 | // implement it for audio as well. |
| 508 | RTCStatsMember<double> total_packet_send_delay; |
| 509 | // Enum type RTCQualityLimitationReason |
| 510 | // TODO(https://crbug.com/webrtc/10686): Also expose |
| 511 | // qualityLimitationDurations. Requires RTCStatsMember support for |
| 512 | // "record<DOMString, double>", see https://crbug.com/webrtc/10685. |
| 513 | RTCStatsMember<std::string> quality_limitation_reason; |
| 514 | // https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationresolutionchanges |
| 515 | RTCStatsMember<uint32_t> quality_limitation_resolution_changes; |
| 516 | // https://henbos.github.io/webrtc-provisional-stats/#dom-rtcoutboundrtpstreamstats-contenttype |
| 517 | RTCStatsMember<std::string> content_type; |
| 518 | // TODO(hbos): This is only implemented for video; implement it for audio as |
| 519 | // well. |
| 520 | RTCStatsMember<std::string> encoder_implementation; |
| 521 | }; |
| 522 |
| 523 | // TODO(https://crbug.com/webrtc/10671): Refactor the stats dictionaries to have |
| 524 | // the same hierarchy as in the spec; implement RTCReceivedRtpStreamStats. |
| 525 | // Several metrics are shared between "outbound-rtp", "remote-inbound-rtp", |
| 526 | // "inbound-rtp" and "remote-outbound-rtp". In the spec there is a hierarchy of |
| 527 | // dictionaries that minimizes defining the same metrics in multiple places. |
| 528 | // From JavaScript this hierarchy is not observable and the spec's hierarchy is |
| 529 | // purely editorial. In C++ non-final classes in the hierarchy could be used to |
| 530 | // refer to different stats objects within the hierarchy. |
| 531 | // https://w3c.github.io/webrtc-stats/#remoteinboundrtpstats-dict* |
| 532 | class RTC_EXPORT RTCRemoteInboundRtpStreamStats final : public RTCStats { |
| 533 | public: |
| 534 | WEBRTC_RTCSTATS_DECL(); |
| 535 |
| 536 | RTCRemoteInboundRtpStreamStats(const std::string& id, int64_t timestamp_us); |
| 537 | RTCRemoteInboundRtpStreamStats(std::string&& id, int64_t timestamp_us); |
| 538 | RTCRemoteInboundRtpStreamStats(const RTCRemoteInboundRtpStreamStats& other); |
| 539 | ~RTCRemoteInboundRtpStreamStats() override; |
| 540 |
| 541 | // In the spec RTCRemoteInboundRtpStreamStats inherits from RTCRtpStreamStats |
| 542 | // and RTCReceivedRtpStreamStats. The members here are listed based on where |
| 543 | // they are defined in the spec. |
| 544 | // RTCRtpStreamStats |
| 545 | RTCStatsMember<uint32_t> ssrc; |
| 546 | RTCStatsMember<std::string> kind; |
| 547 | RTCStatsMember<std::string> transport_id; |
| 548 | RTCStatsMember<std::string> codec_id; |
| 549 | // RTCReceivedRtpStreamStats |
| 550 | RTCStatsMember<int32_t> packets_lost; |
| 551 | RTCStatsMember<double> jitter; |
| 552 | // TODO(hbos): The following RTCReceivedRtpStreamStats metrics should also be |
| 553 | // implemented: packetsReceived, packetsDiscarded, packetsRepaired, |
| 554 | // burstPacketsLost, burstPacketsDiscarded, burstLossCount, burstDiscardCount, |
| 555 | // burstLossRate, burstDiscardRate, gapLossRate and gapDiscardRate. |
| 556 | // RTCRemoteInboundRtpStreamStats |
| 557 | RTCStatsMember<std::string> local_id; |
| 558 | RTCStatsMember<double> round_trip_time; |
| 559 | // TODO(hbos): The following RTCRemoteInboundRtpStreamStats metric should also |
| 560 | // be implemented: fractionLost. |
| 561 | }; |
| 562 |
| 563 | // https://w3c.github.io/webrtc-stats/#dom-rtcmediasourcestats |
| 564 | class RTC_EXPORT RTCMediaSourceStats : public RTCStats { |
| 565 | public: |
| 566 | WEBRTC_RTCSTATS_DECL(); |
| 567 |
| 568 | RTCMediaSourceStats(const RTCMediaSourceStats& other); |
| 569 | ~RTCMediaSourceStats() override; |
| 570 |
| 571 | RTCStatsMember<std::string> track_identifier; |
| 572 | RTCStatsMember<std::string> kind; |
| 573 |
| 574 | protected: |
| 575 | RTCMediaSourceStats(const std::string& id, int64_t timestamp_us); |
| 576 | RTCMediaSourceStats(std::string&& id, int64_t timestamp_us); |
| 577 | }; |
| 578 |
| 579 | // https://w3c.github.io/webrtc-stats/#dom-rtcaudiosourcestats |
| 580 | class RTC_EXPORT RTCAudioSourceStats final : public RTCMediaSourceStats { |
| 581 | public: |
| 582 | WEBRTC_RTCSTATS_DECL(); |
| 583 |
| 584 | RTCAudioSourceStats(const std::string& id, int64_t timestamp_us); |
| 585 | RTCAudioSourceStats(std::string&& id, int64_t timestamp_us); |
| 586 | RTCAudioSourceStats(const RTCAudioSourceStats& other); |
| 587 | ~RTCAudioSourceStats() override; |
| 588 |
| 589 | RTCStatsMember<double> audio_level; |
| 590 | RTCStatsMember<double> total_audio_energy; |
| 591 | RTCStatsMember<double> total_samples_duration; |
| 592 | }; |
| 593 |
| 594 | // https://w3c.github.io/webrtc-stats/#dom-rtcvideosourcestats |
| 595 | class RTC_EXPORT RTCVideoSourceStats final : public RTCMediaSourceStats { |
| 596 | public: |
| 597 | WEBRTC_RTCSTATS_DECL(); |
| 598 |
| 599 | RTCVideoSourceStats(const std::string& id, int64_t timestamp_us); |
| 600 | RTCVideoSourceStats(std::string&& id, int64_t timestamp_us); |
| 601 | RTCVideoSourceStats(const RTCVideoSourceStats& other); |
| 602 | ~RTCVideoSourceStats() override; |
| 603 |
| 604 | RTCStatsMember<uint32_t> width; |
| 605 | RTCStatsMember<uint32_t> height; |
| 606 | // TODO(hbos): Implement this metric. |
| 607 | RTCStatsMember<uint32_t> frames; |
| 608 | RTCStatsMember<uint32_t> frames_per_second; |
| 609 | }; |
| 610 |
| 611 | // https://w3c.github.io/webrtc-stats/#transportstats-dict* |
| 612 | class RTC_EXPORT RTCTransportStats final : public RTCStats { |
| 613 | public: |
| 614 | WEBRTC_RTCSTATS_DECL(); |
| 615 |
| 616 | RTCTransportStats(const std::string& id, int64_t timestamp_us); |
| 617 | RTCTransportStats(std::string&& id, int64_t timestamp_us); |
| 618 | RTCTransportStats(const RTCTransportStats& other); |
| 619 | ~RTCTransportStats() override; |
| 620 |
| 621 | RTCStatsMember<uint64_t> bytes_sent; |
| 622 | RTCStatsMember<uint64_t> packets_sent; |
| 623 | RTCStatsMember<uint64_t> bytes_received; |
| 624 | RTCStatsMember<uint64_t> packets_received; |
| 625 | RTCStatsMember<std::string> rtcp_transport_stats_id; |
| 626 | // TODO(hbos): Support enum types? "RTCStatsMember<RTCDtlsTransportState>"? |
| 627 | RTCStatsMember<std::string> dtls_state; |
| 628 | RTCStatsMember<std::string> selected_candidate_pair_id; |
| 629 | RTCStatsMember<std::string> local_certificate_id; |
| 630 | RTCStatsMember<std::string> remote_certificate_id; |
| 631 | RTCStatsMember<std::string> tls_version; |
| 632 | RTCStatsMember<std::string> dtls_cipher; |
| 633 | RTCStatsMember<std::string> srtp_cipher; |
| 634 | RTCStatsMember<uint32_t> selected_candidate_pair_changes; |
| 635 | }; |
| 636 |
| 637 | } // namespace webrtc |
| 638 |
| 639 | #endif // API_STATS_RTCSTATS_OBJECTS_H_ |
| 640 |