blob: 69b5e0af8baea58b1e7037c82ac4cc7a94a7d765 [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
Jakob Ivarsson758d9462019-03-19 15:38:49 +010017#include "api/stats/rtc_stats.h"
18
hbosd565b732016-08-30 14:04:35 -070019namespace webrtc {
20
agrieve26622d32017-08-08 10:48:15 -070021const char* const RTCDataChannelState::kConnecting = "connecting";
22const char* const RTCDataChannelState::kOpen = "open";
23const char* const RTCDataChannelState::kClosing = "closing";
24const char* const RTCDataChannelState::kClosed = "closed";
hboscc555c52016-10-18 12:48:31 -070025
agrieve26622d32017-08-08 10:48:15 -070026const char* const RTCStatsIceCandidatePairState::kFrozen = "frozen";
27const char* const RTCStatsIceCandidatePairState::kWaiting = "waiting";
28const char* const RTCStatsIceCandidatePairState::kInProgress = "in-progress";
29const char* const RTCStatsIceCandidatePairState::kFailed = "failed";
30const char* const RTCStatsIceCandidatePairState::kSucceeded = "succeeded";
hbosc47a0c32016-10-11 14:54:49 -070031
32// Strings defined in https://tools.ietf.org/html/rfc5245.
agrieve26622d32017-08-08 10:48:15 -070033const char* const RTCIceCandidateType::kHost = "host";
34const char* const RTCIceCandidateType::kSrflx = "srflx";
35const char* const RTCIceCandidateType::kPrflx = "prflx";
36const char* const RTCIceCandidateType::kRelay = "relay";
hbosab9f6e42016-10-07 02:18:47 -070037
agrieve26622d32017-08-08 10:48:15 -070038const char* const RTCDtlsTransportState::kNew = "new";
39const char* const RTCDtlsTransportState::kConnecting = "connecting";
40const char* const RTCDtlsTransportState::kConnected = "connected";
41const char* const RTCDtlsTransportState::kClosed = "closed";
42const char* const RTCDtlsTransportState::kFailed = "failed";
hbos7064d592017-01-16 07:38:02 -080043
agrieve26622d32017-08-08 10:48:15 -070044const char* const RTCMediaStreamTrackKind::kAudio = "audio";
45const char* const RTCMediaStreamTrackKind::kVideo = "video";
hbos160e4a72017-01-17 02:53:23 -080046
Gary Liu37e489c2017-11-21 10:49:36 -080047// https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype
48const char* const RTCNetworkType::kBluetooth = "bluetooth";
49const char* const RTCNetworkType::kCellular = "cellular";
50const char* const RTCNetworkType::kEthernet = "ethernet";
51const char* const RTCNetworkType::kWifi = "wifi";
52const char* const RTCNetworkType::kWimax = "wimax";
53const char* const RTCNetworkType::kVpn = "vpn";
54const char* const RTCNetworkType::kUnknown = "unknown";
55
Steve Antond6a5cbd2017-08-18 09:40:25 -070056// clang-format off
hbos2fa7c672016-10-24 04:00:05 -070057WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
58 &fingerprint,
59 &fingerprint_algorithm,
60 &base64_certificate,
Nico Weber22f99252019-02-20 10:13:16 -050061 &issuer_certificate_id)
Steve Antond6a5cbd2017-08-18 09:40:25 -070062// clang-format on
hbos2fa7c672016-10-24 04:00:05 -070063
Yves Gerey665174f2018-06-19 15:03:05 +020064RTCCertificateStats::RTCCertificateStats(const std::string& id,
65 int64_t timestamp_us)
66 : RTCCertificateStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -070067
Yves Gerey665174f2018-06-19 15:03:05 +020068RTCCertificateStats::RTCCertificateStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -070069 : RTCStats(std::move(id), timestamp_us),
70 fingerprint("fingerprint"),
71 fingerprint_algorithm("fingerprintAlgorithm"),
72 base64_certificate("base64Certificate"),
Yves Gerey665174f2018-06-19 15:03:05 +020073 issuer_certificate_id("issuerCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -070074
Yves Gerey665174f2018-06-19 15:03:05 +020075RTCCertificateStats::RTCCertificateStats(const RTCCertificateStats& other)
hbos2fa7c672016-10-24 04:00:05 -070076 : RTCStats(other.id(), other.timestamp_us()),
77 fingerprint(other.fingerprint),
78 fingerprint_algorithm(other.fingerprint_algorithm),
79 base64_certificate(other.base64_certificate),
Yves Gerey665174f2018-06-19 15:03:05 +020080 issuer_certificate_id(other.issuer_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -070081
Yves Gerey665174f2018-06-19 15:03:05 +020082RTCCertificateStats::~RTCCertificateStats() {}
hbos2fa7c672016-10-24 04:00:05 -070083
Steve Antond6a5cbd2017-08-18 09:40:25 -070084// clang-format off
hbos0adb8282016-11-23 02:32:06 -080085WEBRTC_RTCSTATS_IMPL(RTCCodecStats, RTCStats, "codec",
86 &payload_type,
hbos13f54b22017-02-28 06:56:04 -080087 &mime_type,
hbos0adb8282016-11-23 02:32:06 -080088 &clock_rate,
89 &channels,
hbos13f54b22017-02-28 06:56:04 -080090 &sdp_fmtp_line,
Nico Weber22f99252019-02-20 10:13:16 -050091 &implementation)
Steve Antond6a5cbd2017-08-18 09:40:25 -070092// clang-format on
hbos0adb8282016-11-23 02:32:06 -080093
Yves Gerey665174f2018-06-19 15:03:05 +020094RTCCodecStats::RTCCodecStats(const std::string& id, int64_t timestamp_us)
95 : RTCCodecStats(std::string(id), timestamp_us) {}
hbos0adb8282016-11-23 02:32:06 -080096
Yves Gerey665174f2018-06-19 15:03:05 +020097RTCCodecStats::RTCCodecStats(std::string&& id, int64_t timestamp_us)
hbos0adb8282016-11-23 02:32:06 -080098 : RTCStats(std::move(id), timestamp_us),
99 payload_type("payloadType"),
hbos13f54b22017-02-28 06:56:04 -0800100 mime_type("mimeType"),
hbos0adb8282016-11-23 02:32:06 -0800101 clock_rate("clockRate"),
102 channels("channels"),
hbos13f54b22017-02-28 06:56:04 -0800103 sdp_fmtp_line("sdpFmtpLine"),
Yves Gerey665174f2018-06-19 15:03:05 +0200104 implementation("implementation") {}
hbos0adb8282016-11-23 02:32:06 -0800105
Yves Gerey665174f2018-06-19 15:03:05 +0200106RTCCodecStats::RTCCodecStats(const RTCCodecStats& other)
hbos0adb8282016-11-23 02:32:06 -0800107 : RTCStats(other.id(), other.timestamp_us()),
108 payload_type(other.payload_type),
hbos13f54b22017-02-28 06:56:04 -0800109 mime_type(other.mime_type),
hbos0adb8282016-11-23 02:32:06 -0800110 clock_rate(other.clock_rate),
111 channels(other.channels),
hbos13f54b22017-02-28 06:56:04 -0800112 sdp_fmtp_line(other.sdp_fmtp_line),
Yves Gerey665174f2018-06-19 15:03:05 +0200113 implementation(other.implementation) {}
hbos0adb8282016-11-23 02:32:06 -0800114
Yves Gerey665174f2018-06-19 15:03:05 +0200115RTCCodecStats::~RTCCodecStats() {}
hbos0adb8282016-11-23 02:32:06 -0800116
Steve Antond6a5cbd2017-08-18 09:40:25 -0700117// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700118WEBRTC_RTCSTATS_IMPL(RTCDataChannelStats, RTCStats, "data-channel",
119 &label,
120 &protocol,
121 &datachannelid,
122 &state,
123 &messages_sent,
124 &bytes_sent,
125 &messages_received,
Nico Weber22f99252019-02-20 10:13:16 -0500126 &bytes_received)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700127// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700128
Yves Gerey665174f2018-06-19 15:03:05 +0200129RTCDataChannelStats::RTCDataChannelStats(const std::string& id,
130 int64_t timestamp_us)
131 : RTCDataChannelStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700132
Yves Gerey665174f2018-06-19 15:03:05 +0200133RTCDataChannelStats::RTCDataChannelStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700134 : RTCStats(std::move(id), timestamp_us),
135 label("label"),
136 protocol("protocol"),
137 datachannelid("datachannelid"),
138 state("state"),
139 messages_sent("messagesSent"),
140 bytes_sent("bytesSent"),
141 messages_received("messagesReceived"),
Yves Gerey665174f2018-06-19 15:03:05 +0200142 bytes_received("bytesReceived") {}
hbos2fa7c672016-10-24 04:00:05 -0700143
Yves Gerey665174f2018-06-19 15:03:05 +0200144RTCDataChannelStats::RTCDataChannelStats(const RTCDataChannelStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700145 : RTCStats(other.id(), other.timestamp_us()),
146 label(other.label),
147 protocol(other.protocol),
148 datachannelid(other.datachannelid),
149 state(other.state),
150 messages_sent(other.messages_sent),
151 bytes_sent(other.bytes_sent),
152 messages_received(other.messages_received),
Yves Gerey665174f2018-06-19 15:03:05 +0200153 bytes_received(other.bytes_received) {}
hbos2fa7c672016-10-24 04:00:05 -0700154
Yves Gerey665174f2018-06-19 15:03:05 +0200155RTCDataChannelStats::~RTCDataChannelStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700156
Steve Antond6a5cbd2017-08-18 09:40:25 -0700157// clang-format off
hbosc47a0c32016-10-11 14:54:49 -0700158WEBRTC_RTCSTATS_IMPL(RTCIceCandidatePairStats, RTCStats, "candidate-pair",
159 &transport_id,
160 &local_candidate_id,
161 &remote_candidate_id,
162 &state,
163 &priority,
164 &nominated,
165 &writable,
166 &readable,
167 &bytes_sent,
168 &bytes_received,
hbos3168c7a2016-12-15 06:17:08 -0800169 &total_round_trip_time,
170 &current_round_trip_time,
hbosc47a0c32016-10-11 14:54:49 -0700171 &available_outgoing_bitrate,
172 &available_incoming_bitrate,
173 &requests_received,
174 &requests_sent,
175 &responses_received,
176 &responses_sent,
177 &retransmissions_received,
178 &retransmissions_sent,
179 &consent_requests_received,
180 &consent_requests_sent,
181 &consent_responses_received,
Nico Weber22f99252019-02-20 10:13:16 -0500182 &consent_responses_sent)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700183// clang-format on
hbosc47a0c32016-10-11 14:54:49 -0700184
Yves Gerey665174f2018-06-19 15:03:05 +0200185RTCIceCandidatePairStats::RTCIceCandidatePairStats(const std::string& id,
186 int64_t timestamp_us)
187 : RTCIceCandidatePairStats(std::string(id), timestamp_us) {}
hbosc47a0c32016-10-11 14:54:49 -0700188
Yves Gerey665174f2018-06-19 15:03:05 +0200189RTCIceCandidatePairStats::RTCIceCandidatePairStats(std::string&& id,
190 int64_t timestamp_us)
hbosc47a0c32016-10-11 14:54:49 -0700191 : RTCStats(std::move(id), timestamp_us),
192 transport_id("transportId"),
193 local_candidate_id("localCandidateId"),
194 remote_candidate_id("remoteCandidateId"),
195 state("state"),
196 priority("priority"),
197 nominated("nominated"),
198 writable("writable"),
199 readable("readable"),
200 bytes_sent("bytesSent"),
201 bytes_received("bytesReceived"),
hbos3168c7a2016-12-15 06:17:08 -0800202 total_round_trip_time("totalRoundTripTime"),
203 current_round_trip_time("currentRoundTripTime"),
hbosc47a0c32016-10-11 14:54:49 -0700204 available_outgoing_bitrate("availableOutgoingBitrate"),
205 available_incoming_bitrate("availableIncomingBitrate"),
206 requests_received("requestsReceived"),
207 requests_sent("requestsSent"),
208 responses_received("responsesReceived"),
209 responses_sent("responsesSent"),
210 retransmissions_received("retransmissionsReceived"),
211 retransmissions_sent("retransmissionsSent"),
212 consent_requests_received("consentRequestsReceived"),
213 consent_requests_sent("consentRequestsSent"),
214 consent_responses_received("consentResponsesReceived"),
Yves Gerey665174f2018-06-19 15:03:05 +0200215 consent_responses_sent("consentResponsesSent") {}
hbosc47a0c32016-10-11 14:54:49 -0700216
217RTCIceCandidatePairStats::RTCIceCandidatePairStats(
218 const RTCIceCandidatePairStats& other)
219 : RTCStats(other.id(), other.timestamp_us()),
220 transport_id(other.transport_id),
221 local_candidate_id(other.local_candidate_id),
222 remote_candidate_id(other.remote_candidate_id),
223 state(other.state),
224 priority(other.priority),
225 nominated(other.nominated),
226 writable(other.writable),
227 readable(other.readable),
228 bytes_sent(other.bytes_sent),
229 bytes_received(other.bytes_received),
hbos3168c7a2016-12-15 06:17:08 -0800230 total_round_trip_time(other.total_round_trip_time),
231 current_round_trip_time(other.current_round_trip_time),
hbosc47a0c32016-10-11 14:54:49 -0700232 available_outgoing_bitrate(other.available_outgoing_bitrate),
233 available_incoming_bitrate(other.available_incoming_bitrate),
234 requests_received(other.requests_received),
235 requests_sent(other.requests_sent),
236 responses_received(other.responses_received),
237 responses_sent(other.responses_sent),
238 retransmissions_received(other.retransmissions_received),
239 retransmissions_sent(other.retransmissions_sent),
240 consent_requests_received(other.consent_requests_received),
241 consent_requests_sent(other.consent_requests_sent),
242 consent_responses_received(other.consent_responses_received),
Yves Gerey665174f2018-06-19 15:03:05 +0200243 consent_responses_sent(other.consent_responses_sent) {}
hbosc47a0c32016-10-11 14:54:49 -0700244
Yves Gerey665174f2018-06-19 15:03:05 +0200245RTCIceCandidatePairStats::~RTCIceCandidatePairStats() {}
hbosc47a0c32016-10-11 14:54:49 -0700246
Steve Antond6a5cbd2017-08-18 09:40:25 -0700247// clang-format off
Henrik Boström1df1bf82018-03-20 13:24:20 +0100248WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "abstract-ice-candidate",
hbosb4e426e2017-01-02 09:59:31 -0800249 &transport_id,
hbosc3a2b7f2017-01-02 04:46:15 -0800250 &is_remote,
Gary Liu37e489c2017-11-21 10:49:36 -0800251 &network_type,
hbosab9f6e42016-10-07 02:18:47 -0700252 &ip,
253 &port,
254 &protocol,
Philipp Hancke95513752018-09-27 14:40:08 +0200255 &relay_protocol,
hbosab9f6e42016-10-07 02:18:47 -0700256 &candidate_type,
257 &priority,
hbosd17a5a72017-01-02 08:09:59 -0800258 &url,
Nico Weber22f99252019-02-20 10:13:16 -0500259 &deleted)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700260// clang-format on
hbosab9f6e42016-10-07 02:18:47 -0700261
Yves Gerey665174f2018-06-19 15:03:05 +0200262RTCIceCandidateStats::RTCIceCandidateStats(const std::string& id,
263 int64_t timestamp_us,
264 bool is_remote)
265 : RTCIceCandidateStats(std::string(id), timestamp_us, is_remote) {}
hbosab9f6e42016-10-07 02:18:47 -0700266
Gary Liu37e489c2017-11-21 10:49:36 -0800267RTCIceCandidateStats::RTCIceCandidateStats(std::string&& id,
268 int64_t timestamp_us,
269 bool is_remote)
hbosab9f6e42016-10-07 02:18:47 -0700270 : RTCStats(std::move(id), timestamp_us),
hbosb4e426e2017-01-02 09:59:31 -0800271 transport_id("transportId"),
hbosc3a2b7f2017-01-02 04:46:15 -0800272 is_remote("isRemote", is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800273 network_type("networkType"),
hbosab9f6e42016-10-07 02:18:47 -0700274 ip("ip"),
275 port("port"),
276 protocol("protocol"),
Philipp Hancke95513752018-09-27 14:40:08 +0200277 relay_protocol("relayProtocol"),
hbosab9f6e42016-10-07 02:18:47 -0700278 candidate_type("candidateType"),
279 priority("priority"),
hbosd17a5a72017-01-02 08:09:59 -0800280 url("url"),
Gary Liu37e489c2017-11-21 10:49:36 -0800281 deleted("deleted", false) {}
hbosab9f6e42016-10-07 02:18:47 -0700282
283RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
284 : RTCStats(other.id(), other.timestamp_us()),
hbosb4e426e2017-01-02 09:59:31 -0800285 transport_id(other.transport_id),
hbosc3a2b7f2017-01-02 04:46:15 -0800286 is_remote(other.is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800287 network_type(other.network_type),
hbosab9f6e42016-10-07 02:18:47 -0700288 ip(other.ip),
289 port(other.port),
290 protocol(other.protocol),
Philipp Hancke95513752018-09-27 14:40:08 +0200291 relay_protocol(other.relay_protocol),
hbosab9f6e42016-10-07 02:18:47 -0700292 candidate_type(other.candidate_type),
293 priority(other.priority),
hbosd17a5a72017-01-02 08:09:59 -0800294 url(other.url),
Gary Liu37e489c2017-11-21 10:49:36 -0800295 deleted(other.deleted) {}
hbosab9f6e42016-10-07 02:18:47 -0700296
Yves Gerey665174f2018-06-19 15:03:05 +0200297RTCIceCandidateStats::~RTCIceCandidateStats() {}
hbosab9f6e42016-10-07 02:18:47 -0700298
299const char RTCLocalIceCandidateStats::kType[] = "local-candidate";
300
Yves Gerey665174f2018-06-19 15:03:05 +0200301RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(const std::string& id,
302 int64_t timestamp_us)
303 : RTCIceCandidateStats(id, timestamp_us, false) {}
hbosab9f6e42016-10-07 02:18:47 -0700304
Yves Gerey665174f2018-06-19 15:03:05 +0200305RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(std::string&& id,
306 int64_t timestamp_us)
307 : RTCIceCandidateStats(std::move(id), timestamp_us, false) {}
hbosab9f6e42016-10-07 02:18:47 -0700308
Henrik Boström1df1bf82018-03-20 13:24:20 +0100309std::unique_ptr<RTCStats> RTCLocalIceCandidateStats::copy() const {
310 return std::unique_ptr<RTCStats>(new RTCLocalIceCandidateStats(*this));
311}
312
hbosab9f6e42016-10-07 02:18:47 -0700313const char* RTCLocalIceCandidateStats::type() const {
314 return kType;
315}
316
317const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate";
318
Yves Gerey665174f2018-06-19 15:03:05 +0200319RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(const std::string& id,
320 int64_t timestamp_us)
321 : RTCIceCandidateStats(id, timestamp_us, true) {}
hbosab9f6e42016-10-07 02:18:47 -0700322
Yves Gerey665174f2018-06-19 15:03:05 +0200323RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(std::string&& id,
324 int64_t timestamp_us)
325 : RTCIceCandidateStats(std::move(id), timestamp_us, true) {}
hbosab9f6e42016-10-07 02:18:47 -0700326
Henrik Boström1df1bf82018-03-20 13:24:20 +0100327std::unique_ptr<RTCStats> RTCRemoteIceCandidateStats::copy() const {
328 return std::unique_ptr<RTCStats>(new RTCRemoteIceCandidateStats(*this));
329}
330
hbosab9f6e42016-10-07 02:18:47 -0700331const char* RTCRemoteIceCandidateStats::type() const {
332 return kType;
333}
334
Steve Antond6a5cbd2017-08-18 09:40:25 -0700335// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800336WEBRTC_RTCSTATS_IMPL(RTCMediaStreamStats, RTCStats, "stream",
337 &stream_identifier,
Nico Weber22f99252019-02-20 10:13:16 -0500338 &track_ids)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700339// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800340
Yves Gerey665174f2018-06-19 15:03:05 +0200341RTCMediaStreamStats::RTCMediaStreamStats(const std::string& id,
342 int64_t timestamp_us)
343 : RTCMediaStreamStats(std::string(id), timestamp_us) {}
hbos09bc1282016-11-08 06:29:22 -0800344
Yves Gerey665174f2018-06-19 15:03:05 +0200345RTCMediaStreamStats::RTCMediaStreamStats(std::string&& id, int64_t timestamp_us)
hbos09bc1282016-11-08 06:29:22 -0800346 : RTCStats(std::move(id), timestamp_us),
347 stream_identifier("streamIdentifier"),
Yves Gerey665174f2018-06-19 15:03:05 +0200348 track_ids("trackIds") {}
hbos09bc1282016-11-08 06:29:22 -0800349
Yves Gerey665174f2018-06-19 15:03:05 +0200350RTCMediaStreamStats::RTCMediaStreamStats(const RTCMediaStreamStats& other)
hbos09bc1282016-11-08 06:29:22 -0800351 : RTCStats(other.id(), other.timestamp_us()),
352 stream_identifier(other.stream_identifier),
Yves Gerey665174f2018-06-19 15:03:05 +0200353 track_ids(other.track_ids) {}
hbos09bc1282016-11-08 06:29:22 -0800354
Yves Gerey665174f2018-06-19 15:03:05 +0200355RTCMediaStreamStats::~RTCMediaStreamStats() {}
hbos09bc1282016-11-08 06:29:22 -0800356
Steve Antond6a5cbd2017-08-18 09:40:25 -0700357// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800358WEBRTC_RTCSTATS_IMPL(RTCMediaStreamTrackStats, RTCStats, "track",
zsteine76bd3a2017-07-14 12:17:49 -0700359 &track_identifier,
360 &remote_source,
361 &ended,
362 &detached,
363 &kind,
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200364 &jitter_buffer_delay,
Chen Xing0acffb52019-01-15 15:46:29 +0100365 &jitter_buffer_emitted_count,
zsteine76bd3a2017-07-14 12:17:49 -0700366 &frame_width,
367 &frame_height,
368 &frames_per_second,
369 &frames_sent,
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100370 &huge_frames_sent,
zsteine76bd3a2017-07-14 12:17:49 -0700371 &frames_received,
372 &frames_decoded,
373 &frames_dropped,
374 &frames_corrupted,
375 &partial_frames_lost,
376 &full_frames_lost,
377 &audio_level,
378 &total_audio_energy,
zsteine76bd3a2017-07-14 12:17:49 -0700379 &echo_return_loss,
Steve Anton2dbc69f2017-08-24 17:15:13 -0700380 &echo_return_loss_enhancement,
381 &total_samples_received,
382 &total_samples_duration,
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200383 &concealed_samples,
Ruslan Burakov8af88962018-11-22 17:21:10 +0100384 &concealment_events,
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100385 &jitter_buffer_flushes,
Sergey Silkin02371062019-01-31 16:45:42 +0100386 &delayed_packet_outage_samples,
Jakob Ivarsson232b3fd2019-03-06 09:18:40 +0100387 &relative_packet_arrival_delay,
Sergey Silkin02371062019-01-31 16:45:42 +0100388 &freeze_count,
389 &pause_count,
390 &total_freezes_duration,
391 &total_pauses_duration,
392 &total_frames_duration,
Nico Weber22f99252019-02-20 10:13:16 -0500393 &sum_squared_frame_durations)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700394// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800395
Yves Gerey665174f2018-06-19 15:03:05 +0200396RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(const std::string& id,
397 int64_t timestamp_us,
398 const char* kind)
399 : RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) {}
hbos09bc1282016-11-08 06:29:22 -0800400
zsteine76bd3a2017-07-14 12:17:49 -0700401RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(std::string&& id,
402 int64_t timestamp_us,
403 const char* kind)
hbos09bc1282016-11-08 06:29:22 -0800404 : RTCStats(std::move(id), timestamp_us),
405 track_identifier("trackIdentifier"),
406 remote_source("remoteSource"),
407 ended("ended"),
408 detached("detached"),
hbos160e4a72017-01-17 02:53:23 -0800409 kind("kind", kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200410 jitter_buffer_delay("jitterBufferDelay"),
Chen Xing0acffb52019-01-15 15:46:29 +0100411 jitter_buffer_emitted_count("jitterBufferEmittedCount"),
hbos09bc1282016-11-08 06:29:22 -0800412 frame_width("frameWidth"),
413 frame_height("frameHeight"),
414 frames_per_second("framesPerSecond"),
415 frames_sent("framesSent"),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100416 huge_frames_sent("hugeFramesSent"),
hbos09bc1282016-11-08 06:29:22 -0800417 frames_received("framesReceived"),
418 frames_decoded("framesDecoded"),
419 frames_dropped("framesDropped"),
420 frames_corrupted("framesCorrupted"),
421 partial_frames_lost("partialFramesLost"),
422 full_frames_lost("fullFramesLost"),
423 audio_level("audioLevel"),
zsteine76bd3a2017-07-14 12:17:49 -0700424 total_audio_energy("totalAudioEnergy"),
hbos09bc1282016-11-08 06:29:22 -0800425 echo_return_loss("echoReturnLoss"),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700426 echo_return_loss_enhancement("echoReturnLossEnhancement"),
427 total_samples_received("totalSamplesReceived"),
428 total_samples_duration("totalSamplesDuration"),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200429 concealed_samples("concealedSamples"),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100430 concealment_events("concealmentEvents"),
Jakob Ivarsson758d9462019-03-19 15:38:49 +0100431 jitter_buffer_flushes(
432 "jitterBufferFlushes",
433 {NonStandardGroupId::kRtcAudioJitterBufferMaxPackets}),
434 delayed_packet_outage_samples(
435 "delayedPacketOutageSamples",
436 {NonStandardGroupId::kRtcAudioJitterBufferMaxPackets,
437 NonStandardGroupId::kRtcStatsRelativePacketArrivalDelay}),
438 relative_packet_arrival_delay(
439 "relativePacketArrivalDelay",
440 {NonStandardGroupId::kRtcStatsRelativePacketArrivalDelay}),
Sergey Silkin02371062019-01-31 16:45:42 +0100441 freeze_count("freezeCount"),
442 pause_count("pauseCount"),
443 total_freezes_duration("totalFreezesDuration"),
444 total_pauses_duration("totalPausesDuration"),
445 total_frames_duration("totalFramesDuration"),
446 sum_squared_frame_durations("sumOfSquaredFramesDuration") {
hbos160e4a72017-01-17 02:53:23 -0800447 RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
448 kind == RTCMediaStreamTrackKind::kVideo);
hbos09bc1282016-11-08 06:29:22 -0800449}
450
451RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
452 const RTCMediaStreamTrackStats& other)
453 : RTCStats(other.id(), other.timestamp_us()),
454 track_identifier(other.track_identifier),
455 remote_source(other.remote_source),
456 ended(other.ended),
457 detached(other.detached),
hbos160e4a72017-01-17 02:53:23 -0800458 kind(other.kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200459 jitter_buffer_delay(other.jitter_buffer_delay),
Chen Xing0acffb52019-01-15 15:46:29 +0100460 jitter_buffer_emitted_count(other.jitter_buffer_emitted_count),
hbos09bc1282016-11-08 06:29:22 -0800461 frame_width(other.frame_width),
462 frame_height(other.frame_height),
463 frames_per_second(other.frames_per_second),
464 frames_sent(other.frames_sent),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100465 huge_frames_sent(other.huge_frames_sent),
hbos09bc1282016-11-08 06:29:22 -0800466 frames_received(other.frames_received),
467 frames_decoded(other.frames_decoded),
468 frames_dropped(other.frames_dropped),
469 frames_corrupted(other.frames_corrupted),
470 partial_frames_lost(other.partial_frames_lost),
471 full_frames_lost(other.full_frames_lost),
472 audio_level(other.audio_level),
zsteine76bd3a2017-07-14 12:17:49 -0700473 total_audio_energy(other.total_audio_energy),
hbos09bc1282016-11-08 06:29:22 -0800474 echo_return_loss(other.echo_return_loss),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700475 echo_return_loss_enhancement(other.echo_return_loss_enhancement),
476 total_samples_received(other.total_samples_received),
477 total_samples_duration(other.total_samples_duration),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200478 concealed_samples(other.concealed_samples),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100479 concealment_events(other.concealment_events),
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100480 jitter_buffer_flushes(other.jitter_buffer_flushes),
Sergey Silkin02371062019-01-31 16:45:42 +0100481 delayed_packet_outage_samples(other.delayed_packet_outage_samples),
Jakob Ivarsson232b3fd2019-03-06 09:18:40 +0100482 relative_packet_arrival_delay(other.relative_packet_arrival_delay),
Sergey Silkin02371062019-01-31 16:45:42 +0100483 freeze_count(other.freeze_count),
484 pause_count(other.pause_count),
485 total_freezes_duration(other.total_freezes_duration),
486 total_pauses_duration(other.total_pauses_duration),
487 total_frames_duration(other.total_frames_duration),
488 sum_squared_frame_durations(other.sum_squared_frame_durations) {}
hbos09bc1282016-11-08 06:29:22 -0800489
Yves Gerey665174f2018-06-19 15:03:05 +0200490RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {}
hbos09bc1282016-11-08 06:29:22 -0800491
Steve Antond6a5cbd2017-08-18 09:40:25 -0700492// clang-format off
hbosfc5e0502016-10-06 02:06:10 -0700493WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
494 &data_channels_opened,
Nico Weber22f99252019-02-20 10:13:16 -0500495 &data_channels_closed)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700496// clang-format on
hbosd565b732016-08-30 14:04:35 -0700497
Yves Gerey665174f2018-06-19 15:03:05 +0200498RTCPeerConnectionStats::RTCPeerConnectionStats(const std::string& id,
499 int64_t timestamp_us)
500 : RTCPeerConnectionStats(std::string(id), timestamp_us) {}
hbosd565b732016-08-30 14:04:35 -0700501
Yves Gerey665174f2018-06-19 15:03:05 +0200502RTCPeerConnectionStats::RTCPeerConnectionStats(std::string&& id,
503 int64_t timestamp_us)
hbos0e6758d2016-08-31 07:57:36 -0700504 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700505 data_channels_opened("dataChannelsOpened"),
Yves Gerey665174f2018-06-19 15:03:05 +0200506 data_channels_closed("dataChannelsClosed") {}
hbosd565b732016-08-30 14:04:35 -0700507
hbosfc5e0502016-10-06 02:06:10 -0700508RTCPeerConnectionStats::RTCPeerConnectionStats(
509 const RTCPeerConnectionStats& other)
510 : RTCStats(other.id(), other.timestamp_us()),
511 data_channels_opened(other.data_channels_opened),
Yves Gerey665174f2018-06-19 15:03:05 +0200512 data_channels_closed(other.data_channels_closed) {}
hbosfc5e0502016-10-06 02:06:10 -0700513
Yves Gerey665174f2018-06-19 15:03:05 +0200514RTCPeerConnectionStats::~RTCPeerConnectionStats() {}
hbosfc5e0502016-10-06 02:06:10 -0700515
Steve Antond6a5cbd2017-08-18 09:40:25 -0700516// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700517WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
518 &ssrc,
519 &associate_stats_id,
520 &is_remote,
521 &media_type,
Philipp Hancke3bc01662018-08-28 14:55:03 +0200522 &kind,
hbosb0ae9202017-01-27 06:35:16 -0800523 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700524 &transport_id,
525 &codec_id,
526 &fir_count,
527 &pli_count,
528 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800529 &sli_count,
Nico Weber22f99252019-02-20 10:13:16 -0500530 &qp_sum)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700531// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700532
Yves Gerey665174f2018-06-19 15:03:05 +0200533RTCRTPStreamStats::RTCRTPStreamStats(const std::string& id,
534 int64_t timestamp_us)
535 : RTCRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700536
Yves Gerey665174f2018-06-19 15:03:05 +0200537RTCRTPStreamStats::RTCRTPStreamStats(std::string&& id, int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700538 : RTCStats(std::move(id), timestamp_us),
539 ssrc("ssrc"),
540 associate_stats_id("associateStatsId"),
541 is_remote("isRemote", false),
542 media_type("mediaType"),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200543 kind("kind"),
hbosb0ae9202017-01-27 06:35:16 -0800544 track_id("trackId"),
hbos6ded1902016-11-01 01:50:46 -0700545 transport_id("transportId"),
546 codec_id("codecId"),
547 fir_count("firCount"),
548 pli_count("pliCount"),
549 nack_count("nackCount"),
hbos6769c492017-01-02 08:35:13 -0800550 sli_count("sliCount"),
Yves Gerey665174f2018-06-19 15:03:05 +0200551 qp_sum("qpSum") {}
hbos6ded1902016-11-01 01:50:46 -0700552
Yves Gerey665174f2018-06-19 15:03:05 +0200553RTCRTPStreamStats::RTCRTPStreamStats(const RTCRTPStreamStats& other)
hbos6ded1902016-11-01 01:50:46 -0700554 : RTCStats(other.id(), other.timestamp_us()),
555 ssrc(other.ssrc),
556 associate_stats_id(other.associate_stats_id),
557 is_remote(other.is_remote),
558 media_type(other.media_type),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200559 kind(other.kind),
hbosb0ae9202017-01-27 06:35:16 -0800560 track_id(other.track_id),
hbos6ded1902016-11-01 01:50:46 -0700561 transport_id(other.transport_id),
562 codec_id(other.codec_id),
563 fir_count(other.fir_count),
564 pli_count(other.pli_count),
565 nack_count(other.nack_count),
hbos6769c492017-01-02 08:35:13 -0800566 sli_count(other.sli_count),
Yves Gerey665174f2018-06-19 15:03:05 +0200567 qp_sum(other.qp_sum) {}
hbos6ded1902016-11-01 01:50:46 -0700568
Yves Gerey665174f2018-06-19 15:03:05 +0200569RTCRTPStreamStats::~RTCRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700570
Steve Antond6a5cbd2017-08-18 09:40:25 -0700571// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700572WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700573 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
574 &packets_received,
575 &bytes_received,
576 &packets_lost,
577 &jitter,
578 &fraction_lost,
hbosa7a9be12017-03-01 01:02:45 -0800579 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700580 &packets_discarded,
581 &packets_repaired,
582 &burst_packets_lost,
583 &burst_packets_discarded,
584 &burst_loss_count,
585 &burst_discard_count,
586 &burst_loss_rate,
587 &burst_discard_rate,
588 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800589 &gap_discard_rate,
Nico Weber22f99252019-02-20 10:13:16 -0500590 &frames_decoded)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700591// clang-format on
hboseeafe942016-11-01 03:00:17 -0700592
Yves Gerey665174f2018-06-19 15:03:05 +0200593RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id,
594 int64_t timestamp_us)
595 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {}
hboseeafe942016-11-01 03:00:17 -0700596
Yves Gerey665174f2018-06-19 15:03:05 +0200597RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
598 int64_t timestamp_us)
hboseeafe942016-11-01 03:00:17 -0700599 : RTCRTPStreamStats(std::move(id), timestamp_us),
600 packets_received("packetsReceived"),
601 bytes_received("bytesReceived"),
602 packets_lost("packetsLost"),
603 jitter("jitter"),
604 fraction_lost("fractionLost"),
hbosa7a9be12017-03-01 01:02:45 -0800605 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700606 packets_discarded("packetsDiscarded"),
607 packets_repaired("packetsRepaired"),
608 burst_packets_lost("burstPacketsLost"),
609 burst_packets_discarded("burstPacketsDiscarded"),
610 burst_loss_count("burstLossCount"),
611 burst_discard_count("burstDiscardCount"),
612 burst_loss_rate("burstLossRate"),
613 burst_discard_rate("burstDiscardRate"),
614 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800615 gap_discard_rate("gapDiscardRate"),
Yves Gerey665174f2018-06-19 15:03:05 +0200616 frames_decoded("framesDecoded") {}
hboseeafe942016-11-01 03:00:17 -0700617
618RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
619 const RTCInboundRTPStreamStats& other)
620 : RTCRTPStreamStats(other),
621 packets_received(other.packets_received),
622 bytes_received(other.bytes_received),
623 packets_lost(other.packets_lost),
624 jitter(other.jitter),
625 fraction_lost(other.fraction_lost),
hbosa7a9be12017-03-01 01:02:45 -0800626 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700627 packets_discarded(other.packets_discarded),
628 packets_repaired(other.packets_repaired),
629 burst_packets_lost(other.burst_packets_lost),
630 burst_packets_discarded(other.burst_packets_discarded),
631 burst_loss_count(other.burst_loss_count),
632 burst_discard_count(other.burst_discard_count),
633 burst_loss_rate(other.burst_loss_rate),
634 burst_discard_rate(other.burst_discard_rate),
635 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800636 gap_discard_rate(other.gap_discard_rate),
Yves Gerey665174f2018-06-19 15:03:05 +0200637 frames_decoded(other.frames_decoded) {}
hboseeafe942016-11-01 03:00:17 -0700638
Yves Gerey665174f2018-06-19 15:03:05 +0200639RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {}
hboseeafe942016-11-01 03:00:17 -0700640
Steve Antond6a5cbd2017-08-18 09:40:25 -0700641// clang-format off
hboseeafe942016-11-01 03:00:17 -0700642WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700643 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
644 &packets_sent,
645 &bytes_sent,
646 &target_bitrate,
Nico Weber22f99252019-02-20 10:13:16 -0500647 &frames_encoded)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700648// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700649
Yves Gerey665174f2018-06-19 15:03:05 +0200650RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(const std::string& id,
651 int64_t timestamp_us)
652 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700653
Yves Gerey665174f2018-06-19 15:03:05 +0200654RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id,
655 int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700656 : RTCRTPStreamStats(std::move(id), timestamp_us),
657 packets_sent("packetsSent"),
658 bytes_sent("bytesSent"),
659 target_bitrate("targetBitrate"),
Yves Gerey665174f2018-06-19 15:03:05 +0200660 frames_encoded("framesEncoded") {}
hbos6ded1902016-11-01 01:50:46 -0700661
662RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
663 const RTCOutboundRTPStreamStats& other)
664 : RTCRTPStreamStats(other),
665 packets_sent(other.packets_sent),
666 bytes_sent(other.bytes_sent),
667 target_bitrate(other.target_bitrate),
Yves Gerey665174f2018-06-19 15:03:05 +0200668 frames_encoded(other.frames_encoded) {}
hbos6ded1902016-11-01 01:50:46 -0700669
Yves Gerey665174f2018-06-19 15:03:05 +0200670RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700671
Steve Antond6a5cbd2017-08-18 09:40:25 -0700672// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700673WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
674 &bytes_sent,
675 &bytes_received,
676 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800677 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700678 &selected_candidate_pair_id,
679 &local_certificate_id,
Nico Weber22f99252019-02-20 10:13:16 -0500680 &remote_certificate_id)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700681// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700682
Yves Gerey665174f2018-06-19 15:03:05 +0200683RTCTransportStats::RTCTransportStats(const std::string& id,
684 int64_t timestamp_us)
685 : RTCTransportStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700686
Yves Gerey665174f2018-06-19 15:03:05 +0200687RTCTransportStats::RTCTransportStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700688 : RTCStats(std::move(id), timestamp_us),
689 bytes_sent("bytesSent"),
690 bytes_received("bytesReceived"),
691 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800692 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700693 selected_candidate_pair_id("selectedCandidatePairId"),
694 local_certificate_id("localCertificateId"),
Yves Gerey665174f2018-06-19 15:03:05 +0200695 remote_certificate_id("remoteCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -0700696
Yves Gerey665174f2018-06-19 15:03:05 +0200697RTCTransportStats::RTCTransportStats(const RTCTransportStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700698 : RTCStats(other.id(), other.timestamp_us()),
699 bytes_sent(other.bytes_sent),
700 bytes_received(other.bytes_received),
701 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800702 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700703 selected_candidate_pair_id(other.selected_candidate_pair_id),
704 local_certificate_id(other.local_certificate_id),
Yves Gerey665174f2018-06-19 15:03:05 +0200705 remote_certificate_id(other.remote_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -0700706
Yves Gerey665174f2018-06-19 15:03:05 +0200707RTCTransportStats::~RTCTransportStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700708
hbosd565b732016-08-30 14:04:35 -0700709} // namespace webrtc