blob: ead0ebfb66ae6af74c2198b19be31b0a68e80723 [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,
Ruslan Burakov8af88962018-11-22 17:21:10 +0100391 &concealment_events,
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100392 &jitter_buffer_flushes,
Sergey Silkin02371062019-01-31 16:45:42 +0100393 &delayed_packet_outage_samples,
Jakob Ivarsson232b3fd2019-03-06 09:18:40 +0100394 &relative_packet_arrival_delay,
Henrik Lundin44125fa2019-04-29 17:00:46 +0200395 &interruption_count,
396 &total_interruption_duration,
Sergey Silkin02371062019-01-31 16:45:42 +0100397 &freeze_count,
398 &pause_count,
399 &total_freezes_duration,
400 &total_pauses_duration,
401 &total_frames_duration,
Nico Weber22f99252019-02-20 10:13:16 -0500402 &sum_squared_frame_durations)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700403// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800404
Yves Gerey665174f2018-06-19 15:03:05 +0200405RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(const std::string& id,
406 int64_t timestamp_us,
407 const char* kind)
408 : RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) {}
hbos09bc1282016-11-08 06:29:22 -0800409
zsteine76bd3a2017-07-14 12:17:49 -0700410RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(std::string&& id,
411 int64_t timestamp_us,
412 const char* kind)
hbos09bc1282016-11-08 06:29:22 -0800413 : RTCStats(std::move(id), timestamp_us),
414 track_identifier("trackIdentifier"),
Henrik Boström646fda02019-05-22 15:49:42 +0200415 media_source_id("mediaSourceId"),
hbos09bc1282016-11-08 06:29:22 -0800416 remote_source("remoteSource"),
417 ended("ended"),
418 detached("detached"),
hbos160e4a72017-01-17 02:53:23 -0800419 kind("kind", kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200420 jitter_buffer_delay("jitterBufferDelay"),
Chen Xing0acffb52019-01-15 15:46:29 +0100421 jitter_buffer_emitted_count("jitterBufferEmittedCount"),
hbos09bc1282016-11-08 06:29:22 -0800422 frame_width("frameWidth"),
423 frame_height("frameHeight"),
424 frames_per_second("framesPerSecond"),
425 frames_sent("framesSent"),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100426 huge_frames_sent("hugeFramesSent"),
hbos09bc1282016-11-08 06:29:22 -0800427 frames_received("framesReceived"),
428 frames_decoded("framesDecoded"),
429 frames_dropped("framesDropped"),
430 frames_corrupted("framesCorrupted"),
431 partial_frames_lost("partialFramesLost"),
432 full_frames_lost("fullFramesLost"),
433 audio_level("audioLevel"),
zsteine76bd3a2017-07-14 12:17:49 -0700434 total_audio_energy("totalAudioEnergy"),
hbos09bc1282016-11-08 06:29:22 -0800435 echo_return_loss("echoReturnLoss"),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700436 echo_return_loss_enhancement("echoReturnLossEnhancement"),
437 total_samples_received("totalSamplesReceived"),
438 total_samples_duration("totalSamplesDuration"),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200439 concealed_samples("concealedSamples"),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200440 silent_concealed_samples("silentConcealedSamples"),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100441 concealment_events("concealmentEvents"),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200442 inserted_samples_for_deceleration("insertedSamplesForDeceleration"),
443 removed_samples_for_acceleration("removedSamplesForAcceleration"),
Jakob Ivarsson758d9462019-03-19 15:38:49 +0100444 jitter_buffer_flushes(
445 "jitterBufferFlushes",
446 {NonStandardGroupId::kRtcAudioJitterBufferMaxPackets}),
447 delayed_packet_outage_samples(
448 "delayedPacketOutageSamples",
449 {NonStandardGroupId::kRtcAudioJitterBufferMaxPackets,
450 NonStandardGroupId::kRtcStatsRelativePacketArrivalDelay}),
451 relative_packet_arrival_delay(
452 "relativePacketArrivalDelay",
453 {NonStandardGroupId::kRtcStatsRelativePacketArrivalDelay}),
Henrik Lundin44125fa2019-04-29 17:00:46 +0200454 interruption_count("interruptionCount"),
455 total_interruption_duration("totalInterruptionDuration"),
Sergey Silkin02371062019-01-31 16:45:42 +0100456 freeze_count("freezeCount"),
457 pause_count("pauseCount"),
458 total_freezes_duration("totalFreezesDuration"),
459 total_pauses_duration("totalPausesDuration"),
460 total_frames_duration("totalFramesDuration"),
461 sum_squared_frame_durations("sumOfSquaredFramesDuration") {
hbos160e4a72017-01-17 02:53:23 -0800462 RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
463 kind == RTCMediaStreamTrackKind::kVideo);
hbos09bc1282016-11-08 06:29:22 -0800464}
465
466RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
467 const RTCMediaStreamTrackStats& other)
468 : RTCStats(other.id(), other.timestamp_us()),
469 track_identifier(other.track_identifier),
Henrik Boström646fda02019-05-22 15:49:42 +0200470 media_source_id(other.media_source_id),
hbos09bc1282016-11-08 06:29:22 -0800471 remote_source(other.remote_source),
472 ended(other.ended),
473 detached(other.detached),
hbos160e4a72017-01-17 02:53:23 -0800474 kind(other.kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200475 jitter_buffer_delay(other.jitter_buffer_delay),
Chen Xing0acffb52019-01-15 15:46:29 +0100476 jitter_buffer_emitted_count(other.jitter_buffer_emitted_count),
hbos09bc1282016-11-08 06:29:22 -0800477 frame_width(other.frame_width),
478 frame_height(other.frame_height),
479 frames_per_second(other.frames_per_second),
480 frames_sent(other.frames_sent),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100481 huge_frames_sent(other.huge_frames_sent),
hbos09bc1282016-11-08 06:29:22 -0800482 frames_received(other.frames_received),
483 frames_decoded(other.frames_decoded),
484 frames_dropped(other.frames_dropped),
485 frames_corrupted(other.frames_corrupted),
486 partial_frames_lost(other.partial_frames_lost),
487 full_frames_lost(other.full_frames_lost),
488 audio_level(other.audio_level),
zsteine76bd3a2017-07-14 12:17:49 -0700489 total_audio_energy(other.total_audio_energy),
hbos09bc1282016-11-08 06:29:22 -0800490 echo_return_loss(other.echo_return_loss),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700491 echo_return_loss_enhancement(other.echo_return_loss_enhancement),
492 total_samples_received(other.total_samples_received),
493 total_samples_duration(other.total_samples_duration),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200494 concealed_samples(other.concealed_samples),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200495 silent_concealed_samples(other.silent_concealed_samples),
Ruslan Burakov8af88962018-11-22 17:21:10 +0100496 concealment_events(other.concealment_events),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200497 inserted_samples_for_deceleration(
498 other.inserted_samples_for_deceleration),
499 removed_samples_for_acceleration(other.removed_samples_for_acceleration),
Jakob Ivarsson352ce5c2018-11-27 12:52:16 +0100500 jitter_buffer_flushes(other.jitter_buffer_flushes),
Sergey Silkin02371062019-01-31 16:45:42 +0100501 delayed_packet_outage_samples(other.delayed_packet_outage_samples),
Jakob Ivarsson232b3fd2019-03-06 09:18:40 +0100502 relative_packet_arrival_delay(other.relative_packet_arrival_delay),
Henrik Lundin44125fa2019-04-29 17:00:46 +0200503 interruption_count(other.interruption_count),
504 total_interruption_duration(other.total_interruption_duration),
Sergey Silkin02371062019-01-31 16:45:42 +0100505 freeze_count(other.freeze_count),
506 pause_count(other.pause_count),
507 total_freezes_duration(other.total_freezes_duration),
508 total_pauses_duration(other.total_pauses_duration),
509 total_frames_duration(other.total_frames_duration),
510 sum_squared_frame_durations(other.sum_squared_frame_durations) {}
hbos09bc1282016-11-08 06:29:22 -0800511
Yves Gerey665174f2018-06-19 15:03:05 +0200512RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {}
hbos09bc1282016-11-08 06:29:22 -0800513
Steve Antond6a5cbd2017-08-18 09:40:25 -0700514// clang-format off
hbosfc5e0502016-10-06 02:06:10 -0700515WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
516 &data_channels_opened,
Nico Weber22f99252019-02-20 10:13:16 -0500517 &data_channels_closed)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700518// clang-format on
hbosd565b732016-08-30 14:04:35 -0700519
Yves Gerey665174f2018-06-19 15:03:05 +0200520RTCPeerConnectionStats::RTCPeerConnectionStats(const std::string& id,
521 int64_t timestamp_us)
522 : RTCPeerConnectionStats(std::string(id), timestamp_us) {}
hbosd565b732016-08-30 14:04:35 -0700523
Yves Gerey665174f2018-06-19 15:03:05 +0200524RTCPeerConnectionStats::RTCPeerConnectionStats(std::string&& id,
525 int64_t timestamp_us)
hbos0e6758d2016-08-31 07:57:36 -0700526 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700527 data_channels_opened("dataChannelsOpened"),
Yves Gerey665174f2018-06-19 15:03:05 +0200528 data_channels_closed("dataChannelsClosed") {}
hbosd565b732016-08-30 14:04:35 -0700529
hbosfc5e0502016-10-06 02:06:10 -0700530RTCPeerConnectionStats::RTCPeerConnectionStats(
531 const RTCPeerConnectionStats& other)
532 : RTCStats(other.id(), other.timestamp_us()),
533 data_channels_opened(other.data_channels_opened),
Yves Gerey665174f2018-06-19 15:03:05 +0200534 data_channels_closed(other.data_channels_closed) {}
hbosfc5e0502016-10-06 02:06:10 -0700535
Yves Gerey665174f2018-06-19 15:03:05 +0200536RTCPeerConnectionStats::~RTCPeerConnectionStats() {}
hbosfc5e0502016-10-06 02:06:10 -0700537
Steve Antond6a5cbd2017-08-18 09:40:25 -0700538// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700539WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
540 &ssrc,
541 &associate_stats_id,
542 &is_remote,
543 &media_type,
Philipp Hancke3bc01662018-08-28 14:55:03 +0200544 &kind,
hbosb0ae9202017-01-27 06:35:16 -0800545 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700546 &transport_id,
547 &codec_id,
548 &fir_count,
549 &pli_count,
550 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800551 &sli_count,
Nico Weber22f99252019-02-20 10:13:16 -0500552 &qp_sum)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700553// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700554
Yves Gerey665174f2018-06-19 15:03:05 +0200555RTCRTPStreamStats::RTCRTPStreamStats(const std::string& id,
556 int64_t timestamp_us)
557 : RTCRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700558
Yves Gerey665174f2018-06-19 15:03:05 +0200559RTCRTPStreamStats::RTCRTPStreamStats(std::string&& id, int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700560 : RTCStats(std::move(id), timestamp_us),
561 ssrc("ssrc"),
562 associate_stats_id("associateStatsId"),
563 is_remote("isRemote", false),
564 media_type("mediaType"),
Philipp Hancke3bc01662018-08-28 14:55:03 +0200565 kind("kind"),
hbosb0ae9202017-01-27 06:35:16 -0800566 track_id("trackId"),
hbos6ded1902016-11-01 01:50:46 -0700567 transport_id("transportId"),
568 codec_id("codecId"),
569 fir_count("firCount"),
570 pli_count("pliCount"),
571 nack_count("nackCount"),
hbos6769c492017-01-02 08:35:13 -0800572 sli_count("sliCount"),
Yves Gerey665174f2018-06-19 15:03:05 +0200573 qp_sum("qpSum") {}
hbos6ded1902016-11-01 01:50:46 -0700574
Yves Gerey665174f2018-06-19 15:03:05 +0200575RTCRTPStreamStats::RTCRTPStreamStats(const RTCRTPStreamStats& other)
hbos6ded1902016-11-01 01:50:46 -0700576 : RTCStats(other.id(), other.timestamp_us()),
577 ssrc(other.ssrc),
578 associate_stats_id(other.associate_stats_id),
579 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,
598 &packets_lost,
Henrik Boström01738c62019-04-15 17:32:00 +0200599 &last_packet_received_timestamp,
hboseeafe942016-11-01 03:00:17 -0700600 &jitter,
hbosa7a9be12017-03-01 01:02:45 -0800601 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700602 &packets_discarded,
603 &packets_repaired,
604 &burst_packets_lost,
605 &burst_packets_discarded,
606 &burst_loss_count,
607 &burst_discard_count,
608 &burst_loss_rate,
609 &burst_discard_rate,
610 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800611 &gap_discard_rate,
Henrik Boström2e069262019-04-09 13:59:31 +0200612 &frames_decoded,
Rasmus Brandt2efae772019-06-27 14:29:34 +0200613 &key_frames_decoded,
Johannes Kronbfd343b2019-07-01 10:07:50 +0200614 &total_decode_time,
Henrik Boström6b430862019-08-16 13:09:51 +0200615 &content_type,
616 &decoder_implementation)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700617// clang-format on
hboseeafe942016-11-01 03:00:17 -0700618
Yves Gerey665174f2018-06-19 15:03:05 +0200619RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id,
620 int64_t timestamp_us)
621 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {}
hboseeafe942016-11-01 03:00:17 -0700622
Yves Gerey665174f2018-06-19 15:03:05 +0200623RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
624 int64_t timestamp_us)
hboseeafe942016-11-01 03:00:17 -0700625 : RTCRTPStreamStats(std::move(id), timestamp_us),
626 packets_received("packetsReceived"),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200627 fec_packets_received("fecPacketsReceived"),
628 fec_packets_discarded("fecPacketsDiscarded"),
hboseeafe942016-11-01 03:00:17 -0700629 bytes_received("bytesReceived"),
630 packets_lost("packetsLost"),
Henrik Boström01738c62019-04-15 17:32:00 +0200631 last_packet_received_timestamp("lastPacketReceivedTimestamp"),
hboseeafe942016-11-01 03:00:17 -0700632 jitter("jitter"),
hbosa7a9be12017-03-01 01:02:45 -0800633 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700634 packets_discarded("packetsDiscarded"),
635 packets_repaired("packetsRepaired"),
636 burst_packets_lost("burstPacketsLost"),
637 burst_packets_discarded("burstPacketsDiscarded"),
638 burst_loss_count("burstLossCount"),
639 burst_discard_count("burstDiscardCount"),
640 burst_loss_rate("burstLossRate"),
641 burst_discard_rate("burstDiscardRate"),
642 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800643 gap_discard_rate("gapDiscardRate"),
Henrik Boström2e069262019-04-09 13:59:31 +0200644 frames_decoded("framesDecoded"),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200645 key_frames_decoded("keyFramesDecoded"),
Johannes Kronbfd343b2019-07-01 10:07:50 +0200646 total_decode_time("totalDecodeTime"),
Henrik Boström6b430862019-08-16 13:09:51 +0200647 content_type("contentType"),
648 decoder_implementation("decoderImplementation") {}
hboseeafe942016-11-01 03:00:17 -0700649
650RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
651 const RTCInboundRTPStreamStats& other)
652 : RTCRTPStreamStats(other),
653 packets_received(other.packets_received),
Ivo Creusen8d8ffdb2019-04-30 09:45:21 +0200654 fec_packets_received(other.fec_packets_received),
655 fec_packets_discarded(other.fec_packets_discarded),
hboseeafe942016-11-01 03:00:17 -0700656 bytes_received(other.bytes_received),
657 packets_lost(other.packets_lost),
Henrik Boström01738c62019-04-15 17:32:00 +0200658 last_packet_received_timestamp(other.last_packet_received_timestamp),
hboseeafe942016-11-01 03:00:17 -0700659 jitter(other.jitter),
hbosa7a9be12017-03-01 01:02:45 -0800660 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700661 packets_discarded(other.packets_discarded),
662 packets_repaired(other.packets_repaired),
663 burst_packets_lost(other.burst_packets_lost),
664 burst_packets_discarded(other.burst_packets_discarded),
665 burst_loss_count(other.burst_loss_count),
666 burst_discard_count(other.burst_discard_count),
667 burst_loss_rate(other.burst_loss_rate),
668 burst_discard_rate(other.burst_discard_rate),
669 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800670 gap_discard_rate(other.gap_discard_rate),
Henrik Boström2e069262019-04-09 13:59:31 +0200671 frames_decoded(other.frames_decoded),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200672 key_frames_decoded(other.key_frames_decoded),
Johannes Kronbfd343b2019-07-01 10:07:50 +0200673 total_decode_time(other.total_decode_time),
Henrik Boström6b430862019-08-16 13:09:51 +0200674 content_type(other.content_type),
675 decoder_implementation(other.decoder_implementation) {}
hboseeafe942016-11-01 03:00:17 -0700676
Yves Gerey665174f2018-06-19 15:03:05 +0200677RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {}
hboseeafe942016-11-01 03:00:17 -0700678
Steve Antond6a5cbd2017-08-18 09:40:25 -0700679// clang-format off
hboseeafe942016-11-01 03:00:17 -0700680WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700681 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
Henrik Boström646fda02019-05-22 15:49:42 +0200682 &media_source_id,
hbos6ded1902016-11-01 01:50:46 -0700683 &packets_sent,
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200684 &retransmitted_packets_sent,
hbos6ded1902016-11-01 01:50:46 -0700685 &bytes_sent,
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200686 &retransmitted_bytes_sent,
hbos6ded1902016-11-01 01:50:46 -0700687 &target_bitrate,
Henrik Boströmf71362f2019-04-08 16:14:23 +0200688 &frames_encoded,
Rasmus Brandt2efae772019-06-27 14:29:34 +0200689 &key_frames_encoded,
Henrik Boström2e069262019-04-09 13:59:31 +0200690 &total_encode_time,
Henrik Boström23aff9b2019-05-20 15:15:38 +0200691 &total_encoded_bytes_target,
Henrik Boström9fe18342019-05-16 18:38:20 +0200692 &total_packet_send_delay,
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200693 &quality_limitation_reason,
Henrik Boström6b430862019-08-16 13:09:51 +0200694 &content_type,
695 &encoder_implementation)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700696// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700697
Yves Gerey665174f2018-06-19 15:03:05 +0200698RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(const std::string& id,
699 int64_t timestamp_us)
700 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {}
hbos6ded1902016-11-01 01:50:46 -0700701
Yves Gerey665174f2018-06-19 15:03:05 +0200702RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id,
703 int64_t timestamp_us)
hbos6ded1902016-11-01 01:50:46 -0700704 : RTCRTPStreamStats(std::move(id), timestamp_us),
Henrik Boström646fda02019-05-22 15:49:42 +0200705 media_source_id("mediaSourceId"),
hbos6ded1902016-11-01 01:50:46 -0700706 packets_sent("packetsSent"),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200707 retransmitted_packets_sent("retransmittedPacketsSent"),
hbos6ded1902016-11-01 01:50:46 -0700708 bytes_sent("bytesSent"),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200709 retransmitted_bytes_sent("retransmittedBytesSent"),
hbos6ded1902016-11-01 01:50:46 -0700710 target_bitrate("targetBitrate"),
Henrik Boströmf71362f2019-04-08 16:14:23 +0200711 frames_encoded("framesEncoded"),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200712 key_frames_encoded("keyFramesEncoded"),
Henrik Boström2e069262019-04-09 13:59:31 +0200713 total_encode_time("totalEncodeTime"),
Henrik Boström23aff9b2019-05-20 15:15:38 +0200714 total_encoded_bytes_target("totalEncodedBytesTarget"),
Henrik Boström9fe18342019-05-16 18:38:20 +0200715 total_packet_send_delay("totalPacketSendDelay"),
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200716 quality_limitation_reason("qualityLimitationReason"),
Henrik Boström6b430862019-08-16 13:09:51 +0200717 content_type("contentType"),
718 encoder_implementation("encoderImplementation") {}
hbos6ded1902016-11-01 01:50:46 -0700719
720RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
721 const RTCOutboundRTPStreamStats& other)
722 : RTCRTPStreamStats(other),
Henrik Boström646fda02019-05-22 15:49:42 +0200723 media_source_id(other.media_source_id),
hbos6ded1902016-11-01 01:50:46 -0700724 packets_sent(other.packets_sent),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200725 retransmitted_packets_sent(other.retransmitted_packets_sent),
hbos6ded1902016-11-01 01:50:46 -0700726 bytes_sent(other.bytes_sent),
Henrik Boströmcf96e0f2019-04-17 13:51:53 +0200727 retransmitted_bytes_sent(other.retransmitted_bytes_sent),
hbos6ded1902016-11-01 01:50:46 -0700728 target_bitrate(other.target_bitrate),
Henrik Boströmf71362f2019-04-08 16:14:23 +0200729 frames_encoded(other.frames_encoded),
Rasmus Brandt2efae772019-06-27 14:29:34 +0200730 key_frames_encoded(other.key_frames_encoded),
Henrik Boström2e069262019-04-09 13:59:31 +0200731 total_encode_time(other.total_encode_time),
Henrik Boström23aff9b2019-05-20 15:15:38 +0200732 total_encoded_bytes_target(other.total_encoded_bytes_target),
Henrik Boström9fe18342019-05-16 18:38:20 +0200733 total_packet_send_delay(other.total_packet_send_delay),
Henrik Boströmce33b6a2019-05-28 17:42:38 +0200734 quality_limitation_reason(other.quality_limitation_reason),
Henrik Boström6b430862019-08-16 13:09:51 +0200735 content_type(other.content_type),
736 encoder_implementation(other.encoder_implementation) {}
hbos6ded1902016-11-01 01:50:46 -0700737
Yves Gerey665174f2018-06-19 15:03:05 +0200738RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {}
hbos6ded1902016-11-01 01:50:46 -0700739
Steve Antond6a5cbd2017-08-18 09:40:25 -0700740// clang-format off
Henrik Boström883eefc2019-05-27 13:40:25 +0200741WEBRTC_RTCSTATS_IMPL(
742 RTCRemoteInboundRtpStreamStats, RTCStats, "remote-inbound-rtp",
743 &ssrc,
744 &kind,
745 &transport_id,
746 &codec_id,
747 &packets_lost,
748 &jitter,
749 &local_id,
750 &round_trip_time)
751// clang-format on
752
753RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
754 const std::string& id,
755 int64_t timestamp_us)
756 : RTCRemoteInboundRtpStreamStats(std::string(id), timestamp_us) {}
757
758RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
759 std::string&& id,
760 int64_t timestamp_us)
761 : RTCStats(std::move(id), timestamp_us),
762 ssrc("ssrc"),
763 kind("kind"),
764 transport_id("transportId"),
765 codec_id("codecId"),
766 packets_lost("packetsLost"),
767 jitter("jitter"),
768 local_id("localId"),
769 round_trip_time("roundTripTime") {}
770
771RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
772 const RTCRemoteInboundRtpStreamStats& other)
773 : RTCStats(other),
774 ssrc(other.ssrc),
775 kind(other.kind),
776 transport_id(other.transport_id),
777 codec_id(other.codec_id),
778 packets_lost(other.packets_lost),
779 jitter(other.jitter),
780 local_id(other.local_id),
781 round_trip_time(other.round_trip_time) {}
782
783RTCRemoteInboundRtpStreamStats::~RTCRemoteInboundRtpStreamStats() {}
784
785// clang-format off
Henrik Boström646fda02019-05-22 15:49:42 +0200786WEBRTC_RTCSTATS_IMPL(RTCMediaSourceStats, RTCStats, "parent-media-source",
787 &track_identifier,
788 &kind)
789// clang-format on
790
791RTCMediaSourceStats::RTCMediaSourceStats(const std::string& id,
792 int64_t timestamp_us)
793 : RTCMediaSourceStats(std::string(id), timestamp_us) {}
794
795RTCMediaSourceStats::RTCMediaSourceStats(std::string&& id, int64_t timestamp_us)
796 : RTCStats(std::move(id), timestamp_us),
797 track_identifier("trackIdentifier"),
798 kind("kind") {}
799
800RTCMediaSourceStats::RTCMediaSourceStats(const RTCMediaSourceStats& other)
801 : RTCStats(other.id(), other.timestamp_us()),
802 track_identifier(other.track_identifier),
803 kind(other.kind) {}
804
805RTCMediaSourceStats::~RTCMediaSourceStats() {}
806
807// clang-format off
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200808WEBRTC_RTCSTATS_IMPL(RTCAudioSourceStats, RTCMediaSourceStats, "media-source",
809 &audio_level,
810 &total_audio_energy,
811 &total_samples_duration)
Henrik Boström646fda02019-05-22 15:49:42 +0200812// clang-format on
813
814RTCAudioSourceStats::RTCAudioSourceStats(const std::string& id,
815 int64_t timestamp_us)
816 : RTCAudioSourceStats(std::string(id), timestamp_us) {}
817
818RTCAudioSourceStats::RTCAudioSourceStats(std::string&& id, int64_t timestamp_us)
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200819 : RTCMediaSourceStats(std::move(id), timestamp_us),
820 audio_level("audioLevel"),
821 total_audio_energy("totalAudioEnergy"),
822 total_samples_duration("totalSamplesDuration") {}
Henrik Boström646fda02019-05-22 15:49:42 +0200823
824RTCAudioSourceStats::RTCAudioSourceStats(const RTCAudioSourceStats& other)
Henrik Boströmd2c336f2019-07-03 17:11:10 +0200825 : RTCMediaSourceStats(other),
826 audio_level(other.audio_level),
827 total_audio_energy(other.total_audio_energy),
828 total_samples_duration(other.total_samples_duration) {}
Henrik Boström646fda02019-05-22 15:49:42 +0200829
830RTCAudioSourceStats::~RTCAudioSourceStats() {}
831
832// clang-format off
833WEBRTC_RTCSTATS_IMPL(RTCVideoSourceStats, RTCMediaSourceStats, "media-source",
834 &width,
835 &height,
836 &frames,
837 &frames_per_second)
838// clang-format on
839
840RTCVideoSourceStats::RTCVideoSourceStats(const std::string& id,
841 int64_t timestamp_us)
842 : RTCVideoSourceStats(std::string(id), timestamp_us) {}
843
844RTCVideoSourceStats::RTCVideoSourceStats(std::string&& id, int64_t timestamp_us)
845 : RTCMediaSourceStats(std::move(id), timestamp_us),
846 width("width"),
847 height("height"),
848 frames("frames"),
849 frames_per_second("framesPerSecond") {}
850
851RTCVideoSourceStats::RTCVideoSourceStats(const RTCVideoSourceStats& other)
852 : RTCMediaSourceStats(other),
853 width(other.width),
854 height(other.height),
855 frames(other.frames),
856 frames_per_second(other.frames_per_second) {}
857
858RTCVideoSourceStats::~RTCVideoSourceStats() {}
859
860// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700861WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
862 &bytes_sent,
863 &bytes_received,
864 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800865 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700866 &selected_candidate_pair_id,
867 &local_certificate_id,
Nico Weber22f99252019-02-20 10:13:16 -0500868 &remote_certificate_id)
Steve Antond6a5cbd2017-08-18 09:40:25 -0700869// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700870
Yves Gerey665174f2018-06-19 15:03:05 +0200871RTCTransportStats::RTCTransportStats(const std::string& id,
872 int64_t timestamp_us)
873 : RTCTransportStats(std::string(id), timestamp_us) {}
hbos2fa7c672016-10-24 04:00:05 -0700874
Yves Gerey665174f2018-06-19 15:03:05 +0200875RTCTransportStats::RTCTransportStats(std::string&& id, int64_t timestamp_us)
hbos2fa7c672016-10-24 04:00:05 -0700876 : RTCStats(std::move(id), timestamp_us),
877 bytes_sent("bytesSent"),
878 bytes_received("bytesReceived"),
879 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800880 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700881 selected_candidate_pair_id("selectedCandidatePairId"),
882 local_certificate_id("localCertificateId"),
Yves Gerey665174f2018-06-19 15:03:05 +0200883 remote_certificate_id("remoteCertificateId") {}
hbos2fa7c672016-10-24 04:00:05 -0700884
Yves Gerey665174f2018-06-19 15:03:05 +0200885RTCTransportStats::RTCTransportStats(const RTCTransportStats& other)
hbos2fa7c672016-10-24 04:00:05 -0700886 : RTCStats(other.id(), other.timestamp_us()),
887 bytes_sent(other.bytes_sent),
888 bytes_received(other.bytes_received),
889 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800890 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700891 selected_candidate_pair_id(other.selected_candidate_pair_id),
892 local_certificate_id(other.local_certificate_id),
Yves Gerey665174f2018-06-19 15:03:05 +0200893 remote_certificate_id(other.remote_certificate_id) {}
hbos2fa7c672016-10-24 04:00:05 -0700894
Yves Gerey665174f2018-06-19 15:03:05 +0200895RTCTransportStats::~RTCTransportStats() {}
hbos2fa7c672016-10-24 04:00:05 -0700896
hbosd565b732016-08-30 14:04:35 -0700897} // namespace webrtc