blob: 8a89d76d6fa4ee8c0850c8a92f1ad727dacb0d89 [file] [log] [blame]
hbosd565b732016-08-30 14:04:35 -07001/*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "api/stats/rtcstats_objects.h"
hbosd565b732016-08-30 14:04:35 -070012
Yves Gerey3e707812018-11-28 16:47:49 +010013#include <utility>
14
Jakob Ivarsson758d9462019-03-19 15:38:49 +010015#include "api/stats/rtc_stats.h"
Jonas Olssona4d87372019-07-05 19:08:33 +020016#include "rtc_base/checks.h"
Jakob Ivarsson758d9462019-03-19 15:38:49 +010017
hbosd565b732016-08-30 14:04:35 -070018namespace webrtc {
19
agrieve26622d32017-08-08 10:48:15 -070020const char* const RTCDataChannelState::kConnecting = "connecting";
21const char* const RTCDataChannelState::kOpen = "open";
22const char* const RTCDataChannelState::kClosing = "closing";
23const char* const RTCDataChannelState::kClosed = "closed";
hboscc555c52016-10-18 12:48:31 -070024
agrieve26622d32017-08-08 10:48:15 -070025const char* const RTCStatsIceCandidatePairState::kFrozen = "frozen";
26const char* const RTCStatsIceCandidatePairState::kWaiting = "waiting";
27const char* const RTCStatsIceCandidatePairState::kInProgress = "in-progress";
28const char* const RTCStatsIceCandidatePairState::kFailed = "failed";
29const char* const RTCStatsIceCandidatePairState::kSucceeded = "succeeded";
hbosc47a0c32016-10-11 14:54:49 -070030
31// Strings defined in https://tools.ietf.org/html/rfc5245.
agrieve26622d32017-08-08 10:48:15 -070032const char* const RTCIceCandidateType::kHost = "host";
33const char* const RTCIceCandidateType::kSrflx = "srflx";
34const char* const RTCIceCandidateType::kPrflx = "prflx";
35const char* const RTCIceCandidateType::kRelay = "relay";
hbosab9f6e42016-10-07 02:18:47 -070036
agrieve26622d32017-08-08 10:48:15 -070037const char* const RTCDtlsTransportState::kNew = "new";
38const char* const RTCDtlsTransportState::kConnecting = "connecting";
39const char* const RTCDtlsTransportState::kConnected = "connected";
40const char* const RTCDtlsTransportState::kClosed = "closed";
41const char* const RTCDtlsTransportState::kFailed = "failed";
hbos7064d592017-01-16 07:38:02 -080042
agrieve26622d32017-08-08 10:48:15 -070043const char* const RTCMediaStreamTrackKind::kAudio = "audio";
44const char* const RTCMediaStreamTrackKind::kVideo = "video";
hbos160e4a72017-01-17 02:53:23 -080045
Gary Liu37e489c2017-11-21 10:49:36 -080046// https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype
47const char* const RTCNetworkType::kBluetooth = "bluetooth";
48const char* const RTCNetworkType::kCellular = "cellular";
49const char* const RTCNetworkType::kEthernet = "ethernet";
50const char* const RTCNetworkType::kWifi = "wifi";
51const char* const RTCNetworkType::kWimax = "wimax";
52const char* const RTCNetworkType::kVpn = "vpn";
53const char* const RTCNetworkType::kUnknown = "unknown";
54
Henrik Boströmce33b6a2019-05-28 17:42:38 +020055// https://w3c.github.io/webrtc-stats/#dom-rtcqualitylimitationreason
56const char* const RTCQualityLimitationReason::kNone = "none";
57const char* const RTCQualityLimitationReason::kCpu = "cpu";
58const char* const RTCQualityLimitationReason::kBandwidth = "bandwidth";
59const char* const RTCQualityLimitationReason::kOther = "other";
60
Henrik Boström2e069262019-04-09 13:59:31 +020061// https://webrtc.org/experiments/rtp-hdrext/video-content-type/
62const char* const RTCContentType::kUnspecified = "unspecified";
63const char* const RTCContentType::kScreenshare = "screenshare";
64
Steve Antond6a5cbd2017-08-18 09:40:25 -070065// clang-format off
hbos2fa7c672016-10-24 04:00:05 -070066WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
67 &fingerprint,
68 &fingerprint_algorithm,
69 &base64_certificate,
Nico Weber22f99252019-02-20 10:13:16 -050070 &issuer_certificate_id)
Steve Antond6a5cbd2017-08-18 09:40:25 -070071// clang-format on
hbos2fa7c672016-10-24 04:00:05 -070072
Yves Gerey665174f2018-06-19 15:03:05 +020073RTCCertificateStats::RTCCertificateStats(const std::string& id,
74 int64_t timestamp_us)
75 : RTCCertificateStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -070076
Yves Gerey665174f2018-06-19 15:03:05 +020077RTCCertificateStats::RTCCertificateStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -070078 : RTCStats(std::move(id), timestamp_us),
79 fingerprint("fingerprint"),
80 fingerprint_algorithm("fingerprintAlgorithm"),
81 base64_certificate("base64Certificate"),
Yves Gerey665174f2018-06-19 15:03:05 +020082 issuer_certificate_id("issuerCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -070083
Yves Gerey665174f2018-06-19 15:03:05 +020084RTCCertificateStats::RTCCertificateStats(const RTCCertificateStats& other)
hbos2fa7c672016-10-24 04:00:05 -070085 : RTCStats(other.id(), other.timestamp_us()),
86 fingerprint(other.fingerprint),
87 fingerprint_algorithm(other.fingerprint_algorithm),
88 base64_certificate(other.base64_certificate),
Yves Gerey665174f2018-06-19 15:03:05 +020089 issuer_certificate_id(other.issuer_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -070090
Yves Gerey665174f2018-06-19 15:03:05 +020091RTCCertificateStats::~RTCCertificateStats() {}
hbos2fa7c672016-10-24 04:00:05 -070092
Steve Antond6a5cbd2017-08-18 09:40:25 -070093// clang-format off
hbos0adb8282016-11-23 02:32:06 -080094WEBRTC_RTCSTATS_IMPL(RTCCodecStats, RTCStats, "codec",
95 &payload_type,
hbos13f54b22017-02-28 06:56:04 -080096 &mime_type,
hbos0adb8282016-11-23 02:32:06 -080097 &clock_rate,
98 &channels,
hbos13f54b22017-02-28 06:56:04 -080099 &sdp_fmtp_line,
Nico Weber22f99252019-02-20 10:13:16 -0500100 &implementation)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700101// clang-format on
hbos0adb8282016-11-23 02:32:06 -0800102
Yves Gerey665174f2018-06-19 15:03:05 +0200103RTCCodecStats::RTCCodecStats(const std::string& id, int64_t timestamp_us)
104 : RTCCodecStats(std::string(id), timestamp_us) {}
hbos0adb8282016-11-23 02:32:06 -0800105
Yves Gerey665174f2018-06-19 15:03:05 +0200106RTCCodecStats::RTCCodecStats(std::string&& id, int64_t timestamp_us)
hbos0adb8282016-11-23 02:32:06 -0800107 : RTCStats(std::move(id), timestamp_us),
108 payload_type("payloadType"),
hbos13f54b22017-02-28 06:56:04 -0800109 mime_type("mimeType"),
hbos0adb8282016-11-23 02:32:06 -0800110 clock_rate("clockRate"),
111 channels("channels"),
hbos13f54b22017-02-28 06:56:04 -0800112 sdp_fmtp_line("sdpFmtpLine"),
Yves Gerey665174f2018-06-19 15:03:05 +0200113 implementation("implementation") {}
hbos0adb8282016-11-23 02:32:06 -0800114
Yves Gerey665174f2018-06-19 15:03:05 +0200115RTCCodecStats::RTCCodecStats(const RTCCodecStats& other)
hbos0adb8282016-11-23 02:32:06 -0800116 : RTCStats(other.id(), other.timestamp_us()),
117 payload_type(other.payload_type),
hbos13f54b22017-02-28 06:56:04 -0800118 mime_type(other.mime_type),
hbos0adb8282016-11-23 02:32:06 -0800119 clock_rate(other.clock_rate),
120 channels(other.channels),
hbos13f54b22017-02-28 06:56:04 -0800121 sdp_fmtp_line(other.sdp_fmtp_line),
Yves Gerey665174f2018-06-19 15:03:05 +0200122 implementation(other.implementation) {}
hbos0adb8282016-11-23 02:32:06 -0800123
Yves Gerey665174f2018-06-19 15:03:05 +0200124RTCCodecStats::~RTCCodecStats() {}
hbos0adb8282016-11-23 02:32:06 -0800125
Steve Antond6a5cbd2017-08-18 09:40:25 -0700126// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700127WEBRTC_RTCSTATS_IMPL(RTCDataChannelStats, RTCStats, "data-channel",
128 &label,
129 &protocol,
130 &datachannelid,
131 &state,
132 &messages_sent,
133 &bytes_sent,
134 &messages_received,
Nico Weber22f99252019-02-20 10:13:16 -0500135 &bytes_received)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700136// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700137
Yves Gerey665174f2018-06-19 15:03:05 +0200138RTCDataChannelStats::RTCDataChannelStats(const std::string& id,
139 int64_t timestamp_us)
140 : RTCDataChannelStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700141
Yves Gerey665174f2018-06-19 15:03:05 +0200142RTCDataChannelStats::RTCDataChannelStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700143 : RTCStats(std::move(id), timestamp_us),
144 label("label"),
145 protocol("protocol"),
146 datachannelid("datachannelid"),
147 state("state"),
148 messages_sent("messagesSent"),
149 bytes_sent("bytesSent"),
150 messages_received("messagesReceived"),
Yves Gerey665174f2018-06-19 15:03:05 +0200151 bytes_received("bytesReceived") {}
hbos2fa7c672016-10-24 04:00:05 -0700152
Yves Gerey665174f2018-06-19 15:03:05 +0200153RTCDataChannelStats::RTCDataChannelStats(const RTCDataChannelStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700154 : RTCStats(other.id(), other.timestamp_us()),
155 label(other.label),
156 protocol(other.protocol),
157 datachannelid(other.datachannelid),
158 state(other.state),
159 messages_sent(other.messages_sent),
160 bytes_sent(other.bytes_sent),
161 messages_received(other.messages_received),
Yves Gerey665174f2018-06-19 15:03:05 +0200162 bytes_received(other.bytes_received) {}
hbos2fa7c672016-10-24 04:00:05 -0700163
Yves Gerey665174f2018-06-19 15:03:05 +0200164RTCDataChannelStats::~RTCDataChannelStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700165
Steve Antond6a5cbd2017-08-18 09:40:25 -0700166// clang-format off
hbosc47a0c32016-10-11 14:54:49 -0700167WEBRTC_RTCSTATS_IMPL(RTCIceCandidatePairStats, RTCStats, "candidate-pair",
168 &transport_id,
169 &local_candidate_id,
170 &remote_candidate_id,
171 &state,
172 &priority,
173 &nominated,
174 &writable,
175 &readable,
176 &bytes_sent,
177 &bytes_received,
hbos3168c7a2016-12-15 06:17:08 -0800178 &total_round_trip_time,
179 &current_round_trip_time,
hbosc47a0c32016-10-11 14:54:49 -0700180 &available_outgoing_bitrate,
181 &available_incoming_bitrate,
182 &requests_received,
183 &requests_sent,
184 &responses_received,
185 &responses_sent,
186 &retransmissions_received,
187 &retransmissions_sent,
188 &consent_requests_received,
189 &consent_requests_sent,
190 &consent_responses_received,
Nico Weber22f99252019-02-20 10:13:16 -0500191 &consent_responses_sent)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700192// clang-format on
hbosc47a0c32016-10-11 14:54:49 -0700193
Yves Gerey665174f2018-06-19 15:03:05 +0200194RTCIceCandidatePairStats::RTCIceCandidatePairStats(const std::string& id,
195 int64_t timestamp_us)
196 : RTCIceCandidatePairStats(std::string(id), timestamp_us) {}
hbosc47a0c32016-10-11 14:54:49 -0700197
Yves Gerey665174f2018-06-19 15:03:05 +0200198RTCIceCandidatePairStats::RTCIceCandidatePairStats(std::string&& id,
199 int64_t timestamp_us)
hbosc47a0c32016-10-11 14:54:49 -0700200 : RTCStats(std::move(id), timestamp_us),
201 transport_id("transportId"),
202 local_candidate_id("localCandidateId"),
203 remote_candidate_id("remoteCandidateId"),
204 state("state"),
205 priority("priority"),
206 nominated("nominated"),
207 writable("writable"),
208 readable("readable"),
209 bytes_sent("bytesSent"),
210 bytes_received("bytesReceived"),
hbos3168c7a2016-12-15 06:17:08 -0800211 total_round_trip_time("totalRoundTripTime"),
212 current_round_trip_time("currentRoundTripTime"),
hbosc47a0c32016-10-11 14:54:49 -0700213 available_outgoing_bitrate("availableOutgoingBitrate"),
214 available_incoming_bitrate("availableIncomingBitrate"),
215 requests_received("requestsReceived"),
216 requests_sent("requestsSent"),
217 responses_received("responsesReceived"),
218 responses_sent("responsesSent"),
219 retransmissions_received("retransmissionsReceived"),
220 retransmissions_sent("retransmissionsSent"),
221 consent_requests_received("consentRequestsReceived"),
222 consent_requests_sent("consentRequestsSent"),
223 consent_responses_received("consentResponsesReceived"),
Yves Gerey665174f2018-06-19 15:03:05 +0200224 consent_responses_sent("consentResponsesSent") {}
hbosc47a0c32016-10-11 14:54:49 -0700225
226RTCIceCandidatePairStats::RTCIceCandidatePairStats(
227 const RTCIceCandidatePairStats& other)
228 : RTCStats(other.id(), other.timestamp_us()),
229 transport_id(other.transport_id),
230 local_candidate_id(other.local_candidate_id),
231 remote_candidate_id(other.remote_candidate_id),
232 state(other.state),
233 priority(other.priority),
234 nominated(other.nominated),
235 writable(other.writable),
236 readable(other.readable),
237 bytes_sent(other.bytes_sent),
238 bytes_received(other.bytes_received),
hbos3168c7a2016-12-15 06:17:08 -0800239 total_round_trip_time(other.total_round_trip_time),
240 current_round_trip_time(other.current_round_trip_time),
hbosc47a0c32016-10-11 14:54:49 -0700241 available_outgoing_bitrate(other.available_outgoing_bitrate),
242 available_incoming_bitrate(other.available_incoming_bitrate),
243 requests_received(other.requests_received),
244 requests_sent(other.requests_sent),
245 responses_received(other.responses_received),
246 responses_sent(other.responses_sent),
247 retransmissions_received(other.retransmissions_received),
248 retransmissions_sent(other.retransmissions_sent),
249 consent_requests_received(other.consent_requests_received),
250 consent_requests_sent(other.consent_requests_sent),
251 consent_responses_received(other.consent_responses_received),
Yves Gerey665174f2018-06-19 15:03:05 +0200252 consent_responses_sent(other.consent_responses_sent) {}
hbosc47a0c32016-10-11 14:54:49 -0700253
Yves Gerey665174f2018-06-19 15:03:05 +0200254RTCIceCandidatePairStats::~RTCIceCandidatePairStats() {}
hbosc47a0c32016-10-11 14:54:49 -0700255
Steve Antond6a5cbd2017-08-18 09:40:25 -0700256// clang-format off
Henrik Boström1df1bf82018-03-20 13:24:20 +0100257WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "abstract-ice-candidate",
hbosb4e426e2017-01-02 09:59:31 -0800258 &transport_id,
hbosc3a2b7f2017-01-02 04:46:15 -0800259 &is_remote,
Gary Liu37e489c2017-11-21 10:49:36 -0800260 &network_type,
hbosab9f6e42016-10-07 02:18:47 -0700261 &ip,
262 &port,
263 &protocol,
Philipp Hancke95513752018-09-27 14:40:08 +0200264 &relay_protocol,
hbosab9f6e42016-10-07 02:18:47 -0700265 &candidate_type,
266 &priority,
hbosd17a5a72017-01-02 08:09:59 -0800267 &url,
Nico Weber22f99252019-02-20 10:13:16 -0500268 &deleted)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700269// clang-format on
hbosab9f6e42016-10-07 02:18:47 -0700270
Yves Gerey665174f2018-06-19 15:03:05 +0200271RTCIceCandidateStats::RTCIceCandidateStats(const std::string& id,
272 int64_t timestamp_us,
273 bool is_remote)
274 : RTCIceCandidateStats(std::string(id), timestamp_us, is_remote) {}
hbosab9f6e42016-10-07 02:18:47 -0700275
Gary Liu37e489c2017-11-21 10:49:36 -0800276RTCIceCandidateStats::RTCIceCandidateStats(std::string&& id,
277 int64_t timestamp_us,
278 bool is_remote)
hbosab9f6e42016-10-07 02:18:47 -0700279 : RTCStats(std::move(id), timestamp_us),
hbosb4e426e2017-01-02 09:59:31 -0800280 transport_id("transportId"),
hbosc3a2b7f2017-01-02 04:46:15 -0800281 is_remote("isRemote", is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800282 network_type("networkType"),
hbosab9f6e42016-10-07 02:18:47 -0700283 ip("ip"),
284 port("port"),
285 protocol("protocol"),
Philipp Hancke95513752018-09-27 14:40:08 +0200286 relay_protocol("relayProtocol"),
hbosab9f6e42016-10-07 02:18:47 -0700287 candidate_type("candidateType"),
288 priority("priority"),
hbosd17a5a72017-01-02 08:09:59 -0800289 url("url"),
Gary Liu37e489c2017-11-21 10:49:36 -0800290 deleted("deleted", false) {}
hbosab9f6e42016-10-07 02:18:47 -0700291
292RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
293 : RTCStats(other.id(), other.timestamp_us()),
hbosb4e426e2017-01-02 09:59:31 -0800294 transport_id(other.transport_id),
hbosc3a2b7f2017-01-02 04:46:15 -0800295 is_remote(other.is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800296 network_type(other.network_type),
hbosab9f6e42016-10-07 02:18:47 -0700297 ip(other.ip),
298 port(other.port),
299 protocol(other.protocol),
Philipp Hancke95513752018-09-27 14:40:08 +0200300 relay_protocol(other.relay_protocol),
hbosab9f6e42016-10-07 02:18:47 -0700301 candidate_type(other.candidate_type),
302 priority(other.priority),
hbosd17a5a72017-01-02 08:09:59 -0800303 url(other.url),
Gary Liu37e489c2017-11-21 10:49:36 -0800304 deleted(other.deleted) {}
hbosab9f6e42016-10-07 02:18:47 -0700305
Yves Gerey665174f2018-06-19 15:03:05 +0200306RTCIceCandidateStats::~RTCIceCandidateStats() {}
hbosab9f6e42016-10-07 02:18:47 -0700307
308const char RTCLocalIceCandidateStats::kType[] = "local-candidate";
309
Yves Gerey665174f2018-06-19 15:03:05 +0200310RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(const std::string& id,
311 int64_t timestamp_us)
312 : RTCIceCandidateStats(id, timestamp_us, false) {}
hbosab9f6e42016-10-07 02:18:47 -0700313
Yves Gerey665174f2018-06-19 15:03:05 +0200314RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(std::string&& id,
315 int64_t timestamp_us)
316 : RTCIceCandidateStats(std::move(id), timestamp_us, false) {}
hbosab9f6e42016-10-07 02:18:47 -0700317
Henrik Boström1df1bf82018-03-20 13:24:20 +0100318std::unique_ptr<RTCStats> RTCLocalIceCandidateStats::copy() const {
319 return std::unique_ptr<RTCStats>(new RTCLocalIceCandidateStats(*this));
320}
321
hbosab9f6e42016-10-07 02:18:47 -0700322const char* RTCLocalIceCandidateStats::type() const {
323 return kType;
324}
325
326const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate";
327
Yves Gerey665174f2018-06-19 15:03:05 +0200328RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(const std::string& id,
329 int64_t timestamp_us)
330 : RTCIceCandidateStats(id, timestamp_us, true) {}
hbosab9f6e42016-10-07 02:18:47 -0700331
Yves Gerey665174f2018-06-19 15:03:05 +0200332RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(std::string&& id,
333 int64_t timestamp_us)
334 : RTCIceCandidateStats(std::move(id), timestamp_us, true) {}
hbosab9f6e42016-10-07 02:18:47 -0700335
Henrik Boström1df1bf82018-03-20 13:24:20 +0100336std::unique_ptr<RTCStats> RTCRemoteIceCandidateStats::copy() const {
337 return std::unique_ptr<RTCStats>(new RTCRemoteIceCandidateStats(*this));
338}
339
hbosab9f6e42016-10-07 02:18:47 -0700340const char* RTCRemoteIceCandidateStats::type() const {
341 return kType;
342}
343
Steve Antond6a5cbd2017-08-18 09:40:25 -0700344// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800345WEBRTC_RTCSTATS_IMPL(RTCMediaStreamStats, RTCStats, "stream",
346 &stream_identifier,
Nico Weber22f99252019-02-20 10:13:16 -0500347 &track_ids)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700348// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800349
Yves Gerey665174f2018-06-19 15:03:05 +0200350RTCMediaStreamStats::RTCMediaStreamStats(const std::string& id,
351 int64_t timestamp_us)
352 : RTCMediaStreamStats(std::string(id), timestamp_us) {}
hbos09bc1282016-11-08 06:29:22 -0800353
Yves Gerey665174f2018-06-19 15:03:05 +0200354RTCMediaStreamStats::RTCMediaStreamStats(std::string&& id, int64_t timestamp_us)
hbos09bc1282016-11-08 06:29:22 -0800355 : RTCStats(std::move(id), timestamp_us),
356 stream_identifier("streamIdentifier"),
Yves Gerey665174f2018-06-19 15:03:05 +0200357 track_ids("trackIds") {}
hbos09bc1282016-11-08 06:29:22 -0800358
Yves Gerey665174f2018-06-19 15:03:05 +0200359RTCMediaStreamStats::RTCMediaStreamStats(const RTCMediaStreamStats& other)
hbos09bc1282016-11-08 06:29:22 -0800360 : RTCStats(other.id(), other.timestamp_us()),
361 stream_identifier(other.stream_identifier),
Yves Gerey665174f2018-06-19 15:03:05 +0200362 track_ids(other.track_ids) {}
hbos09bc1282016-11-08 06:29:22 -0800363
Yves Gerey665174f2018-06-19 15:03:05 +0200364RTCMediaStreamStats::~RTCMediaStreamStats() {}
hbos09bc1282016-11-08 06:29:22 -0800365
Steve Antond6a5cbd2017-08-18 09:40:25 -0700366// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800367WEBRTC_RTCSTATS_IMPL(RTCMediaStreamTrackStats, RTCStats, "track",
zsteine76bd3a2017-07-14 12:17:49 -0700368 &track_identifier,
Henrik Boström646fda02019-05-22 15:49:42 +0200369 &media_source_id,
zsteine76bd3a2017-07-14 12:17:49 -0700370 &remote_source,
371 &ended,
372 &detached,
373 &kind,
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200374 &jitter_buffer_delay,
Chen Xing0acffb52019-01-15 15:46:29 +0100375 &jitter_buffer_emitted_count,
zsteine76bd3a2017-07-14 12:17:49 -0700376 &frame_width,
377 &frame_height,
378 &frames_per_second,
379 &frames_sent,
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100380 &huge_frames_sent,
zsteine76bd3a2017-07-14 12:17:49 -0700381 &frames_received,
382 &frames_decoded,
383 &frames_dropped,
384 &frames_corrupted,
385 &partial_frames_lost,
386 &full_frames_lost,
387 &audio_level,
388 &total_audio_energy,
zsteine76bd3a2017-07-14 12:17:49 -0700389 &echo_return_loss,
Steve Anton2dbc69f2017-08-24 17:15:13 -0700390 &echo_return_loss_enhancement,
391 &total_samples_received,
392 &total_samples_duration,
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200393 &concealed_samples,
Ruslan Burakov8af88962018-11-22 17:21:10 +0100394 &concealment_events,
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100395 &jitter_buffer_flushes,
Sergey Silkin02371062019-01-31 16:45:42 +0100396 &delayed_packet_outage_samples,
Jakob Ivarsson232b3fd2019-03-06 09:18:40 +0100397 &relative_packet_arrival_delay,
Henrik Lundin44125fa2019-04-29 17:00:46 +0200398 &interruption_count,
399 &total_interruption_duration,
Sergey Silkin02371062019-01-31 16:45:42 +0100400 &freeze_count,
401 &pause_count,
402 &total_freezes_duration,
403 &total_pauses_duration,
404 &total_frames_duration,
Nico Weber22f99252019-02-20 10:13:16 -0500405 &sum_squared_frame_durations)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700406// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800407
Yves Gerey665174f2018-06-19 15:03:05 +0200408RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(const std::string& id,
409 int64_t timestamp_us,
410 const char* kind)
411 : RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) {}
hbos09bc1282016-11-08 06:29:22 -0800412
zsteine76bd3a2017-07-14 12:17:49 -0700413RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(std::string&& id,
414 int64_t timestamp_us,
415 const char* kind)
hbos09bc1282016-11-08 06:29:22 -0800416 : RTCStats(std::move(id), timestamp_us),
417 track_identifier("trackIdentifier"),
Henrik Boström646fda02019-05-22 15:49:42 +0200418 media_source_id("mediaSourceId"),
hbos09bc1282016-11-08 06:29:22 -0800419 remote_source("remoteSource"),
420 ended("ended"),
421 detached("detached"),
hbos160e4a72017-01-17 02:53:23 -0800422 kind("kind", kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200423 jitter_buffer_delay("jitterBufferDelay"),
Chen Xing0acffb52019-01-15 15:46:29 +0100424 jitter_buffer_emitted_count("jitterBufferEmittedCount"),
hbos09bc1282016-11-08 06:29:22 -0800425 frame_width("frameWidth"),
426 frame_height("frameHeight"),
427 frames_per_second("framesPerSecond"),
428 frames_sent("framesSent"),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100429 huge_frames_sent("hugeFramesSent"),
hbos09bc1282016-11-08 06:29:22 -0800430 frames_received("framesReceived"),
431 frames_decoded("framesDecoded"),
432 frames_dropped("framesDropped"),
433 frames_corrupted("framesCorrupted"),
434 partial_frames_lost("partialFramesLost"),
435 full_frames_lost("fullFramesLost"),
436 audio_level("audioLevel"),
zsteine76bd3a2017-07-14 12:17:49 -0700437 total_audio_energy("totalAudioEnergy"),
hbos09bc1282016-11-08 06:29:22 -0800438 echo_return_loss("echoReturnLoss"),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700439 echo_return_loss_enhancement("echoReturnLossEnhancement"),
440 total_samples_received("totalSamplesReceived"),
441 total_samples_duration("totalSamplesDuration"),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200442 concealed_samples("concealedSamples"),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200443 silent_concealed_samples("silentConcealedSamples"),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100444 concealment_events("concealmentEvents"),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200445 inserted_samples_for_deceleration("insertedSamplesForDeceleration"),
446 removed_samples_for_acceleration("removedSamplesForAcceleration"),
Jakob Ivarsson758d9462019-03-19 15:38:49 +0100447 jitter_buffer_flushes(
448 "jitterBufferFlushes",
449 {NonStandardGroupId::kRtcAudioJitterBufferMaxPackets}),
450 delayed_packet_outage_samples(
451 "delayedPacketOutageSamples",
452 {NonStandardGroupId::kRtcAudioJitterBufferMaxPackets,
453 NonStandardGroupId::kRtcStatsRelativePacketArrivalDelay}),
454 relative_packet_arrival_delay(
455 "relativePacketArrivalDelay",
456 {NonStandardGroupId::kRtcStatsRelativePacketArrivalDelay}),
Henrik Lundin44125fa2019-04-29 17:00:46 +0200457 interruption_count("interruptionCount"),
458 total_interruption_duration("totalInterruptionDuration"),
Sergey Silkin02371062019-01-31 16:45:42 +0100459 freeze_count("freezeCount"),
460 pause_count("pauseCount"),
461 total_freezes_duration("totalFreezesDuration"),
462 total_pauses_duration("totalPausesDuration"),
463 total_frames_duration("totalFramesDuration"),
464 sum_squared_frame_durations("sumOfSquaredFramesDuration") {
hbos160e4a72017-01-17 02:53:23 -0800465 RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
466 kind == RTCMediaStreamTrackKind::kVideo);
hbos09bc1282016-11-08 06:29:22 -0800467}
468
469RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
470 const RTCMediaStreamTrackStats& other)
471 : RTCStats(other.id(), other.timestamp_us()),
472 track_identifier(other.track_identifier),
Henrik Boström646fda02019-05-22 15:49:42 +0200473 media_source_id(other.media_source_id),
hbos09bc1282016-11-08 06:29:22 -0800474 remote_source(other.remote_source),
475 ended(other.ended),
476 detached(other.detached),
hbos160e4a72017-01-17 02:53:23 -0800477 kind(other.kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200478 jitter_buffer_delay(other.jitter_buffer_delay),
Chen Xing0acffb52019-01-15 15:46:29 +0100479 jitter_buffer_emitted_count(other.jitter_buffer_emitted_count),
hbos09bc1282016-11-08 06:29:22 -0800480 frame_width(other.frame_width),
481 frame_height(other.frame_height),
482 frames_per_second(other.frames_per_second),
483 frames_sent(other.frames_sent),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100484 huge_frames_sent(other.huge_frames_sent),
hbos09bc1282016-11-08 06:29:22 -0800485 frames_received(other.frames_received),
486 frames_decoded(other.frames_decoded),
487 frames_dropped(other.frames_dropped),
488 frames_corrupted(other.frames_corrupted),
489 partial_frames_lost(other.partial_frames_lost),
490 full_frames_lost(other.full_frames_lost),
491 audio_level(other.audio_level),
zsteine76bd3a2017-07-14 12:17:49 -0700492 total_audio_energy(other.total_audio_energy),
hbos09bc1282016-11-08 06:29:22 -0800493 echo_return_loss(other.echo_return_loss),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700494 echo_return_loss_enhancement(other.echo_return_loss_enhancement),
495 total_samples_received(other.total_samples_received),
496 total_samples_duration(other.total_samples_duration),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200497 concealed_samples(other.concealed_samples),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200498 silent_concealed_samples(other.silent_concealed_samples),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100499 concealment_events(other.concealment_events),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200500 inserted_samples_for_deceleration(
501 other.inserted_samples_for_deceleration),
502 removed_samples_for_acceleration(other.removed_samples_for_acceleration),
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100503 jitter_buffer_flushes(other.jitter_buffer_flushes),
Sergey Silkin02371062019-01-31 16:45:42 +0100504 delayed_packet_outage_samples(other.delayed_packet_outage_samples),
Jakob Ivarsson232b3fd2019-03-06 09:18:40 +0100505 relative_packet_arrival_delay(other.relative_packet_arrival_delay),
Henrik Lundin44125fa2019-04-29 17:00:46 +0200506 interruption_count(other.interruption_count),
507 total_interruption_duration(other.total_interruption_duration),
Sergey Silkin02371062019-01-31 16:45:42 +0100508 freeze_count(other.freeze_count),
509 pause_count(other.pause_count),
510 total_freezes_duration(other.total_freezes_duration),
511 total_pauses_duration(other.total_pauses_duration),
512 total_frames_duration(other.total_frames_duration),
513 sum_squared_frame_durations(other.sum_squared_frame_durations) {}
hbos09bc1282016-11-08 06:29:22 -0800514
Yves Gerey665174f2018-06-19 15:03:05 +0200515RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {}
hbos09bc1282016-11-08 06:29:22 -0800516
Steve Antond6a5cbd2017-08-18 09:40:25 -0700517// clang-format off
hbosfc5e0502016-10-06 02:06:10 -0700518WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
519 &data_channels_opened,
Nico Weber22f99252019-02-20 10:13:16 -0500520 &data_channels_closed)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700521// clang-format on
hbosd565b732016-08-30 14:04:35 -0700522
Yves Gerey665174f2018-06-19 15:03:05 +0200523RTCPeerConnectionStats::RTCPeerConnectionStats(const std::string& id,
524 int64_t timestamp_us)
525 : RTCPeerConnectionStats(std::string(id), timestamp_us) {}
hbosd565b732016-08-30 14:04:35 -0700526
Yves Gerey665174f2018-06-19 15:03:05 +0200527RTCPeerConnectionStats::RTCPeerConnectionStats(std::string&& id,
528 int64_t timestamp_us)
hbos0e6758d2016-08-31 07:57:36 -0700529 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700530 data_channels_opened("dataChannelsOpened"),
Yves Gerey665174f2018-06-19 15:03:05 +0200531 data_channels_closed("dataChannelsClosed") {}
hbosd565b732016-08-30 14:04:35 -0700532
hbosfc5e0502016-10-06 02:06:10 -0700533RTCPeerConnectionStats::RTCPeerConnectionStats(
534 const RTCPeerConnectionStats& other)
535 : RTCStats(other.id(), other.timestamp_us()),
536 data_channels_opened(other.data_channels_opened),
Yves Gerey665174f2018-06-19 15:03:05 +0200537 data_channels_closed(other.data_channels_closed) {}
hbosfc5e0502016-10-06 02:06:10 -0700538
Yves Gerey665174f2018-06-19 15:03:05 +0200539RTCPeerConnectionStats::~RTCPeerConnectionStats() {}
hbosfc5e0502016-10-06 02:06:10 -0700540
Steve Antond6a5cbd2017-08-18 09:40:25 -0700541// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700542WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
543 &ssrc,
544 &associate_stats_id,
545 &is_remote,
546 &media_type,
Philipp Hancke3bc01662018-08-28 14:55:03 +0200547 &kind,
hbosb0ae9202017-01-27 06:35:16 -0800548 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700549 &transport_id,
550 &codec_id,
551 &fir_count,
552 &pli_count,
553 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800554 &sli_count,
Nico Weber22f99252019-02-20 10:13:16 -0500555 &qp_sum)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700556// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700557
Yves Gerey665174f2018-06-19 15:03:05 +0200558RTCRTPStreamStats::RTCRTPStreamStats(const std::string& id,
559 int64_t timestamp_us)
560 : RTCRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700561
Yves Gerey665174f2018-06-19 15:03:05 +0200562RTCRTPStreamStats::RTCRTPStreamStats(std::string&& id, int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700563 : RTCStats(std::move(id), timestamp_us),
564 ssrc("ssrc"),
565 associate_stats_id("associateStatsId"),
566 is_remote("isRemote", false),
567 media_type("mediaType"),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200568 kind("kind"),
hbosb0ae9202017-01-27 06:35:16 -0800569 track_id("trackId"),
hbos6ded1902016-11-01 01:50:46 -0700570 transport_id("transportId"),
571 codec_id("codecId"),
572 fir_count("firCount"),
573 pli_count("pliCount"),
574 nack_count("nackCount"),
hbos6769c492017-01-02 08:35:13 -0800575 sli_count("sliCount"),
Yves Gerey665174f2018-06-19 15:03:05 +0200576 qp_sum("qpSum") {}
hbos6ded1902016-11-01 01:50:46 -0700577
Yves Gerey665174f2018-06-19 15:03:05 +0200578RTCRTPStreamStats::RTCRTPStreamStats(const RTCRTPStreamStats& other)
hbos6ded1902016-11-01 01:50:46 -0700579 : RTCStats(other.id(), other.timestamp_us()),
580 ssrc(other.ssrc),
581 associate_stats_id(other.associate_stats_id),
582 is_remote(other.is_remote),
583 media_type(other.media_type),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200584 kind(other.kind),
hbosb0ae9202017-01-27 06:35:16 -0800585 track_id(other.track_id),
hbos6ded1902016-11-01 01:50:46 -0700586 transport_id(other.transport_id),
587 codec_id(other.codec_id),
588 fir_count(other.fir_count),
589 pli_count(other.pli_count),
590 nack_count(other.nack_count),
hbos6769c492017-01-02 08:35:13 -0800591 sli_count(other.sli_count),
Yves Gerey665174f2018-06-19 15:03:05 +0200592 qp_sum(other.qp_sum) {}
hbos6ded1902016-11-01 01:50:46 -0700593
Yves Gerey665174f2018-06-19 15:03:05 +0200594RTCRTPStreamStats::~RTCRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700595
Steve Antond6a5cbd2017-08-18 09:40:25 -0700596// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700597WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700598 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
599 &packets_received,
600 &bytes_received,
601 &packets_lost,
Henrik Boström01738c62019-04-15 17:32:00 +0200602 &last_packet_received_timestamp,
hboseeafe942016-11-01 03:00:17 -0700603 &jitter,
hbosa7a9be12017-03-01 01:02:45 -0800604 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700605 &packets_discarded,
606 &packets_repaired,
607 &burst_packets_lost,
608 &burst_packets_discarded,
609 &burst_loss_count,
610 &burst_discard_count,
611 &burst_loss_rate,
612 &burst_discard_rate,
613 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800614 &gap_discard_rate,
Henrik Boström2e069262019-04-09 13:59:31 +0200615 &frames_decoded,
Rasmus Brandt2efae772019-06-27 14:29:34 +0200616 &key_frames_decoded,
Johannes Kronbfd343b2019-07-01 10:07:50 +0200617 &total_decode_time,
Henrik Boström2e069262019-04-09 13:59:31 +0200618 &content_type)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700619// clang-format on
hboseeafe942016-11-01 03:00:17 -0700620
Yves Gerey665174f2018-06-19 15:03:05 +0200621RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id,
622 int64_t timestamp_us)
623 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {}
hboseeafe942016-11-01 03:00:17 -0700624
Yves Gerey665174f2018-06-19 15:03:05 +0200625RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
626 int64_t timestamp_us)
hboseeafe942016-11-01 03:00:17 -0700627 : RTCRTPStreamStats(std::move(id), timestamp_us),
628 packets_received("packetsReceived"),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200629 fec_packets_received("fecPacketsReceived"),
630 fec_packets_discarded("fecPacketsDiscarded"),
hboseeafe942016-11-01 03:00:17 -0700631 bytes_received("bytesReceived"),
632 packets_lost("packetsLost"),
Henrik Boström01738c62019-04-15 17:32:00 +0200633 last_packet_received_timestamp("lastPacketReceivedTimestamp"),
hboseeafe942016-11-01 03:00:17 -0700634 jitter("jitter"),
hbosa7a9be12017-03-01 01:02:45 -0800635 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700636 packets_discarded("packetsDiscarded"),
637 packets_repaired("packetsRepaired"),
638 burst_packets_lost("burstPacketsLost"),
639 burst_packets_discarded("burstPacketsDiscarded"),
640 burst_loss_count("burstLossCount"),
641 burst_discard_count("burstDiscardCount"),
642 burst_loss_rate("burstLossRate"),
643 burst_discard_rate("burstDiscardRate"),
644 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800645 gap_discard_rate("gapDiscardRate"),
Henrik Boström2e069262019-04-09 13:59:31 +0200646 frames_decoded("framesDecoded"),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200647 key_frames_decoded("keyFramesDecoded"),
Johannes Kronbfd343b2019-07-01 10:07:50 +0200648 total_decode_time("totalDecodeTime"),
Henrik Boström2e069262019-04-09 13:59:31 +0200649 content_type("contentType") {}
hboseeafe942016-11-01 03:00:17 -0700650
651RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
652 const RTCInboundRTPStreamStats& other)
653 : RTCRTPStreamStats(other),
654 packets_received(other.packets_received),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200655 fec_packets_received(other.fec_packets_received),
656 fec_packets_discarded(other.fec_packets_discarded),
hboseeafe942016-11-01 03:00:17 -0700657 bytes_received(other.bytes_received),
658 packets_lost(other.packets_lost),
Henrik Boström01738c62019-04-15 17:32:00 +0200659 last_packet_received_timestamp(other.last_packet_received_timestamp),
hboseeafe942016-11-01 03:00:17 -0700660 jitter(other.jitter),
hbosa7a9be12017-03-01 01:02:45 -0800661 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700662 packets_discarded(other.packets_discarded),
663 packets_repaired(other.packets_repaired),
664 burst_packets_lost(other.burst_packets_lost),
665 burst_packets_discarded(other.burst_packets_discarded),
666 burst_loss_count(other.burst_loss_count),
667 burst_discard_count(other.burst_discard_count),
668 burst_loss_rate(other.burst_loss_rate),
669 burst_discard_rate(other.burst_discard_rate),
670 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800671 gap_discard_rate(other.gap_discard_rate),
Henrik Boström2e069262019-04-09 13:59:31 +0200672 frames_decoded(other.frames_decoded),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200673 key_frames_decoded(other.key_frames_decoded),
Johannes Kronbfd343b2019-07-01 10:07:50 +0200674 total_decode_time(other.total_decode_time),
Henrik Boström2e069262019-04-09 13:59:31 +0200675 content_type(other.content_type) {}
hboseeafe942016-11-01 03:00:17 -0700676
Yves Gerey665174f2018-06-19 15:03:05 +0200677RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {}
hboseeafe942016-11-01 03:00:17 -0700678
Steve Antond6a5cbd2017-08-18 09:40:25 -0700679// clang-format off
hboseeafe942016-11-01 03:00:17 -0700680WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700681 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
Henrik Boström646fda02019-05-22 15:49:42 +0200682 &media_source_id,
hbos6ded1902016-11-01 01:50:46 -0700683 &packets_sent,
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200684 &retransmitted_packets_sent,
hbos6ded1902016-11-01 01:50:46 -0700685 &bytes_sent,
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200686 &retransmitted_bytes_sent,
hbos6ded1902016-11-01 01:50:46 -0700687 &target_bitrate,
Henrik Boströmf71362f2019-04-08 16:14:23 +0200688 &frames_encoded,
Rasmus Brandt2efae772019-06-27 14:29:34 +0200689 &key_frames_encoded,
Henrik Boström2e069262019-04-09 13:59:31 +0200690 &total_encode_time,
Henrik Boström23aff9b2019-05-20 15:15:38 +0200691 &total_encoded_bytes_target,
Henrik Boström9fe18342019-05-16 18:38:20 +0200692 &total_packet_send_delay,
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200693 &quality_limitation_reason,
Henrik Boström2e069262019-04-09 13:59:31 +0200694 &content_type)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700695// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700696
Yves Gerey665174f2018-06-19 15:03:05 +0200697RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(const std::string& id,
698 int64_t timestamp_us)
699 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700700
Yves Gerey665174f2018-06-19 15:03:05 +0200701RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id,
702 int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700703 : RTCRTPStreamStats(std::move(id), timestamp_us),
Henrik Boström646fda02019-05-22 15:49:42 +0200704 media_source_id("mediaSourceId"),
hbos6ded1902016-11-01 01:50:46 -0700705 packets_sent("packetsSent"),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200706 retransmitted_packets_sent("retransmittedPacketsSent"),
hbos6ded1902016-11-01 01:50:46 -0700707 bytes_sent("bytesSent"),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200708 retransmitted_bytes_sent("retransmittedBytesSent"),
hbos6ded1902016-11-01 01:50:46 -0700709 target_bitrate("targetBitrate"),
Henrik Boströmf71362f2019-04-08 16:14:23 +0200710 frames_encoded("framesEncoded"),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200711 key_frames_encoded("keyFramesEncoded"),
Henrik Boström2e069262019-04-09 13:59:31 +0200712 total_encode_time("totalEncodeTime"),
Henrik Boström23aff9b2019-05-20 15:15:38 +0200713 total_encoded_bytes_target("totalEncodedBytesTarget"),
Henrik Boström9fe18342019-05-16 18:38:20 +0200714 total_packet_send_delay("totalPacketSendDelay"),
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200715 quality_limitation_reason("qualityLimitationReason"),
Henrik Boström2e069262019-04-09 13:59:31 +0200716 content_type("contentType") {}
hbos6ded1902016-11-01 01:50:46 -0700717
718RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
719 const RTCOutboundRTPStreamStats& other)
720 : RTCRTPStreamStats(other),
Henrik Boström646fda02019-05-22 15:49:42 +0200721 media_source_id(other.media_source_id),
hbos6ded1902016-11-01 01:50:46 -0700722 packets_sent(other.packets_sent),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200723 retransmitted_packets_sent(other.retransmitted_packets_sent),
hbos6ded1902016-11-01 01:50:46 -0700724 bytes_sent(other.bytes_sent),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200725 retransmitted_bytes_sent(other.retransmitted_bytes_sent),
hbos6ded1902016-11-01 01:50:46 -0700726 target_bitrate(other.target_bitrate),
Henrik Boströmf71362f2019-04-08 16:14:23 +0200727 frames_encoded(other.frames_encoded),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200728 key_frames_encoded(other.key_frames_encoded),
Henrik Boström2e069262019-04-09 13:59:31 +0200729 total_encode_time(other.total_encode_time),
Henrik Boström23aff9b2019-05-20 15:15:38 +0200730 total_encoded_bytes_target(other.total_encoded_bytes_target),
Henrik Boström9fe18342019-05-16 18:38:20 +0200731 total_packet_send_delay(other.total_packet_send_delay),
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200732 quality_limitation_reason(other.quality_limitation_reason),
Henrik Boström2e069262019-04-09 13:59:31 +0200733 content_type(other.content_type) {}
hbos6ded1902016-11-01 01:50:46 -0700734
Yves Gerey665174f2018-06-19 15:03:05 +0200735RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700736
Steve Antond6a5cbd2017-08-18 09:40:25 -0700737// clang-format off
Henrik Boström883eefc2019-05-27 13:40:25 +0200738WEBRTC_RTCSTATS_IMPL(
739 RTCRemoteInboundRtpStreamStats, RTCStats, "remote-inbound-rtp",
740 &ssrc,
741 &kind,
742 &transport_id,
743 &codec_id,
744 &packets_lost,
745 &jitter,
746 &local_id,
747 &round_trip_time)
748// clang-format on
749
750RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
751 const std::string& id,
752 int64_t timestamp_us)
753 : RTCRemoteInboundRtpStreamStats(std::string(id), timestamp_us) {}
754
755RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
756 std::string&& id,
757 int64_t timestamp_us)
758 : RTCStats(std::move(id), timestamp_us),
759 ssrc("ssrc"),
760 kind("kind"),
761 transport_id("transportId"),
762 codec_id("codecId"),
763 packets_lost("packetsLost"),
764 jitter("jitter"),
765 local_id("localId"),
766 round_trip_time("roundTripTime") {}
767
768RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
769 const RTCRemoteInboundRtpStreamStats& other)
770 : RTCStats(other),
771 ssrc(other.ssrc),
772 kind(other.kind),
773 transport_id(other.transport_id),
774 codec_id(other.codec_id),
775 packets_lost(other.packets_lost),
776 jitter(other.jitter),
777 local_id(other.local_id),
778 round_trip_time(other.round_trip_time) {}
779
780RTCRemoteInboundRtpStreamStats::~RTCRemoteInboundRtpStreamStats() {}
781
782// clang-format off
Henrik Boström646fda02019-05-22 15:49:42 +0200783WEBRTC_RTCSTATS_IMPL(RTCMediaSourceStats, RTCStats, "parent-media-source",
784 &track_identifier,
785 &kind)
786// clang-format on
787
788RTCMediaSourceStats::RTCMediaSourceStats(const std::string& id,
789 int64_t timestamp_us)
790 : RTCMediaSourceStats(std::string(id), timestamp_us) {}
791
792RTCMediaSourceStats::RTCMediaSourceStats(std::string&& id, int64_t timestamp_us)
793 : RTCStats(std::move(id), timestamp_us),
794 track_identifier("trackIdentifier"),
795 kind("kind") {}
796
797RTCMediaSourceStats::RTCMediaSourceStats(const RTCMediaSourceStats& other)
798 : RTCStats(other.id(), other.timestamp_us()),
799 track_identifier(other.track_identifier),
800 kind(other.kind) {}
801
802RTCMediaSourceStats::~RTCMediaSourceStats() {}
803
804// clang-format off
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200805WEBRTC_RTCSTATS_IMPL(RTCAudioSourceStats, RTCMediaSourceStats, "media-source",
806 &audio_level,
807 &total_audio_energy,
808 &total_samples_duration)
Henrik Boström646fda02019-05-22 15:49:42 +0200809// clang-format on
810
811RTCAudioSourceStats::RTCAudioSourceStats(const std::string& id,
812 int64_t timestamp_us)
813 : RTCAudioSourceStats(std::string(id), timestamp_us) {}
814
815RTCAudioSourceStats::RTCAudioSourceStats(std::string&& id, int64_t timestamp_us)
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200816 : RTCMediaSourceStats(std::move(id), timestamp_us),
817 audio_level("audioLevel"),
818 total_audio_energy("totalAudioEnergy"),
819 total_samples_duration("totalSamplesDuration") {}
Henrik Boström646fda02019-05-22 15:49:42 +0200820
821RTCAudioSourceStats::RTCAudioSourceStats(const RTCAudioSourceStats& other)
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200822 : RTCMediaSourceStats(other),
823 audio_level(other.audio_level),
824 total_audio_energy(other.total_audio_energy),
825 total_samples_duration(other.total_samples_duration) {}
Henrik Boström646fda02019-05-22 15:49:42 +0200826
827RTCAudioSourceStats::~RTCAudioSourceStats() {}
828
829// clang-format off
830WEBRTC_RTCSTATS_IMPL(RTCVideoSourceStats, RTCMediaSourceStats, "media-source",
831 &width,
832 &height,
833 &frames,
834 &frames_per_second)
835// clang-format on
836
837RTCVideoSourceStats::RTCVideoSourceStats(const std::string& id,
838 int64_t timestamp_us)
839 : RTCVideoSourceStats(std::string(id), timestamp_us) {}
840
841RTCVideoSourceStats::RTCVideoSourceStats(std::string&& id, int64_t timestamp_us)
842 : RTCMediaSourceStats(std::move(id), timestamp_us),
843 width("width"),
844 height("height"),
845 frames("frames"),
846 frames_per_second("framesPerSecond") {}
847
848RTCVideoSourceStats::RTCVideoSourceStats(const RTCVideoSourceStats& other)
849 : RTCMediaSourceStats(other),
850 width(other.width),
851 height(other.height),
852 frames(other.frames),
853 frames_per_second(other.frames_per_second) {}
854
855RTCVideoSourceStats::~RTCVideoSourceStats() {}
856
857// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700858WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
859 &bytes_sent,
860 &bytes_received,
861 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800862 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700863 &selected_candidate_pair_id,
864 &local_certificate_id,
Nico Weber22f99252019-02-20 10:13:16 -0500865 &remote_certificate_id)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700866// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700867
Yves Gerey665174f2018-06-19 15:03:05 +0200868RTCTransportStats::RTCTransportStats(const std::string& id,
869 int64_t timestamp_us)
870 : RTCTransportStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700871
Yves Gerey665174f2018-06-19 15:03:05 +0200872RTCTransportStats::RTCTransportStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700873 : RTCStats(std::move(id), timestamp_us),
874 bytes_sent("bytesSent"),
875 bytes_received("bytesReceived"),
876 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800877 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700878 selected_candidate_pair_id("selectedCandidatePairId"),
879 local_certificate_id("localCertificateId"),
Yves Gerey665174f2018-06-19 15:03:05 +0200880 remote_certificate_id("remoteCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -0700881
Yves Gerey665174f2018-06-19 15:03:05 +0200882RTCTransportStats::RTCTransportStats(const RTCTransportStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700883 : RTCStats(other.id(), other.timestamp_us()),
884 bytes_sent(other.bytes_sent),
885 bytes_received(other.bytes_received),
886 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800887 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700888 selected_candidate_pair_id(other.selected_candidate_pair_id),
889 local_certificate_id(other.local_certificate_id),
Yves Gerey665174f2018-06-19 15:03:05 +0200890 remote_certificate_id(other.remote_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -0700891
Yves Gerey665174f2018-06-19 15:03:05 +0200892RTCTransportStats::~RTCTransportStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700893
hbosd565b732016-08-30 14:04:35 -0700894} // namespace webrtc