blob: b711a2775885706b83e65cf01ad32035742e8fec [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,
249 &candidate_type,
250 &priority,
hbosd17a5a72017-01-02 08:09:59 -0800251 &url,
252 &deleted);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700253// clang-format on
hbosab9f6e42016-10-07 02:18:47 -0700254
Yves Gerey665174f2018-06-19 15:03:05 +0200255RTCIceCandidateStats::RTCIceCandidateStats(const std::string& id,
256 int64_t timestamp_us,
257 bool is_remote)
258 : RTCIceCandidateStats(std::string(id), timestamp_us, is_remote) {}
hbosab9f6e42016-10-07 02:18:47 -0700259
Gary Liu37e489c2017-11-21 10:49:36 -0800260RTCIceCandidateStats::RTCIceCandidateStats(std::string&& id,
261 int64_t timestamp_us,
262 bool is_remote)
hbosab9f6e42016-10-07 02:18:47 -0700263 : RTCStats(std::move(id), timestamp_us),
hbosb4e426e2017-01-02 09:59:31 -0800264 transport_id("transportId"),
hbosc3a2b7f2017-01-02 04:46:15 -0800265 is_remote("isRemote", is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800266 network_type("networkType"),
hbosab9f6e42016-10-07 02:18:47 -0700267 ip("ip"),
268 port("port"),
269 protocol("protocol"),
270 candidate_type("candidateType"),
271 priority("priority"),
hbosd17a5a72017-01-02 08:09:59 -0800272 url("url"),
Gary Liu37e489c2017-11-21 10:49:36 -0800273 deleted("deleted", false) {}
hbosab9f6e42016-10-07 02:18:47 -0700274
275RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
276 : RTCStats(other.id(), other.timestamp_us()),
hbosb4e426e2017-01-02 09:59:31 -0800277 transport_id(other.transport_id),
hbosc3a2b7f2017-01-02 04:46:15 -0800278 is_remote(other.is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800279 network_type(other.network_type),
hbosab9f6e42016-10-07 02:18:47 -0700280 ip(other.ip),
281 port(other.port),
282 protocol(other.protocol),
283 candidate_type(other.candidate_type),
284 priority(other.priority),
hbosd17a5a72017-01-02 08:09:59 -0800285 url(other.url),
Gary Liu37e489c2017-11-21 10:49:36 -0800286 deleted(other.deleted) {}
hbosab9f6e42016-10-07 02:18:47 -0700287
Yves Gerey665174f2018-06-19 15:03:05 +0200288RTCIceCandidateStats::~RTCIceCandidateStats() {}
hbosab9f6e42016-10-07 02:18:47 -0700289
290const char RTCLocalIceCandidateStats::kType[] = "local-candidate";
291
Yves Gerey665174f2018-06-19 15:03:05 +0200292RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(const std::string& id,
293 int64_t timestamp_us)
294 : RTCIceCandidateStats(id, timestamp_us, false) {}
hbosab9f6e42016-10-07 02:18:47 -0700295
Yves Gerey665174f2018-06-19 15:03:05 +0200296RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(std::string&& id,
297 int64_t timestamp_us)
298 : RTCIceCandidateStats(std::move(id), timestamp_us, false) {}
hbosab9f6e42016-10-07 02:18:47 -0700299
Henrik Boström1df1bf82018-03-20 13:24:20 +0100300std::unique_ptr<RTCStats> RTCLocalIceCandidateStats::copy() const {
301 return std::unique_ptr<RTCStats>(new RTCLocalIceCandidateStats(*this));
302}
303
hbosab9f6e42016-10-07 02:18:47 -0700304const char* RTCLocalIceCandidateStats::type() const {
305 return kType;
306}
307
308const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate";
309
Yves Gerey665174f2018-06-19 15:03:05 +0200310RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(const std::string& id,
311 int64_t timestamp_us)
312 : RTCIceCandidateStats(id, timestamp_us, true) {}
hbosab9f6e42016-10-07 02:18:47 -0700313
Yves Gerey665174f2018-06-19 15:03:05 +0200314RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(std::string&& id,
315 int64_t timestamp_us)
316 : RTCIceCandidateStats(std::move(id), timestamp_us, true) {}
hbosab9f6e42016-10-07 02:18:47 -0700317
Henrik Boström1df1bf82018-03-20 13:24:20 +0100318std::unique_ptr<RTCStats> RTCRemoteIceCandidateStats::copy() const {
319 return std::unique_ptr<RTCStats>(new RTCRemoteIceCandidateStats(*this));
320}
321
hbosab9f6e42016-10-07 02:18:47 -0700322const char* RTCRemoteIceCandidateStats::type() const {
323 return kType;
324}
325
Steve Antond6a5cbd2017-08-18 09:40:25 -0700326// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800327WEBRTC_RTCSTATS_IMPL(RTCMediaStreamStats, RTCStats, "stream",
328 &stream_identifier,
329 &track_ids);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700330// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800331
Yves Gerey665174f2018-06-19 15:03:05 +0200332RTCMediaStreamStats::RTCMediaStreamStats(const std::string& id,
333 int64_t timestamp_us)
334 : RTCMediaStreamStats(std::string(id), timestamp_us) {}
hbos09bc1282016-11-08 06:29:22 -0800335
Yves Gerey665174f2018-06-19 15:03:05 +0200336RTCMediaStreamStats::RTCMediaStreamStats(std::string&& id, int64_t timestamp_us)
hbos09bc1282016-11-08 06:29:22 -0800337 : RTCStats(std::move(id), timestamp_us),
338 stream_identifier("streamIdentifier"),
Yves Gerey665174f2018-06-19 15:03:05 +0200339 track_ids("trackIds") {}
hbos09bc1282016-11-08 06:29:22 -0800340
Yves Gerey665174f2018-06-19 15:03:05 +0200341RTCMediaStreamStats::RTCMediaStreamStats(const RTCMediaStreamStats& other)
hbos09bc1282016-11-08 06:29:22 -0800342 : RTCStats(other.id(), other.timestamp_us()),
343 stream_identifier(other.stream_identifier),
Yves Gerey665174f2018-06-19 15:03:05 +0200344 track_ids(other.track_ids) {}
hbos09bc1282016-11-08 06:29:22 -0800345
Yves Gerey665174f2018-06-19 15:03:05 +0200346RTCMediaStreamStats::~RTCMediaStreamStats() {}
hbos09bc1282016-11-08 06:29:22 -0800347
Steve Antond6a5cbd2017-08-18 09:40:25 -0700348// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800349WEBRTC_RTCSTATS_IMPL(RTCMediaStreamTrackStats, RTCStats, "track",
zsteine76bd3a2017-07-14 12:17:49 -0700350 &track_identifier,
351 &remote_source,
352 &ended,
353 &detached,
354 &kind,
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200355 &jitter_buffer_delay,
zsteine76bd3a2017-07-14 12:17:49 -0700356 &frame_width,
357 &frame_height,
358 &frames_per_second,
359 &frames_sent,
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100360 &huge_frames_sent,
zsteine76bd3a2017-07-14 12:17:49 -0700361 &frames_received,
362 &frames_decoded,
363 &frames_dropped,
364 &frames_corrupted,
365 &partial_frames_lost,
366 &full_frames_lost,
367 &audio_level,
368 &total_audio_energy,
zsteine76bd3a2017-07-14 12:17:49 -0700369 &echo_return_loss,
Steve Anton2dbc69f2017-08-24 17:15:13 -0700370 &echo_return_loss_enhancement,
371 &total_samples_received,
372 &total_samples_duration,
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200373 &concealed_samples,
374 &concealment_events);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700375// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800376
Yves Gerey665174f2018-06-19 15:03:05 +0200377RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(const std::string& id,
378 int64_t timestamp_us,
379 const char* kind)
380 : RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) {}
hbos09bc1282016-11-08 06:29:22 -0800381
zsteine76bd3a2017-07-14 12:17:49 -0700382RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(std::string&& id,
383 int64_t timestamp_us,
384 const char* kind)
hbos09bc1282016-11-08 06:29:22 -0800385 : RTCStats(std::move(id), timestamp_us),
386 track_identifier("trackIdentifier"),
387 remote_source("remoteSource"),
388 ended("ended"),
389 detached("detached"),
hbos160e4a72017-01-17 02:53:23 -0800390 kind("kind", kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200391 jitter_buffer_delay("jitterBufferDelay"),
hbos09bc1282016-11-08 06:29:22 -0800392 frame_width("frameWidth"),
393 frame_height("frameHeight"),
394 frames_per_second("framesPerSecond"),
395 frames_sent("framesSent"),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100396 huge_frames_sent("hugeFramesSent"),
hbos09bc1282016-11-08 06:29:22 -0800397 frames_received("framesReceived"),
398 frames_decoded("framesDecoded"),
399 frames_dropped("framesDropped"),
400 frames_corrupted("framesCorrupted"),
401 partial_frames_lost("partialFramesLost"),
402 full_frames_lost("fullFramesLost"),
403 audio_level("audioLevel"),
zsteine76bd3a2017-07-14 12:17:49 -0700404 total_audio_energy("totalAudioEnergy"),
hbos09bc1282016-11-08 06:29:22 -0800405 echo_return_loss("echoReturnLoss"),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700406 echo_return_loss_enhancement("echoReturnLossEnhancement"),
407 total_samples_received("totalSamplesReceived"),
408 total_samples_duration("totalSamplesDuration"),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200409 concealed_samples("concealedSamples"),
410 concealment_events("concealmentEvents") {
hbos160e4a72017-01-17 02:53:23 -0800411 RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
412 kind == RTCMediaStreamTrackKind::kVideo);
hbos09bc1282016-11-08 06:29:22 -0800413}
414
415RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
416 const RTCMediaStreamTrackStats& other)
417 : RTCStats(other.id(), other.timestamp_us()),
418 track_identifier(other.track_identifier),
419 remote_source(other.remote_source),
420 ended(other.ended),
421 detached(other.detached),
hbos160e4a72017-01-17 02:53:23 -0800422 kind(other.kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200423 jitter_buffer_delay(other.jitter_buffer_delay),
hbos09bc1282016-11-08 06:29:22 -0800424 frame_width(other.frame_width),
425 frame_height(other.frame_height),
426 frames_per_second(other.frames_per_second),
427 frames_sent(other.frames_sent),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100428 huge_frames_sent(other.huge_frames_sent),
hbos09bc1282016-11-08 06:29:22 -0800429 frames_received(other.frames_received),
430 frames_decoded(other.frames_decoded),
431 frames_dropped(other.frames_dropped),
432 frames_corrupted(other.frames_corrupted),
433 partial_frames_lost(other.partial_frames_lost),
434 full_frames_lost(other.full_frames_lost),
435 audio_level(other.audio_level),
zsteine76bd3a2017-07-14 12:17:49 -0700436 total_audio_energy(other.total_audio_energy),
hbos09bc1282016-11-08 06:29:22 -0800437 echo_return_loss(other.echo_return_loss),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700438 echo_return_loss_enhancement(other.echo_return_loss_enhancement),
439 total_samples_received(other.total_samples_received),
440 total_samples_duration(other.total_samples_duration),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200441 concealed_samples(other.concealed_samples),
442 concealment_events(other.concealment_events) {}
hbos09bc1282016-11-08 06:29:22 -0800443
Yves Gerey665174f2018-06-19 15:03:05 +0200444RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {}
hbos09bc1282016-11-08 06:29:22 -0800445
Steve Antond6a5cbd2017-08-18 09:40:25 -0700446// clang-format off
hbosfc5e0502016-10-06 02:06:10 -0700447WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
448 &data_channels_opened,
449 &data_channels_closed);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700450// clang-format on
hbosd565b732016-08-30 14:04:35 -0700451
Yves Gerey665174f2018-06-19 15:03:05 +0200452RTCPeerConnectionStats::RTCPeerConnectionStats(const std::string& id,
453 int64_t timestamp_us)
454 : RTCPeerConnectionStats(std::string(id), timestamp_us) {}
hbosd565b732016-08-30 14:04:35 -0700455
Yves Gerey665174f2018-06-19 15:03:05 +0200456RTCPeerConnectionStats::RTCPeerConnectionStats(std::string&& id,
457 int64_t timestamp_us)
hbos0e6758d2016-08-31 07:57:36 -0700458 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700459 data_channels_opened("dataChannelsOpened"),
Yves Gerey665174f2018-06-19 15:03:05 +0200460 data_channels_closed("dataChannelsClosed") {}
hbosd565b732016-08-30 14:04:35 -0700461
hbosfc5e0502016-10-06 02:06:10 -0700462RTCPeerConnectionStats::RTCPeerConnectionStats(
463 const RTCPeerConnectionStats& other)
464 : RTCStats(other.id(), other.timestamp_us()),
465 data_channels_opened(other.data_channels_opened),
Yves Gerey665174f2018-06-19 15:03:05 +0200466 data_channels_closed(other.data_channels_closed) {}
hbosfc5e0502016-10-06 02:06:10 -0700467
Yves Gerey665174f2018-06-19 15:03:05 +0200468RTCPeerConnectionStats::~RTCPeerConnectionStats() {}
hbosfc5e0502016-10-06 02:06:10 -0700469
Steve Antond6a5cbd2017-08-18 09:40:25 -0700470// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700471WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
472 &ssrc,
473 &associate_stats_id,
474 &is_remote,
475 &media_type,
hbosb0ae9202017-01-27 06:35:16 -0800476 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700477 &transport_id,
478 &codec_id,
479 &fir_count,
480 &pli_count,
481 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800482 &sli_count,
483 &qp_sum);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700484// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700485
Yves Gerey665174f2018-06-19 15:03:05 +0200486RTCRTPStreamStats::RTCRTPStreamStats(const std::string& id,
487 int64_t timestamp_us)
488 : RTCRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700489
Yves Gerey665174f2018-06-19 15:03:05 +0200490RTCRTPStreamStats::RTCRTPStreamStats(std::string&& id, int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700491 : RTCStats(std::move(id), timestamp_us),
492 ssrc("ssrc"),
493 associate_stats_id("associateStatsId"),
494 is_remote("isRemote", false),
495 media_type("mediaType"),
hbosb0ae9202017-01-27 06:35:16 -0800496 track_id("trackId"),
hbos6ded1902016-11-01 01:50:46 -0700497 transport_id("transportId"),
498 codec_id("codecId"),
499 fir_count("firCount"),
500 pli_count("pliCount"),
501 nack_count("nackCount"),
hbos6769c492017-01-02 08:35:13 -0800502 sli_count("sliCount"),
Yves Gerey665174f2018-06-19 15:03:05 +0200503 qp_sum("qpSum") {}
hbos6ded1902016-11-01 01:50:46 -0700504
Yves Gerey665174f2018-06-19 15:03:05 +0200505RTCRTPStreamStats::RTCRTPStreamStats(const RTCRTPStreamStats& other)
hbos6ded1902016-11-01 01:50:46 -0700506 : RTCStats(other.id(), other.timestamp_us()),
507 ssrc(other.ssrc),
508 associate_stats_id(other.associate_stats_id),
509 is_remote(other.is_remote),
510 media_type(other.media_type),
hbosb0ae9202017-01-27 06:35:16 -0800511 track_id(other.track_id),
hbos6ded1902016-11-01 01:50:46 -0700512 transport_id(other.transport_id),
513 codec_id(other.codec_id),
514 fir_count(other.fir_count),
515 pli_count(other.pli_count),
516 nack_count(other.nack_count),
hbos6769c492017-01-02 08:35:13 -0800517 sli_count(other.sli_count),
Yves Gerey665174f2018-06-19 15:03:05 +0200518 qp_sum(other.qp_sum) {}
hbos6ded1902016-11-01 01:50:46 -0700519
Yves Gerey665174f2018-06-19 15:03:05 +0200520RTCRTPStreamStats::~RTCRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700521
Steve Antond6a5cbd2017-08-18 09:40:25 -0700522// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700523WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700524 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
525 &packets_received,
526 &bytes_received,
527 &packets_lost,
528 &jitter,
529 &fraction_lost,
hbosa7a9be12017-03-01 01:02:45 -0800530 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700531 &packets_discarded,
532 &packets_repaired,
533 &burst_packets_lost,
534 &burst_packets_discarded,
535 &burst_loss_count,
536 &burst_discard_count,
537 &burst_loss_rate,
538 &burst_discard_rate,
539 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800540 &gap_discard_rate,
541 &frames_decoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700542// clang-format on
hboseeafe942016-11-01 03:00:17 -0700543
Yves Gerey665174f2018-06-19 15:03:05 +0200544RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id,
545 int64_t timestamp_us)
546 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {}
hboseeafe942016-11-01 03:00:17 -0700547
Yves Gerey665174f2018-06-19 15:03:05 +0200548RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
549 int64_t timestamp_us)
hboseeafe942016-11-01 03:00:17 -0700550 : RTCRTPStreamStats(std::move(id), timestamp_us),
551 packets_received("packetsReceived"),
552 bytes_received("bytesReceived"),
553 packets_lost("packetsLost"),
554 jitter("jitter"),
555 fraction_lost("fractionLost"),
hbosa7a9be12017-03-01 01:02:45 -0800556 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700557 packets_discarded("packetsDiscarded"),
558 packets_repaired("packetsRepaired"),
559 burst_packets_lost("burstPacketsLost"),
560 burst_packets_discarded("burstPacketsDiscarded"),
561 burst_loss_count("burstLossCount"),
562 burst_discard_count("burstDiscardCount"),
563 burst_loss_rate("burstLossRate"),
564 burst_discard_rate("burstDiscardRate"),
565 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800566 gap_discard_rate("gapDiscardRate"),
Yves Gerey665174f2018-06-19 15:03:05 +0200567 frames_decoded("framesDecoded") {}
hboseeafe942016-11-01 03:00:17 -0700568
569RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
570 const RTCInboundRTPStreamStats& other)
571 : RTCRTPStreamStats(other),
572 packets_received(other.packets_received),
573 bytes_received(other.bytes_received),
574 packets_lost(other.packets_lost),
575 jitter(other.jitter),
576 fraction_lost(other.fraction_lost),
hbosa7a9be12017-03-01 01:02:45 -0800577 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700578 packets_discarded(other.packets_discarded),
579 packets_repaired(other.packets_repaired),
580 burst_packets_lost(other.burst_packets_lost),
581 burst_packets_discarded(other.burst_packets_discarded),
582 burst_loss_count(other.burst_loss_count),
583 burst_discard_count(other.burst_discard_count),
584 burst_loss_rate(other.burst_loss_rate),
585 burst_discard_rate(other.burst_discard_rate),
586 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800587 gap_discard_rate(other.gap_discard_rate),
Yves Gerey665174f2018-06-19 15:03:05 +0200588 frames_decoded(other.frames_decoded) {}
hboseeafe942016-11-01 03:00:17 -0700589
Yves Gerey665174f2018-06-19 15:03:05 +0200590RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {}
hboseeafe942016-11-01 03:00:17 -0700591
Steve Antond6a5cbd2017-08-18 09:40:25 -0700592// clang-format off
hboseeafe942016-11-01 03:00:17 -0700593WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700594 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
595 &packets_sent,
596 &bytes_sent,
597 &target_bitrate,
hbos6769c492017-01-02 08:35:13 -0800598 &frames_encoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700599// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700600
Yves Gerey665174f2018-06-19 15:03:05 +0200601RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(const std::string& id,
602 int64_t timestamp_us)
603 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700604
Yves Gerey665174f2018-06-19 15:03:05 +0200605RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id,
606 int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700607 : RTCRTPStreamStats(std::move(id), timestamp_us),
608 packets_sent("packetsSent"),
609 bytes_sent("bytesSent"),
610 target_bitrate("targetBitrate"),
Yves Gerey665174f2018-06-19 15:03:05 +0200611 frames_encoded("framesEncoded") {}
hbos6ded1902016-11-01 01:50:46 -0700612
613RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
614 const RTCOutboundRTPStreamStats& other)
615 : RTCRTPStreamStats(other),
616 packets_sent(other.packets_sent),
617 bytes_sent(other.bytes_sent),
618 target_bitrate(other.target_bitrate),
Yves Gerey665174f2018-06-19 15:03:05 +0200619 frames_encoded(other.frames_encoded) {}
hbos6ded1902016-11-01 01:50:46 -0700620
Yves Gerey665174f2018-06-19 15:03:05 +0200621RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700622
Steve Antond6a5cbd2017-08-18 09:40:25 -0700623// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700624WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
625 &bytes_sent,
626 &bytes_received,
627 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800628 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700629 &selected_candidate_pair_id,
630 &local_certificate_id,
631 &remote_certificate_id);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700632// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700633
Yves Gerey665174f2018-06-19 15:03:05 +0200634RTCTransportStats::RTCTransportStats(const std::string& id,
635 int64_t timestamp_us)
636 : RTCTransportStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700637
Yves Gerey665174f2018-06-19 15:03:05 +0200638RTCTransportStats::RTCTransportStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700639 : RTCStats(std::move(id), timestamp_us),
640 bytes_sent("bytesSent"),
641 bytes_received("bytesReceived"),
642 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800643 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700644 selected_candidate_pair_id("selectedCandidatePairId"),
645 local_certificate_id("localCertificateId"),
Yves Gerey665174f2018-06-19 15:03:05 +0200646 remote_certificate_id("remoteCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -0700647
Yves Gerey665174f2018-06-19 15:03:05 +0200648RTCTransportStats::RTCTransportStats(const RTCTransportStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700649 : RTCStats(other.id(), other.timestamp_us()),
650 bytes_sent(other.bytes_sent),
651 bytes_received(other.bytes_received),
652 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800653 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700654 selected_candidate_pair_id(other.selected_candidate_pair_id),
655 local_certificate_id(other.local_certificate_id),
Yves Gerey665174f2018-06-19 15:03:05 +0200656 remote_certificate_id(other.remote_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -0700657
Yves Gerey665174f2018-06-19 15:03:05 +0200658RTCTransportStats::~RTCTransportStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700659
hbosd565b732016-08-30 14:04:35 -0700660} // namespace webrtc