blob: 4ba0b28f4095cde4f4bd4788c9f99432b9cb763a [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,
zsteine76bd3a2017-07-14 12:17:49 -0700363 &frame_width,
364 &frame_height,
365 &frames_per_second,
366 &frames_sent,
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100367 &huge_frames_sent,
zsteine76bd3a2017-07-14 12:17:49 -0700368 &frames_received,
369 &frames_decoded,
370 &frames_dropped,
371 &frames_corrupted,
372 &partial_frames_lost,
373 &full_frames_lost,
374 &audio_level,
375 &total_audio_energy,
zsteine76bd3a2017-07-14 12:17:49 -0700376 &echo_return_loss,
Steve Anton2dbc69f2017-08-24 17:15:13 -0700377 &echo_return_loss_enhancement,
378 &total_samples_received,
379 &total_samples_duration,
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200380 &concealed_samples,
Ruslan Burakov8af88962018-11-22 17:21:10 +0100381 &concealment_events,
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100382 &jitter_buffer_flushes,
383 &delayed_packet_outage_samples);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700384// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800385
Yves Gerey665174f2018-06-19 15:03:05 +0200386RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(const std::string& id,
387 int64_t timestamp_us,
388 const char* kind)
389 : RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) {}
hbos09bc1282016-11-08 06:29:22 -0800390
zsteine76bd3a2017-07-14 12:17:49 -0700391RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(std::string&& id,
392 int64_t timestamp_us,
393 const char* kind)
hbos09bc1282016-11-08 06:29:22 -0800394 : RTCStats(std::move(id), timestamp_us),
395 track_identifier("trackIdentifier"),
396 remote_source("remoteSource"),
397 ended("ended"),
398 detached("detached"),
hbos160e4a72017-01-17 02:53:23 -0800399 kind("kind", kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200400 jitter_buffer_delay("jitterBufferDelay"),
hbos09bc1282016-11-08 06:29:22 -0800401 frame_width("frameWidth"),
402 frame_height("frameHeight"),
403 frames_per_second("framesPerSecond"),
404 frames_sent("framesSent"),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100405 huge_frames_sent("hugeFramesSent"),
hbos09bc1282016-11-08 06:29:22 -0800406 frames_received("framesReceived"),
407 frames_decoded("framesDecoded"),
408 frames_dropped("framesDropped"),
409 frames_corrupted("framesCorrupted"),
410 partial_frames_lost("partialFramesLost"),
411 full_frames_lost("fullFramesLost"),
412 audio_level("audioLevel"),
zsteine76bd3a2017-07-14 12:17:49 -0700413 total_audio_energy("totalAudioEnergy"),
hbos09bc1282016-11-08 06:29:22 -0800414 echo_return_loss("echoReturnLoss"),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700415 echo_return_loss_enhancement("echoReturnLossEnhancement"),
416 total_samples_received("totalSamplesReceived"),
417 total_samples_duration("totalSamplesDuration"),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200418 concealed_samples("concealedSamples"),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100419 concealment_events("concealmentEvents"),
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100420 jitter_buffer_flushes("jitterBufferFlushes"),
421 delayed_packet_outage_samples("delayedPacketOutageSamples") {
hbos160e4a72017-01-17 02:53:23 -0800422 RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
423 kind == RTCMediaStreamTrackKind::kVideo);
hbos09bc1282016-11-08 06:29:22 -0800424}
425
426RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
427 const RTCMediaStreamTrackStats& other)
428 : RTCStats(other.id(), other.timestamp_us()),
429 track_identifier(other.track_identifier),
430 remote_source(other.remote_source),
431 ended(other.ended),
432 detached(other.detached),
hbos160e4a72017-01-17 02:53:23 -0800433 kind(other.kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200434 jitter_buffer_delay(other.jitter_buffer_delay),
hbos09bc1282016-11-08 06:29:22 -0800435 frame_width(other.frame_width),
436 frame_height(other.frame_height),
437 frames_per_second(other.frames_per_second),
438 frames_sent(other.frames_sent),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100439 huge_frames_sent(other.huge_frames_sent),
hbos09bc1282016-11-08 06:29:22 -0800440 frames_received(other.frames_received),
441 frames_decoded(other.frames_decoded),
442 frames_dropped(other.frames_dropped),
443 frames_corrupted(other.frames_corrupted),
444 partial_frames_lost(other.partial_frames_lost),
445 full_frames_lost(other.full_frames_lost),
446 audio_level(other.audio_level),
zsteine76bd3a2017-07-14 12:17:49 -0700447 total_audio_energy(other.total_audio_energy),
hbos09bc1282016-11-08 06:29:22 -0800448 echo_return_loss(other.echo_return_loss),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700449 echo_return_loss_enhancement(other.echo_return_loss_enhancement),
450 total_samples_received(other.total_samples_received),
451 total_samples_duration(other.total_samples_duration),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200452 concealed_samples(other.concealed_samples),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100453 concealment_events(other.concealment_events),
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100454 jitter_buffer_flushes(other.jitter_buffer_flushes),
455 delayed_packet_outage_samples(other.delayed_packet_outage_samples) {}
hbos09bc1282016-11-08 06:29:22 -0800456
Yves Gerey665174f2018-06-19 15:03:05 +0200457RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {}
hbos09bc1282016-11-08 06:29:22 -0800458
Steve Antond6a5cbd2017-08-18 09:40:25 -0700459// clang-format off
hbosfc5e0502016-10-06 02:06:10 -0700460WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
461 &data_channels_opened,
462 &data_channels_closed);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700463// clang-format on
hbosd565b732016-08-30 14:04:35 -0700464
Yves Gerey665174f2018-06-19 15:03:05 +0200465RTCPeerConnectionStats::RTCPeerConnectionStats(const std::string& id,
466 int64_t timestamp_us)
467 : RTCPeerConnectionStats(std::string(id), timestamp_us) {}
hbosd565b732016-08-30 14:04:35 -0700468
Yves Gerey665174f2018-06-19 15:03:05 +0200469RTCPeerConnectionStats::RTCPeerConnectionStats(std::string&& id,
470 int64_t timestamp_us)
hbos0e6758d2016-08-31 07:57:36 -0700471 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700472 data_channels_opened("dataChannelsOpened"),
Yves Gerey665174f2018-06-19 15:03:05 +0200473 data_channels_closed("dataChannelsClosed") {}
hbosd565b732016-08-30 14:04:35 -0700474
hbosfc5e0502016-10-06 02:06:10 -0700475RTCPeerConnectionStats::RTCPeerConnectionStats(
476 const RTCPeerConnectionStats& other)
477 : RTCStats(other.id(), other.timestamp_us()),
478 data_channels_opened(other.data_channels_opened),
Yves Gerey665174f2018-06-19 15:03:05 +0200479 data_channels_closed(other.data_channels_closed) {}
hbosfc5e0502016-10-06 02:06:10 -0700480
Yves Gerey665174f2018-06-19 15:03:05 +0200481RTCPeerConnectionStats::~RTCPeerConnectionStats() {}
hbosfc5e0502016-10-06 02:06:10 -0700482
Steve Antond6a5cbd2017-08-18 09:40:25 -0700483// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700484WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
485 &ssrc,
486 &associate_stats_id,
487 &is_remote,
488 &media_type,
Philipp Hancke3bc01662018-08-28 14:55:03 +0200489 &kind,
hbosb0ae9202017-01-27 06:35:16 -0800490 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700491 &transport_id,
492 &codec_id,
493 &fir_count,
494 &pli_count,
495 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800496 &sli_count,
497 &qp_sum);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700498// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700499
Yves Gerey665174f2018-06-19 15:03:05 +0200500RTCRTPStreamStats::RTCRTPStreamStats(const std::string& id,
501 int64_t timestamp_us)
502 : RTCRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700503
Yves Gerey665174f2018-06-19 15:03:05 +0200504RTCRTPStreamStats::RTCRTPStreamStats(std::string&& id, int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700505 : RTCStats(std::move(id), timestamp_us),
506 ssrc("ssrc"),
507 associate_stats_id("associateStatsId"),
508 is_remote("isRemote", false),
509 media_type("mediaType"),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200510 kind("kind"),
hbosb0ae9202017-01-27 06:35:16 -0800511 track_id("trackId"),
hbos6ded1902016-11-01 01:50:46 -0700512 transport_id("transportId"),
513 codec_id("codecId"),
514 fir_count("firCount"),
515 pli_count("pliCount"),
516 nack_count("nackCount"),
hbos6769c492017-01-02 08:35:13 -0800517 sli_count("sliCount"),
Yves Gerey665174f2018-06-19 15:03:05 +0200518 qp_sum("qpSum") {}
hbos6ded1902016-11-01 01:50:46 -0700519
Yves Gerey665174f2018-06-19 15:03:05 +0200520RTCRTPStreamStats::RTCRTPStreamStats(const RTCRTPStreamStats& other)
hbos6ded1902016-11-01 01:50:46 -0700521 : RTCStats(other.id(), other.timestamp_us()),
522 ssrc(other.ssrc),
523 associate_stats_id(other.associate_stats_id),
524 is_remote(other.is_remote),
525 media_type(other.media_type),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200526 kind(other.kind),
hbosb0ae9202017-01-27 06:35:16 -0800527 track_id(other.track_id),
hbos6ded1902016-11-01 01:50:46 -0700528 transport_id(other.transport_id),
529 codec_id(other.codec_id),
530 fir_count(other.fir_count),
531 pli_count(other.pli_count),
532 nack_count(other.nack_count),
hbos6769c492017-01-02 08:35:13 -0800533 sli_count(other.sli_count),
Yves Gerey665174f2018-06-19 15:03:05 +0200534 qp_sum(other.qp_sum) {}
hbos6ded1902016-11-01 01:50:46 -0700535
Yves Gerey665174f2018-06-19 15:03:05 +0200536RTCRTPStreamStats::~RTCRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700537
Steve Antond6a5cbd2017-08-18 09:40:25 -0700538// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700539WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700540 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
541 &packets_received,
542 &bytes_received,
543 &packets_lost,
544 &jitter,
545 &fraction_lost,
hbosa7a9be12017-03-01 01:02:45 -0800546 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700547 &packets_discarded,
548 &packets_repaired,
549 &burst_packets_lost,
550 &burst_packets_discarded,
551 &burst_loss_count,
552 &burst_discard_count,
553 &burst_loss_rate,
554 &burst_discard_rate,
555 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800556 &gap_discard_rate,
557 &frames_decoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700558// clang-format on
hboseeafe942016-11-01 03:00:17 -0700559
Yves Gerey665174f2018-06-19 15:03:05 +0200560RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id,
561 int64_t timestamp_us)
562 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {}
hboseeafe942016-11-01 03:00:17 -0700563
Yves Gerey665174f2018-06-19 15:03:05 +0200564RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
565 int64_t timestamp_us)
hboseeafe942016-11-01 03:00:17 -0700566 : RTCRTPStreamStats(std::move(id), timestamp_us),
567 packets_received("packetsReceived"),
568 bytes_received("bytesReceived"),
569 packets_lost("packetsLost"),
570 jitter("jitter"),
571 fraction_lost("fractionLost"),
hbosa7a9be12017-03-01 01:02:45 -0800572 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700573 packets_discarded("packetsDiscarded"),
574 packets_repaired("packetsRepaired"),
575 burst_packets_lost("burstPacketsLost"),
576 burst_packets_discarded("burstPacketsDiscarded"),
577 burst_loss_count("burstLossCount"),
578 burst_discard_count("burstDiscardCount"),
579 burst_loss_rate("burstLossRate"),
580 burst_discard_rate("burstDiscardRate"),
581 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800582 gap_discard_rate("gapDiscardRate"),
Yves Gerey665174f2018-06-19 15:03:05 +0200583 frames_decoded("framesDecoded") {}
hboseeafe942016-11-01 03:00:17 -0700584
585RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
586 const RTCInboundRTPStreamStats& other)
587 : RTCRTPStreamStats(other),
588 packets_received(other.packets_received),
589 bytes_received(other.bytes_received),
590 packets_lost(other.packets_lost),
591 jitter(other.jitter),
592 fraction_lost(other.fraction_lost),
hbosa7a9be12017-03-01 01:02:45 -0800593 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700594 packets_discarded(other.packets_discarded),
595 packets_repaired(other.packets_repaired),
596 burst_packets_lost(other.burst_packets_lost),
597 burst_packets_discarded(other.burst_packets_discarded),
598 burst_loss_count(other.burst_loss_count),
599 burst_discard_count(other.burst_discard_count),
600 burst_loss_rate(other.burst_loss_rate),
601 burst_discard_rate(other.burst_discard_rate),
602 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800603 gap_discard_rate(other.gap_discard_rate),
Yves Gerey665174f2018-06-19 15:03:05 +0200604 frames_decoded(other.frames_decoded) {}
hboseeafe942016-11-01 03:00:17 -0700605
Yves Gerey665174f2018-06-19 15:03:05 +0200606RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {}
hboseeafe942016-11-01 03:00:17 -0700607
Steve Antond6a5cbd2017-08-18 09:40:25 -0700608// clang-format off
hboseeafe942016-11-01 03:00:17 -0700609WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700610 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
611 &packets_sent,
612 &bytes_sent,
613 &target_bitrate,
hbos6769c492017-01-02 08:35:13 -0800614 &frames_encoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700615// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700616
Yves Gerey665174f2018-06-19 15:03:05 +0200617RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(const std::string& id,
618 int64_t timestamp_us)
619 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700620
Yves Gerey665174f2018-06-19 15:03:05 +0200621RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id,
622 int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700623 : RTCRTPStreamStats(std::move(id), timestamp_us),
624 packets_sent("packetsSent"),
625 bytes_sent("bytesSent"),
626 target_bitrate("targetBitrate"),
Yves Gerey665174f2018-06-19 15:03:05 +0200627 frames_encoded("framesEncoded") {}
hbos6ded1902016-11-01 01:50:46 -0700628
629RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
630 const RTCOutboundRTPStreamStats& other)
631 : RTCRTPStreamStats(other),
632 packets_sent(other.packets_sent),
633 bytes_sent(other.bytes_sent),
634 target_bitrate(other.target_bitrate),
Yves Gerey665174f2018-06-19 15:03:05 +0200635 frames_encoded(other.frames_encoded) {}
hbos6ded1902016-11-01 01:50:46 -0700636
Yves Gerey665174f2018-06-19 15:03:05 +0200637RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700638
Steve Antond6a5cbd2017-08-18 09:40:25 -0700639// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700640WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
641 &bytes_sent,
642 &bytes_received,
643 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800644 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700645 &selected_candidate_pair_id,
646 &local_certificate_id,
647 &remote_certificate_id);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700648// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700649
Yves Gerey665174f2018-06-19 15:03:05 +0200650RTCTransportStats::RTCTransportStats(const std::string& id,
651 int64_t timestamp_us)
652 : RTCTransportStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700653
Yves Gerey665174f2018-06-19 15:03:05 +0200654RTCTransportStats::RTCTransportStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700655 : RTCStats(std::move(id), timestamp_us),
656 bytes_sent("bytesSent"),
657 bytes_received("bytesReceived"),
658 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800659 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700660 selected_candidate_pair_id("selectedCandidatePairId"),
661 local_certificate_id("localCertificateId"),
Yves Gerey665174f2018-06-19 15:03:05 +0200662 remote_certificate_id("remoteCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -0700663
Yves Gerey665174f2018-06-19 15:03:05 +0200664RTCTransportStats::RTCTransportStats(const RTCTransportStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700665 : RTCStats(other.id(), other.timestamp_us()),
666 bytes_sent(other.bytes_sent),
667 bytes_received(other.bytes_received),
668 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800669 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700670 selected_candidate_pair_id(other.selected_candidate_pair_id),
671 local_certificate_id(other.local_certificate_id),
Yves Gerey665174f2018-06-19 15:03:05 +0200672 remote_certificate_id(other.remote_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -0700673
Yves Gerey665174f2018-06-19 15:03:05 +0200674RTCTransportStats::~RTCTransportStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700675
hbosd565b732016-08-30 14:04:35 -0700676} // namespace webrtc