blob: 43c1d231e311f8c1480801700b9bf362f272fa2b [file] [log] [blame]
hbosd565b732016-08-30 14:04:35 -07001/*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "api/stats/rtcstats_objects.h"
hbosd565b732016-08-30 14:04:35 -070012
Yves Gerey3e707812018-11-28 16:47:49 +010013#include <utility>
14
15#include "rtc_base/checks.h"
16
Jakob Ivarsson758d9462019-03-19 15:38:49 +010017#include "api/stats/rtc_stats.h"
18
hbosd565b732016-08-30 14:04:35 -070019namespace webrtc {
20
agrieve26622d32017-08-08 10:48:15 -070021const char* const RTCDataChannelState::kConnecting = "connecting";
22const char* const RTCDataChannelState::kOpen = "open";
23const char* const RTCDataChannelState::kClosing = "closing";
24const char* const RTCDataChannelState::kClosed = "closed";
hboscc555c52016-10-18 12:48:31 -070025
agrieve26622d32017-08-08 10:48:15 -070026const char* const RTCStatsIceCandidatePairState::kFrozen = "frozen";
27const char* const RTCStatsIceCandidatePairState::kWaiting = "waiting";
28const char* const RTCStatsIceCandidatePairState::kInProgress = "in-progress";
29const char* const RTCStatsIceCandidatePairState::kFailed = "failed";
30const char* const RTCStatsIceCandidatePairState::kSucceeded = "succeeded";
hbosc47a0c32016-10-11 14:54:49 -070031
32// Strings defined in https://tools.ietf.org/html/rfc5245.
agrieve26622d32017-08-08 10:48:15 -070033const char* const RTCIceCandidateType::kHost = "host";
34const char* const RTCIceCandidateType::kSrflx = "srflx";
35const char* const RTCIceCandidateType::kPrflx = "prflx";
36const char* const RTCIceCandidateType::kRelay = "relay";
hbosab9f6e42016-10-07 02:18:47 -070037
agrieve26622d32017-08-08 10:48:15 -070038const char* const RTCDtlsTransportState::kNew = "new";
39const char* const RTCDtlsTransportState::kConnecting = "connecting";
40const char* const RTCDtlsTransportState::kConnected = "connected";
41const char* const RTCDtlsTransportState::kClosed = "closed";
42const char* const RTCDtlsTransportState::kFailed = "failed";
hbos7064d592017-01-16 07:38:02 -080043
agrieve26622d32017-08-08 10:48:15 -070044const char* const RTCMediaStreamTrackKind::kAudio = "audio";
45const char* const RTCMediaStreamTrackKind::kVideo = "video";
hbos160e4a72017-01-17 02:53:23 -080046
Gary Liu37e489c2017-11-21 10:49:36 -080047// https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype
48const char* const RTCNetworkType::kBluetooth = "bluetooth";
49const char* const RTCNetworkType::kCellular = "cellular";
50const char* const RTCNetworkType::kEthernet = "ethernet";
51const char* const RTCNetworkType::kWifi = "wifi";
52const char* const RTCNetworkType::kWimax = "wimax";
53const char* const RTCNetworkType::kVpn = "vpn";
54const char* const RTCNetworkType::kUnknown = "unknown";
55
Henrik Boströmce33b6a2019-05-28 17:42:38 +020056// https://w3c.github.io/webrtc-stats/#dom-rtcqualitylimitationreason
57const char* const RTCQualityLimitationReason::kNone = "none";
58const char* const RTCQualityLimitationReason::kCpu = "cpu";
59const char* const RTCQualityLimitationReason::kBandwidth = "bandwidth";
60const char* const RTCQualityLimitationReason::kOther = "other";
61
Henrik Boström2e069262019-04-09 13:59:31 +020062// https://webrtc.org/experiments/rtp-hdrext/video-content-type/
63const char* const RTCContentType::kUnspecified = "unspecified";
64const char* const RTCContentType::kScreenshare = "screenshare";
65
Steve Antond6a5cbd2017-08-18 09:40:25 -070066// clang-format off
hbos2fa7c672016-10-24 04:00:05 -070067WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
68 &fingerprint,
69 &fingerprint_algorithm,
70 &base64_certificate,
Nico Weber22f99252019-02-20 10:13:16 -050071 &issuer_certificate_id)
Steve Antond6a5cbd2017-08-18 09:40:25 -070072// clang-format on
hbos2fa7c672016-10-24 04:00:05 -070073
Yves Gerey665174f2018-06-19 15:03:05 +020074RTCCertificateStats::RTCCertificateStats(const std::string& id,
75 int64_t timestamp_us)
76 : RTCCertificateStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -070077
Yves Gerey665174f2018-06-19 15:03:05 +020078RTCCertificateStats::RTCCertificateStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -070079 : RTCStats(std::move(id), timestamp_us),
80 fingerprint("fingerprint"),
81 fingerprint_algorithm("fingerprintAlgorithm"),
82 base64_certificate("base64Certificate"),
Yves Gerey665174f2018-06-19 15:03:05 +020083 issuer_certificate_id("issuerCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -070084
Yves Gerey665174f2018-06-19 15:03:05 +020085RTCCertificateStats::RTCCertificateStats(const RTCCertificateStats& other)
hbos2fa7c672016-10-24 04:00:05 -070086 : RTCStats(other.id(), other.timestamp_us()),
87 fingerprint(other.fingerprint),
88 fingerprint_algorithm(other.fingerprint_algorithm),
89 base64_certificate(other.base64_certificate),
Yves Gerey665174f2018-06-19 15:03:05 +020090 issuer_certificate_id(other.issuer_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -070091
Yves Gerey665174f2018-06-19 15:03:05 +020092RTCCertificateStats::~RTCCertificateStats() {}
hbos2fa7c672016-10-24 04:00:05 -070093
Steve Antond6a5cbd2017-08-18 09:40:25 -070094// clang-format off
hbos0adb8282016-11-23 02:32:06 -080095WEBRTC_RTCSTATS_IMPL(RTCCodecStats, RTCStats, "codec",
96 &payload_type,
hbos13f54b22017-02-28 06:56:04 -080097 &mime_type,
hbos0adb8282016-11-23 02:32:06 -080098 &clock_rate,
99 &channels,
hbos13f54b22017-02-28 06:56:04 -0800100 &sdp_fmtp_line,
Nico Weber22f99252019-02-20 10:13:16 -0500101 &implementation)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700102// clang-format on
hbos0adb8282016-11-23 02:32:06 -0800103
Yves Gerey665174f2018-06-19 15:03:05 +0200104RTCCodecStats::RTCCodecStats(const std::string& id, int64_t timestamp_us)
105 : RTCCodecStats(std::string(id), timestamp_us) {}
hbos0adb8282016-11-23 02:32:06 -0800106
Yves Gerey665174f2018-06-19 15:03:05 +0200107RTCCodecStats::RTCCodecStats(std::string&& id, int64_t timestamp_us)
hbos0adb8282016-11-23 02:32:06 -0800108 : RTCStats(std::move(id), timestamp_us),
109 payload_type("payloadType"),
hbos13f54b22017-02-28 06:56:04 -0800110 mime_type("mimeType"),
hbos0adb8282016-11-23 02:32:06 -0800111 clock_rate("clockRate"),
112 channels("channels"),
hbos13f54b22017-02-28 06:56:04 -0800113 sdp_fmtp_line("sdpFmtpLine"),
Yves Gerey665174f2018-06-19 15:03:05 +0200114 implementation("implementation") {}
hbos0adb8282016-11-23 02:32:06 -0800115
Yves Gerey665174f2018-06-19 15:03:05 +0200116RTCCodecStats::RTCCodecStats(const RTCCodecStats& other)
hbos0adb8282016-11-23 02:32:06 -0800117 : RTCStats(other.id(), other.timestamp_us()),
118 payload_type(other.payload_type),
hbos13f54b22017-02-28 06:56:04 -0800119 mime_type(other.mime_type),
hbos0adb8282016-11-23 02:32:06 -0800120 clock_rate(other.clock_rate),
121 channels(other.channels),
hbos13f54b22017-02-28 06:56:04 -0800122 sdp_fmtp_line(other.sdp_fmtp_line),
Yves Gerey665174f2018-06-19 15:03:05 +0200123 implementation(other.implementation) {}
hbos0adb8282016-11-23 02:32:06 -0800124
Yves Gerey665174f2018-06-19 15:03:05 +0200125RTCCodecStats::~RTCCodecStats() {}
hbos0adb8282016-11-23 02:32:06 -0800126
Steve Antond6a5cbd2017-08-18 09:40:25 -0700127// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700128WEBRTC_RTCSTATS_IMPL(RTCDataChannelStats, RTCStats, "data-channel",
129 &label,
130 &protocol,
131 &datachannelid,
132 &state,
133 &messages_sent,
134 &bytes_sent,
135 &messages_received,
Nico Weber22f99252019-02-20 10:13:16 -0500136 &bytes_received)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700137// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700138
Yves Gerey665174f2018-06-19 15:03:05 +0200139RTCDataChannelStats::RTCDataChannelStats(const std::string& id,
140 int64_t timestamp_us)
141 : RTCDataChannelStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700142
Yves Gerey665174f2018-06-19 15:03:05 +0200143RTCDataChannelStats::RTCDataChannelStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700144 : RTCStats(std::move(id), timestamp_us),
145 label("label"),
146 protocol("protocol"),
147 datachannelid("datachannelid"),
148 state("state"),
149 messages_sent("messagesSent"),
150 bytes_sent("bytesSent"),
151 messages_received("messagesReceived"),
Yves Gerey665174f2018-06-19 15:03:05 +0200152 bytes_received("bytesReceived") {}
hbos2fa7c672016-10-24 04:00:05 -0700153
Yves Gerey665174f2018-06-19 15:03:05 +0200154RTCDataChannelStats::RTCDataChannelStats(const RTCDataChannelStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700155 : RTCStats(other.id(), other.timestamp_us()),
156 label(other.label),
157 protocol(other.protocol),
158 datachannelid(other.datachannelid),
159 state(other.state),
160 messages_sent(other.messages_sent),
161 bytes_sent(other.bytes_sent),
162 messages_received(other.messages_received),
Yves Gerey665174f2018-06-19 15:03:05 +0200163 bytes_received(other.bytes_received) {}
hbos2fa7c672016-10-24 04:00:05 -0700164
Yves Gerey665174f2018-06-19 15:03:05 +0200165RTCDataChannelStats::~RTCDataChannelStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700166
Steve Antond6a5cbd2017-08-18 09:40:25 -0700167// clang-format off
hbosc47a0c32016-10-11 14:54:49 -0700168WEBRTC_RTCSTATS_IMPL(RTCIceCandidatePairStats, RTCStats, "candidate-pair",
169 &transport_id,
170 &local_candidate_id,
171 &remote_candidate_id,
172 &state,
173 &priority,
174 &nominated,
175 &writable,
176 &readable,
177 &bytes_sent,
178 &bytes_received,
hbos3168c7a2016-12-15 06:17:08 -0800179 &total_round_trip_time,
180 &current_round_trip_time,
hbosc47a0c32016-10-11 14:54:49 -0700181 &available_outgoing_bitrate,
182 &available_incoming_bitrate,
183 &requests_received,
184 &requests_sent,
185 &responses_received,
186 &responses_sent,
187 &retransmissions_received,
188 &retransmissions_sent,
189 &consent_requests_received,
190 &consent_requests_sent,
191 &consent_responses_received,
Nico Weber22f99252019-02-20 10:13:16 -0500192 &consent_responses_sent)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700193// clang-format on
hbosc47a0c32016-10-11 14:54:49 -0700194
Yves Gerey665174f2018-06-19 15:03:05 +0200195RTCIceCandidatePairStats::RTCIceCandidatePairStats(const std::string& id,
196 int64_t timestamp_us)
197 : RTCIceCandidatePairStats(std::string(id), timestamp_us) {}
hbosc47a0c32016-10-11 14:54:49 -0700198
Yves Gerey665174f2018-06-19 15:03:05 +0200199RTCIceCandidatePairStats::RTCIceCandidatePairStats(std::string&& id,
200 int64_t timestamp_us)
hbosc47a0c32016-10-11 14:54:49 -0700201 : RTCStats(std::move(id), timestamp_us),
202 transport_id("transportId"),
203 local_candidate_id("localCandidateId"),
204 remote_candidate_id("remoteCandidateId"),
205 state("state"),
206 priority("priority"),
207 nominated("nominated"),
208 writable("writable"),
209 readable("readable"),
210 bytes_sent("bytesSent"),
211 bytes_received("bytesReceived"),
hbos3168c7a2016-12-15 06:17:08 -0800212 total_round_trip_time("totalRoundTripTime"),
213 current_round_trip_time("currentRoundTripTime"),
hbosc47a0c32016-10-11 14:54:49 -0700214 available_outgoing_bitrate("availableOutgoingBitrate"),
215 available_incoming_bitrate("availableIncomingBitrate"),
216 requests_received("requestsReceived"),
217 requests_sent("requestsSent"),
218 responses_received("responsesReceived"),
219 responses_sent("responsesSent"),
220 retransmissions_received("retransmissionsReceived"),
221 retransmissions_sent("retransmissionsSent"),
222 consent_requests_received("consentRequestsReceived"),
223 consent_requests_sent("consentRequestsSent"),
224 consent_responses_received("consentResponsesReceived"),
Yves Gerey665174f2018-06-19 15:03:05 +0200225 consent_responses_sent("consentResponsesSent") {}
hbosc47a0c32016-10-11 14:54:49 -0700226
227RTCIceCandidatePairStats::RTCIceCandidatePairStats(
228 const RTCIceCandidatePairStats& other)
229 : RTCStats(other.id(), other.timestamp_us()),
230 transport_id(other.transport_id),
231 local_candidate_id(other.local_candidate_id),
232 remote_candidate_id(other.remote_candidate_id),
233 state(other.state),
234 priority(other.priority),
235 nominated(other.nominated),
236 writable(other.writable),
237 readable(other.readable),
238 bytes_sent(other.bytes_sent),
239 bytes_received(other.bytes_received),
hbos3168c7a2016-12-15 06:17:08 -0800240 total_round_trip_time(other.total_round_trip_time),
241 current_round_trip_time(other.current_round_trip_time),
hbosc47a0c32016-10-11 14:54:49 -0700242 available_outgoing_bitrate(other.available_outgoing_bitrate),
243 available_incoming_bitrate(other.available_incoming_bitrate),
244 requests_received(other.requests_received),
245 requests_sent(other.requests_sent),
246 responses_received(other.responses_received),
247 responses_sent(other.responses_sent),
248 retransmissions_received(other.retransmissions_received),
249 retransmissions_sent(other.retransmissions_sent),
250 consent_requests_received(other.consent_requests_received),
251 consent_requests_sent(other.consent_requests_sent),
252 consent_responses_received(other.consent_responses_received),
Yves Gerey665174f2018-06-19 15:03:05 +0200253 consent_responses_sent(other.consent_responses_sent) {}
hbosc47a0c32016-10-11 14:54:49 -0700254
Yves Gerey665174f2018-06-19 15:03:05 +0200255RTCIceCandidatePairStats::~RTCIceCandidatePairStats() {}
hbosc47a0c32016-10-11 14:54:49 -0700256
Steve Antond6a5cbd2017-08-18 09:40:25 -0700257// clang-format off
Henrik Boström1df1bf82018-03-20 13:24:20 +0100258WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "abstract-ice-candidate",
hbosb4e426e2017-01-02 09:59:31 -0800259 &transport_id,
hbosc3a2b7f2017-01-02 04:46:15 -0800260 &is_remote,
Gary Liu37e489c2017-11-21 10:49:36 -0800261 &network_type,
hbosab9f6e42016-10-07 02:18:47 -0700262 &ip,
263 &port,
264 &protocol,
Philipp Hancke95513752018-09-27 14:40:08 +0200265 &relay_protocol,
hbosab9f6e42016-10-07 02:18:47 -0700266 &candidate_type,
267 &priority,
hbosd17a5a72017-01-02 08:09:59 -0800268 &url,
Nico Weber22f99252019-02-20 10:13:16 -0500269 &deleted)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700270// clang-format on
hbosab9f6e42016-10-07 02:18:47 -0700271
Yves Gerey665174f2018-06-19 15:03:05 +0200272RTCIceCandidateStats::RTCIceCandidateStats(const std::string& id,
273 int64_t timestamp_us,
274 bool is_remote)
275 : RTCIceCandidateStats(std::string(id), timestamp_us, is_remote) {}
hbosab9f6e42016-10-07 02:18:47 -0700276
Gary Liu37e489c2017-11-21 10:49:36 -0800277RTCIceCandidateStats::RTCIceCandidateStats(std::string&& id,
278 int64_t timestamp_us,
279 bool is_remote)
hbosab9f6e42016-10-07 02:18:47 -0700280 : RTCStats(std::move(id), timestamp_us),
hbosb4e426e2017-01-02 09:59:31 -0800281 transport_id("transportId"),
hbosc3a2b7f2017-01-02 04:46:15 -0800282 is_remote("isRemote", is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800283 network_type("networkType"),
hbosab9f6e42016-10-07 02:18:47 -0700284 ip("ip"),
285 port("port"),
286 protocol("protocol"),
Philipp Hancke95513752018-09-27 14:40:08 +0200287 relay_protocol("relayProtocol"),
hbosab9f6e42016-10-07 02:18:47 -0700288 candidate_type("candidateType"),
289 priority("priority"),
hbosd17a5a72017-01-02 08:09:59 -0800290 url("url"),
Gary Liu37e489c2017-11-21 10:49:36 -0800291 deleted("deleted", false) {}
hbosab9f6e42016-10-07 02:18:47 -0700292
293RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
294 : RTCStats(other.id(), other.timestamp_us()),
hbosb4e426e2017-01-02 09:59:31 -0800295 transport_id(other.transport_id),
hbosc3a2b7f2017-01-02 04:46:15 -0800296 is_remote(other.is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800297 network_type(other.network_type),
hbosab9f6e42016-10-07 02:18:47 -0700298 ip(other.ip),
299 port(other.port),
300 protocol(other.protocol),
Philipp Hancke95513752018-09-27 14:40:08 +0200301 relay_protocol(other.relay_protocol),
hbosab9f6e42016-10-07 02:18:47 -0700302 candidate_type(other.candidate_type),
303 priority(other.priority),
hbosd17a5a72017-01-02 08:09:59 -0800304 url(other.url),
Gary Liu37e489c2017-11-21 10:49:36 -0800305 deleted(other.deleted) {}
hbosab9f6e42016-10-07 02:18:47 -0700306
Yves Gerey665174f2018-06-19 15:03:05 +0200307RTCIceCandidateStats::~RTCIceCandidateStats() {}
hbosab9f6e42016-10-07 02:18:47 -0700308
309const char RTCLocalIceCandidateStats::kType[] = "local-candidate";
310
Yves Gerey665174f2018-06-19 15:03:05 +0200311RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(const std::string& id,
312 int64_t timestamp_us)
313 : RTCIceCandidateStats(id, timestamp_us, false) {}
hbosab9f6e42016-10-07 02:18:47 -0700314
Yves Gerey665174f2018-06-19 15:03:05 +0200315RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(std::string&& id,
316 int64_t timestamp_us)
317 : RTCIceCandidateStats(std::move(id), timestamp_us, false) {}
hbosab9f6e42016-10-07 02:18:47 -0700318
Henrik Boström1df1bf82018-03-20 13:24:20 +0100319std::unique_ptr<RTCStats> RTCLocalIceCandidateStats::copy() const {
320 return std::unique_ptr<RTCStats>(new RTCLocalIceCandidateStats(*this));
321}
322
hbosab9f6e42016-10-07 02:18:47 -0700323const char* RTCLocalIceCandidateStats::type() const {
324 return kType;
325}
326
327const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate";
328
Yves Gerey665174f2018-06-19 15:03:05 +0200329RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(const std::string& id,
330 int64_t timestamp_us)
331 : RTCIceCandidateStats(id, timestamp_us, true) {}
hbosab9f6e42016-10-07 02:18:47 -0700332
Yves Gerey665174f2018-06-19 15:03:05 +0200333RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(std::string&& id,
334 int64_t timestamp_us)
335 : RTCIceCandidateStats(std::move(id), timestamp_us, true) {}
hbosab9f6e42016-10-07 02:18:47 -0700336
Henrik Boström1df1bf82018-03-20 13:24:20 +0100337std::unique_ptr<RTCStats> RTCRemoteIceCandidateStats::copy() const {
338 return std::unique_ptr<RTCStats>(new RTCRemoteIceCandidateStats(*this));
339}
340
hbosab9f6e42016-10-07 02:18:47 -0700341const char* RTCRemoteIceCandidateStats::type() const {
342 return kType;
343}
344
Steve Antond6a5cbd2017-08-18 09:40:25 -0700345// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800346WEBRTC_RTCSTATS_IMPL(RTCMediaStreamStats, RTCStats, "stream",
347 &stream_identifier,
Nico Weber22f99252019-02-20 10:13:16 -0500348 &track_ids)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700349// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800350
Yves Gerey665174f2018-06-19 15:03:05 +0200351RTCMediaStreamStats::RTCMediaStreamStats(const std::string& id,
352 int64_t timestamp_us)
353 : RTCMediaStreamStats(std::string(id), timestamp_us) {}
hbos09bc1282016-11-08 06:29:22 -0800354
Yves Gerey665174f2018-06-19 15:03:05 +0200355RTCMediaStreamStats::RTCMediaStreamStats(std::string&& id, int64_t timestamp_us)
hbos09bc1282016-11-08 06:29:22 -0800356 : RTCStats(std::move(id), timestamp_us),
357 stream_identifier("streamIdentifier"),
Yves Gerey665174f2018-06-19 15:03:05 +0200358 track_ids("trackIds") {}
hbos09bc1282016-11-08 06:29:22 -0800359
Yves Gerey665174f2018-06-19 15:03:05 +0200360RTCMediaStreamStats::RTCMediaStreamStats(const RTCMediaStreamStats& other)
hbos09bc1282016-11-08 06:29:22 -0800361 : RTCStats(other.id(), other.timestamp_us()),
362 stream_identifier(other.stream_identifier),
Yves Gerey665174f2018-06-19 15:03:05 +0200363 track_ids(other.track_ids) {}
hbos09bc1282016-11-08 06:29:22 -0800364
Yves Gerey665174f2018-06-19 15:03:05 +0200365RTCMediaStreamStats::~RTCMediaStreamStats() {}
hbos09bc1282016-11-08 06:29:22 -0800366
Steve Antond6a5cbd2017-08-18 09:40:25 -0700367// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800368WEBRTC_RTCSTATS_IMPL(RTCMediaStreamTrackStats, RTCStats, "track",
zsteine76bd3a2017-07-14 12:17:49 -0700369 &track_identifier,
Henrik Boström646fda02019-05-22 15:49:42 +0200370 &media_source_id,
zsteine76bd3a2017-07-14 12:17:49 -0700371 &remote_source,
372 &ended,
373 &detached,
374 &kind,
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200375 &jitter_buffer_delay,
Chen Xing0acffb52019-01-15 15:46:29 +0100376 &jitter_buffer_emitted_count,
zsteine76bd3a2017-07-14 12:17:49 -0700377 &frame_width,
378 &frame_height,
379 &frames_per_second,
380 &frames_sent,
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100381 &huge_frames_sent,
zsteine76bd3a2017-07-14 12:17:49 -0700382 &frames_received,
383 &frames_decoded,
384 &frames_dropped,
385 &frames_corrupted,
386 &partial_frames_lost,
387 &full_frames_lost,
388 &audio_level,
389 &total_audio_energy,
zsteine76bd3a2017-07-14 12:17:49 -0700390 &echo_return_loss,
Steve Anton2dbc69f2017-08-24 17:15:13 -0700391 &echo_return_loss_enhancement,
392 &total_samples_received,
393 &total_samples_duration,
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200394 &concealed_samples,
Ruslan Burakov8af88962018-11-22 17:21:10 +0100395 &concealment_events,
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100396 &jitter_buffer_flushes,
Sergey Silkin02371062019-01-31 16:45:42 +0100397 &delayed_packet_outage_samples,
Jakob Ivarsson232b3fd2019-03-06 09:18:40 +0100398 &relative_packet_arrival_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}),
Henrik Lundin44125fa2019-04-29 17:00:46 +0200458 interruption_count("interruptionCount"),
459 total_interruption_duration("totalInterruptionDuration"),
Sergey Silkin02371062019-01-31 16:45:42 +0100460 freeze_count("freezeCount"),
461 pause_count("pauseCount"),
462 total_freezes_duration("totalFreezesDuration"),
463 total_pauses_duration("totalPausesDuration"),
464 total_frames_duration("totalFramesDuration"),
465 sum_squared_frame_durations("sumOfSquaredFramesDuration") {
hbos160e4a72017-01-17 02:53:23 -0800466 RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
467 kind == RTCMediaStreamTrackKind::kVideo);
hbos09bc1282016-11-08 06:29:22 -0800468}
469
470RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
471 const RTCMediaStreamTrackStats& other)
472 : RTCStats(other.id(), other.timestamp_us()),
473 track_identifier(other.track_identifier),
Henrik Boström646fda02019-05-22 15:49:42 +0200474 media_source_id(other.media_source_id),
hbos09bc1282016-11-08 06:29:22 -0800475 remote_source(other.remote_source),
476 ended(other.ended),
477 detached(other.detached),
hbos160e4a72017-01-17 02:53:23 -0800478 kind(other.kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200479 jitter_buffer_delay(other.jitter_buffer_delay),
Chen Xing0acffb52019-01-15 15:46:29 +0100480 jitter_buffer_emitted_count(other.jitter_buffer_emitted_count),
hbos09bc1282016-11-08 06:29:22 -0800481 frame_width(other.frame_width),
482 frame_height(other.frame_height),
483 frames_per_second(other.frames_per_second),
484 frames_sent(other.frames_sent),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100485 huge_frames_sent(other.huge_frames_sent),
hbos09bc1282016-11-08 06:29:22 -0800486 frames_received(other.frames_received),
487 frames_decoded(other.frames_decoded),
488 frames_dropped(other.frames_dropped),
489 frames_corrupted(other.frames_corrupted),
490 partial_frames_lost(other.partial_frames_lost),
491 full_frames_lost(other.full_frames_lost),
492 audio_level(other.audio_level),
zsteine76bd3a2017-07-14 12:17:49 -0700493 total_audio_energy(other.total_audio_energy),
hbos09bc1282016-11-08 06:29:22 -0800494 echo_return_loss(other.echo_return_loss),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700495 echo_return_loss_enhancement(other.echo_return_loss_enhancement),
496 total_samples_received(other.total_samples_received),
497 total_samples_duration(other.total_samples_duration),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200498 concealed_samples(other.concealed_samples),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200499 silent_concealed_samples(other.silent_concealed_samples),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100500 concealment_events(other.concealment_events),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200501 inserted_samples_for_deceleration(
502 other.inserted_samples_for_deceleration),
503 removed_samples_for_acceleration(other.removed_samples_for_acceleration),
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100504 jitter_buffer_flushes(other.jitter_buffer_flushes),
Sergey Silkin02371062019-01-31 16:45:42 +0100505 delayed_packet_outage_samples(other.delayed_packet_outage_samples),
Jakob Ivarsson232b3fd2019-03-06 09:18:40 +0100506 relative_packet_arrival_delay(other.relative_packet_arrival_delay),
Henrik Lundin44125fa2019-04-29 17:00:46 +0200507 interruption_count(other.interruption_count),
508 total_interruption_duration(other.total_interruption_duration),
Sergey Silkin02371062019-01-31 16:45:42 +0100509 freeze_count(other.freeze_count),
510 pause_count(other.pause_count),
511 total_freezes_duration(other.total_freezes_duration),
512 total_pauses_duration(other.total_pauses_duration),
513 total_frames_duration(other.total_frames_duration),
514 sum_squared_frame_durations(other.sum_squared_frame_durations) {}
hbos09bc1282016-11-08 06:29:22 -0800515
Yves Gerey665174f2018-06-19 15:03:05 +0200516RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {}
hbos09bc1282016-11-08 06:29:22 -0800517
Steve Antond6a5cbd2017-08-18 09:40:25 -0700518// clang-format off
hbosfc5e0502016-10-06 02:06:10 -0700519WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
520 &data_channels_opened,
Nico Weber22f99252019-02-20 10:13:16 -0500521 &data_channels_closed)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700522// clang-format on
hbosd565b732016-08-30 14:04:35 -0700523
Yves Gerey665174f2018-06-19 15:03:05 +0200524RTCPeerConnectionStats::RTCPeerConnectionStats(const std::string& id,
525 int64_t timestamp_us)
526 : RTCPeerConnectionStats(std::string(id), timestamp_us) {}
hbosd565b732016-08-30 14:04:35 -0700527
Yves Gerey665174f2018-06-19 15:03:05 +0200528RTCPeerConnectionStats::RTCPeerConnectionStats(std::string&& id,
529 int64_t timestamp_us)
hbos0e6758d2016-08-31 07:57:36 -0700530 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700531 data_channels_opened("dataChannelsOpened"),
Yves Gerey665174f2018-06-19 15:03:05 +0200532 data_channels_closed("dataChannelsClosed") {}
hbosd565b732016-08-30 14:04:35 -0700533
hbosfc5e0502016-10-06 02:06:10 -0700534RTCPeerConnectionStats::RTCPeerConnectionStats(
535 const RTCPeerConnectionStats& other)
536 : RTCStats(other.id(), other.timestamp_us()),
537 data_channels_opened(other.data_channels_opened),
Yves Gerey665174f2018-06-19 15:03:05 +0200538 data_channels_closed(other.data_channels_closed) {}
hbosfc5e0502016-10-06 02:06:10 -0700539
Yves Gerey665174f2018-06-19 15:03:05 +0200540RTCPeerConnectionStats::~RTCPeerConnectionStats() {}
hbosfc5e0502016-10-06 02:06:10 -0700541
Steve Antond6a5cbd2017-08-18 09:40:25 -0700542// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700543WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
544 &ssrc,
545 &associate_stats_id,
546 &is_remote,
547 &media_type,
Philipp Hancke3bc01662018-08-28 14:55:03 +0200548 &kind,
hbosb0ae9202017-01-27 06:35:16 -0800549 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700550 &transport_id,
551 &codec_id,
552 &fir_count,
553 &pli_count,
554 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800555 &sli_count,
Nico Weber22f99252019-02-20 10:13:16 -0500556 &qp_sum)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700557// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700558
Yves Gerey665174f2018-06-19 15:03:05 +0200559RTCRTPStreamStats::RTCRTPStreamStats(const std::string& id,
560 int64_t timestamp_us)
561 : RTCRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700562
Yves Gerey665174f2018-06-19 15:03:05 +0200563RTCRTPStreamStats::RTCRTPStreamStats(std::string&& id, int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700564 : RTCStats(std::move(id), timestamp_us),
565 ssrc("ssrc"),
566 associate_stats_id("associateStatsId"),
567 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),
582 associate_stats_id(other.associate_stats_id),
583 is_remote(other.is_remote),
584 media_type(other.media_type),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200585 kind(other.kind),
hbosb0ae9202017-01-27 06:35:16 -0800586 track_id(other.track_id),
hbos6ded1902016-11-01 01:50:46 -0700587 transport_id(other.transport_id),
588 codec_id(other.codec_id),
589 fir_count(other.fir_count),
590 pli_count(other.pli_count),
591 nack_count(other.nack_count),
hbos6769c492017-01-02 08:35:13 -0800592 sli_count(other.sli_count),
Yves Gerey665174f2018-06-19 15:03:05 +0200593 qp_sum(other.qp_sum) {}
hbos6ded1902016-11-01 01:50:46 -0700594
Yves Gerey665174f2018-06-19 15:03:05 +0200595RTCRTPStreamStats::~RTCRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700596
Steve Antond6a5cbd2017-08-18 09:40:25 -0700597// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700598WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700599 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
600 &packets_received,
601 &bytes_received,
602 &packets_lost,
Henrik Boström01738c62019-04-15 17:32:00 +0200603 &last_packet_received_timestamp,
hboseeafe942016-11-01 03:00:17 -0700604 &jitter,
hbosa7a9be12017-03-01 01:02:45 -0800605 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700606 &packets_discarded,
607 &packets_repaired,
608 &burst_packets_lost,
609 &burst_packets_discarded,
610 &burst_loss_count,
611 &burst_discard_count,
612 &burst_loss_rate,
613 &burst_discard_rate,
614 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800615 &gap_discard_rate,
Henrik Boström2e069262019-04-09 13:59:31 +0200616 &frames_decoded,
617 &content_type)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700618// clang-format on
hboseeafe942016-11-01 03:00:17 -0700619
Yves Gerey665174f2018-06-19 15:03:05 +0200620RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id,
621 int64_t timestamp_us)
622 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {}
hboseeafe942016-11-01 03:00:17 -0700623
Yves Gerey665174f2018-06-19 15:03:05 +0200624RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
625 int64_t timestamp_us)
hboseeafe942016-11-01 03:00:17 -0700626 : RTCRTPStreamStats(std::move(id), timestamp_us),
627 packets_received("packetsReceived"),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200628 fec_packets_received("fecPacketsReceived"),
629 fec_packets_discarded("fecPacketsDiscarded"),
hboseeafe942016-11-01 03:00:17 -0700630 bytes_received("bytesReceived"),
631 packets_lost("packetsLost"),
Henrik Boström01738c62019-04-15 17:32:00 +0200632 last_packet_received_timestamp("lastPacketReceivedTimestamp"),
hboseeafe942016-11-01 03:00:17 -0700633 jitter("jitter"),
hbosa7a9be12017-03-01 01:02:45 -0800634 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700635 packets_discarded("packetsDiscarded"),
636 packets_repaired("packetsRepaired"),
637 burst_packets_lost("burstPacketsLost"),
638 burst_packets_discarded("burstPacketsDiscarded"),
639 burst_loss_count("burstLossCount"),
640 burst_discard_count("burstDiscardCount"),
641 burst_loss_rate("burstLossRate"),
642 burst_discard_rate("burstDiscardRate"),
643 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800644 gap_discard_rate("gapDiscardRate"),
Henrik Boström2e069262019-04-09 13:59:31 +0200645 frames_decoded("framesDecoded"),
646 content_type("contentType") {}
hboseeafe942016-11-01 03:00:17 -0700647
648RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
649 const RTCInboundRTPStreamStats& other)
650 : RTCRTPStreamStats(other),
651 packets_received(other.packets_received),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200652 fec_packets_received(other.fec_packets_received),
653 fec_packets_discarded(other.fec_packets_discarded),
hboseeafe942016-11-01 03:00:17 -0700654 bytes_received(other.bytes_received),
655 packets_lost(other.packets_lost),
Henrik Boström01738c62019-04-15 17:32:00 +0200656 last_packet_received_timestamp(other.last_packet_received_timestamp),
hboseeafe942016-11-01 03:00:17 -0700657 jitter(other.jitter),
hbosa7a9be12017-03-01 01:02:45 -0800658 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700659 packets_discarded(other.packets_discarded),
660 packets_repaired(other.packets_repaired),
661 burst_packets_lost(other.burst_packets_lost),
662 burst_packets_discarded(other.burst_packets_discarded),
663 burst_loss_count(other.burst_loss_count),
664 burst_discard_count(other.burst_discard_count),
665 burst_loss_rate(other.burst_loss_rate),
666 burst_discard_rate(other.burst_discard_rate),
667 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800668 gap_discard_rate(other.gap_discard_rate),
Henrik Boström2e069262019-04-09 13:59:31 +0200669 frames_decoded(other.frames_decoded),
670 content_type(other.content_type) {}
hboseeafe942016-11-01 03:00:17 -0700671
Yves Gerey665174f2018-06-19 15:03:05 +0200672RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {}
hboseeafe942016-11-01 03:00:17 -0700673
Steve Antond6a5cbd2017-08-18 09:40:25 -0700674// clang-format off
hboseeafe942016-11-01 03:00:17 -0700675WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700676 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
Henrik Boström646fda02019-05-22 15:49:42 +0200677 &media_source_id,
hbos6ded1902016-11-01 01:50:46 -0700678 &packets_sent,
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200679 &retransmitted_packets_sent,
hbos6ded1902016-11-01 01:50:46 -0700680 &bytes_sent,
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200681 &retransmitted_bytes_sent,
hbos6ded1902016-11-01 01:50:46 -0700682 &target_bitrate,
Henrik Boströmf71362f2019-04-08 16:14:23 +0200683 &frames_encoded,
Henrik Boström2e069262019-04-09 13:59:31 +0200684 &total_encode_time,
Henrik Boström23aff9b2019-05-20 15:15:38 +0200685 &total_encoded_bytes_target,
Henrik Boström9fe18342019-05-16 18:38:20 +0200686 &total_packet_send_delay,
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200687 &quality_limitation_reason,
Henrik Boström2e069262019-04-09 13:59:31 +0200688 &content_type)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700689// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700690
Yves Gerey665174f2018-06-19 15:03:05 +0200691RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(const std::string& id,
692 int64_t timestamp_us)
693 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700694
Yves Gerey665174f2018-06-19 15:03:05 +0200695RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id,
696 int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700697 : RTCRTPStreamStats(std::move(id), timestamp_us),
Henrik Boström646fda02019-05-22 15:49:42 +0200698 media_source_id("mediaSourceId"),
hbos6ded1902016-11-01 01:50:46 -0700699 packets_sent("packetsSent"),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200700 retransmitted_packets_sent("retransmittedPacketsSent"),
hbos6ded1902016-11-01 01:50:46 -0700701 bytes_sent("bytesSent"),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200702 retransmitted_bytes_sent("retransmittedBytesSent"),
hbos6ded1902016-11-01 01:50:46 -0700703 target_bitrate("targetBitrate"),
Henrik Boströmf71362f2019-04-08 16:14:23 +0200704 frames_encoded("framesEncoded"),
Henrik Boström2e069262019-04-09 13:59:31 +0200705 total_encode_time("totalEncodeTime"),
Henrik Boström23aff9b2019-05-20 15:15:38 +0200706 total_encoded_bytes_target("totalEncodedBytesTarget"),
Henrik Boström9fe18342019-05-16 18:38:20 +0200707 total_packet_send_delay("totalPacketSendDelay"),
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200708 quality_limitation_reason("qualityLimitationReason"),
Henrik Boström2e069262019-04-09 13:59:31 +0200709 content_type("contentType") {}
hbos6ded1902016-11-01 01:50:46 -0700710
711RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
712 const RTCOutboundRTPStreamStats& other)
713 : RTCRTPStreamStats(other),
Henrik Boström646fda02019-05-22 15:49:42 +0200714 media_source_id(other.media_source_id),
hbos6ded1902016-11-01 01:50:46 -0700715 packets_sent(other.packets_sent),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200716 retransmitted_packets_sent(other.retransmitted_packets_sent),
hbos6ded1902016-11-01 01:50:46 -0700717 bytes_sent(other.bytes_sent),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200718 retransmitted_bytes_sent(other.retransmitted_bytes_sent),
hbos6ded1902016-11-01 01:50:46 -0700719 target_bitrate(other.target_bitrate),
Henrik Boströmf71362f2019-04-08 16:14:23 +0200720 frames_encoded(other.frames_encoded),
Henrik Boström2e069262019-04-09 13:59:31 +0200721 total_encode_time(other.total_encode_time),
Henrik Boström23aff9b2019-05-20 15:15:38 +0200722 total_encoded_bytes_target(other.total_encoded_bytes_target),
Henrik Boström9fe18342019-05-16 18:38:20 +0200723 total_packet_send_delay(other.total_packet_send_delay),
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200724 quality_limitation_reason(other.quality_limitation_reason),
Henrik Boström2e069262019-04-09 13:59:31 +0200725 content_type(other.content_type) {}
hbos6ded1902016-11-01 01:50:46 -0700726
Yves Gerey665174f2018-06-19 15:03:05 +0200727RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700728
Steve Antond6a5cbd2017-08-18 09:40:25 -0700729// clang-format off
Henrik Boström883eefc2019-05-27 13:40:25 +0200730WEBRTC_RTCSTATS_IMPL(
731 RTCRemoteInboundRtpStreamStats, RTCStats, "remote-inbound-rtp",
732 &ssrc,
733 &kind,
734 &transport_id,
735 &codec_id,
736 &packets_lost,
737 &jitter,
738 &local_id,
739 &round_trip_time)
740// clang-format on
741
742RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
743 const std::string& id,
744 int64_t timestamp_us)
745 : RTCRemoteInboundRtpStreamStats(std::string(id), timestamp_us) {}
746
747RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
748 std::string&& id,
749 int64_t timestamp_us)
750 : RTCStats(std::move(id), timestamp_us),
751 ssrc("ssrc"),
752 kind("kind"),
753 transport_id("transportId"),
754 codec_id("codecId"),
755 packets_lost("packetsLost"),
756 jitter("jitter"),
757 local_id("localId"),
758 round_trip_time("roundTripTime") {}
759
760RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
761 const RTCRemoteInboundRtpStreamStats& other)
762 : RTCStats(other),
763 ssrc(other.ssrc),
764 kind(other.kind),
765 transport_id(other.transport_id),
766 codec_id(other.codec_id),
767 packets_lost(other.packets_lost),
768 jitter(other.jitter),
769 local_id(other.local_id),
770 round_trip_time(other.round_trip_time) {}
771
772RTCRemoteInboundRtpStreamStats::~RTCRemoteInboundRtpStreamStats() {}
773
774// clang-format off
Henrik Boström646fda02019-05-22 15:49:42 +0200775WEBRTC_RTCSTATS_IMPL(RTCMediaSourceStats, RTCStats, "parent-media-source",
776 &track_identifier,
777 &kind)
778// clang-format on
779
780RTCMediaSourceStats::RTCMediaSourceStats(const std::string& id,
781 int64_t timestamp_us)
782 : RTCMediaSourceStats(std::string(id), timestamp_us) {}
783
784RTCMediaSourceStats::RTCMediaSourceStats(std::string&& id, int64_t timestamp_us)
785 : RTCStats(std::move(id), timestamp_us),
786 track_identifier("trackIdentifier"),
787 kind("kind") {}
788
789RTCMediaSourceStats::RTCMediaSourceStats(const RTCMediaSourceStats& other)
790 : RTCStats(other.id(), other.timestamp_us()),
791 track_identifier(other.track_identifier),
792 kind(other.kind) {}
793
794RTCMediaSourceStats::~RTCMediaSourceStats() {}
795
796// clang-format off
797WEBRTC_RTCSTATS_IMPL_NO_MEMBERS(
798 RTCAudioSourceStats, RTCMediaSourceStats, "media-source")
799// clang-format on
800
801RTCAudioSourceStats::RTCAudioSourceStats(const std::string& id,
802 int64_t timestamp_us)
803 : RTCAudioSourceStats(std::string(id), timestamp_us) {}
804
805RTCAudioSourceStats::RTCAudioSourceStats(std::string&& id, int64_t timestamp_us)
806 : RTCMediaSourceStats(std::move(id), timestamp_us) {}
807
808RTCAudioSourceStats::RTCAudioSourceStats(const RTCAudioSourceStats& other)
809 : RTCMediaSourceStats(other) {}
810
811RTCAudioSourceStats::~RTCAudioSourceStats() {}
812
813// clang-format off
814WEBRTC_RTCSTATS_IMPL(RTCVideoSourceStats, RTCMediaSourceStats, "media-source",
815 &width,
816 &height,
817 &frames,
818 &frames_per_second)
819// clang-format on
820
821RTCVideoSourceStats::RTCVideoSourceStats(const std::string& id,
822 int64_t timestamp_us)
823 : RTCVideoSourceStats(std::string(id), timestamp_us) {}
824
825RTCVideoSourceStats::RTCVideoSourceStats(std::string&& id, int64_t timestamp_us)
826 : RTCMediaSourceStats(std::move(id), timestamp_us),
827 width("width"),
828 height("height"),
829 frames("frames"),
830 frames_per_second("framesPerSecond") {}
831
832RTCVideoSourceStats::RTCVideoSourceStats(const RTCVideoSourceStats& other)
833 : RTCMediaSourceStats(other),
834 width(other.width),
835 height(other.height),
836 frames(other.frames),
837 frames_per_second(other.frames_per_second) {}
838
839RTCVideoSourceStats::~RTCVideoSourceStats() {}
840
841// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700842WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
843 &bytes_sent,
844 &bytes_received,
845 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800846 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700847 &selected_candidate_pair_id,
848 &local_certificate_id,
Nico Weber22f99252019-02-20 10:13:16 -0500849 &remote_certificate_id)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700850// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700851
Yves Gerey665174f2018-06-19 15:03:05 +0200852RTCTransportStats::RTCTransportStats(const std::string& id,
853 int64_t timestamp_us)
854 : RTCTransportStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700855
Yves Gerey665174f2018-06-19 15:03:05 +0200856RTCTransportStats::RTCTransportStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700857 : RTCStats(std::move(id), timestamp_us),
858 bytes_sent("bytesSent"),
859 bytes_received("bytesReceived"),
860 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800861 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700862 selected_candidate_pair_id("selectedCandidatePairId"),
863 local_certificate_id("localCertificateId"),
Yves Gerey665174f2018-06-19 15:03:05 +0200864 remote_certificate_id("remoteCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -0700865
Yves Gerey665174f2018-06-19 15:03:05 +0200866RTCTransportStats::RTCTransportStats(const RTCTransportStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700867 : RTCStats(other.id(), other.timestamp_us()),
868 bytes_sent(other.bytes_sent),
869 bytes_received(other.bytes_received),
870 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800871 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700872 selected_candidate_pair_id(other.selected_candidate_pair_id),
873 local_certificate_id(other.local_certificate_id),
Yves Gerey665174f2018-06-19 15:03:05 +0200874 remote_certificate_id(other.remote_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -0700875
Yves Gerey665174f2018-06-19 15:03:05 +0200876RTCTransportStats::~RTCTransportStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700877
hbosd565b732016-08-30 14:04:35 -0700878} // namespace webrtc