blob: dcc1180f16f10ffc285adbfe6702f166c71ea851 [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
13namespace webrtc {
14
agrieve26622d32017-08-08 10:48:15 -070015const char* const RTCDataChannelState::kConnecting = "connecting";
16const char* const RTCDataChannelState::kOpen = "open";
17const char* const RTCDataChannelState::kClosing = "closing";
18const char* const RTCDataChannelState::kClosed = "closed";
hboscc555c52016-10-18 12:48:31 -070019
agrieve26622d32017-08-08 10:48:15 -070020const char* const RTCStatsIceCandidatePairState::kFrozen = "frozen";
21const char* const RTCStatsIceCandidatePairState::kWaiting = "waiting";
22const char* const RTCStatsIceCandidatePairState::kInProgress = "in-progress";
23const char* const RTCStatsIceCandidatePairState::kFailed = "failed";
24const char* const RTCStatsIceCandidatePairState::kSucceeded = "succeeded";
hbosc47a0c32016-10-11 14:54:49 -070025
26// Strings defined in https://tools.ietf.org/html/rfc5245.
agrieve26622d32017-08-08 10:48:15 -070027const char* const RTCIceCandidateType::kHost = "host";
28const char* const RTCIceCandidateType::kSrflx = "srflx";
29const char* const RTCIceCandidateType::kPrflx = "prflx";
30const char* const RTCIceCandidateType::kRelay = "relay";
hbosab9f6e42016-10-07 02:18:47 -070031
agrieve26622d32017-08-08 10:48:15 -070032const char* const RTCDtlsTransportState::kNew = "new";
33const char* const RTCDtlsTransportState::kConnecting = "connecting";
34const char* const RTCDtlsTransportState::kConnected = "connected";
35const char* const RTCDtlsTransportState::kClosed = "closed";
36const char* const RTCDtlsTransportState::kFailed = "failed";
hbos7064d592017-01-16 07:38:02 -080037
agrieve26622d32017-08-08 10:48:15 -070038const char* const RTCMediaStreamTrackKind::kAudio = "audio";
39const char* const RTCMediaStreamTrackKind::kVideo = "video";
hbos160e4a72017-01-17 02:53:23 -080040
Gary Liu37e489c2017-11-21 10:49:36 -080041// https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype
42const char* const RTCNetworkType::kBluetooth = "bluetooth";
43const char* const RTCNetworkType::kCellular = "cellular";
44const char* const RTCNetworkType::kEthernet = "ethernet";
45const char* const RTCNetworkType::kWifi = "wifi";
46const char* const RTCNetworkType::kWimax = "wimax";
47const char* const RTCNetworkType::kVpn = "vpn";
48const char* const RTCNetworkType::kUnknown = "unknown";
49
Steve Antond6a5cbd2017-08-18 09:40:25 -070050// clang-format off
hbos2fa7c672016-10-24 04:00:05 -070051WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
52 &fingerprint,
53 &fingerprint_algorithm,
54 &base64_certificate,
55 &issuer_certificate_id);
Steve Antond6a5cbd2017-08-18 09:40:25 -070056// clang-format on
hbos2fa7c672016-10-24 04:00:05 -070057
Yves Gerey665174f2018-06-19 15:03:05 +020058RTCCertificateStats::RTCCertificateStats(const std::string& id,
59 int64_t timestamp_us)
60 : RTCCertificateStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -070061
Yves Gerey665174f2018-06-19 15:03:05 +020062RTCCertificateStats::RTCCertificateStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -070063 : RTCStats(std::move(id), timestamp_us),
64 fingerprint("fingerprint"),
65 fingerprint_algorithm("fingerprintAlgorithm"),
66 base64_certificate("base64Certificate"),
Yves Gerey665174f2018-06-19 15:03:05 +020067 issuer_certificate_id("issuerCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -070068
Yves Gerey665174f2018-06-19 15:03:05 +020069RTCCertificateStats::RTCCertificateStats(const RTCCertificateStats& other)
hbos2fa7c672016-10-24 04:00:05 -070070 : RTCStats(other.id(), other.timestamp_us()),
71 fingerprint(other.fingerprint),
72 fingerprint_algorithm(other.fingerprint_algorithm),
73 base64_certificate(other.base64_certificate),
Yves Gerey665174f2018-06-19 15:03:05 +020074 issuer_certificate_id(other.issuer_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -070075
Yves Gerey665174f2018-06-19 15:03:05 +020076RTCCertificateStats::~RTCCertificateStats() {}
hbos2fa7c672016-10-24 04:00:05 -070077
Steve Antond6a5cbd2017-08-18 09:40:25 -070078// clang-format off
hbos0adb8282016-11-23 02:32:06 -080079WEBRTC_RTCSTATS_IMPL(RTCCodecStats, RTCStats, "codec",
80 &payload_type,
hbos13f54b22017-02-28 06:56:04 -080081 &mime_type,
hbos0adb8282016-11-23 02:32:06 -080082 &clock_rate,
83 &channels,
hbos13f54b22017-02-28 06:56:04 -080084 &sdp_fmtp_line,
hbos0adb8282016-11-23 02:32:06 -080085 &implementation);
Steve Antond6a5cbd2017-08-18 09:40:25 -070086// clang-format on
hbos0adb8282016-11-23 02:32:06 -080087
Yves Gerey665174f2018-06-19 15:03:05 +020088RTCCodecStats::RTCCodecStats(const std::string& id, int64_t timestamp_us)
89 : RTCCodecStats(std::string(id), timestamp_us) {}
hbos0adb8282016-11-23 02:32:06 -080090
Yves Gerey665174f2018-06-19 15:03:05 +020091RTCCodecStats::RTCCodecStats(std::string&& id, int64_t timestamp_us)
hbos0adb8282016-11-23 02:32:06 -080092 : RTCStats(std::move(id), timestamp_us),
93 payload_type("payloadType"),
hbos13f54b22017-02-28 06:56:04 -080094 mime_type("mimeType"),
hbos0adb8282016-11-23 02:32:06 -080095 clock_rate("clockRate"),
96 channels("channels"),
hbos13f54b22017-02-28 06:56:04 -080097 sdp_fmtp_line("sdpFmtpLine"),
Yves Gerey665174f2018-06-19 15:03:05 +020098 implementation("implementation") {}
hbos0adb8282016-11-23 02:32:06 -080099
Yves Gerey665174f2018-06-19 15:03:05 +0200100RTCCodecStats::RTCCodecStats(const RTCCodecStats& other)
hbos0adb8282016-11-23 02:32:06 -0800101 : RTCStats(other.id(), other.timestamp_us()),
102 payload_type(other.payload_type),
hbos13f54b22017-02-28 06:56:04 -0800103 mime_type(other.mime_type),
hbos0adb8282016-11-23 02:32:06 -0800104 clock_rate(other.clock_rate),
105 channels(other.channels),
hbos13f54b22017-02-28 06:56:04 -0800106 sdp_fmtp_line(other.sdp_fmtp_line),
Yves Gerey665174f2018-06-19 15:03:05 +0200107 implementation(other.implementation) {}
hbos0adb8282016-11-23 02:32:06 -0800108
Yves Gerey665174f2018-06-19 15:03:05 +0200109RTCCodecStats::~RTCCodecStats() {}
hbos0adb8282016-11-23 02:32:06 -0800110
Steve Antond6a5cbd2017-08-18 09:40:25 -0700111// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700112WEBRTC_RTCSTATS_IMPL(RTCDataChannelStats, RTCStats, "data-channel",
113 &label,
114 &protocol,
115 &datachannelid,
116 &state,
117 &messages_sent,
118 &bytes_sent,
119 &messages_received,
120 &bytes_received);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700121// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700122
Yves Gerey665174f2018-06-19 15:03:05 +0200123RTCDataChannelStats::RTCDataChannelStats(const std::string& id,
124 int64_t timestamp_us)
125 : RTCDataChannelStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700126
Yves Gerey665174f2018-06-19 15:03:05 +0200127RTCDataChannelStats::RTCDataChannelStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700128 : RTCStats(std::move(id), timestamp_us),
129 label("label"),
130 protocol("protocol"),
131 datachannelid("datachannelid"),
132 state("state"),
133 messages_sent("messagesSent"),
134 bytes_sent("bytesSent"),
135 messages_received("messagesReceived"),
Yves Gerey665174f2018-06-19 15:03:05 +0200136 bytes_received("bytesReceived") {}
hbos2fa7c672016-10-24 04:00:05 -0700137
Yves Gerey665174f2018-06-19 15:03:05 +0200138RTCDataChannelStats::RTCDataChannelStats(const RTCDataChannelStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700139 : RTCStats(other.id(), other.timestamp_us()),
140 label(other.label),
141 protocol(other.protocol),
142 datachannelid(other.datachannelid),
143 state(other.state),
144 messages_sent(other.messages_sent),
145 bytes_sent(other.bytes_sent),
146 messages_received(other.messages_received),
Yves Gerey665174f2018-06-19 15:03:05 +0200147 bytes_received(other.bytes_received) {}
hbos2fa7c672016-10-24 04:00:05 -0700148
Yves Gerey665174f2018-06-19 15:03:05 +0200149RTCDataChannelStats::~RTCDataChannelStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700150
Steve Antond6a5cbd2017-08-18 09:40:25 -0700151// clang-format off
hbosc47a0c32016-10-11 14:54:49 -0700152WEBRTC_RTCSTATS_IMPL(RTCIceCandidatePairStats, RTCStats, "candidate-pair",
153 &transport_id,
154 &local_candidate_id,
155 &remote_candidate_id,
156 &state,
157 &priority,
158 &nominated,
159 &writable,
160 &readable,
161 &bytes_sent,
162 &bytes_received,
hbos3168c7a2016-12-15 06:17:08 -0800163 &total_round_trip_time,
164 &current_round_trip_time,
hbosc47a0c32016-10-11 14:54:49 -0700165 &available_outgoing_bitrate,
166 &available_incoming_bitrate,
167 &requests_received,
168 &requests_sent,
169 &responses_received,
170 &responses_sent,
171 &retransmissions_received,
172 &retransmissions_sent,
173 &consent_requests_received,
174 &consent_requests_sent,
175 &consent_responses_received,
176 &consent_responses_sent);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700177// clang-format on
hbosc47a0c32016-10-11 14:54:49 -0700178
Yves Gerey665174f2018-06-19 15:03:05 +0200179RTCIceCandidatePairStats::RTCIceCandidatePairStats(const std::string& id,
180 int64_t timestamp_us)
181 : RTCIceCandidatePairStats(std::string(id), timestamp_us) {}
hbosc47a0c32016-10-11 14:54:49 -0700182
Yves Gerey665174f2018-06-19 15:03:05 +0200183RTCIceCandidatePairStats::RTCIceCandidatePairStats(std::string&& id,
184 int64_t timestamp_us)
hbosc47a0c32016-10-11 14:54:49 -0700185 : RTCStats(std::move(id), timestamp_us),
186 transport_id("transportId"),
187 local_candidate_id("localCandidateId"),
188 remote_candidate_id("remoteCandidateId"),
189 state("state"),
190 priority("priority"),
191 nominated("nominated"),
192 writable("writable"),
193 readable("readable"),
194 bytes_sent("bytesSent"),
195 bytes_received("bytesReceived"),
hbos3168c7a2016-12-15 06:17:08 -0800196 total_round_trip_time("totalRoundTripTime"),
197 current_round_trip_time("currentRoundTripTime"),
hbosc47a0c32016-10-11 14:54:49 -0700198 available_outgoing_bitrate("availableOutgoingBitrate"),
199 available_incoming_bitrate("availableIncomingBitrate"),
200 requests_received("requestsReceived"),
201 requests_sent("requestsSent"),
202 responses_received("responsesReceived"),
203 responses_sent("responsesSent"),
204 retransmissions_received("retransmissionsReceived"),
205 retransmissions_sent("retransmissionsSent"),
206 consent_requests_received("consentRequestsReceived"),
207 consent_requests_sent("consentRequestsSent"),
208 consent_responses_received("consentResponsesReceived"),
Yves Gerey665174f2018-06-19 15:03:05 +0200209 consent_responses_sent("consentResponsesSent") {}
hbosc47a0c32016-10-11 14:54:49 -0700210
211RTCIceCandidatePairStats::RTCIceCandidatePairStats(
212 const RTCIceCandidatePairStats& other)
213 : RTCStats(other.id(), other.timestamp_us()),
214 transport_id(other.transport_id),
215 local_candidate_id(other.local_candidate_id),
216 remote_candidate_id(other.remote_candidate_id),
217 state(other.state),
218 priority(other.priority),
219 nominated(other.nominated),
220 writable(other.writable),
221 readable(other.readable),
222 bytes_sent(other.bytes_sent),
223 bytes_received(other.bytes_received),
hbos3168c7a2016-12-15 06:17:08 -0800224 total_round_trip_time(other.total_round_trip_time),
225 current_round_trip_time(other.current_round_trip_time),
hbosc47a0c32016-10-11 14:54:49 -0700226 available_outgoing_bitrate(other.available_outgoing_bitrate),
227 available_incoming_bitrate(other.available_incoming_bitrate),
228 requests_received(other.requests_received),
229 requests_sent(other.requests_sent),
230 responses_received(other.responses_received),
231 responses_sent(other.responses_sent),
232 retransmissions_received(other.retransmissions_received),
233 retransmissions_sent(other.retransmissions_sent),
234 consent_requests_received(other.consent_requests_received),
235 consent_requests_sent(other.consent_requests_sent),
236 consent_responses_received(other.consent_responses_received),
Yves Gerey665174f2018-06-19 15:03:05 +0200237 consent_responses_sent(other.consent_responses_sent) {}
hbosc47a0c32016-10-11 14:54:49 -0700238
Yves Gerey665174f2018-06-19 15:03:05 +0200239RTCIceCandidatePairStats::~RTCIceCandidatePairStats() {}
hbosc47a0c32016-10-11 14:54:49 -0700240
Steve Antond6a5cbd2017-08-18 09:40:25 -0700241// clang-format off
Henrik Boström1df1bf82018-03-20 13:24:20 +0100242WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "abstract-ice-candidate",
hbosb4e426e2017-01-02 09:59:31 -0800243 &transport_id,
hbosc3a2b7f2017-01-02 04:46:15 -0800244 &is_remote,
Gary Liu37e489c2017-11-21 10:49:36 -0800245 &network_type,
hbosab9f6e42016-10-07 02:18:47 -0700246 &ip,
247 &port,
248 &protocol,
Philipp Hancke95513752018-09-27 14:40:08 +0200249 &relay_protocol,
hbosab9f6e42016-10-07 02:18:47 -0700250 &candidate_type,
251 &priority,
hbosd17a5a72017-01-02 08:09:59 -0800252 &url,
253 &deleted);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700254// clang-format on
hbosab9f6e42016-10-07 02:18:47 -0700255
Yves Gerey665174f2018-06-19 15:03:05 +0200256RTCIceCandidateStats::RTCIceCandidateStats(const std::string& id,
257 int64_t timestamp_us,
258 bool is_remote)
259 : RTCIceCandidateStats(std::string(id), timestamp_us, is_remote) {}
hbosab9f6e42016-10-07 02:18:47 -0700260
Gary Liu37e489c2017-11-21 10:49:36 -0800261RTCIceCandidateStats::RTCIceCandidateStats(std::string&& id,
262 int64_t timestamp_us,
263 bool is_remote)
hbosab9f6e42016-10-07 02:18:47 -0700264 : RTCStats(std::move(id), timestamp_us),
hbosb4e426e2017-01-02 09:59:31 -0800265 transport_id("transportId"),
hbosc3a2b7f2017-01-02 04:46:15 -0800266 is_remote("isRemote", is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800267 network_type("networkType"),
hbosab9f6e42016-10-07 02:18:47 -0700268 ip("ip"),
269 port("port"),
270 protocol("protocol"),
Philipp Hancke95513752018-09-27 14:40:08 +0200271 relay_protocol("relayProtocol"),
hbosab9f6e42016-10-07 02:18:47 -0700272 candidate_type("candidateType"),
273 priority("priority"),
hbosd17a5a72017-01-02 08:09:59 -0800274 url("url"),
Gary Liu37e489c2017-11-21 10:49:36 -0800275 deleted("deleted", false) {}
hbosab9f6e42016-10-07 02:18:47 -0700276
277RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
278 : RTCStats(other.id(), other.timestamp_us()),
hbosb4e426e2017-01-02 09:59:31 -0800279 transport_id(other.transport_id),
hbosc3a2b7f2017-01-02 04:46:15 -0800280 is_remote(other.is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800281 network_type(other.network_type),
hbosab9f6e42016-10-07 02:18:47 -0700282 ip(other.ip),
283 port(other.port),
284 protocol(other.protocol),
Philipp Hancke95513752018-09-27 14:40:08 +0200285 relay_protocol(other.relay_protocol),
hbosab9f6e42016-10-07 02:18:47 -0700286 candidate_type(other.candidate_type),
287 priority(other.priority),
hbosd17a5a72017-01-02 08:09:59 -0800288 url(other.url),
Gary Liu37e489c2017-11-21 10:49:36 -0800289 deleted(other.deleted) {}
hbosab9f6e42016-10-07 02:18:47 -0700290
Yves Gerey665174f2018-06-19 15:03:05 +0200291RTCIceCandidateStats::~RTCIceCandidateStats() {}
hbosab9f6e42016-10-07 02:18:47 -0700292
293const char RTCLocalIceCandidateStats::kType[] = "local-candidate";
294
Yves Gerey665174f2018-06-19 15:03:05 +0200295RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(const std::string& id,
296 int64_t timestamp_us)
297 : RTCIceCandidateStats(id, timestamp_us, false) {}
hbosab9f6e42016-10-07 02:18:47 -0700298
Yves Gerey665174f2018-06-19 15:03:05 +0200299RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(std::string&& id,
300 int64_t timestamp_us)
301 : RTCIceCandidateStats(std::move(id), timestamp_us, false) {}
hbosab9f6e42016-10-07 02:18:47 -0700302
Henrik Boström1df1bf82018-03-20 13:24:20 +0100303std::unique_ptr<RTCStats> RTCLocalIceCandidateStats::copy() const {
304 return std::unique_ptr<RTCStats>(new RTCLocalIceCandidateStats(*this));
305}
306
hbosab9f6e42016-10-07 02:18:47 -0700307const char* RTCLocalIceCandidateStats::type() const {
308 return kType;
309}
310
311const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate";
312
Yves Gerey665174f2018-06-19 15:03:05 +0200313RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(const std::string& id,
314 int64_t timestamp_us)
315 : RTCIceCandidateStats(id, timestamp_us, true) {}
hbosab9f6e42016-10-07 02:18:47 -0700316
Yves Gerey665174f2018-06-19 15:03:05 +0200317RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(std::string&& id,
318 int64_t timestamp_us)
319 : RTCIceCandidateStats(std::move(id), timestamp_us, true) {}
hbosab9f6e42016-10-07 02:18:47 -0700320
Henrik Boström1df1bf82018-03-20 13:24:20 +0100321std::unique_ptr<RTCStats> RTCRemoteIceCandidateStats::copy() const {
322 return std::unique_ptr<RTCStats>(new RTCRemoteIceCandidateStats(*this));
323}
324
hbosab9f6e42016-10-07 02:18:47 -0700325const char* RTCRemoteIceCandidateStats::type() const {
326 return kType;
327}
328
Steve Antond6a5cbd2017-08-18 09:40:25 -0700329// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800330WEBRTC_RTCSTATS_IMPL(RTCMediaStreamStats, RTCStats, "stream",
331 &stream_identifier,
332 &track_ids);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700333// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800334
Yves Gerey665174f2018-06-19 15:03:05 +0200335RTCMediaStreamStats::RTCMediaStreamStats(const std::string& id,
336 int64_t timestamp_us)
337 : RTCMediaStreamStats(std::string(id), timestamp_us) {}
hbos09bc1282016-11-08 06:29:22 -0800338
Yves Gerey665174f2018-06-19 15:03:05 +0200339RTCMediaStreamStats::RTCMediaStreamStats(std::string&& id, int64_t timestamp_us)
hbos09bc1282016-11-08 06:29:22 -0800340 : RTCStats(std::move(id), timestamp_us),
341 stream_identifier("streamIdentifier"),
Yves Gerey665174f2018-06-19 15:03:05 +0200342 track_ids("trackIds") {}
hbos09bc1282016-11-08 06:29:22 -0800343
Yves Gerey665174f2018-06-19 15:03:05 +0200344RTCMediaStreamStats::RTCMediaStreamStats(const RTCMediaStreamStats& other)
hbos09bc1282016-11-08 06:29:22 -0800345 : RTCStats(other.id(), other.timestamp_us()),
346 stream_identifier(other.stream_identifier),
Yves Gerey665174f2018-06-19 15:03:05 +0200347 track_ids(other.track_ids) {}
hbos09bc1282016-11-08 06:29:22 -0800348
Yves Gerey665174f2018-06-19 15:03:05 +0200349RTCMediaStreamStats::~RTCMediaStreamStats() {}
hbos09bc1282016-11-08 06:29:22 -0800350
Steve Antond6a5cbd2017-08-18 09:40:25 -0700351// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800352WEBRTC_RTCSTATS_IMPL(RTCMediaStreamTrackStats, RTCStats, "track",
zsteine76bd3a2017-07-14 12:17:49 -0700353 &track_identifier,
354 &remote_source,
355 &ended,
356 &detached,
357 &kind,
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200358 &jitter_buffer_delay,
zsteine76bd3a2017-07-14 12:17:49 -0700359 &frame_width,
360 &frame_height,
361 &frames_per_second,
362 &frames_sent,
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100363 &huge_frames_sent,
zsteine76bd3a2017-07-14 12:17:49 -0700364 &frames_received,
365 &frames_decoded,
366 &frames_dropped,
367 &frames_corrupted,
368 &partial_frames_lost,
369 &full_frames_lost,
370 &audio_level,
371 &total_audio_energy,
zsteine76bd3a2017-07-14 12:17:49 -0700372 &echo_return_loss,
Steve Anton2dbc69f2017-08-24 17:15:13 -0700373 &echo_return_loss_enhancement,
374 &total_samples_received,
375 &total_samples_duration,
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200376 &concealed_samples,
377 &concealment_events);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700378// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800379
Yves Gerey665174f2018-06-19 15:03:05 +0200380RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(const std::string& id,
381 int64_t timestamp_us,
382 const char* kind)
383 : RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) {}
hbos09bc1282016-11-08 06:29:22 -0800384
zsteine76bd3a2017-07-14 12:17:49 -0700385RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(std::string&& id,
386 int64_t timestamp_us,
387 const char* kind)
hbos09bc1282016-11-08 06:29:22 -0800388 : RTCStats(std::move(id), timestamp_us),
389 track_identifier("trackIdentifier"),
390 remote_source("remoteSource"),
391 ended("ended"),
392 detached("detached"),
hbos160e4a72017-01-17 02:53:23 -0800393 kind("kind", kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200394 jitter_buffer_delay("jitterBufferDelay"),
hbos09bc1282016-11-08 06:29:22 -0800395 frame_width("frameWidth"),
396 frame_height("frameHeight"),
397 frames_per_second("framesPerSecond"),
398 frames_sent("framesSent"),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100399 huge_frames_sent("hugeFramesSent"),
hbos09bc1282016-11-08 06:29:22 -0800400 frames_received("framesReceived"),
401 frames_decoded("framesDecoded"),
402 frames_dropped("framesDropped"),
403 frames_corrupted("framesCorrupted"),
404 partial_frames_lost("partialFramesLost"),
405 full_frames_lost("fullFramesLost"),
406 audio_level("audioLevel"),
zsteine76bd3a2017-07-14 12:17:49 -0700407 total_audio_energy("totalAudioEnergy"),
hbos09bc1282016-11-08 06:29:22 -0800408 echo_return_loss("echoReturnLoss"),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700409 echo_return_loss_enhancement("echoReturnLossEnhancement"),
410 total_samples_received("totalSamplesReceived"),
411 total_samples_duration("totalSamplesDuration"),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200412 concealed_samples("concealedSamples"),
413 concealment_events("concealmentEvents") {
hbos160e4a72017-01-17 02:53:23 -0800414 RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
415 kind == RTCMediaStreamTrackKind::kVideo);
hbos09bc1282016-11-08 06:29:22 -0800416}
417
418RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
419 const RTCMediaStreamTrackStats& other)
420 : RTCStats(other.id(), other.timestamp_us()),
421 track_identifier(other.track_identifier),
422 remote_source(other.remote_source),
423 ended(other.ended),
424 detached(other.detached),
hbos160e4a72017-01-17 02:53:23 -0800425 kind(other.kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200426 jitter_buffer_delay(other.jitter_buffer_delay),
hbos09bc1282016-11-08 06:29:22 -0800427 frame_width(other.frame_width),
428 frame_height(other.frame_height),
429 frames_per_second(other.frames_per_second),
430 frames_sent(other.frames_sent),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100431 huge_frames_sent(other.huge_frames_sent),
hbos09bc1282016-11-08 06:29:22 -0800432 frames_received(other.frames_received),
433 frames_decoded(other.frames_decoded),
434 frames_dropped(other.frames_dropped),
435 frames_corrupted(other.frames_corrupted),
436 partial_frames_lost(other.partial_frames_lost),
437 full_frames_lost(other.full_frames_lost),
438 audio_level(other.audio_level),
zsteine76bd3a2017-07-14 12:17:49 -0700439 total_audio_energy(other.total_audio_energy),
hbos09bc1282016-11-08 06:29:22 -0800440 echo_return_loss(other.echo_return_loss),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700441 echo_return_loss_enhancement(other.echo_return_loss_enhancement),
442 total_samples_received(other.total_samples_received),
443 total_samples_duration(other.total_samples_duration),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200444 concealed_samples(other.concealed_samples),
445 concealment_events(other.concealment_events) {}
hbos09bc1282016-11-08 06:29:22 -0800446
Yves Gerey665174f2018-06-19 15:03:05 +0200447RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {}
hbos09bc1282016-11-08 06:29:22 -0800448
Steve Antond6a5cbd2017-08-18 09:40:25 -0700449// clang-format off
hbosfc5e0502016-10-06 02:06:10 -0700450WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
451 &data_channels_opened,
452 &data_channels_closed);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700453// clang-format on
hbosd565b732016-08-30 14:04:35 -0700454
Yves Gerey665174f2018-06-19 15:03:05 +0200455RTCPeerConnectionStats::RTCPeerConnectionStats(const std::string& id,
456 int64_t timestamp_us)
457 : RTCPeerConnectionStats(std::string(id), timestamp_us) {}
hbosd565b732016-08-30 14:04:35 -0700458
Yves Gerey665174f2018-06-19 15:03:05 +0200459RTCPeerConnectionStats::RTCPeerConnectionStats(std::string&& id,
460 int64_t timestamp_us)
hbos0e6758d2016-08-31 07:57:36 -0700461 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700462 data_channels_opened("dataChannelsOpened"),
Yves Gerey665174f2018-06-19 15:03:05 +0200463 data_channels_closed("dataChannelsClosed") {}
hbosd565b732016-08-30 14:04:35 -0700464
hbosfc5e0502016-10-06 02:06:10 -0700465RTCPeerConnectionStats::RTCPeerConnectionStats(
466 const RTCPeerConnectionStats& other)
467 : RTCStats(other.id(), other.timestamp_us()),
468 data_channels_opened(other.data_channels_opened),
Yves Gerey665174f2018-06-19 15:03:05 +0200469 data_channels_closed(other.data_channels_closed) {}
hbosfc5e0502016-10-06 02:06:10 -0700470
Yves Gerey665174f2018-06-19 15:03:05 +0200471RTCPeerConnectionStats::~RTCPeerConnectionStats() {}
hbosfc5e0502016-10-06 02:06:10 -0700472
Steve Antond6a5cbd2017-08-18 09:40:25 -0700473// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700474WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
475 &ssrc,
476 &associate_stats_id,
477 &is_remote,
478 &media_type,
Philipp Hancke3bc01662018-08-28 14:55:03 +0200479 &kind,
hbosb0ae9202017-01-27 06:35:16 -0800480 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700481 &transport_id,
482 &codec_id,
483 &fir_count,
484 &pli_count,
485 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800486 &sli_count,
487 &qp_sum);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700488// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700489
Yves Gerey665174f2018-06-19 15:03:05 +0200490RTCRTPStreamStats::RTCRTPStreamStats(const std::string& id,
491 int64_t timestamp_us)
492 : RTCRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700493
Yves Gerey665174f2018-06-19 15:03:05 +0200494RTCRTPStreamStats::RTCRTPStreamStats(std::string&& id, int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700495 : RTCStats(std::move(id), timestamp_us),
496 ssrc("ssrc"),
497 associate_stats_id("associateStatsId"),
498 is_remote("isRemote", false),
499 media_type("mediaType"),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200500 kind("kind"),
hbosb0ae9202017-01-27 06:35:16 -0800501 track_id("trackId"),
hbos6ded1902016-11-01 01:50:46 -0700502 transport_id("transportId"),
503 codec_id("codecId"),
504 fir_count("firCount"),
505 pli_count("pliCount"),
506 nack_count("nackCount"),
hbos6769c492017-01-02 08:35:13 -0800507 sli_count("sliCount"),
Yves Gerey665174f2018-06-19 15:03:05 +0200508 qp_sum("qpSum") {}
hbos6ded1902016-11-01 01:50:46 -0700509
Yves Gerey665174f2018-06-19 15:03:05 +0200510RTCRTPStreamStats::RTCRTPStreamStats(const RTCRTPStreamStats& other)
hbos6ded1902016-11-01 01:50:46 -0700511 : RTCStats(other.id(), other.timestamp_us()),
512 ssrc(other.ssrc),
513 associate_stats_id(other.associate_stats_id),
514 is_remote(other.is_remote),
515 media_type(other.media_type),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200516 kind(other.kind),
hbosb0ae9202017-01-27 06:35:16 -0800517 track_id(other.track_id),
hbos6ded1902016-11-01 01:50:46 -0700518 transport_id(other.transport_id),
519 codec_id(other.codec_id),
520 fir_count(other.fir_count),
521 pli_count(other.pli_count),
522 nack_count(other.nack_count),
hbos6769c492017-01-02 08:35:13 -0800523 sli_count(other.sli_count),
Yves Gerey665174f2018-06-19 15:03:05 +0200524 qp_sum(other.qp_sum) {}
hbos6ded1902016-11-01 01:50:46 -0700525
Yves Gerey665174f2018-06-19 15:03:05 +0200526RTCRTPStreamStats::~RTCRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700527
Steve Antond6a5cbd2017-08-18 09:40:25 -0700528// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700529WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700530 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
531 &packets_received,
532 &bytes_received,
533 &packets_lost,
534 &jitter,
535 &fraction_lost,
hbosa7a9be12017-03-01 01:02:45 -0800536 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700537 &packets_discarded,
538 &packets_repaired,
539 &burst_packets_lost,
540 &burst_packets_discarded,
541 &burst_loss_count,
542 &burst_discard_count,
543 &burst_loss_rate,
544 &burst_discard_rate,
545 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800546 &gap_discard_rate,
547 &frames_decoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700548// clang-format on
hboseeafe942016-11-01 03:00:17 -0700549
Yves Gerey665174f2018-06-19 15:03:05 +0200550RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id,
551 int64_t timestamp_us)
552 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {}
hboseeafe942016-11-01 03:00:17 -0700553
Yves Gerey665174f2018-06-19 15:03:05 +0200554RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
555 int64_t timestamp_us)
hboseeafe942016-11-01 03:00:17 -0700556 : RTCRTPStreamStats(std::move(id), timestamp_us),
557 packets_received("packetsReceived"),
558 bytes_received("bytesReceived"),
559 packets_lost("packetsLost"),
560 jitter("jitter"),
561 fraction_lost("fractionLost"),
hbosa7a9be12017-03-01 01:02:45 -0800562 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700563 packets_discarded("packetsDiscarded"),
564 packets_repaired("packetsRepaired"),
565 burst_packets_lost("burstPacketsLost"),
566 burst_packets_discarded("burstPacketsDiscarded"),
567 burst_loss_count("burstLossCount"),
568 burst_discard_count("burstDiscardCount"),
569 burst_loss_rate("burstLossRate"),
570 burst_discard_rate("burstDiscardRate"),
571 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800572 gap_discard_rate("gapDiscardRate"),
Yves Gerey665174f2018-06-19 15:03:05 +0200573 frames_decoded("framesDecoded") {}
hboseeafe942016-11-01 03:00:17 -0700574
575RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
576 const RTCInboundRTPStreamStats& other)
577 : RTCRTPStreamStats(other),
578 packets_received(other.packets_received),
579 bytes_received(other.bytes_received),
580 packets_lost(other.packets_lost),
581 jitter(other.jitter),
582 fraction_lost(other.fraction_lost),
hbosa7a9be12017-03-01 01:02:45 -0800583 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700584 packets_discarded(other.packets_discarded),
585 packets_repaired(other.packets_repaired),
586 burst_packets_lost(other.burst_packets_lost),
587 burst_packets_discarded(other.burst_packets_discarded),
588 burst_loss_count(other.burst_loss_count),
589 burst_discard_count(other.burst_discard_count),
590 burst_loss_rate(other.burst_loss_rate),
591 burst_discard_rate(other.burst_discard_rate),
592 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800593 gap_discard_rate(other.gap_discard_rate),
Yves Gerey665174f2018-06-19 15:03:05 +0200594 frames_decoded(other.frames_decoded) {}
hboseeafe942016-11-01 03:00:17 -0700595
Yves Gerey665174f2018-06-19 15:03:05 +0200596RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {}
hboseeafe942016-11-01 03:00:17 -0700597
Steve Antond6a5cbd2017-08-18 09:40:25 -0700598// clang-format off
hboseeafe942016-11-01 03:00:17 -0700599WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700600 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
601 &packets_sent,
602 &bytes_sent,
603 &target_bitrate,
hbos6769c492017-01-02 08:35:13 -0800604 &frames_encoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700605// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700606
Yves Gerey665174f2018-06-19 15:03:05 +0200607RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(const std::string& id,
608 int64_t timestamp_us)
609 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700610
Yves Gerey665174f2018-06-19 15:03:05 +0200611RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id,
612 int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700613 : RTCRTPStreamStats(std::move(id), timestamp_us),
614 packets_sent("packetsSent"),
615 bytes_sent("bytesSent"),
616 target_bitrate("targetBitrate"),
Yves Gerey665174f2018-06-19 15:03:05 +0200617 frames_encoded("framesEncoded") {}
hbos6ded1902016-11-01 01:50:46 -0700618
619RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
620 const RTCOutboundRTPStreamStats& other)
621 : RTCRTPStreamStats(other),
622 packets_sent(other.packets_sent),
623 bytes_sent(other.bytes_sent),
624 target_bitrate(other.target_bitrate),
Yves Gerey665174f2018-06-19 15:03:05 +0200625 frames_encoded(other.frames_encoded) {}
hbos6ded1902016-11-01 01:50:46 -0700626
Yves Gerey665174f2018-06-19 15:03:05 +0200627RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700628
Steve Antond6a5cbd2017-08-18 09:40:25 -0700629// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700630WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
631 &bytes_sent,
632 &bytes_received,
633 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800634 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700635 &selected_candidate_pair_id,
636 &local_certificate_id,
637 &remote_certificate_id);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700638// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700639
Yves Gerey665174f2018-06-19 15:03:05 +0200640RTCTransportStats::RTCTransportStats(const std::string& id,
641 int64_t timestamp_us)
642 : RTCTransportStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700643
Yves Gerey665174f2018-06-19 15:03:05 +0200644RTCTransportStats::RTCTransportStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700645 : RTCStats(std::move(id), timestamp_us),
646 bytes_sent("bytesSent"),
647 bytes_received("bytesReceived"),
648 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800649 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700650 selected_candidate_pair_id("selectedCandidatePairId"),
651 local_certificate_id("localCertificateId"),
Yves Gerey665174f2018-06-19 15:03:05 +0200652 remote_certificate_id("remoteCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -0700653
Yves Gerey665174f2018-06-19 15:03:05 +0200654RTCTransportStats::RTCTransportStats(const RTCTransportStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700655 : RTCStats(other.id(), other.timestamp_us()),
656 bytes_sent(other.bytes_sent),
657 bytes_received(other.bytes_received),
658 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800659 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700660 selected_candidate_pair_id(other.selected_candidate_pair_id),
661 local_certificate_id(other.local_certificate_id),
Yves Gerey665174f2018-06-19 15:03:05 +0200662 remote_certificate_id(other.remote_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -0700663
Yves Gerey665174f2018-06-19 15:03:05 +0200664RTCTransportStats::~RTCTransportStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700665
hbosd565b732016-08-30 14:04:35 -0700666} // namespace webrtc