blob: f8122f458c2aff3a582f0fcd4c221bf54d78cbfb [file] [log] [blame]
hbosd565b732016-08-30 14:04:35 -07001/*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "api/stats/rtcstats_objects.h"
hbosd565b732016-08-30 14:04:35 -070012
Yves Gerey3e707812018-11-28 16:47:49 +010013#include <utility>
14
Jakob Ivarsson758d9462019-03-19 15:38:49 +010015#include "api/stats/rtc_stats.h"
Jonas Olssona4d87372019-07-05 19:08:33 +020016#include "rtc_base/checks.h"
Jakob Ivarsson758d9462019-03-19 15:38:49 +010017
hbosd565b732016-08-30 14:04:35 -070018namespace webrtc {
19
agrieve26622d32017-08-08 10:48:15 -070020const char* const RTCDataChannelState::kConnecting = "connecting";
21const char* const RTCDataChannelState::kOpen = "open";
22const char* const RTCDataChannelState::kClosing = "closing";
23const char* const RTCDataChannelState::kClosed = "closed";
hboscc555c52016-10-18 12:48:31 -070024
agrieve26622d32017-08-08 10:48:15 -070025const char* const RTCStatsIceCandidatePairState::kFrozen = "frozen";
26const char* const RTCStatsIceCandidatePairState::kWaiting = "waiting";
27const char* const RTCStatsIceCandidatePairState::kInProgress = "in-progress";
28const char* const RTCStatsIceCandidatePairState::kFailed = "failed";
29const char* const RTCStatsIceCandidatePairState::kSucceeded = "succeeded";
hbosc47a0c32016-10-11 14:54:49 -070030
31// Strings defined in https://tools.ietf.org/html/rfc5245.
agrieve26622d32017-08-08 10:48:15 -070032const char* const RTCIceCandidateType::kHost = "host";
33const char* const RTCIceCandidateType::kSrflx = "srflx";
34const char* const RTCIceCandidateType::kPrflx = "prflx";
35const char* const RTCIceCandidateType::kRelay = "relay";
hbosab9f6e42016-10-07 02:18:47 -070036
agrieve26622d32017-08-08 10:48:15 -070037const char* const RTCDtlsTransportState::kNew = "new";
38const char* const RTCDtlsTransportState::kConnecting = "connecting";
39const char* const RTCDtlsTransportState::kConnected = "connected";
40const char* const RTCDtlsTransportState::kClosed = "closed";
41const char* const RTCDtlsTransportState::kFailed = "failed";
hbos7064d592017-01-16 07:38:02 -080042
agrieve26622d32017-08-08 10:48:15 -070043const char* const RTCMediaStreamTrackKind::kAudio = "audio";
44const char* const RTCMediaStreamTrackKind::kVideo = "video";
hbos160e4a72017-01-17 02:53:23 -080045
Gary Liu37e489c2017-11-21 10:49:36 -080046// https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype
47const char* const RTCNetworkType::kBluetooth = "bluetooth";
48const char* const RTCNetworkType::kCellular = "cellular";
49const char* const RTCNetworkType::kEthernet = "ethernet";
50const char* const RTCNetworkType::kWifi = "wifi";
51const char* const RTCNetworkType::kWimax = "wimax";
52const char* const RTCNetworkType::kVpn = "vpn";
53const char* const RTCNetworkType::kUnknown = "unknown";
54
Henrik Boströmce33b6a2019-05-28 17:42:38 +020055// https://w3c.github.io/webrtc-stats/#dom-rtcqualitylimitationreason
56const char* const RTCQualityLimitationReason::kNone = "none";
57const char* const RTCQualityLimitationReason::kCpu = "cpu";
58const char* const RTCQualityLimitationReason::kBandwidth = "bandwidth";
59const char* const RTCQualityLimitationReason::kOther = "other";
60
Henrik Boström2e069262019-04-09 13:59:31 +020061// https://webrtc.org/experiments/rtp-hdrext/video-content-type/
62const char* const RTCContentType::kUnspecified = "unspecified";
63const char* const RTCContentType::kScreenshare = "screenshare";
64
Steve Antond6a5cbd2017-08-18 09:40:25 -070065// clang-format off
hbos2fa7c672016-10-24 04:00:05 -070066WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
67 &fingerprint,
68 &fingerprint_algorithm,
69 &base64_certificate,
Nico Weber22f99252019-02-20 10:13:16 -050070 &issuer_certificate_id)
Steve Antond6a5cbd2017-08-18 09:40:25 -070071// clang-format on
hbos2fa7c672016-10-24 04:00:05 -070072
Yves Gerey665174f2018-06-19 15:03:05 +020073RTCCertificateStats::RTCCertificateStats(const std::string& id,
74 int64_t timestamp_us)
75 : RTCCertificateStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -070076
Yves Gerey665174f2018-06-19 15:03:05 +020077RTCCertificateStats::RTCCertificateStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -070078 : RTCStats(std::move(id), timestamp_us),
79 fingerprint("fingerprint"),
80 fingerprint_algorithm("fingerprintAlgorithm"),
81 base64_certificate("base64Certificate"),
Yves Gerey665174f2018-06-19 15:03:05 +020082 issuer_certificate_id("issuerCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -070083
Yves Gerey665174f2018-06-19 15:03:05 +020084RTCCertificateStats::RTCCertificateStats(const RTCCertificateStats& other)
hbos2fa7c672016-10-24 04:00:05 -070085 : RTCStats(other.id(), other.timestamp_us()),
86 fingerprint(other.fingerprint),
87 fingerprint_algorithm(other.fingerprint_algorithm),
88 base64_certificate(other.base64_certificate),
Yves Gerey665174f2018-06-19 15:03:05 +020089 issuer_certificate_id(other.issuer_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -070090
Yves Gerey665174f2018-06-19 15:03:05 +020091RTCCertificateStats::~RTCCertificateStats() {}
hbos2fa7c672016-10-24 04:00:05 -070092
Steve Antond6a5cbd2017-08-18 09:40:25 -070093// clang-format off
hbos0adb8282016-11-23 02:32:06 -080094WEBRTC_RTCSTATS_IMPL(RTCCodecStats, RTCStats, "codec",
95 &payload_type,
hbos13f54b22017-02-28 06:56:04 -080096 &mime_type,
hbos0adb8282016-11-23 02:32:06 -080097 &clock_rate,
98 &channels,
Henrik Boström6b430862019-08-16 13:09:51 +020099 &sdp_fmtp_line)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700100// clang-format on
hbos0adb8282016-11-23 02:32:06 -0800101
Yves Gerey665174f2018-06-19 15:03:05 +0200102RTCCodecStats::RTCCodecStats(const std::string& id, int64_t timestamp_us)
103 : RTCCodecStats(std::string(id), timestamp_us) {}
hbos0adb8282016-11-23 02:32:06 -0800104
Yves Gerey665174f2018-06-19 15:03:05 +0200105RTCCodecStats::RTCCodecStats(std::string&& id, int64_t timestamp_us)
hbos0adb8282016-11-23 02:32:06 -0800106 : RTCStats(std::move(id), timestamp_us),
107 payload_type("payloadType"),
hbos13f54b22017-02-28 06:56:04 -0800108 mime_type("mimeType"),
hbos0adb8282016-11-23 02:32:06 -0800109 clock_rate("clockRate"),
110 channels("channels"),
Henrik Boström6b430862019-08-16 13:09:51 +0200111 sdp_fmtp_line("sdpFmtpLine") {}
hbos0adb8282016-11-23 02:32:06 -0800112
Yves Gerey665174f2018-06-19 15:03:05 +0200113RTCCodecStats::RTCCodecStats(const RTCCodecStats& other)
hbos0adb8282016-11-23 02:32:06 -0800114 : RTCStats(other.id(), other.timestamp_us()),
115 payload_type(other.payload_type),
hbos13f54b22017-02-28 06:56:04 -0800116 mime_type(other.mime_type),
hbos0adb8282016-11-23 02:32:06 -0800117 clock_rate(other.clock_rate),
118 channels(other.channels),
Henrik Boström6b430862019-08-16 13:09:51 +0200119 sdp_fmtp_line(other.sdp_fmtp_line) {}
hbos0adb8282016-11-23 02:32:06 -0800120
Yves Gerey665174f2018-06-19 15:03:05 +0200121RTCCodecStats::~RTCCodecStats() {}
hbos0adb8282016-11-23 02:32:06 -0800122
Steve Antond6a5cbd2017-08-18 09:40:25 -0700123// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700124WEBRTC_RTCSTATS_IMPL(RTCDataChannelStats, RTCStats, "data-channel",
125 &label,
126 &protocol,
127 &datachannelid,
128 &state,
129 &messages_sent,
130 &bytes_sent,
131 &messages_received,
Nico Weber22f99252019-02-20 10:13:16 -0500132 &bytes_received)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700133// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700134
Yves Gerey665174f2018-06-19 15:03:05 +0200135RTCDataChannelStats::RTCDataChannelStats(const std::string& id,
136 int64_t timestamp_us)
137 : RTCDataChannelStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700138
Yves Gerey665174f2018-06-19 15:03:05 +0200139RTCDataChannelStats::RTCDataChannelStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700140 : RTCStats(std::move(id), timestamp_us),
141 label("label"),
142 protocol("protocol"),
143 datachannelid("datachannelid"),
144 state("state"),
145 messages_sent("messagesSent"),
146 bytes_sent("bytesSent"),
147 messages_received("messagesReceived"),
Yves Gerey665174f2018-06-19 15:03:05 +0200148 bytes_received("bytesReceived") {}
hbos2fa7c672016-10-24 04:00:05 -0700149
Yves Gerey665174f2018-06-19 15:03:05 +0200150RTCDataChannelStats::RTCDataChannelStats(const RTCDataChannelStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700151 : RTCStats(other.id(), other.timestamp_us()),
152 label(other.label),
153 protocol(other.protocol),
154 datachannelid(other.datachannelid),
155 state(other.state),
156 messages_sent(other.messages_sent),
157 bytes_sent(other.bytes_sent),
158 messages_received(other.messages_received),
Yves Gerey665174f2018-06-19 15:03:05 +0200159 bytes_received(other.bytes_received) {}
hbos2fa7c672016-10-24 04:00:05 -0700160
Yves Gerey665174f2018-06-19 15:03:05 +0200161RTCDataChannelStats::~RTCDataChannelStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700162
Steve Antond6a5cbd2017-08-18 09:40:25 -0700163// clang-format off
hbosc47a0c32016-10-11 14:54:49 -0700164WEBRTC_RTCSTATS_IMPL(RTCIceCandidatePairStats, RTCStats, "candidate-pair",
165 &transport_id,
166 &local_candidate_id,
167 &remote_candidate_id,
168 &state,
169 &priority,
170 &nominated,
171 &writable,
172 &readable,
173 &bytes_sent,
174 &bytes_received,
hbos3168c7a2016-12-15 06:17:08 -0800175 &total_round_trip_time,
176 &current_round_trip_time,
hbosc47a0c32016-10-11 14:54:49 -0700177 &available_outgoing_bitrate,
178 &available_incoming_bitrate,
179 &requests_received,
180 &requests_sent,
181 &responses_received,
182 &responses_sent,
183 &retransmissions_received,
184 &retransmissions_sent,
185 &consent_requests_received,
186 &consent_requests_sent,
187 &consent_responses_received,
Nico Weber22f99252019-02-20 10:13:16 -0500188 &consent_responses_sent)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700189// clang-format on
hbosc47a0c32016-10-11 14:54:49 -0700190
Yves Gerey665174f2018-06-19 15:03:05 +0200191RTCIceCandidatePairStats::RTCIceCandidatePairStats(const std::string& id,
192 int64_t timestamp_us)
193 : RTCIceCandidatePairStats(std::string(id), timestamp_us) {}
hbosc47a0c32016-10-11 14:54:49 -0700194
Yves Gerey665174f2018-06-19 15:03:05 +0200195RTCIceCandidatePairStats::RTCIceCandidatePairStats(std::string&& id,
196 int64_t timestamp_us)
hbosc47a0c32016-10-11 14:54:49 -0700197 : RTCStats(std::move(id), timestamp_us),
198 transport_id("transportId"),
199 local_candidate_id("localCandidateId"),
200 remote_candidate_id("remoteCandidateId"),
201 state("state"),
202 priority("priority"),
203 nominated("nominated"),
204 writable("writable"),
205 readable("readable"),
206 bytes_sent("bytesSent"),
207 bytes_received("bytesReceived"),
hbos3168c7a2016-12-15 06:17:08 -0800208 total_round_trip_time("totalRoundTripTime"),
209 current_round_trip_time("currentRoundTripTime"),
hbosc47a0c32016-10-11 14:54:49 -0700210 available_outgoing_bitrate("availableOutgoingBitrate"),
211 available_incoming_bitrate("availableIncomingBitrate"),
212 requests_received("requestsReceived"),
213 requests_sent("requestsSent"),
214 responses_received("responsesReceived"),
215 responses_sent("responsesSent"),
216 retransmissions_received("retransmissionsReceived"),
217 retransmissions_sent("retransmissionsSent"),
218 consent_requests_received("consentRequestsReceived"),
219 consent_requests_sent("consentRequestsSent"),
220 consent_responses_received("consentResponsesReceived"),
Yves Gerey665174f2018-06-19 15:03:05 +0200221 consent_responses_sent("consentResponsesSent") {}
hbosc47a0c32016-10-11 14:54:49 -0700222
223RTCIceCandidatePairStats::RTCIceCandidatePairStats(
224 const RTCIceCandidatePairStats& other)
225 : RTCStats(other.id(), other.timestamp_us()),
226 transport_id(other.transport_id),
227 local_candidate_id(other.local_candidate_id),
228 remote_candidate_id(other.remote_candidate_id),
229 state(other.state),
230 priority(other.priority),
231 nominated(other.nominated),
232 writable(other.writable),
233 readable(other.readable),
234 bytes_sent(other.bytes_sent),
235 bytes_received(other.bytes_received),
hbos3168c7a2016-12-15 06:17:08 -0800236 total_round_trip_time(other.total_round_trip_time),
237 current_round_trip_time(other.current_round_trip_time),
hbosc47a0c32016-10-11 14:54:49 -0700238 available_outgoing_bitrate(other.available_outgoing_bitrate),
239 available_incoming_bitrate(other.available_incoming_bitrate),
240 requests_received(other.requests_received),
241 requests_sent(other.requests_sent),
242 responses_received(other.responses_received),
243 responses_sent(other.responses_sent),
244 retransmissions_received(other.retransmissions_received),
245 retransmissions_sent(other.retransmissions_sent),
246 consent_requests_received(other.consent_requests_received),
247 consent_requests_sent(other.consent_requests_sent),
248 consent_responses_received(other.consent_responses_received),
Yves Gerey665174f2018-06-19 15:03:05 +0200249 consent_responses_sent(other.consent_responses_sent) {}
hbosc47a0c32016-10-11 14:54:49 -0700250
Yves Gerey665174f2018-06-19 15:03:05 +0200251RTCIceCandidatePairStats::~RTCIceCandidatePairStats() {}
hbosc47a0c32016-10-11 14:54:49 -0700252
Steve Antond6a5cbd2017-08-18 09:40:25 -0700253// clang-format off
Henrik Boström1df1bf82018-03-20 13:24:20 +0100254WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "abstract-ice-candidate",
hbosb4e426e2017-01-02 09:59:31 -0800255 &transport_id,
hbosc3a2b7f2017-01-02 04:46:15 -0800256 &is_remote,
Gary Liu37e489c2017-11-21 10:49:36 -0800257 &network_type,
hbosab9f6e42016-10-07 02:18:47 -0700258 &ip,
259 &port,
260 &protocol,
Philipp Hancke95513752018-09-27 14:40:08 +0200261 &relay_protocol,
hbosab9f6e42016-10-07 02:18:47 -0700262 &candidate_type,
263 &priority,
hbosd17a5a72017-01-02 08:09:59 -0800264 &url,
Nico Weber22f99252019-02-20 10:13:16 -0500265 &deleted)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700266// clang-format on
hbosab9f6e42016-10-07 02:18:47 -0700267
Yves Gerey665174f2018-06-19 15:03:05 +0200268RTCIceCandidateStats::RTCIceCandidateStats(const std::string& id,
269 int64_t timestamp_us,
270 bool is_remote)
271 : RTCIceCandidateStats(std::string(id), timestamp_us, is_remote) {}
hbosab9f6e42016-10-07 02:18:47 -0700272
Gary Liu37e489c2017-11-21 10:49:36 -0800273RTCIceCandidateStats::RTCIceCandidateStats(std::string&& id,
274 int64_t timestamp_us,
275 bool is_remote)
hbosab9f6e42016-10-07 02:18:47 -0700276 : RTCStats(std::move(id), timestamp_us),
hbosb4e426e2017-01-02 09:59:31 -0800277 transport_id("transportId"),
hbosc3a2b7f2017-01-02 04:46:15 -0800278 is_remote("isRemote", is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800279 network_type("networkType"),
hbosab9f6e42016-10-07 02:18:47 -0700280 ip("ip"),
281 port("port"),
282 protocol("protocol"),
Philipp Hancke95513752018-09-27 14:40:08 +0200283 relay_protocol("relayProtocol"),
hbosab9f6e42016-10-07 02:18:47 -0700284 candidate_type("candidateType"),
285 priority("priority"),
hbosd17a5a72017-01-02 08:09:59 -0800286 url("url"),
Gary Liu37e489c2017-11-21 10:49:36 -0800287 deleted("deleted", false) {}
hbosab9f6e42016-10-07 02:18:47 -0700288
289RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
290 : RTCStats(other.id(), other.timestamp_us()),
hbosb4e426e2017-01-02 09:59:31 -0800291 transport_id(other.transport_id),
hbosc3a2b7f2017-01-02 04:46:15 -0800292 is_remote(other.is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800293 network_type(other.network_type),
hbosab9f6e42016-10-07 02:18:47 -0700294 ip(other.ip),
295 port(other.port),
296 protocol(other.protocol),
Philipp Hancke95513752018-09-27 14:40:08 +0200297 relay_protocol(other.relay_protocol),
hbosab9f6e42016-10-07 02:18:47 -0700298 candidate_type(other.candidate_type),
299 priority(other.priority),
hbosd17a5a72017-01-02 08:09:59 -0800300 url(other.url),
Gary Liu37e489c2017-11-21 10:49:36 -0800301 deleted(other.deleted) {}
hbosab9f6e42016-10-07 02:18:47 -0700302
Yves Gerey665174f2018-06-19 15:03:05 +0200303RTCIceCandidateStats::~RTCIceCandidateStats() {}
hbosab9f6e42016-10-07 02:18:47 -0700304
305const char RTCLocalIceCandidateStats::kType[] = "local-candidate";
306
Yves Gerey665174f2018-06-19 15:03:05 +0200307RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(const std::string& id,
308 int64_t timestamp_us)
309 : RTCIceCandidateStats(id, timestamp_us, false) {}
hbosab9f6e42016-10-07 02:18:47 -0700310
Yves Gerey665174f2018-06-19 15:03:05 +0200311RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(std::string&& id,
312 int64_t timestamp_us)
313 : RTCIceCandidateStats(std::move(id), timestamp_us, false) {}
hbosab9f6e42016-10-07 02:18:47 -0700314
Henrik Boström1df1bf82018-03-20 13:24:20 +0100315std::unique_ptr<RTCStats> RTCLocalIceCandidateStats::copy() const {
316 return std::unique_ptr<RTCStats>(new RTCLocalIceCandidateStats(*this));
317}
318
hbosab9f6e42016-10-07 02:18:47 -0700319const char* RTCLocalIceCandidateStats::type() const {
320 return kType;
321}
322
323const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate";
324
Yves Gerey665174f2018-06-19 15:03:05 +0200325RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(const std::string& id,
326 int64_t timestamp_us)
327 : RTCIceCandidateStats(id, timestamp_us, true) {}
hbosab9f6e42016-10-07 02:18:47 -0700328
Yves Gerey665174f2018-06-19 15:03:05 +0200329RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(std::string&& id,
330 int64_t timestamp_us)
331 : RTCIceCandidateStats(std::move(id), timestamp_us, true) {}
hbosab9f6e42016-10-07 02:18:47 -0700332
Henrik Boström1df1bf82018-03-20 13:24:20 +0100333std::unique_ptr<RTCStats> RTCRemoteIceCandidateStats::copy() const {
334 return std::unique_ptr<RTCStats>(new RTCRemoteIceCandidateStats(*this));
335}
336
hbosab9f6e42016-10-07 02:18:47 -0700337const char* RTCRemoteIceCandidateStats::type() const {
338 return kType;
339}
340
Steve Antond6a5cbd2017-08-18 09:40:25 -0700341// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800342WEBRTC_RTCSTATS_IMPL(RTCMediaStreamStats, RTCStats, "stream",
343 &stream_identifier,
Nico Weber22f99252019-02-20 10:13:16 -0500344 &track_ids)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700345// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800346
Yves Gerey665174f2018-06-19 15:03:05 +0200347RTCMediaStreamStats::RTCMediaStreamStats(const std::string& id,
348 int64_t timestamp_us)
349 : RTCMediaStreamStats(std::string(id), timestamp_us) {}
hbos09bc1282016-11-08 06:29:22 -0800350
Yves Gerey665174f2018-06-19 15:03:05 +0200351RTCMediaStreamStats::RTCMediaStreamStats(std::string&& id, int64_t timestamp_us)
hbos09bc1282016-11-08 06:29:22 -0800352 : RTCStats(std::move(id), timestamp_us),
353 stream_identifier("streamIdentifier"),
Yves Gerey665174f2018-06-19 15:03:05 +0200354 track_ids("trackIds") {}
hbos09bc1282016-11-08 06:29:22 -0800355
Yves Gerey665174f2018-06-19 15:03:05 +0200356RTCMediaStreamStats::RTCMediaStreamStats(const RTCMediaStreamStats& other)
hbos09bc1282016-11-08 06:29:22 -0800357 : RTCStats(other.id(), other.timestamp_us()),
358 stream_identifier(other.stream_identifier),
Yves Gerey665174f2018-06-19 15:03:05 +0200359 track_ids(other.track_ids) {}
hbos09bc1282016-11-08 06:29:22 -0800360
Yves Gerey665174f2018-06-19 15:03:05 +0200361RTCMediaStreamStats::~RTCMediaStreamStats() {}
hbos09bc1282016-11-08 06:29:22 -0800362
Steve Antond6a5cbd2017-08-18 09:40:25 -0700363// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800364WEBRTC_RTCSTATS_IMPL(RTCMediaStreamTrackStats, RTCStats, "track",
zsteine76bd3a2017-07-14 12:17:49 -0700365 &track_identifier,
Henrik Boström646fda02019-05-22 15:49:42 +0200366 &media_source_id,
zsteine76bd3a2017-07-14 12:17:49 -0700367 &remote_source,
368 &ended,
369 &detached,
370 &kind,
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200371 &jitter_buffer_delay,
Chen Xing0acffb52019-01-15 15:46:29 +0100372 &jitter_buffer_emitted_count,
zsteine76bd3a2017-07-14 12:17:49 -0700373 &frame_width,
374 &frame_height,
375 &frames_per_second,
376 &frames_sent,
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100377 &huge_frames_sent,
zsteine76bd3a2017-07-14 12:17:49 -0700378 &frames_received,
379 &frames_decoded,
380 &frames_dropped,
381 &frames_corrupted,
382 &partial_frames_lost,
383 &full_frames_lost,
384 &audio_level,
385 &total_audio_energy,
zsteine76bd3a2017-07-14 12:17:49 -0700386 &echo_return_loss,
Steve Anton2dbc69f2017-08-24 17:15:13 -0700387 &echo_return_loss_enhancement,
388 &total_samples_received,
389 &total_samples_duration,
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200390 &concealed_samples,
Henrik Boström21e99da2019-08-21 12:09:51 +0200391 &silent_concealed_samples,
Ruslan Burakov8af88962018-11-22 17:21:10 +0100392 &concealment_events,
Henrik Boström21e99da2019-08-21 12:09:51 +0200393 &inserted_samples_for_deceleration,
394 &removed_samples_for_acceleration,
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100395 &jitter_buffer_flushes,
Sergey Silkin02371062019-01-31 16:45:42 +0100396 &delayed_packet_outage_samples,
Jakob Ivarsson232b3fd2019-03-06 09:18:40 +0100397 &relative_packet_arrival_delay,
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,
hbos6ded1902016-11-01 01:50:46 -0700544 &is_remote,
545 &media_type,
Philipp Hancke3bc01662018-08-28 14:55:03 +0200546 &kind,
hbosb0ae9202017-01-27 06:35:16 -0800547 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700548 &transport_id,
549 &codec_id,
550 &fir_count,
551 &pli_count,
552 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800553 &sli_count,
Nico Weber22f99252019-02-20 10:13:16 -0500554 &qp_sum)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700555// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700556
Yves Gerey665174f2018-06-19 15:03:05 +0200557RTCRTPStreamStats::RTCRTPStreamStats(const std::string& id,
558 int64_t timestamp_us)
559 : RTCRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700560
Yves Gerey665174f2018-06-19 15:03:05 +0200561RTCRTPStreamStats::RTCRTPStreamStats(std::string&& id, int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700562 : RTCStats(std::move(id), timestamp_us),
563 ssrc("ssrc"),
hbos6ded1902016-11-01 01:50:46 -0700564 is_remote("isRemote", false),
565 media_type("mediaType"),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200566 kind("kind"),
hbosb0ae9202017-01-27 06:35:16 -0800567 track_id("trackId"),
hbos6ded1902016-11-01 01:50:46 -0700568 transport_id("transportId"),
569 codec_id("codecId"),
570 fir_count("firCount"),
571 pli_count("pliCount"),
572 nack_count("nackCount"),
hbos6769c492017-01-02 08:35:13 -0800573 sli_count("sliCount"),
Yves Gerey665174f2018-06-19 15:03:05 +0200574 qp_sum("qpSum") {}
hbos6ded1902016-11-01 01:50:46 -0700575
Yves Gerey665174f2018-06-19 15:03:05 +0200576RTCRTPStreamStats::RTCRTPStreamStats(const RTCRTPStreamStats& other)
hbos6ded1902016-11-01 01:50:46 -0700577 : RTCStats(other.id(), other.timestamp_us()),
578 ssrc(other.ssrc),
hbos6ded1902016-11-01 01:50:46 -0700579 is_remote(other.is_remote),
580 media_type(other.media_type),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200581 kind(other.kind),
hbosb0ae9202017-01-27 06:35:16 -0800582 track_id(other.track_id),
hbos6ded1902016-11-01 01:50:46 -0700583 transport_id(other.transport_id),
584 codec_id(other.codec_id),
585 fir_count(other.fir_count),
586 pli_count(other.pli_count),
587 nack_count(other.nack_count),
hbos6769c492017-01-02 08:35:13 -0800588 sli_count(other.sli_count),
Yves Gerey665174f2018-06-19 15:03:05 +0200589 qp_sum(other.qp_sum) {}
hbos6ded1902016-11-01 01:50:46 -0700590
Yves Gerey665174f2018-06-19 15:03:05 +0200591RTCRTPStreamStats::~RTCRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700592
Steve Antond6a5cbd2017-08-18 09:40:25 -0700593// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700594WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700595 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
596 &packets_received,
597 &bytes_received,
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200598 &header_bytes_received,
hboseeafe942016-11-01 03:00:17 -0700599 &packets_lost,
Henrik Boström01738c62019-04-15 17:32:00 +0200600 &last_packet_received_timestamp,
hboseeafe942016-11-01 03:00:17 -0700601 &jitter,
hbosa7a9be12017-03-01 01:02:45 -0800602 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700603 &packets_discarded,
604 &packets_repaired,
605 &burst_packets_lost,
606 &burst_packets_discarded,
607 &burst_loss_count,
608 &burst_discard_count,
609 &burst_loss_rate,
610 &burst_discard_rate,
611 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800612 &gap_discard_rate,
Henrik Boström2e069262019-04-09 13:59:31 +0200613 &frames_decoded,
Rasmus Brandt2efae772019-06-27 14:29:34 +0200614 &key_frames_decoded,
Johannes Kronbfd343b2019-07-01 10:07:50 +0200615 &total_decode_time,
Johannes Kron00376e12019-11-25 10:25:42 +0100616 &total_inter_frame_delay,
617 &total_squared_inter_frame_delay,
Henrik Boström6b430862019-08-16 13:09:51 +0200618 &content_type,
Åsa Perssonfcf79cc2019-10-22 15:23:44 +0200619 &estimated_playout_timestamp,
Henrik Boström6b430862019-08-16 13:09:51 +0200620 &decoder_implementation)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700621// clang-format on
hboseeafe942016-11-01 03:00:17 -0700622
Yves Gerey665174f2018-06-19 15:03:05 +0200623RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id,
624 int64_t timestamp_us)
625 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {}
hboseeafe942016-11-01 03:00:17 -0700626
Yves Gerey665174f2018-06-19 15:03:05 +0200627RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
628 int64_t timestamp_us)
hboseeafe942016-11-01 03:00:17 -0700629 : RTCRTPStreamStats(std::move(id), timestamp_us),
630 packets_received("packetsReceived"),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200631 fec_packets_received("fecPacketsReceived"),
632 fec_packets_discarded("fecPacketsDiscarded"),
hboseeafe942016-11-01 03:00:17 -0700633 bytes_received("bytesReceived"),
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200634 header_bytes_received("headerBytesReceived"),
hboseeafe942016-11-01 03:00:17 -0700635 packets_lost("packetsLost"),
Henrik Boström01738c62019-04-15 17:32:00 +0200636 last_packet_received_timestamp("lastPacketReceivedTimestamp"),
hboseeafe942016-11-01 03:00:17 -0700637 jitter("jitter"),
hbosa7a9be12017-03-01 01:02:45 -0800638 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700639 packets_discarded("packetsDiscarded"),
640 packets_repaired("packetsRepaired"),
641 burst_packets_lost("burstPacketsLost"),
642 burst_packets_discarded("burstPacketsDiscarded"),
643 burst_loss_count("burstLossCount"),
644 burst_discard_count("burstDiscardCount"),
645 burst_loss_rate("burstLossRate"),
646 burst_discard_rate("burstDiscardRate"),
647 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800648 gap_discard_rate("gapDiscardRate"),
Henrik Boström2e069262019-04-09 13:59:31 +0200649 frames_decoded("framesDecoded"),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200650 key_frames_decoded("keyFramesDecoded"),
Johannes Kronbfd343b2019-07-01 10:07:50 +0200651 total_decode_time("totalDecodeTime"),
Johannes Kron00376e12019-11-25 10:25:42 +0100652 total_inter_frame_delay("totalInterFrameDelay"),
653 total_squared_inter_frame_delay("totalSquaredInterFrameDelay"),
Henrik Boström6b430862019-08-16 13:09:51 +0200654 content_type("contentType"),
Åsa Perssonfcf79cc2019-10-22 15:23:44 +0200655 estimated_playout_timestamp("estimatedPlayoutTimestamp"),
Henrik Boström6b430862019-08-16 13:09:51 +0200656 decoder_implementation("decoderImplementation") {}
hboseeafe942016-11-01 03:00:17 -0700657
658RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
659 const RTCInboundRTPStreamStats& other)
660 : RTCRTPStreamStats(other),
661 packets_received(other.packets_received),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200662 fec_packets_received(other.fec_packets_received),
663 fec_packets_discarded(other.fec_packets_discarded),
hboseeafe942016-11-01 03:00:17 -0700664 bytes_received(other.bytes_received),
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200665 header_bytes_received(other.header_bytes_received),
hboseeafe942016-11-01 03:00:17 -0700666 packets_lost(other.packets_lost),
Henrik Boström01738c62019-04-15 17:32:00 +0200667 last_packet_received_timestamp(other.last_packet_received_timestamp),
hboseeafe942016-11-01 03:00:17 -0700668 jitter(other.jitter),
hbosa7a9be12017-03-01 01:02:45 -0800669 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700670 packets_discarded(other.packets_discarded),
671 packets_repaired(other.packets_repaired),
672 burst_packets_lost(other.burst_packets_lost),
673 burst_packets_discarded(other.burst_packets_discarded),
674 burst_loss_count(other.burst_loss_count),
675 burst_discard_count(other.burst_discard_count),
676 burst_loss_rate(other.burst_loss_rate),
677 burst_discard_rate(other.burst_discard_rate),
678 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800679 gap_discard_rate(other.gap_discard_rate),
Henrik Boström2e069262019-04-09 13:59:31 +0200680 frames_decoded(other.frames_decoded),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200681 key_frames_decoded(other.key_frames_decoded),
Johannes Kronbfd343b2019-07-01 10:07:50 +0200682 total_decode_time(other.total_decode_time),
Johannes Kron00376e12019-11-25 10:25:42 +0100683 total_inter_frame_delay(other.total_inter_frame_delay),
684 total_squared_inter_frame_delay(other.total_squared_inter_frame_delay),
Henrik Boström6b430862019-08-16 13:09:51 +0200685 content_type(other.content_type),
Åsa Perssonfcf79cc2019-10-22 15:23:44 +0200686 estimated_playout_timestamp(other.estimated_playout_timestamp),
Henrik Boström6b430862019-08-16 13:09:51 +0200687 decoder_implementation(other.decoder_implementation) {}
hboseeafe942016-11-01 03:00:17 -0700688
Yves Gerey665174f2018-06-19 15:03:05 +0200689RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {}
hboseeafe942016-11-01 03:00:17 -0700690
Steve Antond6a5cbd2017-08-18 09:40:25 -0700691// clang-format off
hboseeafe942016-11-01 03:00:17 -0700692WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700693 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
Henrik Boström646fda02019-05-22 15:49:42 +0200694 &media_source_id,
Henrik Boström4f40fa52019-12-19 13:27:27 +0100695 &remote_id,
hbos6ded1902016-11-01 01:50:46 -0700696 &packets_sent,
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200697 &retransmitted_packets_sent,
hbos6ded1902016-11-01 01:50:46 -0700698 &bytes_sent,
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200699 &header_bytes_sent,
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200700 &retransmitted_bytes_sent,
hbos6ded1902016-11-01 01:50:46 -0700701 &target_bitrate,
Henrik Boströmf71362f2019-04-08 16:14:23 +0200702 &frames_encoded,
Rasmus Brandt2efae772019-06-27 14:29:34 +0200703 &key_frames_encoded,
Henrik Boström2e069262019-04-09 13:59:31 +0200704 &total_encode_time,
Henrik Boström23aff9b2019-05-20 15:15:38 +0200705 &total_encoded_bytes_target,
Henrik Boström9fe18342019-05-16 18:38:20 +0200706 &total_packet_send_delay,
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200707 &quality_limitation_reason,
Evan Shrubsolecc62b162019-09-09 11:26:45 +0200708 &quality_limitation_resolution_changes,
Henrik Boström6b430862019-08-16 13:09:51 +0200709 &content_type,
710 &encoder_implementation)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700711// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700712
Yves Gerey665174f2018-06-19 15:03:05 +0200713RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(const std::string& id,
714 int64_t timestamp_us)
715 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700716
Yves Gerey665174f2018-06-19 15:03:05 +0200717RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id,
718 int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700719 : RTCRTPStreamStats(std::move(id), timestamp_us),
Henrik Boström646fda02019-05-22 15:49:42 +0200720 media_source_id("mediaSourceId"),
Henrik Boström4f40fa52019-12-19 13:27:27 +0100721 remote_id("remoteId"),
hbos6ded1902016-11-01 01:50:46 -0700722 packets_sent("packetsSent"),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200723 retransmitted_packets_sent("retransmittedPacketsSent"),
hbos6ded1902016-11-01 01:50:46 -0700724 bytes_sent("bytesSent"),
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200725 header_bytes_sent("headerBytesSent"),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200726 retransmitted_bytes_sent("retransmittedBytesSent"),
hbos6ded1902016-11-01 01:50:46 -0700727 target_bitrate("targetBitrate"),
Henrik Boströmf71362f2019-04-08 16:14:23 +0200728 frames_encoded("framesEncoded"),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200729 key_frames_encoded("keyFramesEncoded"),
Henrik Boström2e069262019-04-09 13:59:31 +0200730 total_encode_time("totalEncodeTime"),
Henrik Boström23aff9b2019-05-20 15:15:38 +0200731 total_encoded_bytes_target("totalEncodedBytesTarget"),
Henrik Boström9fe18342019-05-16 18:38:20 +0200732 total_packet_send_delay("totalPacketSendDelay"),
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200733 quality_limitation_reason("qualityLimitationReason"),
Evan Shrubsolecc62b162019-09-09 11:26:45 +0200734 quality_limitation_resolution_changes(
735 "qualityLimitationResolutionChanges"),
Henrik Boström6b430862019-08-16 13:09:51 +0200736 content_type("contentType"),
737 encoder_implementation("encoderImplementation") {}
hbos6ded1902016-11-01 01:50:46 -0700738
739RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
740 const RTCOutboundRTPStreamStats& other)
741 : RTCRTPStreamStats(other),
Henrik Boström646fda02019-05-22 15:49:42 +0200742 media_source_id(other.media_source_id),
Henrik Boström4f40fa52019-12-19 13:27:27 +0100743 remote_id(other.remote_id),
hbos6ded1902016-11-01 01:50:46 -0700744 packets_sent(other.packets_sent),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200745 retransmitted_packets_sent(other.retransmitted_packets_sent),
hbos6ded1902016-11-01 01:50:46 -0700746 bytes_sent(other.bytes_sent),
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200747 header_bytes_sent(other.header_bytes_sent),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200748 retransmitted_bytes_sent(other.retransmitted_bytes_sent),
hbos6ded1902016-11-01 01:50:46 -0700749 target_bitrate(other.target_bitrate),
Henrik Boströmf71362f2019-04-08 16:14:23 +0200750 frames_encoded(other.frames_encoded),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200751 key_frames_encoded(other.key_frames_encoded),
Henrik Boström2e069262019-04-09 13:59:31 +0200752 total_encode_time(other.total_encode_time),
Henrik Boström23aff9b2019-05-20 15:15:38 +0200753 total_encoded_bytes_target(other.total_encoded_bytes_target),
Henrik Boström9fe18342019-05-16 18:38:20 +0200754 total_packet_send_delay(other.total_packet_send_delay),
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200755 quality_limitation_reason(other.quality_limitation_reason),
Evan Shrubsolecc62b162019-09-09 11:26:45 +0200756 quality_limitation_resolution_changes(
757 other.quality_limitation_resolution_changes),
Henrik Boström6b430862019-08-16 13:09:51 +0200758 content_type(other.content_type),
759 encoder_implementation(other.encoder_implementation) {}
hbos6ded1902016-11-01 01:50:46 -0700760
Yves Gerey665174f2018-06-19 15:03:05 +0200761RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700762
Steve Antond6a5cbd2017-08-18 09:40:25 -0700763// clang-format off
Henrik Boström883eefc2019-05-27 13:40:25 +0200764WEBRTC_RTCSTATS_IMPL(
765 RTCRemoteInboundRtpStreamStats, RTCStats, "remote-inbound-rtp",
766 &ssrc,
767 &kind,
768 &transport_id,
769 &codec_id,
770 &packets_lost,
771 &jitter,
772 &local_id,
773 &round_trip_time)
774// clang-format on
775
776RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
777 const std::string& id,
778 int64_t timestamp_us)
779 : RTCRemoteInboundRtpStreamStats(std::string(id), timestamp_us) {}
780
781RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
782 std::string&& id,
783 int64_t timestamp_us)
784 : RTCStats(std::move(id), timestamp_us),
785 ssrc("ssrc"),
786 kind("kind"),
787 transport_id("transportId"),
788 codec_id("codecId"),
789 packets_lost("packetsLost"),
790 jitter("jitter"),
791 local_id("localId"),
792 round_trip_time("roundTripTime") {}
793
794RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
795 const RTCRemoteInboundRtpStreamStats& other)
796 : RTCStats(other),
797 ssrc(other.ssrc),
798 kind(other.kind),
799 transport_id(other.transport_id),
800 codec_id(other.codec_id),
801 packets_lost(other.packets_lost),
802 jitter(other.jitter),
803 local_id(other.local_id),
804 round_trip_time(other.round_trip_time) {}
805
806RTCRemoteInboundRtpStreamStats::~RTCRemoteInboundRtpStreamStats() {}
807
808// clang-format off
Henrik Boström646fda02019-05-22 15:49:42 +0200809WEBRTC_RTCSTATS_IMPL(RTCMediaSourceStats, RTCStats, "parent-media-source",
810 &track_identifier,
811 &kind)
812// clang-format on
813
814RTCMediaSourceStats::RTCMediaSourceStats(const std::string& id,
815 int64_t timestamp_us)
816 : RTCMediaSourceStats(std::string(id), timestamp_us) {}
817
818RTCMediaSourceStats::RTCMediaSourceStats(std::string&& id, int64_t timestamp_us)
819 : RTCStats(std::move(id), timestamp_us),
820 track_identifier("trackIdentifier"),
821 kind("kind") {}
822
823RTCMediaSourceStats::RTCMediaSourceStats(const RTCMediaSourceStats& other)
824 : RTCStats(other.id(), other.timestamp_us()),
825 track_identifier(other.track_identifier),
826 kind(other.kind) {}
827
828RTCMediaSourceStats::~RTCMediaSourceStats() {}
829
830// clang-format off
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200831WEBRTC_RTCSTATS_IMPL(RTCAudioSourceStats, RTCMediaSourceStats, "media-source",
832 &audio_level,
833 &total_audio_energy,
834 &total_samples_duration)
Henrik Boström646fda02019-05-22 15:49:42 +0200835// clang-format on
836
837RTCAudioSourceStats::RTCAudioSourceStats(const std::string& id,
838 int64_t timestamp_us)
839 : RTCAudioSourceStats(std::string(id), timestamp_us) {}
840
841RTCAudioSourceStats::RTCAudioSourceStats(std::string&& id, int64_t timestamp_us)
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200842 : RTCMediaSourceStats(std::move(id), timestamp_us),
843 audio_level("audioLevel"),
844 total_audio_energy("totalAudioEnergy"),
845 total_samples_duration("totalSamplesDuration") {}
Henrik Boström646fda02019-05-22 15:49:42 +0200846
847RTCAudioSourceStats::RTCAudioSourceStats(const RTCAudioSourceStats& other)
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200848 : RTCMediaSourceStats(other),
849 audio_level(other.audio_level),
850 total_audio_energy(other.total_audio_energy),
851 total_samples_duration(other.total_samples_duration) {}
Henrik Boström646fda02019-05-22 15:49:42 +0200852
853RTCAudioSourceStats::~RTCAudioSourceStats() {}
854
855// clang-format off
856WEBRTC_RTCSTATS_IMPL(RTCVideoSourceStats, RTCMediaSourceStats, "media-source",
857 &width,
858 &height,
859 &frames,
860 &frames_per_second)
861// clang-format on
862
863RTCVideoSourceStats::RTCVideoSourceStats(const std::string& id,
864 int64_t timestamp_us)
865 : RTCVideoSourceStats(std::string(id), timestamp_us) {}
866
867RTCVideoSourceStats::RTCVideoSourceStats(std::string&& id, int64_t timestamp_us)
868 : RTCMediaSourceStats(std::move(id), timestamp_us),
869 width("width"),
870 height("height"),
871 frames("frames"),
872 frames_per_second("framesPerSecond") {}
873
874RTCVideoSourceStats::RTCVideoSourceStats(const RTCVideoSourceStats& other)
875 : RTCMediaSourceStats(other),
876 width(other.width),
877 height(other.height),
878 frames(other.frames),
879 frames_per_second(other.frames_per_second) {}
880
881RTCVideoSourceStats::~RTCVideoSourceStats() {}
882
883// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700884WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
885 &bytes_sent,
886 &bytes_received,
887 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800888 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700889 &selected_candidate_pair_id,
890 &local_certificate_id,
Jonas Oreland149dc722019-08-28 08:10:27 +0200891 &remote_certificate_id,
Harald Alvestrand5cb78072019-10-28 09:51:17 +0100892 &tls_version,
893 &dtls_cipher,
894 &srtp_cipher,
Jonas Oreland149dc722019-08-28 08:10:27 +0200895 &selected_candidate_pair_changes)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700896// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700897
Yves Gerey665174f2018-06-19 15:03:05 +0200898RTCTransportStats::RTCTransportStats(const std::string& id,
899 int64_t timestamp_us)
900 : RTCTransportStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700901
Yves Gerey665174f2018-06-19 15:03:05 +0200902RTCTransportStats::RTCTransportStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700903 : RTCStats(std::move(id), timestamp_us),
904 bytes_sent("bytesSent"),
905 bytes_received("bytesReceived"),
906 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800907 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700908 selected_candidate_pair_id("selectedCandidatePairId"),
909 local_certificate_id("localCertificateId"),
Jonas Oreland149dc722019-08-28 08:10:27 +0200910 remote_certificate_id("remoteCertificateId"),
Harald Alvestrand5cb78072019-10-28 09:51:17 +0100911 tls_version("tlsVersion"),
912 dtls_cipher("dtlsCipher"),
913 srtp_cipher("srtpCipher"),
Jonas Oreland149dc722019-08-28 08:10:27 +0200914 selected_candidate_pair_changes("selectedCandidatePairChanges") {}
hbos2fa7c672016-10-24 04:00:05 -0700915
Yves Gerey665174f2018-06-19 15:03:05 +0200916RTCTransportStats::RTCTransportStats(const RTCTransportStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700917 : RTCStats(other.id(), other.timestamp_us()),
918 bytes_sent(other.bytes_sent),
919 bytes_received(other.bytes_received),
920 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800921 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700922 selected_candidate_pair_id(other.selected_candidate_pair_id),
923 local_certificate_id(other.local_certificate_id),
Jonas Oreland149dc722019-08-28 08:10:27 +0200924 remote_certificate_id(other.remote_certificate_id),
Harald Alvestrand5cb78072019-10-28 09:51:17 +0100925 tls_version(other.tls_version),
926 dtls_cipher(other.dtls_cipher),
927 srtp_cipher(other.srtp_cipher),
Jonas Oreland149dc722019-08-28 08:10:27 +0200928 selected_candidate_pair_changes(other.selected_candidate_pair_changes) {}
hbos2fa7c672016-10-24 04:00:05 -0700929
Yves Gerey665174f2018-06-19 15:03:05 +0200930RTCTransportStats::~RTCTransportStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700931
hbosd565b732016-08-30 14:04:35 -0700932} // namespace webrtc