blob: 669db14fc84c57a5e835adac3fe5d009add0bb4c [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,
Ruslan Burakov8af88962018-11-22 17:21:10 +0100377 &concealment_events,
378 &jitter_buffer_flushes);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700379// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800380
Yves Gerey665174f2018-06-19 15:03:05 +0200381RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(const std::string& id,
382 int64_t timestamp_us,
383 const char* kind)
384 : RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) {}
hbos09bc1282016-11-08 06:29:22 -0800385
zsteine76bd3a2017-07-14 12:17:49 -0700386RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(std::string&& id,
387 int64_t timestamp_us,
388 const char* kind)
hbos09bc1282016-11-08 06:29:22 -0800389 : RTCStats(std::move(id), timestamp_us),
390 track_identifier("trackIdentifier"),
391 remote_source("remoteSource"),
392 ended("ended"),
393 detached("detached"),
hbos160e4a72017-01-17 02:53:23 -0800394 kind("kind", kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200395 jitter_buffer_delay("jitterBufferDelay"),
hbos09bc1282016-11-08 06:29:22 -0800396 frame_width("frameWidth"),
397 frame_height("frameHeight"),
398 frames_per_second("framesPerSecond"),
399 frames_sent("framesSent"),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100400 huge_frames_sent("hugeFramesSent"),
hbos09bc1282016-11-08 06:29:22 -0800401 frames_received("framesReceived"),
402 frames_decoded("framesDecoded"),
403 frames_dropped("framesDropped"),
404 frames_corrupted("framesCorrupted"),
405 partial_frames_lost("partialFramesLost"),
406 full_frames_lost("fullFramesLost"),
407 audio_level("audioLevel"),
zsteine76bd3a2017-07-14 12:17:49 -0700408 total_audio_energy("totalAudioEnergy"),
hbos09bc1282016-11-08 06:29:22 -0800409 echo_return_loss("echoReturnLoss"),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700410 echo_return_loss_enhancement("echoReturnLossEnhancement"),
411 total_samples_received("totalSamplesReceived"),
412 total_samples_duration("totalSamplesDuration"),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200413 concealed_samples("concealedSamples"),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100414 concealment_events("concealmentEvents"),
415 jitter_buffer_flushes("jitterBufferFlushes") {
hbos160e4a72017-01-17 02:53:23 -0800416 RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
417 kind == RTCMediaStreamTrackKind::kVideo);
hbos09bc1282016-11-08 06:29:22 -0800418}
419
420RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
421 const RTCMediaStreamTrackStats& other)
422 : RTCStats(other.id(), other.timestamp_us()),
423 track_identifier(other.track_identifier),
424 remote_source(other.remote_source),
425 ended(other.ended),
426 detached(other.detached),
hbos160e4a72017-01-17 02:53:23 -0800427 kind(other.kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200428 jitter_buffer_delay(other.jitter_buffer_delay),
hbos09bc1282016-11-08 06:29:22 -0800429 frame_width(other.frame_width),
430 frame_height(other.frame_height),
431 frames_per_second(other.frames_per_second),
432 frames_sent(other.frames_sent),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100433 huge_frames_sent(other.huge_frames_sent),
hbos09bc1282016-11-08 06:29:22 -0800434 frames_received(other.frames_received),
435 frames_decoded(other.frames_decoded),
436 frames_dropped(other.frames_dropped),
437 frames_corrupted(other.frames_corrupted),
438 partial_frames_lost(other.partial_frames_lost),
439 full_frames_lost(other.full_frames_lost),
440 audio_level(other.audio_level),
zsteine76bd3a2017-07-14 12:17:49 -0700441 total_audio_energy(other.total_audio_energy),
hbos09bc1282016-11-08 06:29:22 -0800442 echo_return_loss(other.echo_return_loss),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700443 echo_return_loss_enhancement(other.echo_return_loss_enhancement),
444 total_samples_received(other.total_samples_received),
445 total_samples_duration(other.total_samples_duration),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200446 concealed_samples(other.concealed_samples),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100447 concealment_events(other.concealment_events),
448 jitter_buffer_flushes(other.jitter_buffer_flushes) {}
hbos09bc1282016-11-08 06:29:22 -0800449
Yves Gerey665174f2018-06-19 15:03:05 +0200450RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {}
hbos09bc1282016-11-08 06:29:22 -0800451
Steve Antond6a5cbd2017-08-18 09:40:25 -0700452// clang-format off
hbosfc5e0502016-10-06 02:06:10 -0700453WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
454 &data_channels_opened,
455 &data_channels_closed);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700456// clang-format on
hbosd565b732016-08-30 14:04:35 -0700457
Yves Gerey665174f2018-06-19 15:03:05 +0200458RTCPeerConnectionStats::RTCPeerConnectionStats(const std::string& id,
459 int64_t timestamp_us)
460 : RTCPeerConnectionStats(std::string(id), timestamp_us) {}
hbosd565b732016-08-30 14:04:35 -0700461
Yves Gerey665174f2018-06-19 15:03:05 +0200462RTCPeerConnectionStats::RTCPeerConnectionStats(std::string&& id,
463 int64_t timestamp_us)
hbos0e6758d2016-08-31 07:57:36 -0700464 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700465 data_channels_opened("dataChannelsOpened"),
Yves Gerey665174f2018-06-19 15:03:05 +0200466 data_channels_closed("dataChannelsClosed") {}
hbosd565b732016-08-30 14:04:35 -0700467
hbosfc5e0502016-10-06 02:06:10 -0700468RTCPeerConnectionStats::RTCPeerConnectionStats(
469 const RTCPeerConnectionStats& other)
470 : RTCStats(other.id(), other.timestamp_us()),
471 data_channels_opened(other.data_channels_opened),
Yves Gerey665174f2018-06-19 15:03:05 +0200472 data_channels_closed(other.data_channels_closed) {}
hbosfc5e0502016-10-06 02:06:10 -0700473
Yves Gerey665174f2018-06-19 15:03:05 +0200474RTCPeerConnectionStats::~RTCPeerConnectionStats() {}
hbosfc5e0502016-10-06 02:06:10 -0700475
Steve Antond6a5cbd2017-08-18 09:40:25 -0700476// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700477WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
478 &ssrc,
479 &associate_stats_id,
480 &is_remote,
481 &media_type,
Philipp Hancke3bc01662018-08-28 14:55:03 +0200482 &kind,
hbosb0ae9202017-01-27 06:35:16 -0800483 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700484 &transport_id,
485 &codec_id,
486 &fir_count,
487 &pli_count,
488 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800489 &sli_count,
490 &qp_sum);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700491// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700492
Yves Gerey665174f2018-06-19 15:03:05 +0200493RTCRTPStreamStats::RTCRTPStreamStats(const std::string& id,
494 int64_t timestamp_us)
495 : RTCRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700496
Yves Gerey665174f2018-06-19 15:03:05 +0200497RTCRTPStreamStats::RTCRTPStreamStats(std::string&& id, int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700498 : RTCStats(std::move(id), timestamp_us),
499 ssrc("ssrc"),
500 associate_stats_id("associateStatsId"),
501 is_remote("isRemote", false),
502 media_type("mediaType"),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200503 kind("kind"),
hbosb0ae9202017-01-27 06:35:16 -0800504 track_id("trackId"),
hbos6ded1902016-11-01 01:50:46 -0700505 transport_id("transportId"),
506 codec_id("codecId"),
507 fir_count("firCount"),
508 pli_count("pliCount"),
509 nack_count("nackCount"),
hbos6769c492017-01-02 08:35:13 -0800510 sli_count("sliCount"),
Yves Gerey665174f2018-06-19 15:03:05 +0200511 qp_sum("qpSum") {}
hbos6ded1902016-11-01 01:50:46 -0700512
Yves Gerey665174f2018-06-19 15:03:05 +0200513RTCRTPStreamStats::RTCRTPStreamStats(const RTCRTPStreamStats& other)
hbos6ded1902016-11-01 01:50:46 -0700514 : RTCStats(other.id(), other.timestamp_us()),
515 ssrc(other.ssrc),
516 associate_stats_id(other.associate_stats_id),
517 is_remote(other.is_remote),
518 media_type(other.media_type),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200519 kind(other.kind),
hbosb0ae9202017-01-27 06:35:16 -0800520 track_id(other.track_id),
hbos6ded1902016-11-01 01:50:46 -0700521 transport_id(other.transport_id),
522 codec_id(other.codec_id),
523 fir_count(other.fir_count),
524 pli_count(other.pli_count),
525 nack_count(other.nack_count),
hbos6769c492017-01-02 08:35:13 -0800526 sli_count(other.sli_count),
Yves Gerey665174f2018-06-19 15:03:05 +0200527 qp_sum(other.qp_sum) {}
hbos6ded1902016-11-01 01:50:46 -0700528
Yves Gerey665174f2018-06-19 15:03:05 +0200529RTCRTPStreamStats::~RTCRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700530
Steve Antond6a5cbd2017-08-18 09:40:25 -0700531// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700532WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700533 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
534 &packets_received,
535 &bytes_received,
536 &packets_lost,
537 &jitter,
538 &fraction_lost,
hbosa7a9be12017-03-01 01:02:45 -0800539 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700540 &packets_discarded,
541 &packets_repaired,
542 &burst_packets_lost,
543 &burst_packets_discarded,
544 &burst_loss_count,
545 &burst_discard_count,
546 &burst_loss_rate,
547 &burst_discard_rate,
548 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800549 &gap_discard_rate,
550 &frames_decoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700551// clang-format on
hboseeafe942016-11-01 03:00:17 -0700552
Yves Gerey665174f2018-06-19 15:03:05 +0200553RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id,
554 int64_t timestamp_us)
555 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {}
hboseeafe942016-11-01 03:00:17 -0700556
Yves Gerey665174f2018-06-19 15:03:05 +0200557RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
558 int64_t timestamp_us)
hboseeafe942016-11-01 03:00:17 -0700559 : RTCRTPStreamStats(std::move(id), timestamp_us),
560 packets_received("packetsReceived"),
561 bytes_received("bytesReceived"),
562 packets_lost("packetsLost"),
563 jitter("jitter"),
564 fraction_lost("fractionLost"),
hbosa7a9be12017-03-01 01:02:45 -0800565 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700566 packets_discarded("packetsDiscarded"),
567 packets_repaired("packetsRepaired"),
568 burst_packets_lost("burstPacketsLost"),
569 burst_packets_discarded("burstPacketsDiscarded"),
570 burst_loss_count("burstLossCount"),
571 burst_discard_count("burstDiscardCount"),
572 burst_loss_rate("burstLossRate"),
573 burst_discard_rate("burstDiscardRate"),
574 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800575 gap_discard_rate("gapDiscardRate"),
Yves Gerey665174f2018-06-19 15:03:05 +0200576 frames_decoded("framesDecoded") {}
hboseeafe942016-11-01 03:00:17 -0700577
578RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
579 const RTCInboundRTPStreamStats& other)
580 : RTCRTPStreamStats(other),
581 packets_received(other.packets_received),
582 bytes_received(other.bytes_received),
583 packets_lost(other.packets_lost),
584 jitter(other.jitter),
585 fraction_lost(other.fraction_lost),
hbosa7a9be12017-03-01 01:02:45 -0800586 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700587 packets_discarded(other.packets_discarded),
588 packets_repaired(other.packets_repaired),
589 burst_packets_lost(other.burst_packets_lost),
590 burst_packets_discarded(other.burst_packets_discarded),
591 burst_loss_count(other.burst_loss_count),
592 burst_discard_count(other.burst_discard_count),
593 burst_loss_rate(other.burst_loss_rate),
594 burst_discard_rate(other.burst_discard_rate),
595 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800596 gap_discard_rate(other.gap_discard_rate),
Yves Gerey665174f2018-06-19 15:03:05 +0200597 frames_decoded(other.frames_decoded) {}
hboseeafe942016-11-01 03:00:17 -0700598
Yves Gerey665174f2018-06-19 15:03:05 +0200599RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {}
hboseeafe942016-11-01 03:00:17 -0700600
Steve Antond6a5cbd2017-08-18 09:40:25 -0700601// clang-format off
hboseeafe942016-11-01 03:00:17 -0700602WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700603 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
604 &packets_sent,
605 &bytes_sent,
606 &target_bitrate,
hbos6769c492017-01-02 08:35:13 -0800607 &frames_encoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700608// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700609
Yves Gerey665174f2018-06-19 15:03:05 +0200610RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(const std::string& id,
611 int64_t timestamp_us)
612 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700613
Yves Gerey665174f2018-06-19 15:03:05 +0200614RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id,
615 int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700616 : RTCRTPStreamStats(std::move(id), timestamp_us),
617 packets_sent("packetsSent"),
618 bytes_sent("bytesSent"),
619 target_bitrate("targetBitrate"),
Yves Gerey665174f2018-06-19 15:03:05 +0200620 frames_encoded("framesEncoded") {}
hbos6ded1902016-11-01 01:50:46 -0700621
622RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
623 const RTCOutboundRTPStreamStats& other)
624 : RTCRTPStreamStats(other),
625 packets_sent(other.packets_sent),
626 bytes_sent(other.bytes_sent),
627 target_bitrate(other.target_bitrate),
Yves Gerey665174f2018-06-19 15:03:05 +0200628 frames_encoded(other.frames_encoded) {}
hbos6ded1902016-11-01 01:50:46 -0700629
Yves Gerey665174f2018-06-19 15:03:05 +0200630RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700631
Steve Antond6a5cbd2017-08-18 09:40:25 -0700632// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700633WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
634 &bytes_sent,
635 &bytes_received,
636 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800637 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700638 &selected_candidate_pair_id,
639 &local_certificate_id,
640 &remote_certificate_id);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700641// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700642
Yves Gerey665174f2018-06-19 15:03:05 +0200643RTCTransportStats::RTCTransportStats(const std::string& id,
644 int64_t timestamp_us)
645 : RTCTransportStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700646
Yves Gerey665174f2018-06-19 15:03:05 +0200647RTCTransportStats::RTCTransportStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700648 : RTCStats(std::move(id), timestamp_us),
649 bytes_sent("bytesSent"),
650 bytes_received("bytesReceived"),
651 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800652 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700653 selected_candidate_pair_id("selectedCandidatePairId"),
654 local_certificate_id("localCertificateId"),
Yves Gerey665174f2018-06-19 15:03:05 +0200655 remote_certificate_id("remoteCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -0700656
Yves Gerey665174f2018-06-19 15:03:05 +0200657RTCTransportStats::RTCTransportStats(const RTCTransportStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700658 : RTCStats(other.id(), other.timestamp_us()),
659 bytes_sent(other.bytes_sent),
660 bytes_received(other.bytes_received),
661 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800662 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700663 selected_candidate_pair_id(other.selected_candidate_pair_id),
664 local_certificate_id(other.local_certificate_id),
Yves Gerey665174f2018-06-19 15:03:05 +0200665 remote_certificate_id(other.remote_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -0700666
Yves Gerey665174f2018-06-19 15:03:05 +0200667RTCTransportStats::~RTCTransportStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700668
hbosd565b732016-08-30 14:04:35 -0700669} // namespace webrtc