blob: 949e74c4a5729c2423106c5b0d0418007808d9d7 [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,
Rasmus Brandt2efae772019-06-27 14:29:34 +0200617 &key_frames_decoded,
Johannes Kronbfd343b2019-07-01 10:07:50 +0200618 &total_decode_time,
Henrik Boström2e069262019-04-09 13:59:31 +0200619 &content_type)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700620// clang-format on
hboseeafe942016-11-01 03:00:17 -0700621
Yves Gerey665174f2018-06-19 15:03:05 +0200622RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id,
623 int64_t timestamp_us)
624 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {}
hboseeafe942016-11-01 03:00:17 -0700625
Yves Gerey665174f2018-06-19 15:03:05 +0200626RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
627 int64_t timestamp_us)
hboseeafe942016-11-01 03:00:17 -0700628 : RTCRTPStreamStats(std::move(id), timestamp_us),
629 packets_received("packetsReceived"),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200630 fec_packets_received("fecPacketsReceived"),
631 fec_packets_discarded("fecPacketsDiscarded"),
hboseeafe942016-11-01 03:00:17 -0700632 bytes_received("bytesReceived"),
633 packets_lost("packetsLost"),
Henrik Boström01738c62019-04-15 17:32:00 +0200634 last_packet_received_timestamp("lastPacketReceivedTimestamp"),
hboseeafe942016-11-01 03:00:17 -0700635 jitter("jitter"),
hbosa7a9be12017-03-01 01:02:45 -0800636 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700637 packets_discarded("packetsDiscarded"),
638 packets_repaired("packetsRepaired"),
639 burst_packets_lost("burstPacketsLost"),
640 burst_packets_discarded("burstPacketsDiscarded"),
641 burst_loss_count("burstLossCount"),
642 burst_discard_count("burstDiscardCount"),
643 burst_loss_rate("burstLossRate"),
644 burst_discard_rate("burstDiscardRate"),
645 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800646 gap_discard_rate("gapDiscardRate"),
Henrik Boström2e069262019-04-09 13:59:31 +0200647 frames_decoded("framesDecoded"),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200648 key_frames_decoded("keyFramesDecoded"),
Johannes Kronbfd343b2019-07-01 10:07:50 +0200649 total_decode_time("totalDecodeTime"),
Henrik Boström2e069262019-04-09 13:59:31 +0200650 content_type("contentType") {}
hboseeafe942016-11-01 03:00:17 -0700651
652RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
653 const RTCInboundRTPStreamStats& other)
654 : RTCRTPStreamStats(other),
655 packets_received(other.packets_received),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200656 fec_packets_received(other.fec_packets_received),
657 fec_packets_discarded(other.fec_packets_discarded),
hboseeafe942016-11-01 03:00:17 -0700658 bytes_received(other.bytes_received),
659 packets_lost(other.packets_lost),
Henrik Boström01738c62019-04-15 17:32:00 +0200660 last_packet_received_timestamp(other.last_packet_received_timestamp),
hboseeafe942016-11-01 03:00:17 -0700661 jitter(other.jitter),
hbosa7a9be12017-03-01 01:02:45 -0800662 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700663 packets_discarded(other.packets_discarded),
664 packets_repaired(other.packets_repaired),
665 burst_packets_lost(other.burst_packets_lost),
666 burst_packets_discarded(other.burst_packets_discarded),
667 burst_loss_count(other.burst_loss_count),
668 burst_discard_count(other.burst_discard_count),
669 burst_loss_rate(other.burst_loss_rate),
670 burst_discard_rate(other.burst_discard_rate),
671 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800672 gap_discard_rate(other.gap_discard_rate),
Henrik Boström2e069262019-04-09 13:59:31 +0200673 frames_decoded(other.frames_decoded),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200674 key_frames_decoded(other.key_frames_decoded),
Johannes Kronbfd343b2019-07-01 10:07:50 +0200675 total_decode_time(other.total_decode_time),
Henrik Boström2e069262019-04-09 13:59:31 +0200676 content_type(other.content_type) {}
hboseeafe942016-11-01 03:00:17 -0700677
Yves Gerey665174f2018-06-19 15:03:05 +0200678RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {}
hboseeafe942016-11-01 03:00:17 -0700679
Steve Antond6a5cbd2017-08-18 09:40:25 -0700680// clang-format off
hboseeafe942016-11-01 03:00:17 -0700681WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700682 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
Henrik Boström646fda02019-05-22 15:49:42 +0200683 &media_source_id,
hbos6ded1902016-11-01 01:50:46 -0700684 &packets_sent,
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200685 &retransmitted_packets_sent,
hbos6ded1902016-11-01 01:50:46 -0700686 &bytes_sent,
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200687 &retransmitted_bytes_sent,
hbos6ded1902016-11-01 01:50:46 -0700688 &target_bitrate,
Henrik Boströmf71362f2019-04-08 16:14:23 +0200689 &frames_encoded,
Rasmus Brandt2efae772019-06-27 14:29:34 +0200690 &key_frames_encoded,
Henrik Boström2e069262019-04-09 13:59:31 +0200691 &total_encode_time,
Henrik Boström23aff9b2019-05-20 15:15:38 +0200692 &total_encoded_bytes_target,
Henrik Boström9fe18342019-05-16 18:38:20 +0200693 &total_packet_send_delay,
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200694 &quality_limitation_reason,
Henrik Boström2e069262019-04-09 13:59:31 +0200695 &content_type)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700696// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700697
Yves Gerey665174f2018-06-19 15:03:05 +0200698RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(const std::string& id,
699 int64_t timestamp_us)
700 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700701
Yves Gerey665174f2018-06-19 15:03:05 +0200702RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id,
703 int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700704 : RTCRTPStreamStats(std::move(id), timestamp_us),
Henrik Boström646fda02019-05-22 15:49:42 +0200705 media_source_id("mediaSourceId"),
hbos6ded1902016-11-01 01:50:46 -0700706 packets_sent("packetsSent"),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200707 retransmitted_packets_sent("retransmittedPacketsSent"),
hbos6ded1902016-11-01 01:50:46 -0700708 bytes_sent("bytesSent"),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200709 retransmitted_bytes_sent("retransmittedBytesSent"),
hbos6ded1902016-11-01 01:50:46 -0700710 target_bitrate("targetBitrate"),
Henrik Boströmf71362f2019-04-08 16:14:23 +0200711 frames_encoded("framesEncoded"),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200712 key_frames_encoded("keyFramesEncoded"),
Henrik Boström2e069262019-04-09 13:59:31 +0200713 total_encode_time("totalEncodeTime"),
Henrik Boström23aff9b2019-05-20 15:15:38 +0200714 total_encoded_bytes_target("totalEncodedBytesTarget"),
Henrik Boström9fe18342019-05-16 18:38:20 +0200715 total_packet_send_delay("totalPacketSendDelay"),
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200716 quality_limitation_reason("qualityLimitationReason"),
Henrik Boström2e069262019-04-09 13:59:31 +0200717 content_type("contentType") {}
hbos6ded1902016-11-01 01:50:46 -0700718
719RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
720 const RTCOutboundRTPStreamStats& other)
721 : RTCRTPStreamStats(other),
Henrik Boström646fda02019-05-22 15:49:42 +0200722 media_source_id(other.media_source_id),
hbos6ded1902016-11-01 01:50:46 -0700723 packets_sent(other.packets_sent),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200724 retransmitted_packets_sent(other.retransmitted_packets_sent),
hbos6ded1902016-11-01 01:50:46 -0700725 bytes_sent(other.bytes_sent),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200726 retransmitted_bytes_sent(other.retransmitted_bytes_sent),
hbos6ded1902016-11-01 01:50:46 -0700727 target_bitrate(other.target_bitrate),
Henrik Boströmf71362f2019-04-08 16:14:23 +0200728 frames_encoded(other.frames_encoded),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200729 key_frames_encoded(other.key_frames_encoded),
Henrik Boström2e069262019-04-09 13:59:31 +0200730 total_encode_time(other.total_encode_time),
Henrik Boström23aff9b2019-05-20 15:15:38 +0200731 total_encoded_bytes_target(other.total_encoded_bytes_target),
Henrik Boström9fe18342019-05-16 18:38:20 +0200732 total_packet_send_delay(other.total_packet_send_delay),
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200733 quality_limitation_reason(other.quality_limitation_reason),
Henrik Boström2e069262019-04-09 13:59:31 +0200734 content_type(other.content_type) {}
hbos6ded1902016-11-01 01:50:46 -0700735
Yves Gerey665174f2018-06-19 15:03:05 +0200736RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700737
Steve Antond6a5cbd2017-08-18 09:40:25 -0700738// clang-format off
Henrik Boström883eefc2019-05-27 13:40:25 +0200739WEBRTC_RTCSTATS_IMPL(
740 RTCRemoteInboundRtpStreamStats, RTCStats, "remote-inbound-rtp",
741 &ssrc,
742 &kind,
743 &transport_id,
744 &codec_id,
745 &packets_lost,
746 &jitter,
747 &local_id,
748 &round_trip_time)
749// clang-format on
750
751RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
752 const std::string& id,
753 int64_t timestamp_us)
754 : RTCRemoteInboundRtpStreamStats(std::string(id), timestamp_us) {}
755
756RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
757 std::string&& id,
758 int64_t timestamp_us)
759 : RTCStats(std::move(id), timestamp_us),
760 ssrc("ssrc"),
761 kind("kind"),
762 transport_id("transportId"),
763 codec_id("codecId"),
764 packets_lost("packetsLost"),
765 jitter("jitter"),
766 local_id("localId"),
767 round_trip_time("roundTripTime") {}
768
769RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
770 const RTCRemoteInboundRtpStreamStats& other)
771 : RTCStats(other),
772 ssrc(other.ssrc),
773 kind(other.kind),
774 transport_id(other.transport_id),
775 codec_id(other.codec_id),
776 packets_lost(other.packets_lost),
777 jitter(other.jitter),
778 local_id(other.local_id),
779 round_trip_time(other.round_trip_time) {}
780
781RTCRemoteInboundRtpStreamStats::~RTCRemoteInboundRtpStreamStats() {}
782
783// clang-format off
Henrik Boström646fda02019-05-22 15:49:42 +0200784WEBRTC_RTCSTATS_IMPL(RTCMediaSourceStats, RTCStats, "parent-media-source",
785 &track_identifier,
786 &kind)
787// clang-format on
788
789RTCMediaSourceStats::RTCMediaSourceStats(const std::string& id,
790 int64_t timestamp_us)
791 : RTCMediaSourceStats(std::string(id), timestamp_us) {}
792
793RTCMediaSourceStats::RTCMediaSourceStats(std::string&& id, int64_t timestamp_us)
794 : RTCStats(std::move(id), timestamp_us),
795 track_identifier("trackIdentifier"),
796 kind("kind") {}
797
798RTCMediaSourceStats::RTCMediaSourceStats(const RTCMediaSourceStats& other)
799 : RTCStats(other.id(), other.timestamp_us()),
800 track_identifier(other.track_identifier),
801 kind(other.kind) {}
802
803RTCMediaSourceStats::~RTCMediaSourceStats() {}
804
805// clang-format off
806WEBRTC_RTCSTATS_IMPL_NO_MEMBERS(
807 RTCAudioSourceStats, RTCMediaSourceStats, "media-source")
808// clang-format on
809
810RTCAudioSourceStats::RTCAudioSourceStats(const std::string& id,
811 int64_t timestamp_us)
812 : RTCAudioSourceStats(std::string(id), timestamp_us) {}
813
814RTCAudioSourceStats::RTCAudioSourceStats(std::string&& id, int64_t timestamp_us)
815 : RTCMediaSourceStats(std::move(id), timestamp_us) {}
816
817RTCAudioSourceStats::RTCAudioSourceStats(const RTCAudioSourceStats& other)
818 : RTCMediaSourceStats(other) {}
819
820RTCAudioSourceStats::~RTCAudioSourceStats() {}
821
822// clang-format off
823WEBRTC_RTCSTATS_IMPL(RTCVideoSourceStats, RTCMediaSourceStats, "media-source",
824 &width,
825 &height,
826 &frames,
827 &frames_per_second)
828// clang-format on
829
830RTCVideoSourceStats::RTCVideoSourceStats(const std::string& id,
831 int64_t timestamp_us)
832 : RTCVideoSourceStats(std::string(id), timestamp_us) {}
833
834RTCVideoSourceStats::RTCVideoSourceStats(std::string&& id, int64_t timestamp_us)
835 : RTCMediaSourceStats(std::move(id), timestamp_us),
836 width("width"),
837 height("height"),
838 frames("frames"),
839 frames_per_second("framesPerSecond") {}
840
841RTCVideoSourceStats::RTCVideoSourceStats(const RTCVideoSourceStats& other)
842 : RTCMediaSourceStats(other),
843 width(other.width),
844 height(other.height),
845 frames(other.frames),
846 frames_per_second(other.frames_per_second) {}
847
848RTCVideoSourceStats::~RTCVideoSourceStats() {}
849
850// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700851WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
852 &bytes_sent,
853 &bytes_received,
854 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800855 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700856 &selected_candidate_pair_id,
857 &local_certificate_id,
Nico Weber22f99252019-02-20 10:13:16 -0500858 &remote_certificate_id)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700859// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700860
Yves Gerey665174f2018-06-19 15:03:05 +0200861RTCTransportStats::RTCTransportStats(const std::string& id,
862 int64_t timestamp_us)
863 : RTCTransportStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700864
Yves Gerey665174f2018-06-19 15:03:05 +0200865RTCTransportStats::RTCTransportStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700866 : RTCStats(std::move(id), timestamp_us),
867 bytes_sent("bytesSent"),
868 bytes_received("bytesReceived"),
869 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800870 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700871 selected_candidate_pair_id("selectedCandidatePairId"),
872 local_certificate_id("localCertificateId"),
Yves Gerey665174f2018-06-19 15:03:05 +0200873 remote_certificate_id("remoteCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -0700874
Yves Gerey665174f2018-06-19 15:03:05 +0200875RTCTransportStats::RTCTransportStats(const RTCTransportStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700876 : RTCStats(other.id(), other.timestamp_us()),
877 bytes_sent(other.bytes_sent),
878 bytes_received(other.bytes_received),
879 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800880 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700881 selected_candidate_pair_id(other.selected_candidate_pair_id),
882 local_certificate_id(other.local_certificate_id),
Yves Gerey665174f2018-06-19 15:03:05 +0200883 remote_certificate_id(other.remote_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -0700884
Yves Gerey665174f2018-06-19 15:03:05 +0200885RTCTransportStats::~RTCTransportStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700886
hbosd565b732016-08-30 14:04:35 -0700887} // namespace webrtc