blob: 1037077e0ca74db572791f77015444e32d2dd187 [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,
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,
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200601 &header_bytes_received,
hboseeafe942016-11-01 03:00:17 -0700602 &packets_lost,
Henrik Boström01738c62019-04-15 17:32:00 +0200603 &last_packet_received_timestamp,
hboseeafe942016-11-01 03:00:17 -0700604 &jitter,
hbosa7a9be12017-03-01 01:02:45 -0800605 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700606 &packets_discarded,
607 &packets_repaired,
608 &burst_packets_lost,
609 &burst_packets_discarded,
610 &burst_loss_count,
611 &burst_discard_count,
612 &burst_loss_rate,
613 &burst_discard_rate,
614 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800615 &gap_discard_rate,
Henrik Boström2e069262019-04-09 13:59:31 +0200616 &frames_decoded,
Rasmus Brandt2efae772019-06-27 14:29:34 +0200617 &key_frames_decoded,
Johannes Kronbfd343b2019-07-01 10:07:50 +0200618 &total_decode_time,
Henrik Boström6b430862019-08-16 13:09:51 +0200619 &content_type,
Åsa Perssonfcf79cc2019-10-22 15:23:44 +0200620 &estimated_playout_timestamp,
Henrik Boström6b430862019-08-16 13:09:51 +0200621 &decoder_implementation)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700622// clang-format on
hboseeafe942016-11-01 03:00:17 -0700623
Yves Gerey665174f2018-06-19 15:03:05 +0200624RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id,
625 int64_t timestamp_us)
626 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {}
hboseeafe942016-11-01 03:00:17 -0700627
Yves Gerey665174f2018-06-19 15:03:05 +0200628RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
629 int64_t timestamp_us)
hboseeafe942016-11-01 03:00:17 -0700630 : RTCRTPStreamStats(std::move(id), timestamp_us),
631 packets_received("packetsReceived"),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200632 fec_packets_received("fecPacketsReceived"),
633 fec_packets_discarded("fecPacketsDiscarded"),
hboseeafe942016-11-01 03:00:17 -0700634 bytes_received("bytesReceived"),
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200635 header_bytes_received("headerBytesReceived"),
hboseeafe942016-11-01 03:00:17 -0700636 packets_lost("packetsLost"),
Henrik Boström01738c62019-04-15 17:32:00 +0200637 last_packet_received_timestamp("lastPacketReceivedTimestamp"),
hboseeafe942016-11-01 03:00:17 -0700638 jitter("jitter"),
hbosa7a9be12017-03-01 01:02:45 -0800639 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700640 packets_discarded("packetsDiscarded"),
641 packets_repaired("packetsRepaired"),
642 burst_packets_lost("burstPacketsLost"),
643 burst_packets_discarded("burstPacketsDiscarded"),
644 burst_loss_count("burstLossCount"),
645 burst_discard_count("burstDiscardCount"),
646 burst_loss_rate("burstLossRate"),
647 burst_discard_rate("burstDiscardRate"),
648 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800649 gap_discard_rate("gapDiscardRate"),
Henrik Boström2e069262019-04-09 13:59:31 +0200650 frames_decoded("framesDecoded"),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200651 key_frames_decoded("keyFramesDecoded"),
Johannes Kronbfd343b2019-07-01 10:07:50 +0200652 total_decode_time("totalDecodeTime"),
Henrik Boström6b430862019-08-16 13:09:51 +0200653 content_type("contentType"),
Åsa Perssonfcf79cc2019-10-22 15:23:44 +0200654 estimated_playout_timestamp("estimatedPlayoutTimestamp"),
Henrik Boström6b430862019-08-16 13:09:51 +0200655 decoder_implementation("decoderImplementation") {}
hboseeafe942016-11-01 03:00:17 -0700656
657RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
658 const RTCInboundRTPStreamStats& other)
659 : RTCRTPStreamStats(other),
660 packets_received(other.packets_received),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200661 fec_packets_received(other.fec_packets_received),
662 fec_packets_discarded(other.fec_packets_discarded),
hboseeafe942016-11-01 03:00:17 -0700663 bytes_received(other.bytes_received),
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200664 header_bytes_received(other.header_bytes_received),
hboseeafe942016-11-01 03:00:17 -0700665 packets_lost(other.packets_lost),
Henrik Boström01738c62019-04-15 17:32:00 +0200666 last_packet_received_timestamp(other.last_packet_received_timestamp),
hboseeafe942016-11-01 03:00:17 -0700667 jitter(other.jitter),
hbosa7a9be12017-03-01 01:02:45 -0800668 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700669 packets_discarded(other.packets_discarded),
670 packets_repaired(other.packets_repaired),
671 burst_packets_lost(other.burst_packets_lost),
672 burst_packets_discarded(other.burst_packets_discarded),
673 burst_loss_count(other.burst_loss_count),
674 burst_discard_count(other.burst_discard_count),
675 burst_loss_rate(other.burst_loss_rate),
676 burst_discard_rate(other.burst_discard_rate),
677 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800678 gap_discard_rate(other.gap_discard_rate),
Henrik Boström2e069262019-04-09 13:59:31 +0200679 frames_decoded(other.frames_decoded),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200680 key_frames_decoded(other.key_frames_decoded),
Johannes Kronbfd343b2019-07-01 10:07:50 +0200681 total_decode_time(other.total_decode_time),
Henrik Boström6b430862019-08-16 13:09:51 +0200682 content_type(other.content_type),
Åsa Perssonfcf79cc2019-10-22 15:23:44 +0200683 estimated_playout_timestamp(other.estimated_playout_timestamp),
Henrik Boström6b430862019-08-16 13:09:51 +0200684 decoder_implementation(other.decoder_implementation) {}
hboseeafe942016-11-01 03:00:17 -0700685
Yves Gerey665174f2018-06-19 15:03:05 +0200686RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {}
hboseeafe942016-11-01 03:00:17 -0700687
Steve Antond6a5cbd2017-08-18 09:40:25 -0700688// clang-format off
hboseeafe942016-11-01 03:00:17 -0700689WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700690 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
Henrik Boström646fda02019-05-22 15:49:42 +0200691 &media_source_id,
hbos6ded1902016-11-01 01:50:46 -0700692 &packets_sent,
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200693 &retransmitted_packets_sent,
hbos6ded1902016-11-01 01:50:46 -0700694 &bytes_sent,
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200695 &header_bytes_sent,
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200696 &retransmitted_bytes_sent,
hbos6ded1902016-11-01 01:50:46 -0700697 &target_bitrate,
Henrik Boströmf71362f2019-04-08 16:14:23 +0200698 &frames_encoded,
Rasmus Brandt2efae772019-06-27 14:29:34 +0200699 &key_frames_encoded,
Henrik Boström2e069262019-04-09 13:59:31 +0200700 &total_encode_time,
Henrik Boström23aff9b2019-05-20 15:15:38 +0200701 &total_encoded_bytes_target,
Henrik Boström9fe18342019-05-16 18:38:20 +0200702 &total_packet_send_delay,
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200703 &quality_limitation_reason,
Evan Shrubsolecc62b162019-09-09 11:26:45 +0200704 &quality_limitation_resolution_changes,
Henrik Boström6b430862019-08-16 13:09:51 +0200705 &content_type,
706 &encoder_implementation)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700707// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700708
Yves Gerey665174f2018-06-19 15:03:05 +0200709RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(const std::string& id,
710 int64_t timestamp_us)
711 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700712
Yves Gerey665174f2018-06-19 15:03:05 +0200713RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id,
714 int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700715 : RTCRTPStreamStats(std::move(id), timestamp_us),
Henrik Boström646fda02019-05-22 15:49:42 +0200716 media_source_id("mediaSourceId"),
hbos6ded1902016-11-01 01:50:46 -0700717 packets_sent("packetsSent"),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200718 retransmitted_packets_sent("retransmittedPacketsSent"),
hbos6ded1902016-11-01 01:50:46 -0700719 bytes_sent("bytesSent"),
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200720 header_bytes_sent("headerBytesSent"),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200721 retransmitted_bytes_sent("retransmittedBytesSent"),
hbos6ded1902016-11-01 01:50:46 -0700722 target_bitrate("targetBitrate"),
Henrik Boströmf71362f2019-04-08 16:14:23 +0200723 frames_encoded("framesEncoded"),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200724 key_frames_encoded("keyFramesEncoded"),
Henrik Boström2e069262019-04-09 13:59:31 +0200725 total_encode_time("totalEncodeTime"),
Henrik Boström23aff9b2019-05-20 15:15:38 +0200726 total_encoded_bytes_target("totalEncodedBytesTarget"),
Henrik Boström9fe18342019-05-16 18:38:20 +0200727 total_packet_send_delay("totalPacketSendDelay"),
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200728 quality_limitation_reason("qualityLimitationReason"),
Evan Shrubsolecc62b162019-09-09 11:26:45 +0200729 quality_limitation_resolution_changes(
730 "qualityLimitationResolutionChanges"),
Henrik Boström6b430862019-08-16 13:09:51 +0200731 content_type("contentType"),
732 encoder_implementation("encoderImplementation") {}
hbos6ded1902016-11-01 01:50:46 -0700733
734RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
735 const RTCOutboundRTPStreamStats& other)
736 : RTCRTPStreamStats(other),
Henrik Boström646fda02019-05-22 15:49:42 +0200737 media_source_id(other.media_source_id),
hbos6ded1902016-11-01 01:50:46 -0700738 packets_sent(other.packets_sent),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200739 retransmitted_packets_sent(other.retransmitted_packets_sent),
hbos6ded1902016-11-01 01:50:46 -0700740 bytes_sent(other.bytes_sent),
Niels Möllerac0a4cb2019-10-09 15:01:33 +0200741 header_bytes_sent(other.header_bytes_sent),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200742 retransmitted_bytes_sent(other.retransmitted_bytes_sent),
hbos6ded1902016-11-01 01:50:46 -0700743 target_bitrate(other.target_bitrate),
Henrik Boströmf71362f2019-04-08 16:14:23 +0200744 frames_encoded(other.frames_encoded),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200745 key_frames_encoded(other.key_frames_encoded),
Henrik Boström2e069262019-04-09 13:59:31 +0200746 total_encode_time(other.total_encode_time),
Henrik Boström23aff9b2019-05-20 15:15:38 +0200747 total_encoded_bytes_target(other.total_encoded_bytes_target),
Henrik Boström9fe18342019-05-16 18:38:20 +0200748 total_packet_send_delay(other.total_packet_send_delay),
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200749 quality_limitation_reason(other.quality_limitation_reason),
Evan Shrubsolecc62b162019-09-09 11:26:45 +0200750 quality_limitation_resolution_changes(
751 other.quality_limitation_resolution_changes),
Henrik Boström6b430862019-08-16 13:09:51 +0200752 content_type(other.content_type),
753 encoder_implementation(other.encoder_implementation) {}
hbos6ded1902016-11-01 01:50:46 -0700754
Yves Gerey665174f2018-06-19 15:03:05 +0200755RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700756
Steve Antond6a5cbd2017-08-18 09:40:25 -0700757// clang-format off
Henrik Boström883eefc2019-05-27 13:40:25 +0200758WEBRTC_RTCSTATS_IMPL(
759 RTCRemoteInboundRtpStreamStats, RTCStats, "remote-inbound-rtp",
760 &ssrc,
761 &kind,
762 &transport_id,
763 &codec_id,
764 &packets_lost,
765 &jitter,
766 &local_id,
767 &round_trip_time)
768// clang-format on
769
770RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
771 const std::string& id,
772 int64_t timestamp_us)
773 : RTCRemoteInboundRtpStreamStats(std::string(id), timestamp_us) {}
774
775RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
776 std::string&& id,
777 int64_t timestamp_us)
778 : RTCStats(std::move(id), timestamp_us),
779 ssrc("ssrc"),
780 kind("kind"),
781 transport_id("transportId"),
782 codec_id("codecId"),
783 packets_lost("packetsLost"),
784 jitter("jitter"),
785 local_id("localId"),
786 round_trip_time("roundTripTime") {}
787
788RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
789 const RTCRemoteInboundRtpStreamStats& other)
790 : RTCStats(other),
791 ssrc(other.ssrc),
792 kind(other.kind),
793 transport_id(other.transport_id),
794 codec_id(other.codec_id),
795 packets_lost(other.packets_lost),
796 jitter(other.jitter),
797 local_id(other.local_id),
798 round_trip_time(other.round_trip_time) {}
799
800RTCRemoteInboundRtpStreamStats::~RTCRemoteInboundRtpStreamStats() {}
801
802// clang-format off
Henrik Boström646fda02019-05-22 15:49:42 +0200803WEBRTC_RTCSTATS_IMPL(RTCMediaSourceStats, RTCStats, "parent-media-source",
804 &track_identifier,
805 &kind)
806// clang-format on
807
808RTCMediaSourceStats::RTCMediaSourceStats(const std::string& id,
809 int64_t timestamp_us)
810 : RTCMediaSourceStats(std::string(id), timestamp_us) {}
811
812RTCMediaSourceStats::RTCMediaSourceStats(std::string&& id, int64_t timestamp_us)
813 : RTCStats(std::move(id), timestamp_us),
814 track_identifier("trackIdentifier"),
815 kind("kind") {}
816
817RTCMediaSourceStats::RTCMediaSourceStats(const RTCMediaSourceStats& other)
818 : RTCStats(other.id(), other.timestamp_us()),
819 track_identifier(other.track_identifier),
820 kind(other.kind) {}
821
822RTCMediaSourceStats::~RTCMediaSourceStats() {}
823
824// clang-format off
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200825WEBRTC_RTCSTATS_IMPL(RTCAudioSourceStats, RTCMediaSourceStats, "media-source",
826 &audio_level,
827 &total_audio_energy,
828 &total_samples_duration)
Henrik Boström646fda02019-05-22 15:49:42 +0200829// clang-format on
830
831RTCAudioSourceStats::RTCAudioSourceStats(const std::string& id,
832 int64_t timestamp_us)
833 : RTCAudioSourceStats(std::string(id), timestamp_us) {}
834
835RTCAudioSourceStats::RTCAudioSourceStats(std::string&& id, int64_t timestamp_us)
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200836 : RTCMediaSourceStats(std::move(id), timestamp_us),
837 audio_level("audioLevel"),
838 total_audio_energy("totalAudioEnergy"),
839 total_samples_duration("totalSamplesDuration") {}
Henrik Boström646fda02019-05-22 15:49:42 +0200840
841RTCAudioSourceStats::RTCAudioSourceStats(const RTCAudioSourceStats& other)
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200842 : RTCMediaSourceStats(other),
843 audio_level(other.audio_level),
844 total_audio_energy(other.total_audio_energy),
845 total_samples_duration(other.total_samples_duration) {}
Henrik Boström646fda02019-05-22 15:49:42 +0200846
847RTCAudioSourceStats::~RTCAudioSourceStats() {}
848
849// clang-format off
850WEBRTC_RTCSTATS_IMPL(RTCVideoSourceStats, RTCMediaSourceStats, "media-source",
851 &width,
852 &height,
853 &frames,
854 &frames_per_second)
855// clang-format on
856
857RTCVideoSourceStats::RTCVideoSourceStats(const std::string& id,
858 int64_t timestamp_us)
859 : RTCVideoSourceStats(std::string(id), timestamp_us) {}
860
861RTCVideoSourceStats::RTCVideoSourceStats(std::string&& id, int64_t timestamp_us)
862 : RTCMediaSourceStats(std::move(id), timestamp_us),
863 width("width"),
864 height("height"),
865 frames("frames"),
866 frames_per_second("framesPerSecond") {}
867
868RTCVideoSourceStats::RTCVideoSourceStats(const RTCVideoSourceStats& other)
869 : RTCMediaSourceStats(other),
870 width(other.width),
871 height(other.height),
872 frames(other.frames),
873 frames_per_second(other.frames_per_second) {}
874
875RTCVideoSourceStats::~RTCVideoSourceStats() {}
876
877// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700878WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
879 &bytes_sent,
880 &bytes_received,
881 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800882 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700883 &selected_candidate_pair_id,
884 &local_certificate_id,
Jonas Oreland149dc722019-08-28 08:10:27 +0200885 &remote_certificate_id,
Harald Alvestrand5cb78072019-10-28 09:51:17 +0100886 &tls_version,
887 &dtls_cipher,
888 &srtp_cipher,
Jonas Oreland149dc722019-08-28 08:10:27 +0200889 &selected_candidate_pair_changes)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700890// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700891
Yves Gerey665174f2018-06-19 15:03:05 +0200892RTCTransportStats::RTCTransportStats(const std::string& id,
893 int64_t timestamp_us)
894 : RTCTransportStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700895
Yves Gerey665174f2018-06-19 15:03:05 +0200896RTCTransportStats::RTCTransportStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700897 : RTCStats(std::move(id), timestamp_us),
898 bytes_sent("bytesSent"),
899 bytes_received("bytesReceived"),
900 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800901 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700902 selected_candidate_pair_id("selectedCandidatePairId"),
903 local_certificate_id("localCertificateId"),
Jonas Oreland149dc722019-08-28 08:10:27 +0200904 remote_certificate_id("remoteCertificateId"),
Harald Alvestrand5cb78072019-10-28 09:51:17 +0100905 tls_version("tlsVersion"),
906 dtls_cipher("dtlsCipher"),
907 srtp_cipher("srtpCipher"),
Jonas Oreland149dc722019-08-28 08:10:27 +0200908 selected_candidate_pair_changes("selectedCandidatePairChanges") {}
hbos2fa7c672016-10-24 04:00:05 -0700909
Yves Gerey665174f2018-06-19 15:03:05 +0200910RTCTransportStats::RTCTransportStats(const RTCTransportStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700911 : RTCStats(other.id(), other.timestamp_us()),
912 bytes_sent(other.bytes_sent),
913 bytes_received(other.bytes_received),
914 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800915 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700916 selected_candidate_pair_id(other.selected_candidate_pair_id),
917 local_certificate_id(other.local_certificate_id),
Jonas Oreland149dc722019-08-28 08:10:27 +0200918 remote_certificate_id(other.remote_certificate_id),
Harald Alvestrand5cb78072019-10-28 09:51:17 +0100919 tls_version(other.tls_version),
920 dtls_cipher(other.dtls_cipher),
921 srtp_cipher(other.srtp_cipher),
Jonas Oreland149dc722019-08-28 08:10:27 +0200922 selected_candidate_pair_changes(other.selected_candidate_pair_changes) {}
hbos2fa7c672016-10-24 04:00:05 -0700923
Yves Gerey665174f2018-06-19 15:03:05 +0200924RTCTransportStats::~RTCTransportStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700925
hbosd565b732016-08-30 14:04:35 -0700926} // namespace webrtc