blob: 453acce9252653a9a6b3f8625dcd8339504d17f6 [file] [log] [blame]
hbosd565b732016-08-30 14:04:35 -07001/*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "api/stats/rtcstats_objects.h"
hbosd565b732016-08-30 14:04:35 -070012
Yves Gerey3e707812018-11-28 16:47:49 +010013#include <utility>
14
Jakob Ivarsson758d9462019-03-19 15:38:49 +010015#include "api/stats/rtc_stats.h"
Jonas Olssona4d87372019-07-05 19:08:33 +020016#include "rtc_base/checks.h"
Jakob Ivarsson758d9462019-03-19 15:38:49 +010017
hbosd565b732016-08-30 14:04:35 -070018namespace webrtc {
19
agrieve26622d32017-08-08 10:48:15 -070020const char* const RTCDataChannelState::kConnecting = "connecting";
21const char* const RTCDataChannelState::kOpen = "open";
22const char* const RTCDataChannelState::kClosing = "closing";
23const char* const RTCDataChannelState::kClosed = "closed";
hboscc555c52016-10-18 12:48:31 -070024
agrieve26622d32017-08-08 10:48:15 -070025const char* const RTCStatsIceCandidatePairState::kFrozen = "frozen";
26const char* const RTCStatsIceCandidatePairState::kWaiting = "waiting";
27const char* const RTCStatsIceCandidatePairState::kInProgress = "in-progress";
28const char* const RTCStatsIceCandidatePairState::kFailed = "failed";
29const char* const RTCStatsIceCandidatePairState::kSucceeded = "succeeded";
hbosc47a0c32016-10-11 14:54:49 -070030
31// Strings defined in https://tools.ietf.org/html/rfc5245.
agrieve26622d32017-08-08 10:48:15 -070032const char* const RTCIceCandidateType::kHost = "host";
33const char* const RTCIceCandidateType::kSrflx = "srflx";
34const char* const RTCIceCandidateType::kPrflx = "prflx";
35const char* const RTCIceCandidateType::kRelay = "relay";
hbosab9f6e42016-10-07 02:18:47 -070036
agrieve26622d32017-08-08 10:48:15 -070037const char* const RTCDtlsTransportState::kNew = "new";
38const char* const RTCDtlsTransportState::kConnecting = "connecting";
39const char* const RTCDtlsTransportState::kConnected = "connected";
40const char* const RTCDtlsTransportState::kClosed = "closed";
41const char* const RTCDtlsTransportState::kFailed = "failed";
hbos7064d592017-01-16 07:38:02 -080042
agrieve26622d32017-08-08 10:48:15 -070043const char* const RTCMediaStreamTrackKind::kAudio = "audio";
44const char* const RTCMediaStreamTrackKind::kVideo = "video";
hbos160e4a72017-01-17 02:53:23 -080045
Gary Liu37e489c2017-11-21 10:49:36 -080046// https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype
47const char* const RTCNetworkType::kBluetooth = "bluetooth";
48const char* const RTCNetworkType::kCellular = "cellular";
49const char* const RTCNetworkType::kEthernet = "ethernet";
50const char* const RTCNetworkType::kWifi = "wifi";
51const char* const RTCNetworkType::kWimax = "wimax";
52const char* const RTCNetworkType::kVpn = "vpn";
53const char* const RTCNetworkType::kUnknown = "unknown";
54
Henrik Boströmce33b6a2019-05-28 17:42:38 +020055// https://w3c.github.io/webrtc-stats/#dom-rtcqualitylimitationreason
56const char* const RTCQualityLimitationReason::kNone = "none";
57const char* const RTCQualityLimitationReason::kCpu = "cpu";
58const char* const RTCQualityLimitationReason::kBandwidth = "bandwidth";
59const char* const RTCQualityLimitationReason::kOther = "other";
60
Henrik Boström2e069262019-04-09 13:59:31 +020061// https://webrtc.org/experiments/rtp-hdrext/video-content-type/
62const char* const RTCContentType::kUnspecified = "unspecified";
63const char* const RTCContentType::kScreenshare = "screenshare";
64
Steve Antond6a5cbd2017-08-18 09:40:25 -070065// clang-format off
hbos2fa7c672016-10-24 04:00:05 -070066WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
67 &fingerprint,
68 &fingerprint_algorithm,
69 &base64_certificate,
Nico Weber22f99252019-02-20 10:13:16 -050070 &issuer_certificate_id)
Steve Antond6a5cbd2017-08-18 09:40:25 -070071// clang-format on
hbos2fa7c672016-10-24 04:00:05 -070072
Yves Gerey665174f2018-06-19 15:03:05 +020073RTCCertificateStats::RTCCertificateStats(const std::string& id,
74 int64_t timestamp_us)
75 : RTCCertificateStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -070076
Yves Gerey665174f2018-06-19 15:03:05 +020077RTCCertificateStats::RTCCertificateStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -070078 : RTCStats(std::move(id), timestamp_us),
79 fingerprint("fingerprint"),
80 fingerprint_algorithm("fingerprintAlgorithm"),
81 base64_certificate("base64Certificate"),
Yves Gerey665174f2018-06-19 15:03:05 +020082 issuer_certificate_id("issuerCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -070083
Yves Gerey665174f2018-06-19 15:03:05 +020084RTCCertificateStats::RTCCertificateStats(const RTCCertificateStats& other)
hbos2fa7c672016-10-24 04:00:05 -070085 : RTCStats(other.id(), other.timestamp_us()),
86 fingerprint(other.fingerprint),
87 fingerprint_algorithm(other.fingerprint_algorithm),
88 base64_certificate(other.base64_certificate),
Yves Gerey665174f2018-06-19 15:03:05 +020089 issuer_certificate_id(other.issuer_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -070090
Yves Gerey665174f2018-06-19 15:03:05 +020091RTCCertificateStats::~RTCCertificateStats() {}
hbos2fa7c672016-10-24 04:00:05 -070092
Steve Antond6a5cbd2017-08-18 09:40:25 -070093// clang-format off
hbos0adb8282016-11-23 02:32:06 -080094WEBRTC_RTCSTATS_IMPL(RTCCodecStats, RTCStats, "codec",
95 &payload_type,
hbos13f54b22017-02-28 06:56:04 -080096 &mime_type,
hbos0adb8282016-11-23 02:32:06 -080097 &clock_rate,
98 &channels,
Henrik Boström6b430862019-08-16 13:09:51 +020099 &sdp_fmtp_line)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700100// clang-format on
hbos0adb8282016-11-23 02:32:06 -0800101
Yves Gerey665174f2018-06-19 15:03:05 +0200102RTCCodecStats::RTCCodecStats(const std::string& id, int64_t timestamp_us)
103 : RTCCodecStats(std::string(id), timestamp_us) {}
hbos0adb8282016-11-23 02:32:06 -0800104
Yves Gerey665174f2018-06-19 15:03:05 +0200105RTCCodecStats::RTCCodecStats(std::string&& id, int64_t timestamp_us)
hbos0adb8282016-11-23 02:32:06 -0800106 : RTCStats(std::move(id), timestamp_us),
107 payload_type("payloadType"),
hbos13f54b22017-02-28 06:56:04 -0800108 mime_type("mimeType"),
hbos0adb8282016-11-23 02:32:06 -0800109 clock_rate("clockRate"),
110 channels("channels"),
Henrik Boström6b430862019-08-16 13:09:51 +0200111 sdp_fmtp_line("sdpFmtpLine") {}
hbos0adb8282016-11-23 02:32:06 -0800112
Yves Gerey665174f2018-06-19 15:03:05 +0200113RTCCodecStats::RTCCodecStats(const RTCCodecStats& other)
hbos0adb8282016-11-23 02:32:06 -0800114 : RTCStats(other.id(), other.timestamp_us()),
115 payload_type(other.payload_type),
hbos13f54b22017-02-28 06:56:04 -0800116 mime_type(other.mime_type),
hbos0adb8282016-11-23 02:32:06 -0800117 clock_rate(other.clock_rate),
118 channels(other.channels),
Henrik Boström6b430862019-08-16 13:09:51 +0200119 sdp_fmtp_line(other.sdp_fmtp_line) {}
hbos0adb8282016-11-23 02:32:06 -0800120
Yves Gerey665174f2018-06-19 15:03:05 +0200121RTCCodecStats::~RTCCodecStats() {}
hbos0adb8282016-11-23 02:32:06 -0800122
Steve Antond6a5cbd2017-08-18 09:40:25 -0700123// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700124WEBRTC_RTCSTATS_IMPL(RTCDataChannelStats, RTCStats, "data-channel",
125 &label,
126 &protocol,
127 &datachannelid,
128 &state,
129 &messages_sent,
130 &bytes_sent,
131 &messages_received,
Nico Weber22f99252019-02-20 10:13:16 -0500132 &bytes_received)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700133// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700134
Yves Gerey665174f2018-06-19 15:03:05 +0200135RTCDataChannelStats::RTCDataChannelStats(const std::string& id,
136 int64_t timestamp_us)
137 : RTCDataChannelStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700138
Yves Gerey665174f2018-06-19 15:03:05 +0200139RTCDataChannelStats::RTCDataChannelStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700140 : RTCStats(std::move(id), timestamp_us),
141 label("label"),
142 protocol("protocol"),
143 datachannelid("datachannelid"),
144 state("state"),
145 messages_sent("messagesSent"),
146 bytes_sent("bytesSent"),
147 messages_received("messagesReceived"),
Yves Gerey665174f2018-06-19 15:03:05 +0200148 bytes_received("bytesReceived") {}
hbos2fa7c672016-10-24 04:00:05 -0700149
Yves Gerey665174f2018-06-19 15:03:05 +0200150RTCDataChannelStats::RTCDataChannelStats(const RTCDataChannelStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700151 : RTCStats(other.id(), other.timestamp_us()),
152 label(other.label),
153 protocol(other.protocol),
154 datachannelid(other.datachannelid),
155 state(other.state),
156 messages_sent(other.messages_sent),
157 bytes_sent(other.bytes_sent),
158 messages_received(other.messages_received),
Yves Gerey665174f2018-06-19 15:03:05 +0200159 bytes_received(other.bytes_received) {}
hbos2fa7c672016-10-24 04:00:05 -0700160
Yves Gerey665174f2018-06-19 15:03:05 +0200161RTCDataChannelStats::~RTCDataChannelStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700162
Steve Antond6a5cbd2017-08-18 09:40:25 -0700163// clang-format off
hbosc47a0c32016-10-11 14:54:49 -0700164WEBRTC_RTCSTATS_IMPL(RTCIceCandidatePairStats, RTCStats, "candidate-pair",
165 &transport_id,
166 &local_candidate_id,
167 &remote_candidate_id,
168 &state,
169 &priority,
170 &nominated,
171 &writable,
172 &readable,
173 &bytes_sent,
174 &bytes_received,
hbos3168c7a2016-12-15 06:17:08 -0800175 &total_round_trip_time,
176 &current_round_trip_time,
hbosc47a0c32016-10-11 14:54:49 -0700177 &available_outgoing_bitrate,
178 &available_incoming_bitrate,
179 &requests_received,
180 &requests_sent,
181 &responses_received,
182 &responses_sent,
183 &retransmissions_received,
184 &retransmissions_sent,
185 &consent_requests_received,
186 &consent_requests_sent,
187 &consent_responses_received,
Nico Weber22f99252019-02-20 10:13:16 -0500188 &consent_responses_sent)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700189// clang-format on
hbosc47a0c32016-10-11 14:54:49 -0700190
Yves Gerey665174f2018-06-19 15:03:05 +0200191RTCIceCandidatePairStats::RTCIceCandidatePairStats(const std::string& id,
192 int64_t timestamp_us)
193 : RTCIceCandidatePairStats(std::string(id), timestamp_us) {}
hbosc47a0c32016-10-11 14:54:49 -0700194
Yves Gerey665174f2018-06-19 15:03:05 +0200195RTCIceCandidatePairStats::RTCIceCandidatePairStats(std::string&& id,
196 int64_t timestamp_us)
hbosc47a0c32016-10-11 14:54:49 -0700197 : RTCStats(std::move(id), timestamp_us),
198 transport_id("transportId"),
199 local_candidate_id("localCandidateId"),
200 remote_candidate_id("remoteCandidateId"),
201 state("state"),
202 priority("priority"),
203 nominated("nominated"),
204 writable("writable"),
205 readable("readable"),
206 bytes_sent("bytesSent"),
207 bytes_received("bytesReceived"),
hbos3168c7a2016-12-15 06:17:08 -0800208 total_round_trip_time("totalRoundTripTime"),
209 current_round_trip_time("currentRoundTripTime"),
hbosc47a0c32016-10-11 14:54:49 -0700210 available_outgoing_bitrate("availableOutgoingBitrate"),
211 available_incoming_bitrate("availableIncomingBitrate"),
212 requests_received("requestsReceived"),
213 requests_sent("requestsSent"),
214 responses_received("responsesReceived"),
215 responses_sent("responsesSent"),
216 retransmissions_received("retransmissionsReceived"),
217 retransmissions_sent("retransmissionsSent"),
218 consent_requests_received("consentRequestsReceived"),
219 consent_requests_sent("consentRequestsSent"),
220 consent_responses_received("consentResponsesReceived"),
Yves Gerey665174f2018-06-19 15:03:05 +0200221 consent_responses_sent("consentResponsesSent") {}
hbosc47a0c32016-10-11 14:54:49 -0700222
223RTCIceCandidatePairStats::RTCIceCandidatePairStats(
224 const RTCIceCandidatePairStats& other)
225 : RTCStats(other.id(), other.timestamp_us()),
226 transport_id(other.transport_id),
227 local_candidate_id(other.local_candidate_id),
228 remote_candidate_id(other.remote_candidate_id),
229 state(other.state),
230 priority(other.priority),
231 nominated(other.nominated),
232 writable(other.writable),
233 readable(other.readable),
234 bytes_sent(other.bytes_sent),
235 bytes_received(other.bytes_received),
hbos3168c7a2016-12-15 06:17:08 -0800236 total_round_trip_time(other.total_round_trip_time),
237 current_round_trip_time(other.current_round_trip_time),
hbosc47a0c32016-10-11 14:54:49 -0700238 available_outgoing_bitrate(other.available_outgoing_bitrate),
239 available_incoming_bitrate(other.available_incoming_bitrate),
240 requests_received(other.requests_received),
241 requests_sent(other.requests_sent),
242 responses_received(other.responses_received),
243 responses_sent(other.responses_sent),
244 retransmissions_received(other.retransmissions_received),
245 retransmissions_sent(other.retransmissions_sent),
246 consent_requests_received(other.consent_requests_received),
247 consent_requests_sent(other.consent_requests_sent),
248 consent_responses_received(other.consent_responses_received),
Yves Gerey665174f2018-06-19 15:03:05 +0200249 consent_responses_sent(other.consent_responses_sent) {}
hbosc47a0c32016-10-11 14:54:49 -0700250
Yves Gerey665174f2018-06-19 15:03:05 +0200251RTCIceCandidatePairStats::~RTCIceCandidatePairStats() {}
hbosc47a0c32016-10-11 14:54:49 -0700252
Steve Antond6a5cbd2017-08-18 09:40:25 -0700253// clang-format off
Henrik Boström1df1bf82018-03-20 13:24:20 +0100254WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "abstract-ice-candidate",
hbosb4e426e2017-01-02 09:59:31 -0800255 &transport_id,
hbosc3a2b7f2017-01-02 04:46:15 -0800256 &is_remote,
Gary Liu37e489c2017-11-21 10:49:36 -0800257 &network_type,
hbosab9f6e42016-10-07 02:18:47 -0700258 &ip,
259 &port,
260 &protocol,
Philipp Hancke95513752018-09-27 14:40:08 +0200261 &relay_protocol,
hbosab9f6e42016-10-07 02:18:47 -0700262 &candidate_type,
263 &priority,
hbosd17a5a72017-01-02 08:09:59 -0800264 &url,
Nico Weber22f99252019-02-20 10:13:16 -0500265 &deleted)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700266// clang-format on
hbosab9f6e42016-10-07 02:18:47 -0700267
Yves Gerey665174f2018-06-19 15:03:05 +0200268RTCIceCandidateStats::RTCIceCandidateStats(const std::string& id,
269 int64_t timestamp_us,
270 bool is_remote)
271 : RTCIceCandidateStats(std::string(id), timestamp_us, is_remote) {}
hbosab9f6e42016-10-07 02:18:47 -0700272
Gary Liu37e489c2017-11-21 10:49:36 -0800273RTCIceCandidateStats::RTCIceCandidateStats(std::string&& id,
274 int64_t timestamp_us,
275 bool is_remote)
hbosab9f6e42016-10-07 02:18:47 -0700276 : RTCStats(std::move(id), timestamp_us),
hbosb4e426e2017-01-02 09:59:31 -0800277 transport_id("transportId"),
hbosc3a2b7f2017-01-02 04:46:15 -0800278 is_remote("isRemote", is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800279 network_type("networkType"),
hbosab9f6e42016-10-07 02:18:47 -0700280 ip("ip"),
281 port("port"),
282 protocol("protocol"),
Philipp Hancke95513752018-09-27 14:40:08 +0200283 relay_protocol("relayProtocol"),
hbosab9f6e42016-10-07 02:18:47 -0700284 candidate_type("candidateType"),
285 priority("priority"),
hbosd17a5a72017-01-02 08:09:59 -0800286 url("url"),
Gary Liu37e489c2017-11-21 10:49:36 -0800287 deleted("deleted", false) {}
hbosab9f6e42016-10-07 02:18:47 -0700288
289RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
290 : RTCStats(other.id(), other.timestamp_us()),
hbosb4e426e2017-01-02 09:59:31 -0800291 transport_id(other.transport_id),
hbosc3a2b7f2017-01-02 04:46:15 -0800292 is_remote(other.is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800293 network_type(other.network_type),
hbosab9f6e42016-10-07 02:18:47 -0700294 ip(other.ip),
295 port(other.port),
296 protocol(other.protocol),
Philipp Hancke95513752018-09-27 14:40:08 +0200297 relay_protocol(other.relay_protocol),
hbosab9f6e42016-10-07 02:18:47 -0700298 candidate_type(other.candidate_type),
299 priority(other.priority),
hbosd17a5a72017-01-02 08:09:59 -0800300 url(other.url),
Gary Liu37e489c2017-11-21 10:49:36 -0800301 deleted(other.deleted) {}
hbosab9f6e42016-10-07 02:18:47 -0700302
Yves Gerey665174f2018-06-19 15:03:05 +0200303RTCIceCandidateStats::~RTCIceCandidateStats() {}
hbosab9f6e42016-10-07 02:18:47 -0700304
305const char RTCLocalIceCandidateStats::kType[] = "local-candidate";
306
Yves Gerey665174f2018-06-19 15:03:05 +0200307RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(const std::string& id,
308 int64_t timestamp_us)
309 : RTCIceCandidateStats(id, timestamp_us, false) {}
hbosab9f6e42016-10-07 02:18:47 -0700310
Yves Gerey665174f2018-06-19 15:03:05 +0200311RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(std::string&& id,
312 int64_t timestamp_us)
313 : RTCIceCandidateStats(std::move(id), timestamp_us, false) {}
hbosab9f6e42016-10-07 02:18:47 -0700314
Henrik Boström1df1bf82018-03-20 13:24:20 +0100315std::unique_ptr<RTCStats> RTCLocalIceCandidateStats::copy() const {
316 return std::unique_ptr<RTCStats>(new RTCLocalIceCandidateStats(*this));
317}
318
hbosab9f6e42016-10-07 02:18:47 -0700319const char* RTCLocalIceCandidateStats::type() const {
320 return kType;
321}
322
323const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate";
324
Yves Gerey665174f2018-06-19 15:03:05 +0200325RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(const std::string& id,
326 int64_t timestamp_us)
327 : RTCIceCandidateStats(id, timestamp_us, true) {}
hbosab9f6e42016-10-07 02:18:47 -0700328
Yves Gerey665174f2018-06-19 15:03:05 +0200329RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(std::string&& id,
330 int64_t timestamp_us)
331 : RTCIceCandidateStats(std::move(id), timestamp_us, true) {}
hbosab9f6e42016-10-07 02:18:47 -0700332
Henrik Boström1df1bf82018-03-20 13:24:20 +0100333std::unique_ptr<RTCStats> RTCRemoteIceCandidateStats::copy() const {
334 return std::unique_ptr<RTCStats>(new RTCRemoteIceCandidateStats(*this));
335}
336
hbosab9f6e42016-10-07 02:18:47 -0700337const char* RTCRemoteIceCandidateStats::type() const {
338 return kType;
339}
340
Steve Antond6a5cbd2017-08-18 09:40:25 -0700341// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800342WEBRTC_RTCSTATS_IMPL(RTCMediaStreamStats, RTCStats, "stream",
343 &stream_identifier,
Nico Weber22f99252019-02-20 10:13:16 -0500344 &track_ids)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700345// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800346
Yves Gerey665174f2018-06-19 15:03:05 +0200347RTCMediaStreamStats::RTCMediaStreamStats(const std::string& id,
348 int64_t timestamp_us)
349 : RTCMediaStreamStats(std::string(id), timestamp_us) {}
hbos09bc1282016-11-08 06:29:22 -0800350
Yves Gerey665174f2018-06-19 15:03:05 +0200351RTCMediaStreamStats::RTCMediaStreamStats(std::string&& id, int64_t timestamp_us)
hbos09bc1282016-11-08 06:29:22 -0800352 : RTCStats(std::move(id), timestamp_us),
353 stream_identifier("streamIdentifier"),
Yves Gerey665174f2018-06-19 15:03:05 +0200354 track_ids("trackIds") {}
hbos09bc1282016-11-08 06:29:22 -0800355
Yves Gerey665174f2018-06-19 15:03:05 +0200356RTCMediaStreamStats::RTCMediaStreamStats(const RTCMediaStreamStats& other)
hbos09bc1282016-11-08 06:29:22 -0800357 : RTCStats(other.id(), other.timestamp_us()),
358 stream_identifier(other.stream_identifier),
Yves Gerey665174f2018-06-19 15:03:05 +0200359 track_ids(other.track_ids) {}
hbos09bc1282016-11-08 06:29:22 -0800360
Yves Gerey665174f2018-06-19 15:03:05 +0200361RTCMediaStreamStats::~RTCMediaStreamStats() {}
hbos09bc1282016-11-08 06:29:22 -0800362
Steve Antond6a5cbd2017-08-18 09:40:25 -0700363// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800364WEBRTC_RTCSTATS_IMPL(RTCMediaStreamTrackStats, RTCStats, "track",
zsteine76bd3a2017-07-14 12:17:49 -0700365 &track_identifier,
Henrik Boström646fda02019-05-22 15:49:42 +0200366 &media_source_id,
zsteine76bd3a2017-07-14 12:17:49 -0700367 &remote_source,
368 &ended,
369 &detached,
370 &kind,
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200371 &jitter_buffer_delay,
Chen Xing0acffb52019-01-15 15:46:29 +0100372 &jitter_buffer_emitted_count,
zsteine76bd3a2017-07-14 12:17:49 -0700373 &frame_width,
374 &frame_height,
375 &frames_per_second,
376 &frames_sent,
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100377 &huge_frames_sent,
zsteine76bd3a2017-07-14 12:17:49 -0700378 &frames_received,
379 &frames_decoded,
380 &frames_dropped,
381 &frames_corrupted,
382 &partial_frames_lost,
383 &full_frames_lost,
384 &audio_level,
385 &total_audio_energy,
zsteine76bd3a2017-07-14 12:17:49 -0700386 &echo_return_loss,
Steve Anton2dbc69f2017-08-24 17:15:13 -0700387 &echo_return_loss_enhancement,
388 &total_samples_received,
389 &total_samples_duration,
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200390 &concealed_samples,
Henrik Boström21e99da2019-08-21 12:09:51 +0200391 &silent_concealed_samples,
Ruslan Burakov8af88962018-11-22 17:21:10 +0100392 &concealment_events,
Henrik Boström21e99da2019-08-21 12:09:51 +0200393 &inserted_samples_for_deceleration,
394 &removed_samples_for_acceleration,
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100395 &jitter_buffer_flushes,
Sergey Silkin02371062019-01-31 16:45:42 +0100396 &delayed_packet_outage_samples,
Jakob Ivarsson232b3fd2019-03-06 09:18:40 +0100397 &relative_packet_arrival_delay,
Artem Titove618cc92020-03-11 11:18:54 +0100398 &jitter_buffer_target_delay,
Henrik Lundin44125fa2019-04-29 17:00:46 +0200399 &interruption_count,
400 &total_interruption_duration,
Sergey Silkin02371062019-01-31 16:45:42 +0100401 &freeze_count,
402 &pause_count,
403 &total_freezes_duration,
404 &total_pauses_duration,
405 &total_frames_duration,
Nico Weber22f99252019-02-20 10:13:16 -0500406 &sum_squared_frame_durations)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700407// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800408
Yves Gerey665174f2018-06-19 15:03:05 +0200409RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(const std::string& id,
410 int64_t timestamp_us,
411 const char* kind)
412 : RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) {}
hbos09bc1282016-11-08 06:29:22 -0800413
zsteine76bd3a2017-07-14 12:17:49 -0700414RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(std::string&& id,
415 int64_t timestamp_us,
416 const char* kind)
hbos09bc1282016-11-08 06:29:22 -0800417 : RTCStats(std::move(id), timestamp_us),
418 track_identifier("trackIdentifier"),
Henrik Boström646fda02019-05-22 15:49:42 +0200419 media_source_id("mediaSourceId"),
hbos09bc1282016-11-08 06:29:22 -0800420 remote_source("remoteSource"),
421 ended("ended"),
422 detached("detached"),
hbos160e4a72017-01-17 02:53:23 -0800423 kind("kind", kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200424 jitter_buffer_delay("jitterBufferDelay"),
Chen Xing0acffb52019-01-15 15:46:29 +0100425 jitter_buffer_emitted_count("jitterBufferEmittedCount"),
hbos09bc1282016-11-08 06:29:22 -0800426 frame_width("frameWidth"),
427 frame_height("frameHeight"),
428 frames_per_second("framesPerSecond"),
429 frames_sent("framesSent"),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100430 huge_frames_sent("hugeFramesSent"),
hbos09bc1282016-11-08 06:29:22 -0800431 frames_received("framesReceived"),
432 frames_decoded("framesDecoded"),
433 frames_dropped("framesDropped"),
434 frames_corrupted("framesCorrupted"),
435 partial_frames_lost("partialFramesLost"),
436 full_frames_lost("fullFramesLost"),
437 audio_level("audioLevel"),
zsteine76bd3a2017-07-14 12:17:49 -0700438 total_audio_energy("totalAudioEnergy"),
hbos09bc1282016-11-08 06:29:22 -0800439 echo_return_loss("echoReturnLoss"),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700440 echo_return_loss_enhancement("echoReturnLossEnhancement"),
441 total_samples_received("totalSamplesReceived"),
442 total_samples_duration("totalSamplesDuration"),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200443 concealed_samples("concealedSamples"),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200444 silent_concealed_samples("silentConcealedSamples"),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100445 concealment_events("concealmentEvents"),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200446 inserted_samples_for_deceleration("insertedSamplesForDeceleration"),
447 removed_samples_for_acceleration("removedSamplesForAcceleration"),
Jakob Ivarsson758d9462019-03-19 15:38:49 +0100448 jitter_buffer_flushes(
449 "jitterBufferFlushes",
450 {NonStandardGroupId::kRtcAudioJitterBufferMaxPackets}),
451 delayed_packet_outage_samples(
452 "delayedPacketOutageSamples",
453 {NonStandardGroupId::kRtcAudioJitterBufferMaxPackets,
454 NonStandardGroupId::kRtcStatsRelativePacketArrivalDelay}),
455 relative_packet_arrival_delay(
456 "relativePacketArrivalDelay",
457 {NonStandardGroupId::kRtcStatsRelativePacketArrivalDelay}),
Artem Titove618cc92020-03-11 11:18:54 +0100458 jitter_buffer_target_delay("jitterBufferTargetDelay"),
Henrik Lundin44125fa2019-04-29 17:00:46 +0200459 interruption_count("interruptionCount"),
460 total_interruption_duration("totalInterruptionDuration"),
Sergey Silkin02371062019-01-31 16:45:42 +0100461 freeze_count("freezeCount"),
462 pause_count("pauseCount"),
463 total_freezes_duration("totalFreezesDuration"),
464 total_pauses_duration("totalPausesDuration"),
465 total_frames_duration("totalFramesDuration"),
466 sum_squared_frame_durations("sumOfSquaredFramesDuration") {
hbos160e4a72017-01-17 02:53:23 -0800467 RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
468 kind == RTCMediaStreamTrackKind::kVideo);
hbos09bc1282016-11-08 06:29:22 -0800469}
470
471RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
472 const RTCMediaStreamTrackStats& other)
473 : RTCStats(other.id(), other.timestamp_us()),
474 track_identifier(other.track_identifier),
Henrik Boström646fda02019-05-22 15:49:42 +0200475 media_source_id(other.media_source_id),
hbos09bc1282016-11-08 06:29:22 -0800476 remote_source(other.remote_source),
477 ended(other.ended),
478 detached(other.detached),
hbos160e4a72017-01-17 02:53:23 -0800479 kind(other.kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200480 jitter_buffer_delay(other.jitter_buffer_delay),
Chen Xing0acffb52019-01-15 15:46:29 +0100481 jitter_buffer_emitted_count(other.jitter_buffer_emitted_count),
hbos09bc1282016-11-08 06:29:22 -0800482 frame_width(other.frame_width),
483 frame_height(other.frame_height),
484 frames_per_second(other.frames_per_second),
485 frames_sent(other.frames_sent),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100486 huge_frames_sent(other.huge_frames_sent),
hbos09bc1282016-11-08 06:29:22 -0800487 frames_received(other.frames_received),
488 frames_decoded(other.frames_decoded),
489 frames_dropped(other.frames_dropped),
490 frames_corrupted(other.frames_corrupted),
491 partial_frames_lost(other.partial_frames_lost),
492 full_frames_lost(other.full_frames_lost),
493 audio_level(other.audio_level),
zsteine76bd3a2017-07-14 12:17:49 -0700494 total_audio_energy(other.total_audio_energy),
hbos09bc1282016-11-08 06:29:22 -0800495 echo_return_loss(other.echo_return_loss),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700496 echo_return_loss_enhancement(other.echo_return_loss_enhancement),
497 total_samples_received(other.total_samples_received),
498 total_samples_duration(other.total_samples_duration),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200499 concealed_samples(other.concealed_samples),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200500 silent_concealed_samples(other.silent_concealed_samples),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100501 concealment_events(other.concealment_events),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200502 inserted_samples_for_deceleration(
503 other.inserted_samples_for_deceleration),
504 removed_samples_for_acceleration(other.removed_samples_for_acceleration),
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100505 jitter_buffer_flushes(other.jitter_buffer_flushes),
Sergey Silkin02371062019-01-31 16:45:42 +0100506 delayed_packet_outage_samples(other.delayed_packet_outage_samples),
Jakob Ivarsson232b3fd2019-03-06 09:18:40 +0100507 relative_packet_arrival_delay(other.relative_packet_arrival_delay),
Artem Titove618cc92020-03-11 11:18:54 +0100508 jitter_buffer_target_delay(other.jitter_buffer_target_delay),
Henrik Lundin44125fa2019-04-29 17:00:46 +0200509 interruption_count(other.interruption_count),
510 total_interruption_duration(other.total_interruption_duration),
Sergey Silkin02371062019-01-31 16:45:42 +0100511 freeze_count(other.freeze_count),
512 pause_count(other.pause_count),
513 total_freezes_duration(other.total_freezes_duration),
514 total_pauses_duration(other.total_pauses_duration),
515 total_frames_duration(other.total_frames_duration),
516 sum_squared_frame_durations(other.sum_squared_frame_durations) {}
hbos09bc1282016-11-08 06:29:22 -0800517
Yves Gerey665174f2018-06-19 15:03:05 +0200518RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {}
hbos09bc1282016-11-08 06:29:22 -0800519
Steve Antond6a5cbd2017-08-18 09:40:25 -0700520// clang-format off
hbosfc5e0502016-10-06 02:06:10 -0700521WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
522 &data_channels_opened,
Nico Weber22f99252019-02-20 10:13:16 -0500523 &data_channels_closed)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700524// clang-format on
hbosd565b732016-08-30 14:04:35 -0700525
Yves Gerey665174f2018-06-19 15:03:05 +0200526RTCPeerConnectionStats::RTCPeerConnectionStats(const std::string& id,
527 int64_t timestamp_us)
528 : RTCPeerConnectionStats(std::string(id), timestamp_us) {}
hbosd565b732016-08-30 14:04:35 -0700529
Yves Gerey665174f2018-06-19 15:03:05 +0200530RTCPeerConnectionStats::RTCPeerConnectionStats(std::string&& id,
531 int64_t timestamp_us)
hbos0e6758d2016-08-31 07:57:36 -0700532 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700533 data_channels_opened("dataChannelsOpened"),
Yves Gerey665174f2018-06-19 15:03:05 +0200534 data_channels_closed("dataChannelsClosed") {}
hbosd565b732016-08-30 14:04:35 -0700535
hbosfc5e0502016-10-06 02:06:10 -0700536RTCPeerConnectionStats::RTCPeerConnectionStats(
537 const RTCPeerConnectionStats& other)
538 : RTCStats(other.id(), other.timestamp_us()),
539 data_channels_opened(other.data_channels_opened),
Yves Gerey665174f2018-06-19 15:03:05 +0200540 data_channels_closed(other.data_channels_closed) {}
hbosfc5e0502016-10-06 02:06:10 -0700541
Yves Gerey665174f2018-06-19 15:03:05 +0200542RTCPeerConnectionStats::~RTCPeerConnectionStats() {}
hbosfc5e0502016-10-06 02:06:10 -0700543
Steve Antond6a5cbd2017-08-18 09:40:25 -0700544// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700545WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
546 &ssrc,
hbos6ded1902016-11-01 01:50:46 -0700547 &is_remote,
548 &media_type,
Philipp Hancke3bc01662018-08-28 14:55:03 +0200549 &kind,
hbosb0ae9202017-01-27 06:35:16 -0800550 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700551 &transport_id,
552 &codec_id,
553 &fir_count,
554 &pli_count,
555 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800556 &sli_count,
Nico Weber22f99252019-02-20 10:13:16 -0500557 &qp_sum)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700558// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700559
Yves Gerey665174f2018-06-19 15:03:05 +0200560RTCRTPStreamStats::RTCRTPStreamStats(const std::string& id,
561 int64_t timestamp_us)
562 : RTCRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700563
Yves Gerey665174f2018-06-19 15:03:05 +0200564RTCRTPStreamStats::RTCRTPStreamStats(std::string&& id, int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700565 : RTCStats(std::move(id), timestamp_us),
566 ssrc("ssrc"),
hbos6ded1902016-11-01 01:50:46 -0700567 is_remote("isRemote", false),
568 media_type("mediaType"),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200569 kind("kind"),
hbosb0ae9202017-01-27 06:35:16 -0800570 track_id("trackId"),
hbos6ded1902016-11-01 01:50:46 -0700571 transport_id("transportId"),
572 codec_id("codecId"),
573 fir_count("firCount"),
574 pli_count("pliCount"),
575 nack_count("nackCount"),
hbos6769c492017-01-02 08:35:13 -0800576 sli_count("sliCount"),
Yves Gerey665174f2018-06-19 15:03:05 +0200577 qp_sum("qpSum") {}
hbos6ded1902016-11-01 01:50:46 -0700578
Yves Gerey665174f2018-06-19 15:03:05 +0200579RTCRTPStreamStats::RTCRTPStreamStats(const RTCRTPStreamStats& other)
hbos6ded1902016-11-01 01:50:46 -0700580 : RTCStats(other.id(), other.timestamp_us()),
581 ssrc(other.ssrc),
hbos6ded1902016-11-01 01:50:46 -0700582 is_remote(other.is_remote),
583 media_type(other.media_type),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200584 kind(other.kind),
hbosb0ae9202017-01-27 06:35:16 -0800585 track_id(other.track_id),
hbos6ded1902016-11-01 01:50:46 -0700586 transport_id(other.transport_id),
587 codec_id(other.codec_id),
588 fir_count(other.fir_count),
589 pli_count(other.pli_count),
590 nack_count(other.nack_count),
hbos6769c492017-01-02 08:35:13 -0800591 sli_count(other.sli_count),
Yves Gerey665174f2018-06-19 15:03:05 +0200592 qp_sum(other.qp_sum) {}
hbos6ded1902016-11-01 01:50:46 -0700593
Yves Gerey665174f2018-06-19 15:03:05 +0200594RTCRTPStreamStats::~RTCRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700595
Steve Antond6a5cbd2017-08-18 09:40:25 -0700596// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700597WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700598 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
599 &packets_received,
Henrik Boström4a5dab02020-01-28 11:15:35 +0100600 &fec_packets_received,
601 &fec_packets_discarded,
hboseeafe942016-11-01 03:00:17 -0700602 &bytes_received,
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200603 &header_bytes_received,
hboseeafe942016-11-01 03:00:17 -0700604 &packets_lost,
Henrik Boström01738c62019-04-15 17:32:00 +0200605 &last_packet_received_timestamp,
hboseeafe942016-11-01 03:00:17 -0700606 &jitter,
hbosa7a9be12017-03-01 01:02:45 -0800607 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700608 &packets_discarded,
609 &packets_repaired,
610 &burst_packets_lost,
611 &burst_packets_discarded,
612 &burst_loss_count,
613 &burst_discard_count,
614 &burst_loss_rate,
615 &burst_discard_rate,
616 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800617 &gap_discard_rate,
Henrik Boström2e069262019-04-09 13:59:31 +0200618 &frames_decoded,
Rasmus Brandt2efae772019-06-27 14:29:34 +0200619 &key_frames_decoded,
Johannes Kronbfd343b2019-07-01 10:07:50 +0200620 &total_decode_time,
Johannes Kron00376e12019-11-25 10:25:42 +0100621 &total_inter_frame_delay,
622 &total_squared_inter_frame_delay,
Henrik Boström6b430862019-08-16 13:09:51 +0200623 &content_type,
Åsa Perssonfcf79cc2019-10-22 15:23:44 +0200624 &estimated_playout_timestamp,
Henrik Boström6b430862019-08-16 13:09:51 +0200625 &decoder_implementation)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700626// clang-format on
hboseeafe942016-11-01 03:00:17 -0700627
Yves Gerey665174f2018-06-19 15:03:05 +0200628RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id,
629 int64_t timestamp_us)
630 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {}
hboseeafe942016-11-01 03:00:17 -0700631
Yves Gerey665174f2018-06-19 15:03:05 +0200632RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
633 int64_t timestamp_us)
hboseeafe942016-11-01 03:00:17 -0700634 : RTCRTPStreamStats(std::move(id), timestamp_us),
635 packets_received("packetsReceived"),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200636 fec_packets_received("fecPacketsReceived"),
637 fec_packets_discarded("fecPacketsDiscarded"),
hboseeafe942016-11-01 03:00:17 -0700638 bytes_received("bytesReceived"),
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200639 header_bytes_received("headerBytesReceived"),
hboseeafe942016-11-01 03:00:17 -0700640 packets_lost("packetsLost"),
Henrik Boström01738c62019-04-15 17:32:00 +0200641 last_packet_received_timestamp("lastPacketReceivedTimestamp"),
hboseeafe942016-11-01 03:00:17 -0700642 jitter("jitter"),
hbosa7a9be12017-03-01 01:02:45 -0800643 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700644 packets_discarded("packetsDiscarded"),
645 packets_repaired("packetsRepaired"),
646 burst_packets_lost("burstPacketsLost"),
647 burst_packets_discarded("burstPacketsDiscarded"),
648 burst_loss_count("burstLossCount"),
649 burst_discard_count("burstDiscardCount"),
650 burst_loss_rate("burstLossRate"),
651 burst_discard_rate("burstDiscardRate"),
652 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800653 gap_discard_rate("gapDiscardRate"),
Henrik Boström2e069262019-04-09 13:59:31 +0200654 frames_decoded("framesDecoded"),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200655 key_frames_decoded("keyFramesDecoded"),
Johannes Kronbfd343b2019-07-01 10:07:50 +0200656 total_decode_time("totalDecodeTime"),
Johannes Kron00376e12019-11-25 10:25:42 +0100657 total_inter_frame_delay("totalInterFrameDelay"),
658 total_squared_inter_frame_delay("totalSquaredInterFrameDelay"),
Henrik Boström6b430862019-08-16 13:09:51 +0200659 content_type("contentType"),
Åsa Perssonfcf79cc2019-10-22 15:23:44 +0200660 estimated_playout_timestamp("estimatedPlayoutTimestamp"),
Henrik Boström6b430862019-08-16 13:09:51 +0200661 decoder_implementation("decoderImplementation") {}
hboseeafe942016-11-01 03:00:17 -0700662
663RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
664 const RTCInboundRTPStreamStats& other)
665 : RTCRTPStreamStats(other),
666 packets_received(other.packets_received),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200667 fec_packets_received(other.fec_packets_received),
668 fec_packets_discarded(other.fec_packets_discarded),
hboseeafe942016-11-01 03:00:17 -0700669 bytes_received(other.bytes_received),
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200670 header_bytes_received(other.header_bytes_received),
hboseeafe942016-11-01 03:00:17 -0700671 packets_lost(other.packets_lost),
Henrik Boström01738c62019-04-15 17:32:00 +0200672 last_packet_received_timestamp(other.last_packet_received_timestamp),
hboseeafe942016-11-01 03:00:17 -0700673 jitter(other.jitter),
hbosa7a9be12017-03-01 01:02:45 -0800674 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700675 packets_discarded(other.packets_discarded),
676 packets_repaired(other.packets_repaired),
677 burst_packets_lost(other.burst_packets_lost),
678 burst_packets_discarded(other.burst_packets_discarded),
679 burst_loss_count(other.burst_loss_count),
680 burst_discard_count(other.burst_discard_count),
681 burst_loss_rate(other.burst_loss_rate),
682 burst_discard_rate(other.burst_discard_rate),
683 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800684 gap_discard_rate(other.gap_discard_rate),
Henrik Boström2e069262019-04-09 13:59:31 +0200685 frames_decoded(other.frames_decoded),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200686 key_frames_decoded(other.key_frames_decoded),
Johannes Kronbfd343b2019-07-01 10:07:50 +0200687 total_decode_time(other.total_decode_time),
Johannes Kron00376e12019-11-25 10:25:42 +0100688 total_inter_frame_delay(other.total_inter_frame_delay),
689 total_squared_inter_frame_delay(other.total_squared_inter_frame_delay),
Henrik Boström6b430862019-08-16 13:09:51 +0200690 content_type(other.content_type),
Åsa Perssonfcf79cc2019-10-22 15:23:44 +0200691 estimated_playout_timestamp(other.estimated_playout_timestamp),
Henrik Boström6b430862019-08-16 13:09:51 +0200692 decoder_implementation(other.decoder_implementation) {}
hboseeafe942016-11-01 03:00:17 -0700693
Yves Gerey665174f2018-06-19 15:03:05 +0200694RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {}
hboseeafe942016-11-01 03:00:17 -0700695
Steve Antond6a5cbd2017-08-18 09:40:25 -0700696// clang-format off
hboseeafe942016-11-01 03:00:17 -0700697WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700698 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
Henrik Boström646fda02019-05-22 15:49:42 +0200699 &media_source_id,
Henrik Boström4f40fa52019-12-19 13:27:27 +0100700 &remote_id,
Eldar Relloda6cda82020-04-17 13:44:28 +0300701 &rid,
hbos6ded1902016-11-01 01:50:46 -0700702 &packets_sent,
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200703 &retransmitted_packets_sent,
hbos6ded1902016-11-01 01:50:46 -0700704 &bytes_sent,
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200705 &header_bytes_sent,
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200706 &retransmitted_bytes_sent,
hbos6ded1902016-11-01 01:50:46 -0700707 &target_bitrate,
Henrik Boströmf71362f2019-04-08 16:14:23 +0200708 &frames_encoded,
Rasmus Brandt2efae772019-06-27 14:29:34 +0200709 &key_frames_encoded,
Henrik Boström2e069262019-04-09 13:59:31 +0200710 &total_encode_time,
Henrik Boström23aff9b2019-05-20 15:15:38 +0200711 &total_encoded_bytes_target,
Eldar Relloda6cda82020-04-17 13:44:28 +0300712 &frame_width,
713 &frame_height,
714 &frames_per_second,
715 &frames_sent,
716 &huge_frames_sent,
Henrik Boström9fe18342019-05-16 18:38:20 +0200717 &total_packet_send_delay,
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200718 &quality_limitation_reason,
Evan Shrubsolecc62b162019-09-09 11:26:45 +0200719 &quality_limitation_resolution_changes,
Henrik Boström6b430862019-08-16 13:09:51 +0200720 &content_type,
721 &encoder_implementation)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700722// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700723
Yves Gerey665174f2018-06-19 15:03:05 +0200724RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(const std::string& id,
725 int64_t timestamp_us)
726 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700727
Yves Gerey665174f2018-06-19 15:03:05 +0200728RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id,
729 int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700730 : RTCRTPStreamStats(std::move(id), timestamp_us),
Henrik Boström646fda02019-05-22 15:49:42 +0200731 media_source_id("mediaSourceId"),
Henrik Boström4f40fa52019-12-19 13:27:27 +0100732 remote_id("remoteId"),
Eldar Relloda6cda82020-04-17 13:44:28 +0300733 rid("rid"),
hbos6ded1902016-11-01 01:50:46 -0700734 packets_sent("packetsSent"),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200735 retransmitted_packets_sent("retransmittedPacketsSent"),
hbos6ded1902016-11-01 01:50:46 -0700736 bytes_sent("bytesSent"),
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200737 header_bytes_sent("headerBytesSent"),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200738 retransmitted_bytes_sent("retransmittedBytesSent"),
hbos6ded1902016-11-01 01:50:46 -0700739 target_bitrate("targetBitrate"),
Henrik Boströmf71362f2019-04-08 16:14:23 +0200740 frames_encoded("framesEncoded"),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200741 key_frames_encoded("keyFramesEncoded"),
Henrik Boström2e069262019-04-09 13:59:31 +0200742 total_encode_time("totalEncodeTime"),
Henrik Boström23aff9b2019-05-20 15:15:38 +0200743 total_encoded_bytes_target("totalEncodedBytesTarget"),
Eldar Relloda6cda82020-04-17 13:44:28 +0300744 frame_width("frameWidth"),
745 frame_height("frameHeight"),
746 frames_per_second("framesPerSecond"),
747 frames_sent("framesSent"),
748 huge_frames_sent("hugeFramesSent"),
Henrik Boström9fe18342019-05-16 18:38:20 +0200749 total_packet_send_delay("totalPacketSendDelay"),
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200750 quality_limitation_reason("qualityLimitationReason"),
Evan Shrubsolecc62b162019-09-09 11:26:45 +0200751 quality_limitation_resolution_changes(
752 "qualityLimitationResolutionChanges"),
Henrik Boström6b430862019-08-16 13:09:51 +0200753 content_type("contentType"),
754 encoder_implementation("encoderImplementation") {}
hbos6ded1902016-11-01 01:50:46 -0700755
756RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
757 const RTCOutboundRTPStreamStats& other)
758 : RTCRTPStreamStats(other),
Henrik Boström646fda02019-05-22 15:49:42 +0200759 media_source_id(other.media_source_id),
Henrik Boström4f40fa52019-12-19 13:27:27 +0100760 remote_id(other.remote_id),
Eldar Relloda6cda82020-04-17 13:44:28 +0300761 rid(other.rid),
hbos6ded1902016-11-01 01:50:46 -0700762 packets_sent(other.packets_sent),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200763 retransmitted_packets_sent(other.retransmitted_packets_sent),
hbos6ded1902016-11-01 01:50:46 -0700764 bytes_sent(other.bytes_sent),
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200765 header_bytes_sent(other.header_bytes_sent),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200766 retransmitted_bytes_sent(other.retransmitted_bytes_sent),
hbos6ded1902016-11-01 01:50:46 -0700767 target_bitrate(other.target_bitrate),
Henrik Boströmf71362f2019-04-08 16:14:23 +0200768 frames_encoded(other.frames_encoded),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200769 key_frames_encoded(other.key_frames_encoded),
Henrik Boström2e069262019-04-09 13:59:31 +0200770 total_encode_time(other.total_encode_time),
Henrik Boström23aff9b2019-05-20 15:15:38 +0200771 total_encoded_bytes_target(other.total_encoded_bytes_target),
Eldar Relloda6cda82020-04-17 13:44:28 +0300772 frame_width(other.frame_width),
773 frame_height(other.frame_height),
774 frames_per_second(other.frames_per_second),
775 frames_sent(other.frames_sent),
776 huge_frames_sent(other.huge_frames_sent),
Henrik Boström9fe18342019-05-16 18:38:20 +0200777 total_packet_send_delay(other.total_packet_send_delay),
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200778 quality_limitation_reason(other.quality_limitation_reason),
Evan Shrubsolecc62b162019-09-09 11:26:45 +0200779 quality_limitation_resolution_changes(
780 other.quality_limitation_resolution_changes),
Henrik Boström6b430862019-08-16 13:09:51 +0200781 content_type(other.content_type),
782 encoder_implementation(other.encoder_implementation) {}
hbos6ded1902016-11-01 01:50:46 -0700783
Yves Gerey665174f2018-06-19 15:03:05 +0200784RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700785
Steve Antond6a5cbd2017-08-18 09:40:25 -0700786// clang-format off
Henrik Boström883eefc2019-05-27 13:40:25 +0200787WEBRTC_RTCSTATS_IMPL(
788 RTCRemoteInboundRtpStreamStats, RTCStats, "remote-inbound-rtp",
789 &ssrc,
790 &kind,
791 &transport_id,
792 &codec_id,
793 &packets_lost,
794 &jitter,
795 &local_id,
796 &round_trip_time)
797// clang-format on
798
799RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
800 const std::string& id,
801 int64_t timestamp_us)
802 : RTCRemoteInboundRtpStreamStats(std::string(id), timestamp_us) {}
803
804RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
805 std::string&& id,
806 int64_t timestamp_us)
807 : RTCStats(std::move(id), timestamp_us),
808 ssrc("ssrc"),
809 kind("kind"),
810 transport_id("transportId"),
811 codec_id("codecId"),
812 packets_lost("packetsLost"),
813 jitter("jitter"),
814 local_id("localId"),
815 round_trip_time("roundTripTime") {}
816
817RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
818 const RTCRemoteInboundRtpStreamStats& other)
819 : RTCStats(other),
820 ssrc(other.ssrc),
821 kind(other.kind),
822 transport_id(other.transport_id),
823 codec_id(other.codec_id),
824 packets_lost(other.packets_lost),
825 jitter(other.jitter),
826 local_id(other.local_id),
827 round_trip_time(other.round_trip_time) {}
828
829RTCRemoteInboundRtpStreamStats::~RTCRemoteInboundRtpStreamStats() {}
830
831// clang-format off
Henrik Boström646fda02019-05-22 15:49:42 +0200832WEBRTC_RTCSTATS_IMPL(RTCMediaSourceStats, RTCStats, "parent-media-source",
833 &track_identifier,
834 &kind)
835// clang-format on
836
837RTCMediaSourceStats::RTCMediaSourceStats(const std::string& id,
838 int64_t timestamp_us)
839 : RTCMediaSourceStats(std::string(id), timestamp_us) {}
840
841RTCMediaSourceStats::RTCMediaSourceStats(std::string&& id, int64_t timestamp_us)
842 : RTCStats(std::move(id), timestamp_us),
843 track_identifier("trackIdentifier"),
844 kind("kind") {}
845
846RTCMediaSourceStats::RTCMediaSourceStats(const RTCMediaSourceStats& other)
847 : RTCStats(other.id(), other.timestamp_us()),
848 track_identifier(other.track_identifier),
849 kind(other.kind) {}
850
851RTCMediaSourceStats::~RTCMediaSourceStats() {}
852
853// clang-format off
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200854WEBRTC_RTCSTATS_IMPL(RTCAudioSourceStats, RTCMediaSourceStats, "media-source",
855 &audio_level,
856 &total_audio_energy,
857 &total_samples_duration)
Henrik Boström646fda02019-05-22 15:49:42 +0200858// clang-format on
859
860RTCAudioSourceStats::RTCAudioSourceStats(const std::string& id,
861 int64_t timestamp_us)
862 : RTCAudioSourceStats(std::string(id), timestamp_us) {}
863
864RTCAudioSourceStats::RTCAudioSourceStats(std::string&& id, int64_t timestamp_us)
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200865 : RTCMediaSourceStats(std::move(id), timestamp_us),
866 audio_level("audioLevel"),
867 total_audio_energy("totalAudioEnergy"),
868 total_samples_duration("totalSamplesDuration") {}
Henrik Boström646fda02019-05-22 15:49:42 +0200869
870RTCAudioSourceStats::RTCAudioSourceStats(const RTCAudioSourceStats& other)
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200871 : RTCMediaSourceStats(other),
872 audio_level(other.audio_level),
873 total_audio_energy(other.total_audio_energy),
874 total_samples_duration(other.total_samples_duration) {}
Henrik Boström646fda02019-05-22 15:49:42 +0200875
876RTCAudioSourceStats::~RTCAudioSourceStats() {}
877
878// clang-format off
879WEBRTC_RTCSTATS_IMPL(RTCVideoSourceStats, RTCMediaSourceStats, "media-source",
880 &width,
881 &height,
882 &frames,
883 &frames_per_second)
884// clang-format on
885
886RTCVideoSourceStats::RTCVideoSourceStats(const std::string& id,
887 int64_t timestamp_us)
888 : RTCVideoSourceStats(std::string(id), timestamp_us) {}
889
890RTCVideoSourceStats::RTCVideoSourceStats(std::string&& id, int64_t timestamp_us)
891 : RTCMediaSourceStats(std::move(id), timestamp_us),
892 width("width"),
893 height("height"),
894 frames("frames"),
895 frames_per_second("framesPerSecond") {}
896
897RTCVideoSourceStats::RTCVideoSourceStats(const RTCVideoSourceStats& other)
898 : RTCMediaSourceStats(other),
899 width(other.width),
900 height(other.height),
901 frames(other.frames),
902 frames_per_second(other.frames_per_second) {}
903
904RTCVideoSourceStats::~RTCVideoSourceStats() {}
905
906// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700907WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
908 &bytes_sent,
909 &bytes_received,
910 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800911 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700912 &selected_candidate_pair_id,
913 &local_certificate_id,
Jonas Oreland149dc722019-08-28 08:10:27 +0200914 &remote_certificate_id,
Harald Alvestrand5cb78072019-10-28 09:51:17 +0100915 &tls_version,
916 &dtls_cipher,
917 &srtp_cipher,
Jonas Oreland149dc722019-08-28 08:10:27 +0200918 &selected_candidate_pair_changes)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700919// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700920
Yves Gerey665174f2018-06-19 15:03:05 +0200921RTCTransportStats::RTCTransportStats(const std::string& id,
922 int64_t timestamp_us)
923 : RTCTransportStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700924
Yves Gerey665174f2018-06-19 15:03:05 +0200925RTCTransportStats::RTCTransportStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700926 : RTCStats(std::move(id), timestamp_us),
927 bytes_sent("bytesSent"),
928 bytes_received("bytesReceived"),
929 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800930 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700931 selected_candidate_pair_id("selectedCandidatePairId"),
932 local_certificate_id("localCertificateId"),
Jonas Oreland149dc722019-08-28 08:10:27 +0200933 remote_certificate_id("remoteCertificateId"),
Harald Alvestrand5cb78072019-10-28 09:51:17 +0100934 tls_version("tlsVersion"),
935 dtls_cipher("dtlsCipher"),
936 srtp_cipher("srtpCipher"),
Jonas Oreland149dc722019-08-28 08:10:27 +0200937 selected_candidate_pair_changes("selectedCandidatePairChanges") {}
hbos2fa7c672016-10-24 04:00:05 -0700938
Yves Gerey665174f2018-06-19 15:03:05 +0200939RTCTransportStats::RTCTransportStats(const RTCTransportStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700940 : RTCStats(other.id(), other.timestamp_us()),
941 bytes_sent(other.bytes_sent),
942 bytes_received(other.bytes_received),
943 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800944 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700945 selected_candidate_pair_id(other.selected_candidate_pair_id),
946 local_certificate_id(other.local_certificate_id),
Jonas Oreland149dc722019-08-28 08:10:27 +0200947 remote_certificate_id(other.remote_certificate_id),
Harald Alvestrand5cb78072019-10-28 09:51:17 +0100948 tls_version(other.tls_version),
949 dtls_cipher(other.dtls_cipher),
950 srtp_cipher(other.srtp_cipher),
Jonas Oreland149dc722019-08-28 08:10:27 +0200951 selected_candidate_pair_changes(other.selected_candidate_pair_changes) {}
hbos2fa7c672016-10-24 04:00:05 -0700952
Yves Gerey665174f2018-06-19 15:03:05 +0200953RTCTransportStats::~RTCTransportStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700954
hbosd565b732016-08-30 14:04:35 -0700955} // namespace webrtc