blob: ccf2574a8e733164e648dbb9d122dccda3d06a01 [file] [log] [blame]
hbosd565b732016-08-30 14:04:35 -07001/*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "api/stats/rtcstats_objects.h"
hbosd565b732016-08-30 14:04:35 -070012
Yves Gerey3e707812018-11-28 16:47:49 +010013#include <utility>
14
15#include "rtc_base/checks.h"
16
hbosd565b732016-08-30 14:04:35 -070017namespace webrtc {
18
agrieve26622d32017-08-08 10:48:15 -070019const char* const RTCDataChannelState::kConnecting = "connecting";
20const char* const RTCDataChannelState::kOpen = "open";
21const char* const RTCDataChannelState::kClosing = "closing";
22const char* const RTCDataChannelState::kClosed = "closed";
hboscc555c52016-10-18 12:48:31 -070023
agrieve26622d32017-08-08 10:48:15 -070024const char* const RTCStatsIceCandidatePairState::kFrozen = "frozen";
25const char* const RTCStatsIceCandidatePairState::kWaiting = "waiting";
26const char* const RTCStatsIceCandidatePairState::kInProgress = "in-progress";
27const char* const RTCStatsIceCandidatePairState::kFailed = "failed";
28const char* const RTCStatsIceCandidatePairState::kSucceeded = "succeeded";
hbosc47a0c32016-10-11 14:54:49 -070029
30// Strings defined in https://tools.ietf.org/html/rfc5245.
agrieve26622d32017-08-08 10:48:15 -070031const char* const RTCIceCandidateType::kHost = "host";
32const char* const RTCIceCandidateType::kSrflx = "srflx";
33const char* const RTCIceCandidateType::kPrflx = "prflx";
34const char* const RTCIceCandidateType::kRelay = "relay";
hbosab9f6e42016-10-07 02:18:47 -070035
agrieve26622d32017-08-08 10:48:15 -070036const char* const RTCDtlsTransportState::kNew = "new";
37const char* const RTCDtlsTransportState::kConnecting = "connecting";
38const char* const RTCDtlsTransportState::kConnected = "connected";
39const char* const RTCDtlsTransportState::kClosed = "closed";
40const char* const RTCDtlsTransportState::kFailed = "failed";
hbos7064d592017-01-16 07:38:02 -080041
agrieve26622d32017-08-08 10:48:15 -070042const char* const RTCMediaStreamTrackKind::kAudio = "audio";
43const char* const RTCMediaStreamTrackKind::kVideo = "video";
hbos160e4a72017-01-17 02:53:23 -080044
Gary Liu37e489c2017-11-21 10:49:36 -080045// https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype
46const char* const RTCNetworkType::kBluetooth = "bluetooth";
47const char* const RTCNetworkType::kCellular = "cellular";
48const char* const RTCNetworkType::kEthernet = "ethernet";
49const char* const RTCNetworkType::kWifi = "wifi";
50const char* const RTCNetworkType::kWimax = "wimax";
51const char* const RTCNetworkType::kVpn = "vpn";
52const char* const RTCNetworkType::kUnknown = "unknown";
53
Steve Antond6a5cbd2017-08-18 09:40:25 -070054// clang-format off
hbos2fa7c672016-10-24 04:00:05 -070055WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
56 &fingerprint,
57 &fingerprint_algorithm,
58 &base64_certificate,
Nico Weber22f99252019-02-20 10:13:16 -050059 &issuer_certificate_id)
Steve Antond6a5cbd2017-08-18 09:40:25 -070060// clang-format on
hbos2fa7c672016-10-24 04:00:05 -070061
Yves Gerey665174f2018-06-19 15:03:05 +020062RTCCertificateStats::RTCCertificateStats(const std::string& id,
63 int64_t timestamp_us)
64 : RTCCertificateStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -070065
Yves Gerey665174f2018-06-19 15:03:05 +020066RTCCertificateStats::RTCCertificateStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -070067 : RTCStats(std::move(id), timestamp_us),
68 fingerprint("fingerprint"),
69 fingerprint_algorithm("fingerprintAlgorithm"),
70 base64_certificate("base64Certificate"),
Yves Gerey665174f2018-06-19 15:03:05 +020071 issuer_certificate_id("issuerCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -070072
Yves Gerey665174f2018-06-19 15:03:05 +020073RTCCertificateStats::RTCCertificateStats(const RTCCertificateStats& other)
hbos2fa7c672016-10-24 04:00:05 -070074 : RTCStats(other.id(), other.timestamp_us()),
75 fingerprint(other.fingerprint),
76 fingerprint_algorithm(other.fingerprint_algorithm),
77 base64_certificate(other.base64_certificate),
Yves Gerey665174f2018-06-19 15:03:05 +020078 issuer_certificate_id(other.issuer_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -070079
Yves Gerey665174f2018-06-19 15:03:05 +020080RTCCertificateStats::~RTCCertificateStats() {}
hbos2fa7c672016-10-24 04:00:05 -070081
Steve Antond6a5cbd2017-08-18 09:40:25 -070082// clang-format off
hbos0adb8282016-11-23 02:32:06 -080083WEBRTC_RTCSTATS_IMPL(RTCCodecStats, RTCStats, "codec",
84 &payload_type,
hbos13f54b22017-02-28 06:56:04 -080085 &mime_type,
hbos0adb8282016-11-23 02:32:06 -080086 &clock_rate,
87 &channels,
hbos13f54b22017-02-28 06:56:04 -080088 &sdp_fmtp_line,
Nico Weber22f99252019-02-20 10:13:16 -050089 &implementation)
Steve Antond6a5cbd2017-08-18 09:40:25 -070090// clang-format on
hbos0adb8282016-11-23 02:32:06 -080091
Yves Gerey665174f2018-06-19 15:03:05 +020092RTCCodecStats::RTCCodecStats(const std::string& id, int64_t timestamp_us)
93 : RTCCodecStats(std::string(id), timestamp_us) {}
hbos0adb8282016-11-23 02:32:06 -080094
Yves Gerey665174f2018-06-19 15:03:05 +020095RTCCodecStats::RTCCodecStats(std::string&& id, int64_t timestamp_us)
hbos0adb8282016-11-23 02:32:06 -080096 : RTCStats(std::move(id), timestamp_us),
97 payload_type("payloadType"),
hbos13f54b22017-02-28 06:56:04 -080098 mime_type("mimeType"),
hbos0adb8282016-11-23 02:32:06 -080099 clock_rate("clockRate"),
100 channels("channels"),
hbos13f54b22017-02-28 06:56:04 -0800101 sdp_fmtp_line("sdpFmtpLine"),
Yves Gerey665174f2018-06-19 15:03:05 +0200102 implementation("implementation") {}
hbos0adb8282016-11-23 02:32:06 -0800103
Yves Gerey665174f2018-06-19 15:03:05 +0200104RTCCodecStats::RTCCodecStats(const RTCCodecStats& other)
hbos0adb8282016-11-23 02:32:06 -0800105 : RTCStats(other.id(), other.timestamp_us()),
106 payload_type(other.payload_type),
hbos13f54b22017-02-28 06:56:04 -0800107 mime_type(other.mime_type),
hbos0adb8282016-11-23 02:32:06 -0800108 clock_rate(other.clock_rate),
109 channels(other.channels),
hbos13f54b22017-02-28 06:56:04 -0800110 sdp_fmtp_line(other.sdp_fmtp_line),
Yves Gerey665174f2018-06-19 15:03:05 +0200111 implementation(other.implementation) {}
hbos0adb8282016-11-23 02:32:06 -0800112
Yves Gerey665174f2018-06-19 15:03:05 +0200113RTCCodecStats::~RTCCodecStats() {}
hbos0adb8282016-11-23 02:32:06 -0800114
Steve Antond6a5cbd2017-08-18 09:40:25 -0700115// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700116WEBRTC_RTCSTATS_IMPL(RTCDataChannelStats, RTCStats, "data-channel",
117 &label,
118 &protocol,
119 &datachannelid,
120 &state,
121 &messages_sent,
122 &bytes_sent,
123 &messages_received,
Nico Weber22f99252019-02-20 10:13:16 -0500124 &bytes_received)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700125// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700126
Yves Gerey665174f2018-06-19 15:03:05 +0200127RTCDataChannelStats::RTCDataChannelStats(const std::string& id,
128 int64_t timestamp_us)
129 : RTCDataChannelStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700130
Yves Gerey665174f2018-06-19 15:03:05 +0200131RTCDataChannelStats::RTCDataChannelStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700132 : RTCStats(std::move(id), timestamp_us),
133 label("label"),
134 protocol("protocol"),
135 datachannelid("datachannelid"),
136 state("state"),
137 messages_sent("messagesSent"),
138 bytes_sent("bytesSent"),
139 messages_received("messagesReceived"),
Yves Gerey665174f2018-06-19 15:03:05 +0200140 bytes_received("bytesReceived") {}
hbos2fa7c672016-10-24 04:00:05 -0700141
Yves Gerey665174f2018-06-19 15:03:05 +0200142RTCDataChannelStats::RTCDataChannelStats(const RTCDataChannelStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700143 : RTCStats(other.id(), other.timestamp_us()),
144 label(other.label),
145 protocol(other.protocol),
146 datachannelid(other.datachannelid),
147 state(other.state),
148 messages_sent(other.messages_sent),
149 bytes_sent(other.bytes_sent),
150 messages_received(other.messages_received),
Yves Gerey665174f2018-06-19 15:03:05 +0200151 bytes_received(other.bytes_received) {}
hbos2fa7c672016-10-24 04:00:05 -0700152
Yves Gerey665174f2018-06-19 15:03:05 +0200153RTCDataChannelStats::~RTCDataChannelStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700154
Steve Antond6a5cbd2017-08-18 09:40:25 -0700155// clang-format off
hbosc47a0c32016-10-11 14:54:49 -0700156WEBRTC_RTCSTATS_IMPL(RTCIceCandidatePairStats, RTCStats, "candidate-pair",
157 &transport_id,
158 &local_candidate_id,
159 &remote_candidate_id,
160 &state,
161 &priority,
162 &nominated,
163 &writable,
164 &readable,
165 &bytes_sent,
166 &bytes_received,
hbos3168c7a2016-12-15 06:17:08 -0800167 &total_round_trip_time,
168 &current_round_trip_time,
hbosc47a0c32016-10-11 14:54:49 -0700169 &available_outgoing_bitrate,
170 &available_incoming_bitrate,
171 &requests_received,
172 &requests_sent,
173 &responses_received,
174 &responses_sent,
175 &retransmissions_received,
176 &retransmissions_sent,
177 &consent_requests_received,
178 &consent_requests_sent,
179 &consent_responses_received,
Nico Weber22f99252019-02-20 10:13:16 -0500180 &consent_responses_sent)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700181// clang-format on
hbosc47a0c32016-10-11 14:54:49 -0700182
Yves Gerey665174f2018-06-19 15:03:05 +0200183RTCIceCandidatePairStats::RTCIceCandidatePairStats(const std::string& id,
184 int64_t timestamp_us)
185 : RTCIceCandidatePairStats(std::string(id), timestamp_us) {}
hbosc47a0c32016-10-11 14:54:49 -0700186
Yves Gerey665174f2018-06-19 15:03:05 +0200187RTCIceCandidatePairStats::RTCIceCandidatePairStats(std::string&& id,
188 int64_t timestamp_us)
hbosc47a0c32016-10-11 14:54:49 -0700189 : RTCStats(std::move(id), timestamp_us),
190 transport_id("transportId"),
191 local_candidate_id("localCandidateId"),
192 remote_candidate_id("remoteCandidateId"),
193 state("state"),
194 priority("priority"),
195 nominated("nominated"),
196 writable("writable"),
197 readable("readable"),
198 bytes_sent("bytesSent"),
199 bytes_received("bytesReceived"),
hbos3168c7a2016-12-15 06:17:08 -0800200 total_round_trip_time("totalRoundTripTime"),
201 current_round_trip_time("currentRoundTripTime"),
hbosc47a0c32016-10-11 14:54:49 -0700202 available_outgoing_bitrate("availableOutgoingBitrate"),
203 available_incoming_bitrate("availableIncomingBitrate"),
204 requests_received("requestsReceived"),
205 requests_sent("requestsSent"),
206 responses_received("responsesReceived"),
207 responses_sent("responsesSent"),
208 retransmissions_received("retransmissionsReceived"),
209 retransmissions_sent("retransmissionsSent"),
210 consent_requests_received("consentRequestsReceived"),
211 consent_requests_sent("consentRequestsSent"),
212 consent_responses_received("consentResponsesReceived"),
Yves Gerey665174f2018-06-19 15:03:05 +0200213 consent_responses_sent("consentResponsesSent") {}
hbosc47a0c32016-10-11 14:54:49 -0700214
215RTCIceCandidatePairStats::RTCIceCandidatePairStats(
216 const RTCIceCandidatePairStats& other)
217 : RTCStats(other.id(), other.timestamp_us()),
218 transport_id(other.transport_id),
219 local_candidate_id(other.local_candidate_id),
220 remote_candidate_id(other.remote_candidate_id),
221 state(other.state),
222 priority(other.priority),
223 nominated(other.nominated),
224 writable(other.writable),
225 readable(other.readable),
226 bytes_sent(other.bytes_sent),
227 bytes_received(other.bytes_received),
hbos3168c7a2016-12-15 06:17:08 -0800228 total_round_trip_time(other.total_round_trip_time),
229 current_round_trip_time(other.current_round_trip_time),
hbosc47a0c32016-10-11 14:54:49 -0700230 available_outgoing_bitrate(other.available_outgoing_bitrate),
231 available_incoming_bitrate(other.available_incoming_bitrate),
232 requests_received(other.requests_received),
233 requests_sent(other.requests_sent),
234 responses_received(other.responses_received),
235 responses_sent(other.responses_sent),
236 retransmissions_received(other.retransmissions_received),
237 retransmissions_sent(other.retransmissions_sent),
238 consent_requests_received(other.consent_requests_received),
239 consent_requests_sent(other.consent_requests_sent),
240 consent_responses_received(other.consent_responses_received),
Yves Gerey665174f2018-06-19 15:03:05 +0200241 consent_responses_sent(other.consent_responses_sent) {}
hbosc47a0c32016-10-11 14:54:49 -0700242
Yves Gerey665174f2018-06-19 15:03:05 +0200243RTCIceCandidatePairStats::~RTCIceCandidatePairStats() {}
hbosc47a0c32016-10-11 14:54:49 -0700244
Steve Antond6a5cbd2017-08-18 09:40:25 -0700245// clang-format off
Henrik Boström1df1bf82018-03-20 13:24:20 +0100246WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "abstract-ice-candidate",
hbosb4e426e2017-01-02 09:59:31 -0800247 &transport_id,
hbosc3a2b7f2017-01-02 04:46:15 -0800248 &is_remote,
Gary Liu37e489c2017-11-21 10:49:36 -0800249 &network_type,
hbosab9f6e42016-10-07 02:18:47 -0700250 &ip,
251 &port,
252 &protocol,
Philipp Hancke95513752018-09-27 14:40:08 +0200253 &relay_protocol,
hbosab9f6e42016-10-07 02:18:47 -0700254 &candidate_type,
255 &priority,
hbosd17a5a72017-01-02 08:09:59 -0800256 &url,
Nico Weber22f99252019-02-20 10:13:16 -0500257 &deleted)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700258// clang-format on
hbosab9f6e42016-10-07 02:18:47 -0700259
Yves Gerey665174f2018-06-19 15:03:05 +0200260RTCIceCandidateStats::RTCIceCandidateStats(const std::string& id,
261 int64_t timestamp_us,
262 bool is_remote)
263 : RTCIceCandidateStats(std::string(id), timestamp_us, is_remote) {}
hbosab9f6e42016-10-07 02:18:47 -0700264
Gary Liu37e489c2017-11-21 10:49:36 -0800265RTCIceCandidateStats::RTCIceCandidateStats(std::string&& id,
266 int64_t timestamp_us,
267 bool is_remote)
hbosab9f6e42016-10-07 02:18:47 -0700268 : RTCStats(std::move(id), timestamp_us),
hbosb4e426e2017-01-02 09:59:31 -0800269 transport_id("transportId"),
hbosc3a2b7f2017-01-02 04:46:15 -0800270 is_remote("isRemote", is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800271 network_type("networkType"),
hbosab9f6e42016-10-07 02:18:47 -0700272 ip("ip"),
273 port("port"),
274 protocol("protocol"),
Philipp Hancke95513752018-09-27 14:40:08 +0200275 relay_protocol("relayProtocol"),
hbosab9f6e42016-10-07 02:18:47 -0700276 candidate_type("candidateType"),
277 priority("priority"),
hbosd17a5a72017-01-02 08:09:59 -0800278 url("url"),
Gary Liu37e489c2017-11-21 10:49:36 -0800279 deleted("deleted", false) {}
hbosab9f6e42016-10-07 02:18:47 -0700280
281RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
282 : RTCStats(other.id(), other.timestamp_us()),
hbosb4e426e2017-01-02 09:59:31 -0800283 transport_id(other.transport_id),
hbosc3a2b7f2017-01-02 04:46:15 -0800284 is_remote(other.is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800285 network_type(other.network_type),
hbosab9f6e42016-10-07 02:18:47 -0700286 ip(other.ip),
287 port(other.port),
288 protocol(other.protocol),
Philipp Hancke95513752018-09-27 14:40:08 +0200289 relay_protocol(other.relay_protocol),
hbosab9f6e42016-10-07 02:18:47 -0700290 candidate_type(other.candidate_type),
291 priority(other.priority),
hbosd17a5a72017-01-02 08:09:59 -0800292 url(other.url),
Gary Liu37e489c2017-11-21 10:49:36 -0800293 deleted(other.deleted) {}
hbosab9f6e42016-10-07 02:18:47 -0700294
Yves Gerey665174f2018-06-19 15:03:05 +0200295RTCIceCandidateStats::~RTCIceCandidateStats() {}
hbosab9f6e42016-10-07 02:18:47 -0700296
297const char RTCLocalIceCandidateStats::kType[] = "local-candidate";
298
Yves Gerey665174f2018-06-19 15:03:05 +0200299RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(const std::string& id,
300 int64_t timestamp_us)
301 : RTCIceCandidateStats(id, timestamp_us, false) {}
hbosab9f6e42016-10-07 02:18:47 -0700302
Yves Gerey665174f2018-06-19 15:03:05 +0200303RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(std::string&& id,
304 int64_t timestamp_us)
305 : RTCIceCandidateStats(std::move(id), timestamp_us, false) {}
hbosab9f6e42016-10-07 02:18:47 -0700306
Henrik Boström1df1bf82018-03-20 13:24:20 +0100307std::unique_ptr<RTCStats> RTCLocalIceCandidateStats::copy() const {
308 return std::unique_ptr<RTCStats>(new RTCLocalIceCandidateStats(*this));
309}
310
hbosab9f6e42016-10-07 02:18:47 -0700311const char* RTCLocalIceCandidateStats::type() const {
312 return kType;
313}
314
315const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate";
316
Yves Gerey665174f2018-06-19 15:03:05 +0200317RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(const std::string& id,
318 int64_t timestamp_us)
319 : RTCIceCandidateStats(id, timestamp_us, true) {}
hbosab9f6e42016-10-07 02:18:47 -0700320
Yves Gerey665174f2018-06-19 15:03:05 +0200321RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(std::string&& id,
322 int64_t timestamp_us)
323 : RTCIceCandidateStats(std::move(id), timestamp_us, true) {}
hbosab9f6e42016-10-07 02:18:47 -0700324
Henrik Boström1df1bf82018-03-20 13:24:20 +0100325std::unique_ptr<RTCStats> RTCRemoteIceCandidateStats::copy() const {
326 return std::unique_ptr<RTCStats>(new RTCRemoteIceCandidateStats(*this));
327}
328
hbosab9f6e42016-10-07 02:18:47 -0700329const char* RTCRemoteIceCandidateStats::type() const {
330 return kType;
331}
332
Steve Antond6a5cbd2017-08-18 09:40:25 -0700333// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800334WEBRTC_RTCSTATS_IMPL(RTCMediaStreamStats, RTCStats, "stream",
335 &stream_identifier,
Nico Weber22f99252019-02-20 10:13:16 -0500336 &track_ids)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700337// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800338
Yves Gerey665174f2018-06-19 15:03:05 +0200339RTCMediaStreamStats::RTCMediaStreamStats(const std::string& id,
340 int64_t timestamp_us)
341 : RTCMediaStreamStats(std::string(id), timestamp_us) {}
hbos09bc1282016-11-08 06:29:22 -0800342
Yves Gerey665174f2018-06-19 15:03:05 +0200343RTCMediaStreamStats::RTCMediaStreamStats(std::string&& id, int64_t timestamp_us)
hbos09bc1282016-11-08 06:29:22 -0800344 : RTCStats(std::move(id), timestamp_us),
345 stream_identifier("streamIdentifier"),
Yves Gerey665174f2018-06-19 15:03:05 +0200346 track_ids("trackIds") {}
hbos09bc1282016-11-08 06:29:22 -0800347
Yves Gerey665174f2018-06-19 15:03:05 +0200348RTCMediaStreamStats::RTCMediaStreamStats(const RTCMediaStreamStats& other)
hbos09bc1282016-11-08 06:29:22 -0800349 : RTCStats(other.id(), other.timestamp_us()),
350 stream_identifier(other.stream_identifier),
Yves Gerey665174f2018-06-19 15:03:05 +0200351 track_ids(other.track_ids) {}
hbos09bc1282016-11-08 06:29:22 -0800352
Yves Gerey665174f2018-06-19 15:03:05 +0200353RTCMediaStreamStats::~RTCMediaStreamStats() {}
hbos09bc1282016-11-08 06:29:22 -0800354
Steve Antond6a5cbd2017-08-18 09:40:25 -0700355// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800356WEBRTC_RTCSTATS_IMPL(RTCMediaStreamTrackStats, RTCStats, "track",
zsteine76bd3a2017-07-14 12:17:49 -0700357 &track_identifier,
358 &remote_source,
359 &ended,
360 &detached,
361 &kind,
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200362 &jitter_buffer_delay,
Chen Xing0acffb52019-01-15 15:46:29 +0100363 &jitter_buffer_emitted_count,
zsteine76bd3a2017-07-14 12:17:49 -0700364 &frame_width,
365 &frame_height,
366 &frames_per_second,
367 &frames_sent,
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100368 &huge_frames_sent,
zsteine76bd3a2017-07-14 12:17:49 -0700369 &frames_received,
370 &frames_decoded,
371 &frames_dropped,
372 &frames_corrupted,
373 &partial_frames_lost,
374 &full_frames_lost,
375 &audio_level,
376 &total_audio_energy,
zsteine76bd3a2017-07-14 12:17:49 -0700377 &echo_return_loss,
Steve Anton2dbc69f2017-08-24 17:15:13 -0700378 &echo_return_loss_enhancement,
379 &total_samples_received,
380 &total_samples_duration,
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200381 &concealed_samples,
Ruslan Burakov8af88962018-11-22 17:21:10 +0100382 &concealment_events,
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100383 &jitter_buffer_flushes,
Sergey Silkin02371062019-01-31 16:45:42 +0100384 &delayed_packet_outage_samples,
Jakob Ivarsson232b3fd2019-03-06 09:18:40 +0100385 &relative_packet_arrival_delay,
Sergey Silkin02371062019-01-31 16:45:42 +0100386 &freeze_count,
387 &pause_count,
388 &total_freezes_duration,
389 &total_pauses_duration,
390 &total_frames_duration,
Nico Weber22f99252019-02-20 10:13:16 -0500391 &sum_squared_frame_durations)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700392// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800393
Yves Gerey665174f2018-06-19 15:03:05 +0200394RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(const std::string& id,
395 int64_t timestamp_us,
396 const char* kind)
397 : RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) {}
hbos09bc1282016-11-08 06:29:22 -0800398
zsteine76bd3a2017-07-14 12:17:49 -0700399RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(std::string&& id,
400 int64_t timestamp_us,
401 const char* kind)
hbos09bc1282016-11-08 06:29:22 -0800402 : RTCStats(std::move(id), timestamp_us),
403 track_identifier("trackIdentifier"),
404 remote_source("remoteSource"),
405 ended("ended"),
406 detached("detached"),
hbos160e4a72017-01-17 02:53:23 -0800407 kind("kind", kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200408 jitter_buffer_delay("jitterBufferDelay"),
Chen Xing0acffb52019-01-15 15:46:29 +0100409 jitter_buffer_emitted_count("jitterBufferEmittedCount"),
hbos09bc1282016-11-08 06:29:22 -0800410 frame_width("frameWidth"),
411 frame_height("frameHeight"),
412 frames_per_second("framesPerSecond"),
413 frames_sent("framesSent"),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100414 huge_frames_sent("hugeFramesSent"),
hbos09bc1282016-11-08 06:29:22 -0800415 frames_received("framesReceived"),
416 frames_decoded("framesDecoded"),
417 frames_dropped("framesDropped"),
418 frames_corrupted("framesCorrupted"),
419 partial_frames_lost("partialFramesLost"),
420 full_frames_lost("fullFramesLost"),
421 audio_level("audioLevel"),
zsteine76bd3a2017-07-14 12:17:49 -0700422 total_audio_energy("totalAudioEnergy"),
hbos09bc1282016-11-08 06:29:22 -0800423 echo_return_loss("echoReturnLoss"),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700424 echo_return_loss_enhancement("echoReturnLossEnhancement"),
425 total_samples_received("totalSamplesReceived"),
426 total_samples_duration("totalSamplesDuration"),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200427 concealed_samples("concealedSamples"),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100428 concealment_events("concealmentEvents"),
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100429 jitter_buffer_flushes("jitterBufferFlushes"),
Sergey Silkin02371062019-01-31 16:45:42 +0100430 delayed_packet_outage_samples("delayedPacketOutageSamples"),
Jakob Ivarsson232b3fd2019-03-06 09:18:40 +0100431 relative_packet_arrival_delay("relativePacketArrivalDelay"),
Sergey Silkin02371062019-01-31 16:45:42 +0100432 freeze_count("freezeCount"),
433 pause_count("pauseCount"),
434 total_freezes_duration("totalFreezesDuration"),
435 total_pauses_duration("totalPausesDuration"),
436 total_frames_duration("totalFramesDuration"),
437 sum_squared_frame_durations("sumOfSquaredFramesDuration") {
hbos160e4a72017-01-17 02:53:23 -0800438 RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
439 kind == RTCMediaStreamTrackKind::kVideo);
hbos09bc1282016-11-08 06:29:22 -0800440}
441
442RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
443 const RTCMediaStreamTrackStats& other)
444 : RTCStats(other.id(), other.timestamp_us()),
445 track_identifier(other.track_identifier),
446 remote_source(other.remote_source),
447 ended(other.ended),
448 detached(other.detached),
hbos160e4a72017-01-17 02:53:23 -0800449 kind(other.kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200450 jitter_buffer_delay(other.jitter_buffer_delay),
Chen Xing0acffb52019-01-15 15:46:29 +0100451 jitter_buffer_emitted_count(other.jitter_buffer_emitted_count),
hbos09bc1282016-11-08 06:29:22 -0800452 frame_width(other.frame_width),
453 frame_height(other.frame_height),
454 frames_per_second(other.frames_per_second),
455 frames_sent(other.frames_sent),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100456 huge_frames_sent(other.huge_frames_sent),
hbos09bc1282016-11-08 06:29:22 -0800457 frames_received(other.frames_received),
458 frames_decoded(other.frames_decoded),
459 frames_dropped(other.frames_dropped),
460 frames_corrupted(other.frames_corrupted),
461 partial_frames_lost(other.partial_frames_lost),
462 full_frames_lost(other.full_frames_lost),
463 audio_level(other.audio_level),
zsteine76bd3a2017-07-14 12:17:49 -0700464 total_audio_energy(other.total_audio_energy),
hbos09bc1282016-11-08 06:29:22 -0800465 echo_return_loss(other.echo_return_loss),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700466 echo_return_loss_enhancement(other.echo_return_loss_enhancement),
467 total_samples_received(other.total_samples_received),
468 total_samples_duration(other.total_samples_duration),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200469 concealed_samples(other.concealed_samples),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100470 concealment_events(other.concealment_events),
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100471 jitter_buffer_flushes(other.jitter_buffer_flushes),
Sergey Silkin02371062019-01-31 16:45:42 +0100472 delayed_packet_outage_samples(other.delayed_packet_outage_samples),
Jakob Ivarsson232b3fd2019-03-06 09:18:40 +0100473 relative_packet_arrival_delay(other.relative_packet_arrival_delay),
Sergey Silkin02371062019-01-31 16:45:42 +0100474 freeze_count(other.freeze_count),
475 pause_count(other.pause_count),
476 total_freezes_duration(other.total_freezes_duration),
477 total_pauses_duration(other.total_pauses_duration),
478 total_frames_duration(other.total_frames_duration),
479 sum_squared_frame_durations(other.sum_squared_frame_durations) {}
hbos09bc1282016-11-08 06:29:22 -0800480
Yves Gerey665174f2018-06-19 15:03:05 +0200481RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {}
hbos09bc1282016-11-08 06:29:22 -0800482
Steve Antond6a5cbd2017-08-18 09:40:25 -0700483// clang-format off
hbosfc5e0502016-10-06 02:06:10 -0700484WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
485 &data_channels_opened,
Nico Weber22f99252019-02-20 10:13:16 -0500486 &data_channels_closed)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700487// clang-format on
hbosd565b732016-08-30 14:04:35 -0700488
Yves Gerey665174f2018-06-19 15:03:05 +0200489RTCPeerConnectionStats::RTCPeerConnectionStats(const std::string& id,
490 int64_t timestamp_us)
491 : RTCPeerConnectionStats(std::string(id), timestamp_us) {}
hbosd565b732016-08-30 14:04:35 -0700492
Yves Gerey665174f2018-06-19 15:03:05 +0200493RTCPeerConnectionStats::RTCPeerConnectionStats(std::string&& id,
494 int64_t timestamp_us)
hbos0e6758d2016-08-31 07:57:36 -0700495 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700496 data_channels_opened("dataChannelsOpened"),
Yves Gerey665174f2018-06-19 15:03:05 +0200497 data_channels_closed("dataChannelsClosed") {}
hbosd565b732016-08-30 14:04:35 -0700498
hbosfc5e0502016-10-06 02:06:10 -0700499RTCPeerConnectionStats::RTCPeerConnectionStats(
500 const RTCPeerConnectionStats& other)
501 : RTCStats(other.id(), other.timestamp_us()),
502 data_channels_opened(other.data_channels_opened),
Yves Gerey665174f2018-06-19 15:03:05 +0200503 data_channels_closed(other.data_channels_closed) {}
hbosfc5e0502016-10-06 02:06:10 -0700504
Yves Gerey665174f2018-06-19 15:03:05 +0200505RTCPeerConnectionStats::~RTCPeerConnectionStats() {}
hbosfc5e0502016-10-06 02:06:10 -0700506
Steve Antond6a5cbd2017-08-18 09:40:25 -0700507// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700508WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
509 &ssrc,
510 &associate_stats_id,
511 &is_remote,
512 &media_type,
Philipp Hancke3bc01662018-08-28 14:55:03 +0200513 &kind,
hbosb0ae9202017-01-27 06:35:16 -0800514 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700515 &transport_id,
516 &codec_id,
517 &fir_count,
518 &pli_count,
519 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800520 &sli_count,
Nico Weber22f99252019-02-20 10:13:16 -0500521 &qp_sum)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700522// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700523
Yves Gerey665174f2018-06-19 15:03:05 +0200524RTCRTPStreamStats::RTCRTPStreamStats(const std::string& id,
525 int64_t timestamp_us)
526 : RTCRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700527
Yves Gerey665174f2018-06-19 15:03:05 +0200528RTCRTPStreamStats::RTCRTPStreamStats(std::string&& id, int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700529 : RTCStats(std::move(id), timestamp_us),
530 ssrc("ssrc"),
531 associate_stats_id("associateStatsId"),
532 is_remote("isRemote", false),
533 media_type("mediaType"),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200534 kind("kind"),
hbosb0ae9202017-01-27 06:35:16 -0800535 track_id("trackId"),
hbos6ded1902016-11-01 01:50:46 -0700536 transport_id("transportId"),
537 codec_id("codecId"),
538 fir_count("firCount"),
539 pli_count("pliCount"),
540 nack_count("nackCount"),
hbos6769c492017-01-02 08:35:13 -0800541 sli_count("sliCount"),
Yves Gerey665174f2018-06-19 15:03:05 +0200542 qp_sum("qpSum") {}
hbos6ded1902016-11-01 01:50:46 -0700543
Yves Gerey665174f2018-06-19 15:03:05 +0200544RTCRTPStreamStats::RTCRTPStreamStats(const RTCRTPStreamStats& other)
hbos6ded1902016-11-01 01:50:46 -0700545 : RTCStats(other.id(), other.timestamp_us()),
546 ssrc(other.ssrc),
547 associate_stats_id(other.associate_stats_id),
548 is_remote(other.is_remote),
549 media_type(other.media_type),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200550 kind(other.kind),
hbosb0ae9202017-01-27 06:35:16 -0800551 track_id(other.track_id),
hbos6ded1902016-11-01 01:50:46 -0700552 transport_id(other.transport_id),
553 codec_id(other.codec_id),
554 fir_count(other.fir_count),
555 pli_count(other.pli_count),
556 nack_count(other.nack_count),
hbos6769c492017-01-02 08:35:13 -0800557 sli_count(other.sli_count),
Yves Gerey665174f2018-06-19 15:03:05 +0200558 qp_sum(other.qp_sum) {}
hbos6ded1902016-11-01 01:50:46 -0700559
Yves Gerey665174f2018-06-19 15:03:05 +0200560RTCRTPStreamStats::~RTCRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700561
Steve Antond6a5cbd2017-08-18 09:40:25 -0700562// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700563WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700564 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
565 &packets_received,
566 &bytes_received,
567 &packets_lost,
568 &jitter,
569 &fraction_lost,
hbosa7a9be12017-03-01 01:02:45 -0800570 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700571 &packets_discarded,
572 &packets_repaired,
573 &burst_packets_lost,
574 &burst_packets_discarded,
575 &burst_loss_count,
576 &burst_discard_count,
577 &burst_loss_rate,
578 &burst_discard_rate,
579 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800580 &gap_discard_rate,
Nico Weber22f99252019-02-20 10:13:16 -0500581 &frames_decoded)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700582// clang-format on
hboseeafe942016-11-01 03:00:17 -0700583
Yves Gerey665174f2018-06-19 15:03:05 +0200584RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id,
585 int64_t timestamp_us)
586 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {}
hboseeafe942016-11-01 03:00:17 -0700587
Yves Gerey665174f2018-06-19 15:03:05 +0200588RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
589 int64_t timestamp_us)
hboseeafe942016-11-01 03:00:17 -0700590 : RTCRTPStreamStats(std::move(id), timestamp_us),
591 packets_received("packetsReceived"),
592 bytes_received("bytesReceived"),
593 packets_lost("packetsLost"),
594 jitter("jitter"),
595 fraction_lost("fractionLost"),
hbosa7a9be12017-03-01 01:02:45 -0800596 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700597 packets_discarded("packetsDiscarded"),
598 packets_repaired("packetsRepaired"),
599 burst_packets_lost("burstPacketsLost"),
600 burst_packets_discarded("burstPacketsDiscarded"),
601 burst_loss_count("burstLossCount"),
602 burst_discard_count("burstDiscardCount"),
603 burst_loss_rate("burstLossRate"),
604 burst_discard_rate("burstDiscardRate"),
605 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800606 gap_discard_rate("gapDiscardRate"),
Yves Gerey665174f2018-06-19 15:03:05 +0200607 frames_decoded("framesDecoded") {}
hboseeafe942016-11-01 03:00:17 -0700608
609RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
610 const RTCInboundRTPStreamStats& other)
611 : RTCRTPStreamStats(other),
612 packets_received(other.packets_received),
613 bytes_received(other.bytes_received),
614 packets_lost(other.packets_lost),
615 jitter(other.jitter),
616 fraction_lost(other.fraction_lost),
hbosa7a9be12017-03-01 01:02:45 -0800617 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700618 packets_discarded(other.packets_discarded),
619 packets_repaired(other.packets_repaired),
620 burst_packets_lost(other.burst_packets_lost),
621 burst_packets_discarded(other.burst_packets_discarded),
622 burst_loss_count(other.burst_loss_count),
623 burst_discard_count(other.burst_discard_count),
624 burst_loss_rate(other.burst_loss_rate),
625 burst_discard_rate(other.burst_discard_rate),
626 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800627 gap_discard_rate(other.gap_discard_rate),
Yves Gerey665174f2018-06-19 15:03:05 +0200628 frames_decoded(other.frames_decoded) {}
hboseeafe942016-11-01 03:00:17 -0700629
Yves Gerey665174f2018-06-19 15:03:05 +0200630RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {}
hboseeafe942016-11-01 03:00:17 -0700631
Steve Antond6a5cbd2017-08-18 09:40:25 -0700632// clang-format off
hboseeafe942016-11-01 03:00:17 -0700633WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700634 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
635 &packets_sent,
636 &bytes_sent,
637 &target_bitrate,
Nico Weber22f99252019-02-20 10:13:16 -0500638 &frames_encoded)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700639// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700640
Yves Gerey665174f2018-06-19 15:03:05 +0200641RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(const std::string& id,
642 int64_t timestamp_us)
643 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700644
Yves Gerey665174f2018-06-19 15:03:05 +0200645RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id,
646 int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700647 : RTCRTPStreamStats(std::move(id), timestamp_us),
648 packets_sent("packetsSent"),
649 bytes_sent("bytesSent"),
650 target_bitrate("targetBitrate"),
Yves Gerey665174f2018-06-19 15:03:05 +0200651 frames_encoded("framesEncoded") {}
hbos6ded1902016-11-01 01:50:46 -0700652
653RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
654 const RTCOutboundRTPStreamStats& other)
655 : RTCRTPStreamStats(other),
656 packets_sent(other.packets_sent),
657 bytes_sent(other.bytes_sent),
658 target_bitrate(other.target_bitrate),
Yves Gerey665174f2018-06-19 15:03:05 +0200659 frames_encoded(other.frames_encoded) {}
hbos6ded1902016-11-01 01:50:46 -0700660
Yves Gerey665174f2018-06-19 15:03:05 +0200661RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700662
Steve Antond6a5cbd2017-08-18 09:40:25 -0700663// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700664WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
665 &bytes_sent,
666 &bytes_received,
667 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800668 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700669 &selected_candidate_pair_id,
670 &local_certificate_id,
Nico Weber22f99252019-02-20 10:13:16 -0500671 &remote_certificate_id)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700672// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700673
Yves Gerey665174f2018-06-19 15:03:05 +0200674RTCTransportStats::RTCTransportStats(const std::string& id,
675 int64_t timestamp_us)
676 : RTCTransportStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700677
Yves Gerey665174f2018-06-19 15:03:05 +0200678RTCTransportStats::RTCTransportStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700679 : RTCStats(std::move(id), timestamp_us),
680 bytes_sent("bytesSent"),
681 bytes_received("bytesReceived"),
682 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800683 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700684 selected_candidate_pair_id("selectedCandidatePairId"),
685 local_certificate_id("localCertificateId"),
Yves Gerey665174f2018-06-19 15:03:05 +0200686 remote_certificate_id("remoteCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -0700687
Yves Gerey665174f2018-06-19 15:03:05 +0200688RTCTransportStats::RTCTransportStats(const RTCTransportStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700689 : RTCStats(other.id(), other.timestamp_us()),
690 bytes_sent(other.bytes_sent),
691 bytes_received(other.bytes_received),
692 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800693 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700694 selected_candidate_pair_id(other.selected_candidate_pair_id),
695 local_certificate_id(other.local_certificate_id),
Yves Gerey665174f2018-06-19 15:03:05 +0200696 remote_certificate_id(other.remote_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -0700697
Yves Gerey665174f2018-06-19 15:03:05 +0200698RTCTransportStats::~RTCTransportStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700699
hbosd565b732016-08-30 14:04:35 -0700700} // namespace webrtc