blob: 2451e121693c345579048df39a5ac2f3c27b0ace [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,
59 &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,
hbos0adb8282016-11-23 02:32:06 -080089 &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,
124 &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,
180 &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,
257 &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,
336 &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,
384 &delayed_packet_outage_samples);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700385// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800386
Yves Gerey665174f2018-06-19 15:03:05 +0200387RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(const std::string& id,
388 int64_t timestamp_us,
389 const char* kind)
390 : RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) {}
hbos09bc1282016-11-08 06:29:22 -0800391
zsteine76bd3a2017-07-14 12:17:49 -0700392RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(std::string&& id,
393 int64_t timestamp_us,
394 const char* kind)
hbos09bc1282016-11-08 06:29:22 -0800395 : RTCStats(std::move(id), timestamp_us),
396 track_identifier("trackIdentifier"),
397 remote_source("remoteSource"),
398 ended("ended"),
399 detached("detached"),
hbos160e4a72017-01-17 02:53:23 -0800400 kind("kind", kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200401 jitter_buffer_delay("jitterBufferDelay"),
Chen Xing0acffb52019-01-15 15:46:29 +0100402 jitter_buffer_emitted_count("jitterBufferEmittedCount"),
hbos09bc1282016-11-08 06:29:22 -0800403 frame_width("frameWidth"),
404 frame_height("frameHeight"),
405 frames_per_second("framesPerSecond"),
406 frames_sent("framesSent"),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100407 huge_frames_sent("hugeFramesSent"),
hbos09bc1282016-11-08 06:29:22 -0800408 frames_received("framesReceived"),
409 frames_decoded("framesDecoded"),
410 frames_dropped("framesDropped"),
411 frames_corrupted("framesCorrupted"),
412 partial_frames_lost("partialFramesLost"),
413 full_frames_lost("fullFramesLost"),
414 audio_level("audioLevel"),
zsteine76bd3a2017-07-14 12:17:49 -0700415 total_audio_energy("totalAudioEnergy"),
hbos09bc1282016-11-08 06:29:22 -0800416 echo_return_loss("echoReturnLoss"),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700417 echo_return_loss_enhancement("echoReturnLossEnhancement"),
418 total_samples_received("totalSamplesReceived"),
419 total_samples_duration("totalSamplesDuration"),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200420 concealed_samples("concealedSamples"),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100421 concealment_events("concealmentEvents"),
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100422 jitter_buffer_flushes("jitterBufferFlushes"),
423 delayed_packet_outage_samples("delayedPacketOutageSamples") {
hbos160e4a72017-01-17 02:53:23 -0800424 RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
425 kind == RTCMediaStreamTrackKind::kVideo);
hbos09bc1282016-11-08 06:29:22 -0800426}
427
428RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
429 const RTCMediaStreamTrackStats& other)
430 : RTCStats(other.id(), other.timestamp_us()),
431 track_identifier(other.track_identifier),
432 remote_source(other.remote_source),
433 ended(other.ended),
434 detached(other.detached),
hbos160e4a72017-01-17 02:53:23 -0800435 kind(other.kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200436 jitter_buffer_delay(other.jitter_buffer_delay),
Chen Xing0acffb52019-01-15 15:46:29 +0100437 jitter_buffer_emitted_count(other.jitter_buffer_emitted_count),
hbos09bc1282016-11-08 06:29:22 -0800438 frame_width(other.frame_width),
439 frame_height(other.frame_height),
440 frames_per_second(other.frames_per_second),
441 frames_sent(other.frames_sent),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100442 huge_frames_sent(other.huge_frames_sent),
hbos09bc1282016-11-08 06:29:22 -0800443 frames_received(other.frames_received),
444 frames_decoded(other.frames_decoded),
445 frames_dropped(other.frames_dropped),
446 frames_corrupted(other.frames_corrupted),
447 partial_frames_lost(other.partial_frames_lost),
448 full_frames_lost(other.full_frames_lost),
449 audio_level(other.audio_level),
zsteine76bd3a2017-07-14 12:17:49 -0700450 total_audio_energy(other.total_audio_energy),
hbos09bc1282016-11-08 06:29:22 -0800451 echo_return_loss(other.echo_return_loss),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700452 echo_return_loss_enhancement(other.echo_return_loss_enhancement),
453 total_samples_received(other.total_samples_received),
454 total_samples_duration(other.total_samples_duration),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200455 concealed_samples(other.concealed_samples),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100456 concealment_events(other.concealment_events),
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100457 jitter_buffer_flushes(other.jitter_buffer_flushes),
458 delayed_packet_outage_samples(other.delayed_packet_outage_samples) {}
hbos09bc1282016-11-08 06:29:22 -0800459
Yves Gerey665174f2018-06-19 15:03:05 +0200460RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {}
hbos09bc1282016-11-08 06:29:22 -0800461
Steve Antond6a5cbd2017-08-18 09:40:25 -0700462// clang-format off
hbosfc5e0502016-10-06 02:06:10 -0700463WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
464 &data_channels_opened,
465 &data_channels_closed);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700466// clang-format on
hbosd565b732016-08-30 14:04:35 -0700467
Yves Gerey665174f2018-06-19 15:03:05 +0200468RTCPeerConnectionStats::RTCPeerConnectionStats(const std::string& id,
469 int64_t timestamp_us)
470 : RTCPeerConnectionStats(std::string(id), timestamp_us) {}
hbosd565b732016-08-30 14:04:35 -0700471
Yves Gerey665174f2018-06-19 15:03:05 +0200472RTCPeerConnectionStats::RTCPeerConnectionStats(std::string&& id,
473 int64_t timestamp_us)
hbos0e6758d2016-08-31 07:57:36 -0700474 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700475 data_channels_opened("dataChannelsOpened"),
Yves Gerey665174f2018-06-19 15:03:05 +0200476 data_channels_closed("dataChannelsClosed") {}
hbosd565b732016-08-30 14:04:35 -0700477
hbosfc5e0502016-10-06 02:06:10 -0700478RTCPeerConnectionStats::RTCPeerConnectionStats(
479 const RTCPeerConnectionStats& other)
480 : RTCStats(other.id(), other.timestamp_us()),
481 data_channels_opened(other.data_channels_opened),
Yves Gerey665174f2018-06-19 15:03:05 +0200482 data_channels_closed(other.data_channels_closed) {}
hbosfc5e0502016-10-06 02:06:10 -0700483
Yves Gerey665174f2018-06-19 15:03:05 +0200484RTCPeerConnectionStats::~RTCPeerConnectionStats() {}
hbosfc5e0502016-10-06 02:06:10 -0700485
Steve Antond6a5cbd2017-08-18 09:40:25 -0700486// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700487WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
488 &ssrc,
489 &associate_stats_id,
490 &is_remote,
491 &media_type,
Philipp Hancke3bc01662018-08-28 14:55:03 +0200492 &kind,
hbosb0ae9202017-01-27 06:35:16 -0800493 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700494 &transport_id,
495 &codec_id,
496 &fir_count,
497 &pli_count,
498 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800499 &sli_count,
500 &qp_sum);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700501// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700502
Yves Gerey665174f2018-06-19 15:03:05 +0200503RTCRTPStreamStats::RTCRTPStreamStats(const std::string& id,
504 int64_t timestamp_us)
505 : RTCRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700506
Yves Gerey665174f2018-06-19 15:03:05 +0200507RTCRTPStreamStats::RTCRTPStreamStats(std::string&& id, int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700508 : RTCStats(std::move(id), timestamp_us),
509 ssrc("ssrc"),
510 associate_stats_id("associateStatsId"),
511 is_remote("isRemote", false),
512 media_type("mediaType"),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200513 kind("kind"),
hbosb0ae9202017-01-27 06:35:16 -0800514 track_id("trackId"),
hbos6ded1902016-11-01 01:50:46 -0700515 transport_id("transportId"),
516 codec_id("codecId"),
517 fir_count("firCount"),
518 pli_count("pliCount"),
519 nack_count("nackCount"),
hbos6769c492017-01-02 08:35:13 -0800520 sli_count("sliCount"),
Yves Gerey665174f2018-06-19 15:03:05 +0200521 qp_sum("qpSum") {}
hbos6ded1902016-11-01 01:50:46 -0700522
Yves Gerey665174f2018-06-19 15:03:05 +0200523RTCRTPStreamStats::RTCRTPStreamStats(const RTCRTPStreamStats& other)
hbos6ded1902016-11-01 01:50:46 -0700524 : RTCStats(other.id(), other.timestamp_us()),
525 ssrc(other.ssrc),
526 associate_stats_id(other.associate_stats_id),
527 is_remote(other.is_remote),
528 media_type(other.media_type),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200529 kind(other.kind),
hbosb0ae9202017-01-27 06:35:16 -0800530 track_id(other.track_id),
hbos6ded1902016-11-01 01:50:46 -0700531 transport_id(other.transport_id),
532 codec_id(other.codec_id),
533 fir_count(other.fir_count),
534 pli_count(other.pli_count),
535 nack_count(other.nack_count),
hbos6769c492017-01-02 08:35:13 -0800536 sli_count(other.sli_count),
Yves Gerey665174f2018-06-19 15:03:05 +0200537 qp_sum(other.qp_sum) {}
hbos6ded1902016-11-01 01:50:46 -0700538
Yves Gerey665174f2018-06-19 15:03:05 +0200539RTCRTPStreamStats::~RTCRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700540
Steve Antond6a5cbd2017-08-18 09:40:25 -0700541// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700542WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700543 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
544 &packets_received,
545 &bytes_received,
546 &packets_lost,
547 &jitter,
548 &fraction_lost,
hbosa7a9be12017-03-01 01:02:45 -0800549 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700550 &packets_discarded,
551 &packets_repaired,
552 &burst_packets_lost,
553 &burst_packets_discarded,
554 &burst_loss_count,
555 &burst_discard_count,
556 &burst_loss_rate,
557 &burst_discard_rate,
558 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800559 &gap_discard_rate,
560 &frames_decoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700561// clang-format on
hboseeafe942016-11-01 03:00:17 -0700562
Yves Gerey665174f2018-06-19 15:03:05 +0200563RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id,
564 int64_t timestamp_us)
565 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {}
hboseeafe942016-11-01 03:00:17 -0700566
Yves Gerey665174f2018-06-19 15:03:05 +0200567RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
568 int64_t timestamp_us)
hboseeafe942016-11-01 03:00:17 -0700569 : RTCRTPStreamStats(std::move(id), timestamp_us),
570 packets_received("packetsReceived"),
571 bytes_received("bytesReceived"),
572 packets_lost("packetsLost"),
573 jitter("jitter"),
574 fraction_lost("fractionLost"),
hbosa7a9be12017-03-01 01:02:45 -0800575 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700576 packets_discarded("packetsDiscarded"),
577 packets_repaired("packetsRepaired"),
578 burst_packets_lost("burstPacketsLost"),
579 burst_packets_discarded("burstPacketsDiscarded"),
580 burst_loss_count("burstLossCount"),
581 burst_discard_count("burstDiscardCount"),
582 burst_loss_rate("burstLossRate"),
583 burst_discard_rate("burstDiscardRate"),
584 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800585 gap_discard_rate("gapDiscardRate"),
Yves Gerey665174f2018-06-19 15:03:05 +0200586 frames_decoded("framesDecoded") {}
hboseeafe942016-11-01 03:00:17 -0700587
588RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
589 const RTCInboundRTPStreamStats& other)
590 : RTCRTPStreamStats(other),
591 packets_received(other.packets_received),
592 bytes_received(other.bytes_received),
593 packets_lost(other.packets_lost),
594 jitter(other.jitter),
595 fraction_lost(other.fraction_lost),
hbosa7a9be12017-03-01 01:02:45 -0800596 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700597 packets_discarded(other.packets_discarded),
598 packets_repaired(other.packets_repaired),
599 burst_packets_lost(other.burst_packets_lost),
600 burst_packets_discarded(other.burst_packets_discarded),
601 burst_loss_count(other.burst_loss_count),
602 burst_discard_count(other.burst_discard_count),
603 burst_loss_rate(other.burst_loss_rate),
604 burst_discard_rate(other.burst_discard_rate),
605 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800606 gap_discard_rate(other.gap_discard_rate),
Yves Gerey665174f2018-06-19 15:03:05 +0200607 frames_decoded(other.frames_decoded) {}
hboseeafe942016-11-01 03:00:17 -0700608
Yves Gerey665174f2018-06-19 15:03:05 +0200609RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {}
hboseeafe942016-11-01 03:00:17 -0700610
Steve Antond6a5cbd2017-08-18 09:40:25 -0700611// clang-format off
hboseeafe942016-11-01 03:00:17 -0700612WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700613 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
614 &packets_sent,
615 &bytes_sent,
616 &target_bitrate,
hbos6769c492017-01-02 08:35:13 -0800617 &frames_encoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700618// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700619
Yves Gerey665174f2018-06-19 15:03:05 +0200620RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(const std::string& id,
621 int64_t timestamp_us)
622 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700623
Yves Gerey665174f2018-06-19 15:03:05 +0200624RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id,
625 int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700626 : RTCRTPStreamStats(std::move(id), timestamp_us),
627 packets_sent("packetsSent"),
628 bytes_sent("bytesSent"),
629 target_bitrate("targetBitrate"),
Yves Gerey665174f2018-06-19 15:03:05 +0200630 frames_encoded("framesEncoded") {}
hbos6ded1902016-11-01 01:50:46 -0700631
632RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
633 const RTCOutboundRTPStreamStats& other)
634 : RTCRTPStreamStats(other),
635 packets_sent(other.packets_sent),
636 bytes_sent(other.bytes_sent),
637 target_bitrate(other.target_bitrate),
Yves Gerey665174f2018-06-19 15:03:05 +0200638 frames_encoded(other.frames_encoded) {}
hbos6ded1902016-11-01 01:50:46 -0700639
Yves Gerey665174f2018-06-19 15:03:05 +0200640RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700641
Steve Antond6a5cbd2017-08-18 09:40:25 -0700642// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700643WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
644 &bytes_sent,
645 &bytes_received,
646 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800647 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700648 &selected_candidate_pair_id,
649 &local_certificate_id,
650 &remote_certificate_id);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700651// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700652
Yves Gerey665174f2018-06-19 15:03:05 +0200653RTCTransportStats::RTCTransportStats(const std::string& id,
654 int64_t timestamp_us)
655 : RTCTransportStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700656
Yves Gerey665174f2018-06-19 15:03:05 +0200657RTCTransportStats::RTCTransportStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700658 : RTCStats(std::move(id), timestamp_us),
659 bytes_sent("bytesSent"),
660 bytes_received("bytesReceived"),
661 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800662 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700663 selected_candidate_pair_id("selectedCandidatePairId"),
664 local_certificate_id("localCertificateId"),
Yves Gerey665174f2018-06-19 15:03:05 +0200665 remote_certificate_id("remoteCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -0700666
Yves Gerey665174f2018-06-19 15:03:05 +0200667RTCTransportStats::RTCTransportStats(const RTCTransportStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700668 : RTCStats(other.id(), other.timestamp_us()),
669 bytes_sent(other.bytes_sent),
670 bytes_received(other.bytes_received),
671 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800672 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700673 selected_candidate_pair_id(other.selected_candidate_pair_id),
674 local_certificate_id(other.local_certificate_id),
Yves Gerey665174f2018-06-19 15:03:05 +0200675 remote_certificate_id(other.remote_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -0700676
Yves Gerey665174f2018-06-19 15:03:05 +0200677RTCTransportStats::~RTCTransportStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700678
hbosd565b732016-08-30 14:04:35 -0700679} // namespace webrtc