| 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 | #include "api/stats/rtcstats_objects.h" |
| 12 |
| 13 | #include <utility> |
| 14 |
| 15 | #include "api/stats/rtc_stats.h" |
| 16 | #include "rtc_base/checks.h" |
| 17 |
| 18 | namespace webrtc { |
| 19 |
| 20 | const char* const RTCDataChannelState::kConnecting = "connecting"; |
| 21 | const char* const RTCDataChannelState::kOpen = "open"; |
| 22 | const char* const RTCDataChannelState::kClosing = "closing"; |
| 23 | const char* const RTCDataChannelState::kClosed = "closed"; |
| 24 |
| 25 | const char* const RTCStatsIceCandidatePairState::kFrozen = "frozen"; |
| 26 | const char* const RTCStatsIceCandidatePairState::kWaiting = "waiting"; |
| 27 | const char* const RTCStatsIceCandidatePairState::kInProgress = "in-progress"; |
| 28 | const char* const RTCStatsIceCandidatePairState::kFailed = "failed"; |
| 29 | const char* const RTCStatsIceCandidatePairState::kSucceeded = "succeeded"; |
| 30 |
| 31 | // Strings defined in https://tools.ietf.org/html/rfc5245. |
| 32 | const char* const RTCIceCandidateType::kHost = "host"; |
| 33 | const char* const RTCIceCandidateType::kSrflx = "srflx"; |
| 34 | const char* const RTCIceCandidateType::kPrflx = "prflx"; |
| 35 | const char* const RTCIceCandidateType::kRelay = "relay"; |
| 36 |
| 37 | const char* const RTCDtlsTransportState::kNew = "new"; |
| 38 | const char* const RTCDtlsTransportState::kConnecting = "connecting"; |
| 39 | const char* const RTCDtlsTransportState::kConnected = "connected"; |
| 40 | const char* const RTCDtlsTransportState::kClosed = "closed"; |
| 41 | const char* const RTCDtlsTransportState::kFailed = "failed"; |
| 42 |
| 43 | const char* const RTCMediaStreamTrackKind::kAudio = "audio"; |
| 44 | const char* const RTCMediaStreamTrackKind::kVideo = "video"; |
| 45 |
| 46 | // https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype |
| 47 | const char* const RTCNetworkType::kBluetooth = "bluetooth"; |
| 48 | const char* const RTCNetworkType::kCellular = "cellular"; |
| 49 | const char* const RTCNetworkType::kEthernet = "ethernet"; |
| 50 | const char* const RTCNetworkType::kWifi = "wifi"; |
| 51 | const char* const RTCNetworkType::kWimax = "wimax"; |
| 52 | const char* const RTCNetworkType::kVpn = "vpn"; |
| 53 | const char* const RTCNetworkType::kUnknown = "unknown"; |
| 54 |
| 55 | // https://w3c.github.io/webrtc-stats/#dom-rtcqualitylimitationreason |
| 56 | const char* const RTCQualityLimitationReason::kNone = "none"; |
| 57 | const char* const RTCQualityLimitationReason::kCpu = "cpu"; |
| 58 | const char* const RTCQualityLimitationReason::kBandwidth = "bandwidth"; |
| 59 | const char* const RTCQualityLimitationReason::kOther = "other"; |
| 60 |
| 61 | // https://webrtc.org/experiments/rtp-hdrext/video-content-type/ |
| 62 | const char* const RTCContentType::kUnspecified = "unspecified"; |
| 63 | const char* const RTCContentType::kScreenshare = "screenshare"; |
| 64 |
| 65 | // https://w3c.github.io/webrtc-stats/#dom-rtcdtlsrole |
| 66 | const char* const RTCDtlsRole::kUnknown = "unknown"; |
| 67 | const char* const RTCDtlsRole::kClient = "client"; |
| 68 | const char* const RTCDtlsRole::kServer = "server"; |
| 69 |
| 70 | // https://www.w3.org/TR/webrtc/#rtcicerole |
| 71 | const char* const RTCIceRole::kUnknown = "unknown"; |
| 72 | const char* const RTCIceRole::kControlled = "controlled"; |
| 73 | const char* const RTCIceRole::kControlling = "controlling"; |
| 74 |
| 75 | // https://www.w3.org/TR/webrtc/#dom-rtcicetransportstate |
| 76 | const char* const RTCIceTransportState::kNew = "new"; |
| 77 | const char* const RTCIceTransportState::kChecking = "checking"; |
| 78 | const char* const RTCIceTransportState::kConnected = "connected"; |
| 79 | const char* const RTCIceTransportState::kCompleted = "completed"; |
| 80 | const char* const RTCIceTransportState::kDisconnected = "disconnected"; |
| 81 | const char* const RTCIceTransportState::kFailed = "failed"; |
| 82 | const char* const RTCIceTransportState::kClosed = "closed"; |
| 83 |
| 84 | // clang-format off |
| 85 | WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate", |
| 86 | &fingerprint, |
| 87 | &fingerprint_algorithm, |
| 88 | &base64_certificate, |
| 89 | &issuer_certificate_id) |
| 90 | // clang-format on |
| 91 |
| 92 | RTCCertificateStats::RTCCertificateStats(const std::string& id, |
| 93 | int64_t timestamp_us) |
| 94 | : RTCCertificateStats(std::string(id), timestamp_us) {} |
| 95 |
| 96 | RTCCertificateStats::RTCCertificateStats(std::string&& id, int64_t timestamp_us) |
| 97 | : RTCStats(std::move(id), timestamp_us), |
| 98 | fingerprint("fingerprint"), |
| 99 | fingerprint_algorithm("fingerprintAlgorithm"), |
| 100 | base64_certificate("base64Certificate"), |
| 101 | issuer_certificate_id("issuerCertificateId") {} |
| 102 |
| 103 | RTCCertificateStats::RTCCertificateStats(const RTCCertificateStats& other) = |
| 104 | default; |
| 105 | RTCCertificateStats::~RTCCertificateStats() {} |
| 106 |
| 107 | // clang-format off |
| 108 | WEBRTC_RTCSTATS_IMPL(RTCCodecStats, RTCStats, "codec", |
| 109 | &transport_id, |
| 110 | &payload_type, |
| 111 | &mime_type, |
| 112 | &clock_rate, |
| 113 | &channels, |
| 114 | &sdp_fmtp_line) |
| 115 | // clang-format on |
| 116 |
| 117 | RTCCodecStats::RTCCodecStats(const std::string& id, int64_t timestamp_us) |
| 118 | : RTCCodecStats(std::string(id), timestamp_us) {} |
| 119 |
| 120 | RTCCodecStats::RTCCodecStats(std::string&& id, int64_t timestamp_us) |
| 121 | : RTCStats(std::move(id), timestamp_us), |
| 122 | transport_id("transportId"), |
| 123 | payload_type("payloadType"), |
| 124 | mime_type("mimeType"), |
| 125 | clock_rate("clockRate"), |
| 126 | channels("channels"), |
| 127 | sdp_fmtp_line("sdpFmtpLine") {} |
| 128 |
| 129 | RTCCodecStats::RTCCodecStats(const RTCCodecStats& other) = default; |
| 130 |
| 131 | RTCCodecStats::~RTCCodecStats() {} |
| 132 |
| 133 | // clang-format off |
| 134 | WEBRTC_RTCSTATS_IMPL(RTCDataChannelStats, RTCStats, "data-channel", |
| 135 | &label, |
| 136 | &protocol, |
| 137 | &data_channel_identifier, |
| 138 | &state, |
| 139 | &messages_sent, |
| 140 | &bytes_sent, |
| 141 | &messages_received, |
| 142 | &bytes_received) |
| 143 | // clang-format on |
| 144 |
| 145 | RTCDataChannelStats::RTCDataChannelStats(const std::string& id, |
| 146 | int64_t timestamp_us) |
| 147 | : RTCDataChannelStats(std::string(id), timestamp_us) {} |
| 148 |
| 149 | RTCDataChannelStats::RTCDataChannelStats(std::string&& id, int64_t timestamp_us) |
| 150 | : RTCStats(std::move(id), timestamp_us), |
| 151 | label("label"), |
| 152 | protocol("protocol"), |
| 153 | data_channel_identifier("dataChannelIdentifier"), |
| 154 | state("state"), |
| 155 | messages_sent("messagesSent"), |
| 156 | bytes_sent("bytesSent"), |
| 157 | messages_received("messagesReceived"), |
| 158 | bytes_received("bytesReceived") {} |
| 159 |
| 160 | RTCDataChannelStats::RTCDataChannelStats(const RTCDataChannelStats& other) = |
| 161 | default; |
| 162 |
| 163 | RTCDataChannelStats::~RTCDataChannelStats() {} |
| 164 |
| 165 | // clang-format off |
| 166 | WEBRTC_RTCSTATS_IMPL(RTCIceCandidatePairStats, RTCStats, "candidate-pair", |
| 167 | &transport_id, |
| 168 | &local_candidate_id, |
| 169 | &remote_candidate_id, |
| 170 | &state, |
| 171 | &priority, |
| 172 | &nominated, |
| 173 | &writable, |
| 174 | &packets_sent, |
| 175 | &packets_received, |
| 176 | &bytes_sent, |
| 177 | &bytes_received, |
| 178 | &total_round_trip_time, |
| 179 | ¤t_round_trip_time, |
| 180 | &available_outgoing_bitrate, |
| 181 | &available_incoming_bitrate, |
| 182 | &requests_received, |
| 183 | &requests_sent, |
| 184 | &responses_received, |
| 185 | &responses_sent, |
| 186 | &consent_requests_sent, |
| 187 | &packets_discarded_on_send, |
| 188 | &bytes_discarded_on_send) |
| 189 | // clang-format on |
| 190 |
| 191 | RTCIceCandidatePairStats::RTCIceCandidatePairStats(const std::string& id, |
| 192 | int64_t timestamp_us) |
| 193 | : RTCIceCandidatePairStats(std::string(id), timestamp_us) {} |
| 194 |
| 195 | RTCIceCandidatePairStats::RTCIceCandidatePairStats(std::string&& id, |
| 196 | int64_t timestamp_us) |
| 197 | : RTCStats(std::move(id), timestamp_us), |
| 198 | transport_id("transportId"), |
| 199 | local_candidate_id("localCandidateId"), |
| 200 | remote_candidate_id("remoteCandidateId"), |
| 201 | state("state"), |
| 202 | priority("priority"), |
| 203 | nominated("nominated"), |
| 204 | writable("writable"), |
| 205 | packets_sent("packetsSent"), |
| 206 | packets_received("packetsReceived"), |
| 207 | bytes_sent("bytesSent"), |
| 208 | bytes_received("bytesReceived"), |
| 209 | total_round_trip_time("totalRoundTripTime"), |
| 210 | current_round_trip_time("currentRoundTripTime"), |
| 211 | available_outgoing_bitrate("availableOutgoingBitrate"), |
| 212 | available_incoming_bitrate("availableIncomingBitrate"), |
| 213 | requests_received("requestsReceived"), |
| 214 | requests_sent("requestsSent"), |
| 215 | responses_received("responsesReceived"), |
| 216 | responses_sent("responsesSent"), |
| 217 | consent_requests_sent("consentRequestsSent"), |
| 218 | packets_discarded_on_send("packetsDiscardedOnSend"), |
| 219 | bytes_discarded_on_send("bytesDiscardedOnSend") {} |
| 220 |
| 221 | RTCIceCandidatePairStats::RTCIceCandidatePairStats( |
| 222 | const RTCIceCandidatePairStats& other) = default; |
| 223 |
| 224 | RTCIceCandidatePairStats::~RTCIceCandidatePairStats() {} |
| 225 |
| 226 | // clang-format off |
| 227 | WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "abstract-ice-candidate", |
| 228 | &transport_id, |
| 229 | &is_remote, |
| 230 | &network_type, |
| 231 | &ip, |
| 232 | &address, |
| 233 | &port, |
| 234 | &protocol, |
| 235 | &relay_protocol, |
| 236 | &candidate_type, |
| 237 | &priority, |
| 238 | &url, |
| 239 | &foundation, |
| 240 | &related_address, |
| 241 | &related_port, |
| 242 | &username_fragment, |
| 243 | &tcp_type, |
| 244 | &vpn, |
| 245 | &network_adapter_type) |
| 246 | // clang-format on |
| 247 |
| 248 | RTCIceCandidateStats::RTCIceCandidateStats(const std::string& id, |
| 249 | int64_t timestamp_us, |
| 250 | bool is_remote) |
| 251 | : RTCIceCandidateStats(std::string(id), timestamp_us, is_remote) {} |
| 252 |
| 253 | RTCIceCandidateStats::RTCIceCandidateStats(std::string&& id, |
| 254 | int64_t timestamp_us, |
| 255 | bool is_remote) |
| 256 | : RTCStats(std::move(id), timestamp_us), |
| 257 | transport_id("transportId"), |
| 258 | is_remote("isRemote", is_remote), |
| 259 | network_type("networkType"), |
| 260 | ip("ip"), |
| 261 | address("address"), |
| 262 | port("port"), |
| 263 | protocol("protocol"), |
| 264 | relay_protocol("relayProtocol"), |
| 265 | candidate_type("candidateType"), |
| 266 | priority("priority"), |
| 267 | url("url"), |
| 268 | foundation("foundation"), |
| 269 | related_address("relatedAddress"), |
| 270 | related_port("relatedPort"), |
| 271 | username_fragment("usernameFragment"), |
| 272 | tcp_type("tcpType"), |
| 273 | vpn("vpn"), |
| 274 | network_adapter_type("networkAdapterType") {} |
| 275 |
| 276 | RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other) = |
| 277 | default; |
| 278 |
| 279 | RTCIceCandidateStats::~RTCIceCandidateStats() {} |
| 280 |
| 281 | const char RTCLocalIceCandidateStats::kType[] = "local-candidate"; |
| 282 |
| 283 | RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(const std::string& id, |
| 284 | int64_t timestamp_us) |
| 285 | : RTCIceCandidateStats(id, timestamp_us, false) {} |
| 286 |
| 287 | RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(std::string&& id, |
| 288 | int64_t timestamp_us) |
| 289 | : RTCIceCandidateStats(std::move(id), timestamp_us, false) {} |
| 290 |
| 291 | std::unique_ptr<RTCStats> RTCLocalIceCandidateStats::copy() const { |
| 292 | return std::make_unique<RTCLocalIceCandidateStats>(*this); |
| 293 | } |
| 294 |
| 295 | const char* RTCLocalIceCandidateStats::type() const { |
| 296 | return kType; |
| 297 | } |
| 298 |
| 299 | const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate"; |
| 300 |
| 301 | RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(const std::string& id, |
| 302 | int64_t timestamp_us) |
| 303 | : RTCIceCandidateStats(id, timestamp_us, true) {} |
| 304 |
| 305 | RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(std::string&& id, |
| 306 | int64_t timestamp_us) |
| 307 | : RTCIceCandidateStats(std::move(id), timestamp_us, true) {} |
| 308 |
| 309 | std::unique_ptr<RTCStats> RTCRemoteIceCandidateStats::copy() const { |
| 310 | return std::make_unique<RTCRemoteIceCandidateStats>(*this); |
| 311 | } |
| 312 |
| 313 | const char* RTCRemoteIceCandidateStats::type() const { |
| 314 | return kType; |
| 315 | } |
| 316 |
| 317 | // clang-format off |
| 318 | WEBRTC_RTCSTATS_IMPL(DEPRECATED_RTCMediaStreamStats, RTCStats, "stream", |
| 319 | &stream_identifier, |
| 320 | &track_ids) |
| 321 | // clang-format on |
| 322 |
| 323 | DEPRECATED_RTCMediaStreamStats::DEPRECATED_RTCMediaStreamStats( |
| 324 | const std::string& id, |
| 325 | int64_t timestamp_us) |
| 326 | : DEPRECATED_RTCMediaStreamStats(std::string(id), timestamp_us) {} |
| 327 |
| 328 | DEPRECATED_RTCMediaStreamStats::DEPRECATED_RTCMediaStreamStats( |
| 329 | std::string&& id, |
| 330 | int64_t timestamp_us) |
| 331 | : RTCStats(std::move(id), timestamp_us), |
| 332 | stream_identifier("streamIdentifier"), |
| 333 | track_ids("trackIds") {} |
| 334 |
| 335 | DEPRECATED_RTCMediaStreamStats::DEPRECATED_RTCMediaStreamStats( |
| 336 | const DEPRECATED_RTCMediaStreamStats& other) = default; |
| 337 |
| 338 | DEPRECATED_RTCMediaStreamStats::~DEPRECATED_RTCMediaStreamStats() {} |
| 339 |
| 340 | // clang-format off |
| 341 | WEBRTC_RTCSTATS_IMPL(DEPRECATED_RTCMediaStreamTrackStats, RTCStats, "track", |
| 342 | &track_identifier, |
| 343 | &media_source_id, |
| 344 | &remote_source, |
| 345 | &ended, |
| 346 | &detached, |
| 347 | &kind, |
| 348 | &jitter_buffer_delay, |
| 349 | &jitter_buffer_emitted_count, |
| 350 | &frame_width, |
| 351 | &frame_height, |
| 352 | &frames_sent, |
| 353 | &huge_frames_sent, |
| 354 | &frames_received, |
| 355 | &frames_decoded, |
| 356 | &frames_dropped, |
| 357 | &audio_level, |
| 358 | &total_audio_energy, |
| 359 | &echo_return_loss, |
| 360 | &echo_return_loss_enhancement, |
| 361 | &total_samples_received, |
| 362 | &total_samples_duration, |
| 363 | &concealed_samples, |
| 364 | &silent_concealed_samples, |
| 365 | &concealment_events, |
| 366 | &inserted_samples_for_deceleration, |
| 367 | &removed_samples_for_acceleration, |
| 368 | &jitter_buffer_flushes, |
| 369 | &delayed_packet_outage_samples, |
| 370 | &relative_packet_arrival_delay, |
| 371 | &interruption_count, |
| 372 | &total_interruption_duration, |
| 373 | &total_frames_duration, |
| 374 | &sum_squared_frame_durations, |
| 375 | &freeze_count, |
| 376 | &pause_count, |
| 377 | &total_freezes_duration, |
| 378 | &total_pauses_duration) |
| 379 | // clang-format on |
| 380 |
| 381 | DEPRECATED_RTCMediaStreamTrackStats::DEPRECATED_RTCMediaStreamTrackStats( |
| 382 | const std::string& id, |
| 383 | int64_t timestamp_us, |
| 384 | const char* kind) |
| 385 | : DEPRECATED_RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) { |
| 386 | } |
| 387 |
| 388 | DEPRECATED_RTCMediaStreamTrackStats::DEPRECATED_RTCMediaStreamTrackStats( |
| 389 | std::string&& id, |
| 390 | int64_t timestamp_us, |
| 391 | const char* kind) |
| 392 | : RTCStats(std::move(id), timestamp_us), |
| 393 | track_identifier("trackIdentifier"), |
| 394 | media_source_id("mediaSourceId"), |
| 395 | remote_source("remoteSource"), |
| 396 | ended("ended"), |
| 397 | detached("detached"), |
| 398 | kind("kind", kind), |
| 399 | jitter_buffer_delay("jitterBufferDelay"), |
| 400 | jitter_buffer_emitted_count("jitterBufferEmittedCount"), |
| 401 | frame_width("frameWidth"), |
| 402 | frame_height("frameHeight"), |
| 403 | frames_sent("framesSent"), |
| 404 | huge_frames_sent("hugeFramesSent"), |
| 405 | frames_received("framesReceived"), |
| 406 | frames_decoded("framesDecoded"), |
| 407 | frames_dropped("framesDropped"), |
| 408 | audio_level("audioLevel"), |
| 409 | total_audio_energy("totalAudioEnergy"), |
| 410 | echo_return_loss("echoReturnLoss"), |
| 411 | echo_return_loss_enhancement("echoReturnLossEnhancement"), |
| 412 | total_samples_received("totalSamplesReceived"), |
| 413 | total_samples_duration("totalSamplesDuration"), |
| 414 | concealed_samples("concealedSamples"), |
| 415 | silent_concealed_samples("silentConcealedSamples"), |
| 416 | concealment_events("concealmentEvents"), |
| 417 | inserted_samples_for_deceleration("insertedSamplesForDeceleration"), |
| 418 | removed_samples_for_acceleration("removedSamplesForAcceleration"), |
| 419 | jitter_buffer_flushes( |
| 420 | "jitterBufferFlushes", |
| 421 | {NonStandardGroupId::kRtcAudioJitterBufferMaxPackets}), |
| 422 | delayed_packet_outage_samples( |
| 423 | "delayedPacketOutageSamples", |
| 424 | {NonStandardGroupId::kRtcAudioJitterBufferMaxPackets, |
| 425 | NonStandardGroupId::kRtcStatsRelativePacketArrivalDelay}), |
| 426 | relative_packet_arrival_delay( |
| 427 | "relativePacketArrivalDelay", |
| 428 | {NonStandardGroupId::kRtcStatsRelativePacketArrivalDelay}), |
| 429 | interruption_count("interruptionCount"), |
| 430 | total_interruption_duration("totalInterruptionDuration"), |
| 431 | total_frames_duration("totalFramesDuration"), |
| 432 | sum_squared_frame_durations("sumOfSquaredFramesDuration"), |
| 433 | freeze_count("freezeCount"), |
| 434 | pause_count("pauseCount"), |
| 435 | total_freezes_duration("totalFreezesDuration"), |
| 436 | total_pauses_duration("totalPausesDuration") { |
| 437 | RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio || |
| 438 | kind == RTCMediaStreamTrackKind::kVideo); |
| 439 | } |
| 440 |
| 441 | DEPRECATED_RTCMediaStreamTrackStats::DEPRECATED_RTCMediaStreamTrackStats( |
| 442 | const DEPRECATED_RTCMediaStreamTrackStats& other) = default; |
| 443 |
| 444 | DEPRECATED_RTCMediaStreamTrackStats::~DEPRECATED_RTCMediaStreamTrackStats() {} |
| 445 |
| 446 | // clang-format off |
| 447 | WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection", |
| 448 | &data_channels_opened, |
| 449 | &data_channels_closed) |
| 450 | // clang-format on |
| 451 |
| 452 | RTCPeerConnectionStats::RTCPeerConnectionStats(const std::string& id, |
| 453 | int64_t timestamp_us) |
| 454 | : RTCPeerConnectionStats(std::string(id), timestamp_us) {} |
| 455 |
| 456 | RTCPeerConnectionStats::RTCPeerConnectionStats(std::string&& id, |
| 457 | int64_t timestamp_us) |
| 458 | : RTCStats(std::move(id), timestamp_us), |
| 459 | data_channels_opened("dataChannelsOpened"), |
| 460 | data_channels_closed("dataChannelsClosed") {} |
| 461 |
| 462 | RTCPeerConnectionStats::RTCPeerConnectionStats( |
| 463 | const RTCPeerConnectionStats& other) = default; |
| 464 |
| 465 | RTCPeerConnectionStats::~RTCPeerConnectionStats() {} |
| 466 |
| 467 | // clang-format off |
| 468 | WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp", |
| 469 | &ssrc, |
| 470 | &kind, |
| 471 | &track_id, |
| 472 | &transport_id, |
| 473 | &codec_id, |
| 474 | &media_type) |
| 475 | // clang-format on |
| 476 |
| 477 | RTCRTPStreamStats::RTCRTPStreamStats(const std::string& id, |
| 478 | int64_t timestamp_us) |
| 479 | : RTCRTPStreamStats(std::string(id), timestamp_us) {} |
| 480 |
| 481 | RTCRTPStreamStats::RTCRTPStreamStats(std::string&& id, int64_t timestamp_us) |
| 482 | : RTCStats(std::move(id), timestamp_us), |
| 483 | ssrc("ssrc"), |
| 484 | kind("kind"), |
| 485 | track_id("trackId"), |
| 486 | transport_id("transportId"), |
| 487 | codec_id("codecId"), |
| 488 | media_type("mediaType") {} |
| 489 |
| 490 | RTCRTPStreamStats::RTCRTPStreamStats(const RTCRTPStreamStats& other) = default; |
| 491 |
| 492 | RTCRTPStreamStats::~RTCRTPStreamStats() {} |
| 493 |
| 494 | // clang-format off |
| 495 | WEBRTC_RTCSTATS_IMPL( |
| 496 | RTCReceivedRtpStreamStats, RTCRTPStreamStats, "received-rtp", |
| 497 | &jitter, |
| 498 | &packets_lost) |
| 499 | // clang-format on |
| 500 |
| 501 | RTCReceivedRtpStreamStats::RTCReceivedRtpStreamStats(const std::string&& id, |
| 502 | int64_t timestamp_us) |
| 503 | : RTCReceivedRtpStreamStats(std::string(id), timestamp_us) {} |
| 504 |
| 505 | RTCReceivedRtpStreamStats::RTCReceivedRtpStreamStats(std::string&& id, |
| 506 | int64_t timestamp_us) |
| 507 | : RTCRTPStreamStats(std::move(id), timestamp_us), |
| 508 | jitter("jitter"), |
| 509 | packets_lost("packetsLost") {} |
| 510 |
| 511 | RTCReceivedRtpStreamStats::RTCReceivedRtpStreamStats( |
| 512 | const RTCReceivedRtpStreamStats& other) = default; |
| 513 |
| 514 | RTCReceivedRtpStreamStats::~RTCReceivedRtpStreamStats() {} |
| 515 |
| 516 | // clang-format off |
| 517 | WEBRTC_RTCSTATS_IMPL( |
| 518 | RTCSentRtpStreamStats, RTCRTPStreamStats, "sent-rtp", |
| 519 | &packets_sent, |
| 520 | &bytes_sent) |
| 521 | // clang-format on |
| 522 |
| 523 | RTCSentRtpStreamStats::RTCSentRtpStreamStats(const std::string&& id, |
| 524 | int64_t timestamp_us) |
| 525 | : RTCSentRtpStreamStats(std::string(id), timestamp_us) {} |
| 526 |
| 527 | RTCSentRtpStreamStats::RTCSentRtpStreamStats(std::string&& id, |
| 528 | int64_t timestamp_us) |
| 529 | : RTCRTPStreamStats(std::move(id), timestamp_us), |
| 530 | packets_sent("packetsSent"), |
| 531 | bytes_sent("bytesSent") {} |
| 532 |
| 533 | RTCSentRtpStreamStats::RTCSentRtpStreamStats( |
| 534 | const RTCSentRtpStreamStats& other) = default; |
| 535 |
| 536 | RTCSentRtpStreamStats::~RTCSentRtpStreamStats() {} |
| 537 |
| 538 | // clang-format off |
| 539 | WEBRTC_RTCSTATS_IMPL( |
| 540 | RTCInboundRTPStreamStats, RTCReceivedRtpStreamStats, "inbound-rtp", |
| 541 | &track_identifier, |
| 542 | &mid, |
| 543 | &remote_id, |
| 544 | &packets_received, |
| 545 | &packets_discarded, |
| 546 | &fec_packets_received, |
| 547 | &fec_packets_discarded, |
| 548 | &bytes_received, |
| 549 | &header_bytes_received, |
| 550 | &last_packet_received_timestamp, |
| 551 | &jitter_buffer_delay, |
| 552 | &jitter_buffer_target_delay, |
| 553 | &jitter_buffer_minimum_delay, |
| 554 | &jitter_buffer_emitted_count, |
| 555 | &total_samples_received, |
| 556 | &concealed_samples, |
| 557 | &silent_concealed_samples, |
| 558 | &concealment_events, |
| 559 | &inserted_samples_for_deceleration, |
| 560 | &removed_samples_for_acceleration, |
| 561 | &audio_level, |
| 562 | &total_audio_energy, |
| 563 | &total_samples_duration, |
| 564 | &frames_received, |
| 565 | &frame_width, |
| 566 | &frame_height, |
| 567 | &frames_per_second, |
| 568 | &frames_decoded, |
| 569 | &key_frames_decoded, |
| 570 | &frames_dropped, |
| 571 | &total_decode_time, |
| 572 | &total_processing_delay, |
| 573 | &total_assembly_time, |
| 574 | &frames_assembled_from_multiple_packets, |
| 575 | &total_inter_frame_delay, |
| 576 | &total_squared_inter_frame_delay, |
| 577 | &pause_count, |
| 578 | &total_pauses_duration, |
| 579 | &freeze_count, |
| 580 | &total_freezes_duration, |
| 581 | &content_type, |
| 582 | &estimated_playout_timestamp, |
| 583 | &decoder_implementation, |
| 584 | &fir_count, |
| 585 | &pli_count, |
| 586 | &nack_count, |
| 587 | &qp_sum, |
| 588 | &goog_timing_frame_info, |
| 589 | &jitter_buffer_flushes, |
| 590 | &delayed_packet_outage_samples, |
| 591 | &relative_packet_arrival_delay, |
| 592 | &interruption_count, |
| 593 | &total_interruption_duration, |
| 594 | &min_playout_delay) |
| 595 | // clang-format on |
| 596 |
| 597 | RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id, |
| 598 | int64_t timestamp_us) |
| 599 | : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {} |
| 600 |
| 601 | RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id, |
| 602 | int64_t timestamp_us) |
| 603 | : RTCReceivedRtpStreamStats(std::move(id), timestamp_us), |
| 604 | track_identifier("trackIdentifier"), |
| 605 | mid("mid"), |
| 606 | remote_id("remoteId"), |
| 607 | packets_received("packetsReceived"), |
| 608 | packets_discarded("packetsDiscarded"), |
| 609 | fec_packets_received("fecPacketsReceived"), |
| 610 | fec_packets_discarded("fecPacketsDiscarded"), |
| 611 | bytes_received("bytesReceived"), |
| 612 | header_bytes_received("headerBytesReceived"), |
| 613 | last_packet_received_timestamp("lastPacketReceivedTimestamp"), |
| 614 | jitter_buffer_delay("jitterBufferDelay"), |
| 615 | jitter_buffer_target_delay("jitterBufferTargetDelay"), |
| 616 | jitter_buffer_minimum_delay("jitterBufferMinimumDelay"), |
| 617 | jitter_buffer_emitted_count("jitterBufferEmittedCount"), |
| 618 | total_samples_received("totalSamplesReceived"), |
| 619 | concealed_samples("concealedSamples"), |
| 620 | silent_concealed_samples("silentConcealedSamples"), |
| 621 | concealment_events("concealmentEvents"), |
| 622 | inserted_samples_for_deceleration("insertedSamplesForDeceleration"), |
| 623 | removed_samples_for_acceleration("removedSamplesForAcceleration"), |
| 624 | audio_level("audioLevel"), |
| 625 | total_audio_energy("totalAudioEnergy"), |
| 626 | total_samples_duration("totalSamplesDuration"), |
| 627 | frames_received("framesReceived"), |
| 628 | frame_width("frameWidth"), |
| 629 | frame_height("frameHeight"), |
| 630 | frames_per_second("framesPerSecond"), |
| 631 | frames_decoded("framesDecoded"), |
| 632 | key_frames_decoded("keyFramesDecoded"), |
| 633 | frames_dropped("framesDropped"), |
| 634 | total_decode_time("totalDecodeTime"), |
| 635 | total_processing_delay("totalProcessingDelay"), |
| 636 | total_assembly_time("totalAssemblyTime"), |
| 637 | frames_assembled_from_multiple_packets( |
| 638 | "framesAssembledFromMultiplePackets"), |
| 639 | total_inter_frame_delay("totalInterFrameDelay"), |
| 640 | total_squared_inter_frame_delay("totalSquaredInterFrameDelay"), |
| 641 | pause_count("pauseCount"), |
| 642 | total_pauses_duration("totalPausesDuration"), |
| 643 | freeze_count("freezeCount"), |
| 644 | total_freezes_duration("totalFreezesDuration"), |
| 645 | content_type("contentType"), |
| 646 | estimated_playout_timestamp("estimatedPlayoutTimestamp"), |
| 647 | decoder_implementation("decoderImplementation"), |
| 648 | fir_count("firCount"), |
| 649 | pli_count("pliCount"), |
| 650 | nack_count("nackCount"), |
| 651 | qp_sum("qpSum"), |
| 652 | goog_timing_frame_info("googTimingFrameInfo"), |
| 653 | jitter_buffer_flushes( |
| 654 | "jitterBufferFlushes", |
| 655 | {NonStandardGroupId::kRtcAudioJitterBufferMaxPackets}), |
| 656 | delayed_packet_outage_samples( |
| 657 | "delayedPacketOutageSamples", |
| 658 | {NonStandardGroupId::kRtcAudioJitterBufferMaxPackets, |
| 659 | NonStandardGroupId::kRtcStatsRelativePacketArrivalDelay}), |
| 660 | relative_packet_arrival_delay( |
| 661 | "relativePacketArrivalDelay", |
| 662 | {NonStandardGroupId::kRtcStatsRelativePacketArrivalDelay}), |
| 663 | interruption_count("interruptionCount"), |
| 664 | total_interruption_duration("totalInterruptionDuration"), |
| 665 | min_playout_delay("minPlayoutDelay") {} |
| 666 |
| 667 | RTCInboundRTPStreamStats::RTCInboundRTPStreamStats( |
| 668 | const RTCInboundRTPStreamStats& other) = default; |
| 669 | RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {} |
| 670 |
| 671 | // clang-format off |
| 672 | WEBRTC_RTCSTATS_IMPL( |
| 673 | RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp", |
| 674 | &media_source_id, |
| 675 | &remote_id, |
| 676 | &mid, |
| 677 | &rid, |
| 678 | &packets_sent, |
| 679 | &retransmitted_packets_sent, |
| 680 | &bytes_sent, |
| 681 | &header_bytes_sent, |
| 682 | &retransmitted_bytes_sent, |
| 683 | &target_bitrate, |
| 684 | &frames_encoded, |
| 685 | &key_frames_encoded, |
| 686 | &total_encode_time, |
| 687 | &total_encoded_bytes_target, |
| 688 | &frame_width, |
| 689 | &frame_height, |
| 690 | &frames_per_second, |
| 691 | &frames_sent, |
| 692 | &huge_frames_sent, |
| 693 | &total_packet_send_delay, |
| 694 | &quality_limitation_reason, |
| 695 | &quality_limitation_durations, |
| 696 | &quality_limitation_resolution_changes, |
| 697 | &content_type, |
| 698 | &encoder_implementation, |
| 699 | &fir_count, |
| 700 | &pli_count, |
| 701 | &nack_count, |
| 702 | &qp_sum, |
| 703 | &active) |
| 704 | // clang-format on |
| 705 |
| 706 | RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(const std::string& id, |
| 707 | int64_t timestamp_us) |
| 708 | : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {} |
| 709 |
| 710 | RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id, |
| 711 | int64_t timestamp_us) |
| 712 | : RTCRTPStreamStats(std::move(id), timestamp_us), |
| 713 | media_source_id("mediaSourceId"), |
| 714 | remote_id("remoteId"), |
| 715 | mid("mid"), |
| 716 | rid("rid"), |
| 717 | packets_sent("packetsSent"), |
| 718 | retransmitted_packets_sent("retransmittedPacketsSent"), |
| 719 | bytes_sent("bytesSent"), |
| 720 | header_bytes_sent("headerBytesSent"), |
| 721 | retransmitted_bytes_sent("retransmittedBytesSent"), |
| 722 | target_bitrate("targetBitrate"), |
| 723 | frames_encoded("framesEncoded"), |
| 724 | key_frames_encoded("keyFramesEncoded"), |
| 725 | total_encode_time("totalEncodeTime"), |
| 726 | total_encoded_bytes_target("totalEncodedBytesTarget"), |
| 727 | frame_width("frameWidth"), |
| 728 | frame_height("frameHeight"), |
| 729 | frames_per_second("framesPerSecond"), |
| 730 | frames_sent("framesSent"), |
| 731 | huge_frames_sent("hugeFramesSent"), |
| 732 | total_packet_send_delay("totalPacketSendDelay"), |
| 733 | quality_limitation_reason("qualityLimitationReason"), |
| 734 | quality_limitation_durations("qualityLimitationDurations"), |
| 735 | quality_limitation_resolution_changes( |
| 736 | "qualityLimitationResolutionChanges"), |
| 737 | content_type("contentType"), |
| 738 | encoder_implementation("encoderImplementation"), |
| 739 | fir_count("firCount"), |
| 740 | pli_count("pliCount"), |
| 741 | nack_count("nackCount"), |
| 742 | qp_sum("qpSum"), |
| 743 | active("active") {} |
| 744 |
| 745 | RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats( |
| 746 | const RTCOutboundRTPStreamStats& other) = default; |
| 747 |
| 748 | RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {} |
| 749 |
| 750 | // clang-format off |
| 751 | WEBRTC_RTCSTATS_IMPL( |
| 752 | RTCRemoteInboundRtpStreamStats, RTCReceivedRtpStreamStats, |
| 753 | "remote-inbound-rtp", |
| 754 | &local_id, |
| 755 | &round_trip_time, |
| 756 | &fraction_lost, |
| 757 | &total_round_trip_time, |
| 758 | &round_trip_time_measurements) |
| 759 | // clang-format on |
| 760 |
| 761 | RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats( |
| 762 | const std::string& id, |
| 763 | int64_t timestamp_us) |
| 764 | : RTCRemoteInboundRtpStreamStats(std::string(id), timestamp_us) {} |
| 765 |
| 766 | RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats( |
| 767 | std::string&& id, |
| 768 | int64_t timestamp_us) |
| 769 | : RTCReceivedRtpStreamStats(std::move(id), timestamp_us), |
| 770 | local_id("localId"), |
| 771 | round_trip_time("roundTripTime"), |
| 772 | fraction_lost("fractionLost"), |
| 773 | total_round_trip_time("totalRoundTripTime"), |
| 774 | round_trip_time_measurements("roundTripTimeMeasurements") {} |
| 775 |
| 776 | RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats( |
| 777 | const RTCRemoteInboundRtpStreamStats& other) = default; |
| 778 |
| 779 | RTCRemoteInboundRtpStreamStats::~RTCRemoteInboundRtpStreamStats() {} |
| 780 |
| 781 | // clang-format off |
| 782 | WEBRTC_RTCSTATS_IMPL( |
| 783 | RTCRemoteOutboundRtpStreamStats, RTCSentRtpStreamStats, |
| 784 | "remote-outbound-rtp", |
| 785 | &local_id, |
| 786 | &remote_timestamp, |
| 787 | &reports_sent, |
| 788 | &round_trip_time, |
| 789 | &round_trip_time_measurements, |
| 790 | &total_round_trip_time) |
| 791 | // clang-format on |
| 792 |
| 793 | RTCRemoteOutboundRtpStreamStats::RTCRemoteOutboundRtpStreamStats( |
| 794 | const std::string& id, |
| 795 | int64_t timestamp_us) |
| 796 | : RTCRemoteOutboundRtpStreamStats(std::string(id), timestamp_us) {} |
| 797 |
| 798 | RTCRemoteOutboundRtpStreamStats::RTCRemoteOutboundRtpStreamStats( |
| 799 | std::string&& id, |
| 800 | int64_t timestamp_us) |
| 801 | : RTCSentRtpStreamStats(std::move(id), timestamp_us), |
| 802 | local_id("localId"), |
| 803 | remote_timestamp("remoteTimestamp"), |
| 804 | reports_sent("reportsSent"), |
| 805 | round_trip_time("roundTripTime"), |
| 806 | round_trip_time_measurements("roundTripTimeMeasurements"), |
| 807 | total_round_trip_time("totalRoundTripTime") {} |
| 808 |
| 809 | RTCRemoteOutboundRtpStreamStats::RTCRemoteOutboundRtpStreamStats( |
| 810 | const RTCRemoteOutboundRtpStreamStats& other) = default; |
| 811 |
| 812 | RTCRemoteOutboundRtpStreamStats::~RTCRemoteOutboundRtpStreamStats() {} |
| 813 |
| 814 | // clang-format off |
| 815 | WEBRTC_RTCSTATS_IMPL(RTCMediaSourceStats, RTCStats, "parent-media-source", |
| 816 | &track_identifier, |
| 817 | &kind) |
| 818 | // clang-format on |
| 819 |
| 820 | RTCMediaSourceStats::RTCMediaSourceStats(const std::string& id, |
| 821 | int64_t timestamp_us) |
| 822 | : RTCMediaSourceStats(std::string(id), timestamp_us) {} |
| 823 |
| 824 | RTCMediaSourceStats::RTCMediaSourceStats(std::string&& id, int64_t timestamp_us) |
| 825 | : RTCStats(std::move(id), timestamp_us), |
| 826 | track_identifier("trackIdentifier"), |
| 827 | kind("kind") {} |
| 828 |
| 829 | RTCMediaSourceStats::RTCMediaSourceStats(const RTCMediaSourceStats& other) = |
| 830 | default; |
| 831 |
| 832 | RTCMediaSourceStats::~RTCMediaSourceStats() {} |
| 833 |
| 834 | // clang-format off |
| 835 | WEBRTC_RTCSTATS_IMPL(RTCAudioSourceStats, RTCMediaSourceStats, "media-source", |
| 836 | &audio_level, |
| 837 | &total_audio_energy, |
| 838 | &total_samples_duration, |
| 839 | &echo_return_loss, |
| 840 | &echo_return_loss_enhancement) |
| 841 | // clang-format on |
| 842 |
| 843 | RTCAudioSourceStats::RTCAudioSourceStats(const std::string& id, |
| 844 | int64_t timestamp_us) |
| 845 | : RTCAudioSourceStats(std::string(id), timestamp_us) {} |
| 846 |
| 847 | RTCAudioSourceStats::RTCAudioSourceStats(std::string&& id, int64_t timestamp_us) |
| 848 | : RTCMediaSourceStats(std::move(id), timestamp_us), |
| 849 | audio_level("audioLevel"), |
| 850 | total_audio_energy("totalAudioEnergy"), |
| 851 | total_samples_duration("totalSamplesDuration"), |
| 852 | echo_return_loss("echoReturnLoss"), |
| 853 | echo_return_loss_enhancement("echoReturnLossEnhancement") {} |
| 854 |
| 855 | RTCAudioSourceStats::RTCAudioSourceStats(const RTCAudioSourceStats& other) = |
| 856 | default; |
| 857 |
| 858 | RTCAudioSourceStats::~RTCAudioSourceStats() {} |
| 859 |
| 860 | // clang-format off |
| 861 | WEBRTC_RTCSTATS_IMPL(RTCVideoSourceStats, RTCMediaSourceStats, "media-source", |
| 862 | &width, |
| 863 | &height, |
| 864 | &frames, |
| 865 | &frames_per_second) |
| 866 | // clang-format on |
| 867 |
| 868 | RTCVideoSourceStats::RTCVideoSourceStats(const std::string& id, |
| 869 | int64_t timestamp_us) |
| 870 | : RTCVideoSourceStats(std::string(id), timestamp_us) {} |
| 871 |
| 872 | RTCVideoSourceStats::RTCVideoSourceStats(std::string&& id, int64_t timestamp_us) |
| 873 | : RTCMediaSourceStats(std::move(id), timestamp_us), |
| 874 | width("width"), |
| 875 | height("height"), |
| 876 | frames("frames"), |
| 877 | frames_per_second("framesPerSecond") {} |
| 878 |
| 879 | RTCVideoSourceStats::RTCVideoSourceStats(const RTCVideoSourceStats& other) = |
| 880 | default; |
| 881 |
| 882 | RTCVideoSourceStats::~RTCVideoSourceStats() {} |
| 883 |
| 884 | // clang-format off |
| 885 | WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport", |
| 886 | &bytes_sent, |
| 887 | &packets_sent, |
| 888 | &bytes_received, |
| 889 | &packets_received, |
| 890 | &rtcp_transport_stats_id, |
| 891 | &dtls_state, |
| 892 | &selected_candidate_pair_id, |
| 893 | &local_certificate_id, |
| 894 | &remote_certificate_id, |
| 895 | &tls_version, |
| 896 | &dtls_cipher, |
| 897 | &dtls_role, |
| 898 | &srtp_cipher, |
| 899 | &selected_candidate_pair_changes, |
| 900 | &ice_role, |
| 901 | &ice_local_username_fragment, |
| 902 | &ice_state) |
| 903 | // clang-format on |
| 904 |
| 905 | RTCTransportStats::RTCTransportStats(const std::string& id, |
| 906 | int64_t timestamp_us) |
| 907 | : RTCTransportStats(std::string(id), timestamp_us) {} |
| 908 |
| 909 | RTCTransportStats::RTCTransportStats(std::string&& id, int64_t timestamp_us) |
| 910 | : RTCStats(std::move(id), timestamp_us), |
| 911 | bytes_sent("bytesSent"), |
| 912 | packets_sent("packetsSent"), |
| 913 | bytes_received("bytesReceived"), |
| 914 | packets_received("packetsReceived"), |
| 915 | rtcp_transport_stats_id("rtcpTransportStatsId"), |
| 916 | dtls_state("dtlsState"), |
| 917 | selected_candidate_pair_id("selectedCandidatePairId"), |
| 918 | local_certificate_id("localCertificateId"), |
| 919 | remote_certificate_id("remoteCertificateId"), |
| 920 | tls_version("tlsVersion"), |
| 921 | dtls_cipher("dtlsCipher"), |
| 922 | dtls_role("dtlsRole"), |
| 923 | srtp_cipher("srtpCipher"), |
| 924 | selected_candidate_pair_changes("selectedCandidatePairChanges"), |
| 925 | ice_role("iceRole"), |
| 926 | ice_local_username_fragment("iceLocalUsernameFragment"), |
| 927 | ice_state("iceState") {} |
| 928 |
| 929 | RTCTransportStats::RTCTransportStats(const RTCTransportStats& other) = default; |
| 930 |
| 931 | RTCTransportStats::~RTCTransportStats() {} |
| 932 |
| 933 | } // namespace webrtc |
| 934 |