blob: 7b697f0f77ebf45d7f78d3d9c5ad84b6c933c3e6 [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
13namespace webrtc {
14
agrieve26622d32017-08-08 10:48:15 -070015const char* const RTCDataChannelState::kConnecting = "connecting";
16const char* const RTCDataChannelState::kOpen = "open";
17const char* const RTCDataChannelState::kClosing = "closing";
18const char* const RTCDataChannelState::kClosed = "closed";
hboscc555c52016-10-18 12:48:31 -070019
agrieve26622d32017-08-08 10:48:15 -070020const char* const RTCStatsIceCandidatePairState::kFrozen = "frozen";
21const char* const RTCStatsIceCandidatePairState::kWaiting = "waiting";
22const char* const RTCStatsIceCandidatePairState::kInProgress = "in-progress";
23const char* const RTCStatsIceCandidatePairState::kFailed = "failed";
24const char* const RTCStatsIceCandidatePairState::kSucceeded = "succeeded";
hbosc47a0c32016-10-11 14:54:49 -070025
26// Strings defined in https://tools.ietf.org/html/rfc5245.
agrieve26622d32017-08-08 10:48:15 -070027const char* const RTCIceCandidateType::kHost = "host";
28const char* const RTCIceCandidateType::kSrflx = "srflx";
29const char* const RTCIceCandidateType::kPrflx = "prflx";
30const char* const RTCIceCandidateType::kRelay = "relay";
hbosab9f6e42016-10-07 02:18:47 -070031
agrieve26622d32017-08-08 10:48:15 -070032const char* const RTCDtlsTransportState::kNew = "new";
33const char* const RTCDtlsTransportState::kConnecting = "connecting";
34const char* const RTCDtlsTransportState::kConnected = "connected";
35const char* const RTCDtlsTransportState::kClosed = "closed";
36const char* const RTCDtlsTransportState::kFailed = "failed";
hbos7064d592017-01-16 07:38:02 -080037
agrieve26622d32017-08-08 10:48:15 -070038const char* const RTCMediaStreamTrackKind::kAudio = "audio";
39const char* const RTCMediaStreamTrackKind::kVideo = "video";
hbos160e4a72017-01-17 02:53:23 -080040
Gary Liu37e489c2017-11-21 10:49:36 -080041// https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype
42const char* const RTCNetworkType::kBluetooth = "bluetooth";
43const char* const RTCNetworkType::kCellular = "cellular";
44const char* const RTCNetworkType::kEthernet = "ethernet";
45const char* const RTCNetworkType::kWifi = "wifi";
46const char* const RTCNetworkType::kWimax = "wimax";
47const char* const RTCNetworkType::kVpn = "vpn";
48const char* const RTCNetworkType::kUnknown = "unknown";
49
Steve Antond6a5cbd2017-08-18 09:40:25 -070050// clang-format off
hbos2fa7c672016-10-24 04:00:05 -070051WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
52 &fingerprint,
53 &fingerprint_algorithm,
54 &base64_certificate,
55 &issuer_certificate_id);
Steve Antond6a5cbd2017-08-18 09:40:25 -070056// clang-format on
hbos2fa7c672016-10-24 04:00:05 -070057
58RTCCertificateStats::RTCCertificateStats(
59 const std::string& id, int64_t timestamp_us)
60 : RTCCertificateStats(std::string(id), timestamp_us) {
61}
62
63RTCCertificateStats::RTCCertificateStats(
64 std::string&& id, int64_t timestamp_us)
65 : RTCStats(std::move(id), timestamp_us),
66 fingerprint("fingerprint"),
67 fingerprint_algorithm("fingerprintAlgorithm"),
68 base64_certificate("base64Certificate"),
69 issuer_certificate_id("issuerCertificateId") {
70}
71
72RTCCertificateStats::RTCCertificateStats(
73 const RTCCertificateStats& other)
74 : RTCStats(other.id(), other.timestamp_us()),
75 fingerprint(other.fingerprint),
76 fingerprint_algorithm(other.fingerprint_algorithm),
77 base64_certificate(other.base64_certificate),
78 issuer_certificate_id(other.issuer_certificate_id) {
79}
80
81RTCCertificateStats::~RTCCertificateStats() {
82}
83
Steve Antond6a5cbd2017-08-18 09:40:25 -070084// clang-format off
hbos0adb8282016-11-23 02:32:06 -080085WEBRTC_RTCSTATS_IMPL(RTCCodecStats, RTCStats, "codec",
86 &payload_type,
hbos13f54b22017-02-28 06:56:04 -080087 &mime_type,
hbos0adb8282016-11-23 02:32:06 -080088 &clock_rate,
89 &channels,
hbos13f54b22017-02-28 06:56:04 -080090 &sdp_fmtp_line,
hbos0adb8282016-11-23 02:32:06 -080091 &implementation);
Steve Antond6a5cbd2017-08-18 09:40:25 -070092// clang-format on
hbos0adb8282016-11-23 02:32:06 -080093
94RTCCodecStats::RTCCodecStats(
95 const std::string& id, int64_t timestamp_us)
96 : RTCCodecStats(std::string(id), timestamp_us) {
97}
98
99RTCCodecStats::RTCCodecStats(
100 std::string&& id, int64_t timestamp_us)
101 : RTCStats(std::move(id), timestamp_us),
102 payload_type("payloadType"),
hbos13f54b22017-02-28 06:56:04 -0800103 mime_type("mimeType"),
hbos0adb8282016-11-23 02:32:06 -0800104 clock_rate("clockRate"),
105 channels("channels"),
hbos13f54b22017-02-28 06:56:04 -0800106 sdp_fmtp_line("sdpFmtpLine"),
hbos0adb8282016-11-23 02:32:06 -0800107 implementation("implementation") {
108}
109
110RTCCodecStats::RTCCodecStats(
111 const RTCCodecStats& other)
112 : RTCStats(other.id(), other.timestamp_us()),
113 payload_type(other.payload_type),
hbos13f54b22017-02-28 06:56:04 -0800114 mime_type(other.mime_type),
hbos0adb8282016-11-23 02:32:06 -0800115 clock_rate(other.clock_rate),
116 channels(other.channels),
hbos13f54b22017-02-28 06:56:04 -0800117 sdp_fmtp_line(other.sdp_fmtp_line),
hbos0adb8282016-11-23 02:32:06 -0800118 implementation(other.implementation) {
119}
120
121RTCCodecStats::~RTCCodecStats() {
122}
123
Steve Antond6a5cbd2017-08-18 09:40:25 -0700124// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700125WEBRTC_RTCSTATS_IMPL(RTCDataChannelStats, RTCStats, "data-channel",
126 &label,
127 &protocol,
128 &datachannelid,
129 &state,
130 &messages_sent,
131 &bytes_sent,
132 &messages_received,
133 &bytes_received);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700134// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700135
136RTCDataChannelStats::RTCDataChannelStats(
137 const std::string& id, int64_t timestamp_us)
138 : RTCDataChannelStats(std::string(id), timestamp_us) {
139}
140
141RTCDataChannelStats::RTCDataChannelStats(
142 std::string&& id, int64_t timestamp_us)
143 : RTCStats(std::move(id), timestamp_us),
144 label("label"),
145 protocol("protocol"),
146 datachannelid("datachannelid"),
147 state("state"),
148 messages_sent("messagesSent"),
149 bytes_sent("bytesSent"),
150 messages_received("messagesReceived"),
151 bytes_received("bytesReceived") {
152}
153
154RTCDataChannelStats::RTCDataChannelStats(
155 const RTCDataChannelStats& other)
156 : RTCStats(other.id(), other.timestamp_us()),
157 label(other.label),
158 protocol(other.protocol),
159 datachannelid(other.datachannelid),
160 state(other.state),
161 messages_sent(other.messages_sent),
162 bytes_sent(other.bytes_sent),
163 messages_received(other.messages_received),
164 bytes_received(other.bytes_received) {
165}
166
167RTCDataChannelStats::~RTCDataChannelStats() {
168}
169
Steve Antond6a5cbd2017-08-18 09:40:25 -0700170// clang-format off
hbosc47a0c32016-10-11 14:54:49 -0700171WEBRTC_RTCSTATS_IMPL(RTCIceCandidatePairStats, RTCStats, "candidate-pair",
172 &transport_id,
173 &local_candidate_id,
174 &remote_candidate_id,
175 &state,
176 &priority,
177 &nominated,
178 &writable,
179 &readable,
180 &bytes_sent,
181 &bytes_received,
hbos3168c7a2016-12-15 06:17:08 -0800182 &total_round_trip_time,
183 &current_round_trip_time,
hbosc47a0c32016-10-11 14:54:49 -0700184 &available_outgoing_bitrate,
185 &available_incoming_bitrate,
186 &requests_received,
187 &requests_sent,
188 &responses_received,
189 &responses_sent,
190 &retransmissions_received,
191 &retransmissions_sent,
192 &consent_requests_received,
193 &consent_requests_sent,
194 &consent_responses_received,
195 &consent_responses_sent);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700196// clang-format on
hbosc47a0c32016-10-11 14:54:49 -0700197
198RTCIceCandidatePairStats::RTCIceCandidatePairStats(
199 const std::string& id, int64_t timestamp_us)
200 : RTCIceCandidatePairStats(std::string(id), timestamp_us) {
201}
202
203RTCIceCandidatePairStats::RTCIceCandidatePairStats(
204 std::string&& id, int64_t timestamp_us)
205 : RTCStats(std::move(id), timestamp_us),
206 transport_id("transportId"),
207 local_candidate_id("localCandidateId"),
208 remote_candidate_id("remoteCandidateId"),
209 state("state"),
210 priority("priority"),
211 nominated("nominated"),
212 writable("writable"),
213 readable("readable"),
214 bytes_sent("bytesSent"),
215 bytes_received("bytesReceived"),
hbos3168c7a2016-12-15 06:17:08 -0800216 total_round_trip_time("totalRoundTripTime"),
217 current_round_trip_time("currentRoundTripTime"),
hbosc47a0c32016-10-11 14:54:49 -0700218 available_outgoing_bitrate("availableOutgoingBitrate"),
219 available_incoming_bitrate("availableIncomingBitrate"),
220 requests_received("requestsReceived"),
221 requests_sent("requestsSent"),
222 responses_received("responsesReceived"),
223 responses_sent("responsesSent"),
224 retransmissions_received("retransmissionsReceived"),
225 retransmissions_sent("retransmissionsSent"),
226 consent_requests_received("consentRequestsReceived"),
227 consent_requests_sent("consentRequestsSent"),
228 consent_responses_received("consentResponsesReceived"),
229 consent_responses_sent("consentResponsesSent") {
230}
231
232RTCIceCandidatePairStats::RTCIceCandidatePairStats(
233 const RTCIceCandidatePairStats& other)
234 : RTCStats(other.id(), other.timestamp_us()),
235 transport_id(other.transport_id),
236 local_candidate_id(other.local_candidate_id),
237 remote_candidate_id(other.remote_candidate_id),
238 state(other.state),
239 priority(other.priority),
240 nominated(other.nominated),
241 writable(other.writable),
242 readable(other.readable),
243 bytes_sent(other.bytes_sent),
244 bytes_received(other.bytes_received),
hbos3168c7a2016-12-15 06:17:08 -0800245 total_round_trip_time(other.total_round_trip_time),
246 current_round_trip_time(other.current_round_trip_time),
hbosc47a0c32016-10-11 14:54:49 -0700247 available_outgoing_bitrate(other.available_outgoing_bitrate),
248 available_incoming_bitrate(other.available_incoming_bitrate),
249 requests_received(other.requests_received),
250 requests_sent(other.requests_sent),
251 responses_received(other.responses_received),
252 responses_sent(other.responses_sent),
253 retransmissions_received(other.retransmissions_received),
254 retransmissions_sent(other.retransmissions_sent),
255 consent_requests_received(other.consent_requests_received),
256 consent_requests_sent(other.consent_requests_sent),
257 consent_responses_received(other.consent_responses_received),
258 consent_responses_sent(other.consent_responses_sent) {
259}
260
261RTCIceCandidatePairStats::~RTCIceCandidatePairStats() {
262}
263
Steve Antond6a5cbd2017-08-18 09:40:25 -0700264// clang-format off
Henrik Boström1df1bf82018-03-20 13:24:20 +0100265WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "abstract-ice-candidate",
hbosb4e426e2017-01-02 09:59:31 -0800266 &transport_id,
hbosc3a2b7f2017-01-02 04:46:15 -0800267 &is_remote,
Gary Liu37e489c2017-11-21 10:49:36 -0800268 &network_type,
hbosab9f6e42016-10-07 02:18:47 -0700269 &ip,
270 &port,
271 &protocol,
272 &candidate_type,
273 &priority,
hbosd17a5a72017-01-02 08:09:59 -0800274 &url,
275 &deleted);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700276// clang-format on
hbosab9f6e42016-10-07 02:18:47 -0700277
278RTCIceCandidateStats::RTCIceCandidateStats(
hbosc3a2b7f2017-01-02 04:46:15 -0800279 const std::string& id, int64_t timestamp_us, bool is_remote)
280 : RTCIceCandidateStats(std::string(id), timestamp_us, is_remote) {
hbosab9f6e42016-10-07 02:18:47 -0700281}
282
Gary Liu37e489c2017-11-21 10:49:36 -0800283RTCIceCandidateStats::RTCIceCandidateStats(std::string&& id,
284 int64_t timestamp_us,
285 bool is_remote)
hbosab9f6e42016-10-07 02:18:47 -0700286 : RTCStats(std::move(id), timestamp_us),
hbosb4e426e2017-01-02 09:59:31 -0800287 transport_id("transportId"),
hbosc3a2b7f2017-01-02 04:46:15 -0800288 is_remote("isRemote", is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800289 network_type("networkType"),
hbosab9f6e42016-10-07 02:18:47 -0700290 ip("ip"),
291 port("port"),
292 protocol("protocol"),
293 candidate_type("candidateType"),
294 priority("priority"),
hbosd17a5a72017-01-02 08:09:59 -0800295 url("url"),
Gary Liu37e489c2017-11-21 10:49:36 -0800296 deleted("deleted", false) {}
hbosab9f6e42016-10-07 02:18:47 -0700297
298RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
299 : RTCStats(other.id(), other.timestamp_us()),
hbosb4e426e2017-01-02 09:59:31 -0800300 transport_id(other.transport_id),
hbosc3a2b7f2017-01-02 04:46:15 -0800301 is_remote(other.is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800302 network_type(other.network_type),
hbosab9f6e42016-10-07 02:18:47 -0700303 ip(other.ip),
304 port(other.port),
305 protocol(other.protocol),
306 candidate_type(other.candidate_type),
307 priority(other.priority),
hbosd17a5a72017-01-02 08:09:59 -0800308 url(other.url),
Gary Liu37e489c2017-11-21 10:49:36 -0800309 deleted(other.deleted) {}
hbosab9f6e42016-10-07 02:18:47 -0700310
311RTCIceCandidateStats::~RTCIceCandidateStats() {
312}
313
314const char RTCLocalIceCandidateStats::kType[] = "local-candidate";
315
316RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(
317 const std::string& id, int64_t timestamp_us)
hbosc3a2b7f2017-01-02 04:46:15 -0800318 : RTCIceCandidateStats(id, timestamp_us, false) {
hbosab9f6e42016-10-07 02:18:47 -0700319}
320
321RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(
322 std::string&& id, int64_t timestamp_us)
hbosc3a2b7f2017-01-02 04:46:15 -0800323 : RTCIceCandidateStats(std::move(id), timestamp_us, false) {
hbosab9f6e42016-10-07 02:18:47 -0700324}
325
Henrik Boström1df1bf82018-03-20 13:24:20 +0100326std::unique_ptr<RTCStats> RTCLocalIceCandidateStats::copy() const {
327 return std::unique_ptr<RTCStats>(new RTCLocalIceCandidateStats(*this));
328}
329
hbosab9f6e42016-10-07 02:18:47 -0700330const char* RTCLocalIceCandidateStats::type() const {
331 return kType;
332}
333
334const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate";
335
336RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(
337 const std::string& id, int64_t timestamp_us)
hbosc3a2b7f2017-01-02 04:46:15 -0800338 : RTCIceCandidateStats(id, timestamp_us, true) {
hbosab9f6e42016-10-07 02:18:47 -0700339}
340
341RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(
342 std::string&& id, int64_t timestamp_us)
hbosc3a2b7f2017-01-02 04:46:15 -0800343 : RTCIceCandidateStats(std::move(id), timestamp_us, true) {
hbosab9f6e42016-10-07 02:18:47 -0700344}
345
Henrik Boström1df1bf82018-03-20 13:24:20 +0100346std::unique_ptr<RTCStats> RTCRemoteIceCandidateStats::copy() const {
347 return std::unique_ptr<RTCStats>(new RTCRemoteIceCandidateStats(*this));
348}
349
hbosab9f6e42016-10-07 02:18:47 -0700350const char* RTCRemoteIceCandidateStats::type() const {
351 return kType;
352}
353
Steve Antond6a5cbd2017-08-18 09:40:25 -0700354// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800355WEBRTC_RTCSTATS_IMPL(RTCMediaStreamStats, RTCStats, "stream",
356 &stream_identifier,
357 &track_ids);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700358// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800359
360RTCMediaStreamStats::RTCMediaStreamStats(
361 const std::string& id, int64_t timestamp_us)
362 : RTCMediaStreamStats(std::string(id), timestamp_us) {
363}
364
365RTCMediaStreamStats::RTCMediaStreamStats(
366 std::string&& id, int64_t timestamp_us)
367 : RTCStats(std::move(id), timestamp_us),
368 stream_identifier("streamIdentifier"),
369 track_ids("trackIds") {
370}
371
372RTCMediaStreamStats::RTCMediaStreamStats(
373 const RTCMediaStreamStats& other)
374 : RTCStats(other.id(), other.timestamp_us()),
375 stream_identifier(other.stream_identifier),
376 track_ids(other.track_ids) {
377}
378
379RTCMediaStreamStats::~RTCMediaStreamStats() {
380}
381
Steve Antond6a5cbd2017-08-18 09:40:25 -0700382// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800383WEBRTC_RTCSTATS_IMPL(RTCMediaStreamTrackStats, RTCStats, "track",
zsteine76bd3a2017-07-14 12:17:49 -0700384 &track_identifier,
385 &remote_source,
386 &ended,
387 &detached,
388 &kind,
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200389 &jitter_buffer_delay,
zsteine76bd3a2017-07-14 12:17:49 -0700390 &frame_width,
391 &frame_height,
392 &frames_per_second,
393 &frames_sent,
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100394 &huge_frames_sent,
zsteine76bd3a2017-07-14 12:17:49 -0700395 &frames_received,
396 &frames_decoded,
397 &frames_dropped,
398 &frames_corrupted,
399 &partial_frames_lost,
400 &full_frames_lost,
401 &audio_level,
402 &total_audio_energy,
zsteine76bd3a2017-07-14 12:17:49 -0700403 &echo_return_loss,
Steve Anton2dbc69f2017-08-24 17:15:13 -0700404 &echo_return_loss_enhancement,
405 &total_samples_received,
406 &total_samples_duration,
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200407 &concealed_samples,
408 &concealment_events);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700409// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800410
411RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
hbos160e4a72017-01-17 02:53:23 -0800412 const std::string& id, int64_t timestamp_us, const char* kind)
413 : RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) {
hbos09bc1282016-11-08 06:29:22 -0800414}
415
zsteine76bd3a2017-07-14 12:17:49 -0700416RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(std::string&& id,
417 int64_t timestamp_us,
418 const char* kind)
hbos09bc1282016-11-08 06:29:22 -0800419 : RTCStats(std::move(id), timestamp_us),
420 track_identifier("trackIdentifier"),
421 remote_source("remoteSource"),
422 ended("ended"),
423 detached("detached"),
hbos160e4a72017-01-17 02:53:23 -0800424 kind("kind", kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200425 jitter_buffer_delay("jitterBufferDelay"),
hbos09bc1282016-11-08 06:29:22 -0800426 frame_width("frameWidth"),
427 frame_height("frameHeight"),
428 frames_per_second("framesPerSecond"),
429 frames_sent("framesSent"),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100430 huge_frames_sent("hugeFramesSent"),
hbos09bc1282016-11-08 06:29:22 -0800431 frames_received("framesReceived"),
432 frames_decoded("framesDecoded"),
433 frames_dropped("framesDropped"),
434 frames_corrupted("framesCorrupted"),
435 partial_frames_lost("partialFramesLost"),
436 full_frames_lost("fullFramesLost"),
437 audio_level("audioLevel"),
zsteine76bd3a2017-07-14 12:17:49 -0700438 total_audio_energy("totalAudioEnergy"),
hbos09bc1282016-11-08 06:29:22 -0800439 echo_return_loss("echoReturnLoss"),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700440 echo_return_loss_enhancement("echoReturnLossEnhancement"),
441 total_samples_received("totalSamplesReceived"),
442 total_samples_duration("totalSamplesDuration"),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200443 concealed_samples("concealedSamples"),
444 concealment_events("concealmentEvents") {
hbos160e4a72017-01-17 02:53:23 -0800445 RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
446 kind == RTCMediaStreamTrackKind::kVideo);
hbos09bc1282016-11-08 06:29:22 -0800447}
448
449RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
450 const RTCMediaStreamTrackStats& other)
451 : RTCStats(other.id(), other.timestamp_us()),
452 track_identifier(other.track_identifier),
453 remote_source(other.remote_source),
454 ended(other.ended),
455 detached(other.detached),
hbos160e4a72017-01-17 02:53:23 -0800456 kind(other.kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200457 jitter_buffer_delay(other.jitter_buffer_delay),
hbos09bc1282016-11-08 06:29:22 -0800458 frame_width(other.frame_width),
459 frame_height(other.frame_height),
460 frames_per_second(other.frames_per_second),
461 frames_sent(other.frames_sent),
Ilya Nikolaevskiy70473fc2018-02-28 16:35:03 +0100462 huge_frames_sent(other.huge_frames_sent),
hbos09bc1282016-11-08 06:29:22 -0800463 frames_received(other.frames_received),
464 frames_decoded(other.frames_decoded),
465 frames_dropped(other.frames_dropped),
466 frames_corrupted(other.frames_corrupted),
467 partial_frames_lost(other.partial_frames_lost),
468 full_frames_lost(other.full_frames_lost),
469 audio_level(other.audio_level),
zsteine76bd3a2017-07-14 12:17:49 -0700470 total_audio_energy(other.total_audio_energy),
hbos09bc1282016-11-08 06:29:22 -0800471 echo_return_loss(other.echo_return_loss),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700472 echo_return_loss_enhancement(other.echo_return_loss_enhancement),
473 total_samples_received(other.total_samples_received),
474 total_samples_duration(other.total_samples_duration),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200475 concealed_samples(other.concealed_samples),
476 concealment_events(other.concealment_events) {}
hbos09bc1282016-11-08 06:29:22 -0800477
478RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {
479}
480
Steve Antond6a5cbd2017-08-18 09:40:25 -0700481// clang-format off
hbosfc5e0502016-10-06 02:06:10 -0700482WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
483 &data_channels_opened,
484 &data_channels_closed);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700485// clang-format on
hbosd565b732016-08-30 14:04:35 -0700486
487RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700488 const std::string& id, int64_t timestamp_us)
489 : RTCPeerConnectionStats(std::string(id), timestamp_us) {
hbosd565b732016-08-30 14:04:35 -0700490}
491
492RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700493 std::string&& id, int64_t timestamp_us)
494 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700495 data_channels_opened("dataChannelsOpened"),
496 data_channels_closed("dataChannelsClosed") {
497}
498
hbosfc5e0502016-10-06 02:06:10 -0700499RTCPeerConnectionStats::RTCPeerConnectionStats(
500 const RTCPeerConnectionStats& other)
501 : RTCStats(other.id(), other.timestamp_us()),
502 data_channels_opened(other.data_channels_opened),
503 data_channels_closed(other.data_channels_closed) {
504}
505
506RTCPeerConnectionStats::~RTCPeerConnectionStats() {
507}
508
Steve Antond6a5cbd2017-08-18 09:40:25 -0700509// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700510WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
511 &ssrc,
512 &associate_stats_id,
513 &is_remote,
514 &media_type,
hbosb0ae9202017-01-27 06:35:16 -0800515 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700516 &transport_id,
517 &codec_id,
518 &fir_count,
519 &pli_count,
520 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800521 &sli_count,
522 &qp_sum);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700523// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700524
525RTCRTPStreamStats::RTCRTPStreamStats(
526 const std::string& id, int64_t timestamp_us)
527 : RTCRTPStreamStats(std::string(id), timestamp_us) {
528}
529
530RTCRTPStreamStats::RTCRTPStreamStats(
531 std::string&& id, int64_t timestamp_us)
532 : RTCStats(std::move(id), timestamp_us),
533 ssrc("ssrc"),
534 associate_stats_id("associateStatsId"),
535 is_remote("isRemote", false),
536 media_type("mediaType"),
hbosb0ae9202017-01-27 06:35:16 -0800537 track_id("trackId"),
hbos6ded1902016-11-01 01:50:46 -0700538 transport_id("transportId"),
539 codec_id("codecId"),
540 fir_count("firCount"),
541 pli_count("pliCount"),
542 nack_count("nackCount"),
hbos6769c492017-01-02 08:35:13 -0800543 sli_count("sliCount"),
544 qp_sum("qpSum") {
hbos6ded1902016-11-01 01:50:46 -0700545}
546
547RTCRTPStreamStats::RTCRTPStreamStats(
548 const RTCRTPStreamStats& other)
549 : RTCStats(other.id(), other.timestamp_us()),
550 ssrc(other.ssrc),
551 associate_stats_id(other.associate_stats_id),
552 is_remote(other.is_remote),
553 media_type(other.media_type),
hbosb0ae9202017-01-27 06:35:16 -0800554 track_id(other.track_id),
hbos6ded1902016-11-01 01:50:46 -0700555 transport_id(other.transport_id),
556 codec_id(other.codec_id),
557 fir_count(other.fir_count),
558 pli_count(other.pli_count),
559 nack_count(other.nack_count),
hbos6769c492017-01-02 08:35:13 -0800560 sli_count(other.sli_count),
561 qp_sum(other.qp_sum) {
hbos6ded1902016-11-01 01:50:46 -0700562}
563
564RTCRTPStreamStats::~RTCRTPStreamStats() {
565}
566
Steve Antond6a5cbd2017-08-18 09:40:25 -0700567// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700568WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700569 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
570 &packets_received,
571 &bytes_received,
572 &packets_lost,
573 &jitter,
574 &fraction_lost,
hbosa7a9be12017-03-01 01:02:45 -0800575 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700576 &packets_discarded,
577 &packets_repaired,
578 &burst_packets_lost,
579 &burst_packets_discarded,
580 &burst_loss_count,
581 &burst_discard_count,
582 &burst_loss_rate,
583 &burst_discard_rate,
584 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800585 &gap_discard_rate,
586 &frames_decoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700587// clang-format on
hboseeafe942016-11-01 03:00:17 -0700588
589RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
590 const std::string& id, int64_t timestamp_us)
591 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {
592}
593
594RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
595 std::string&& id, int64_t timestamp_us)
596 : RTCRTPStreamStats(std::move(id), timestamp_us),
597 packets_received("packetsReceived"),
598 bytes_received("bytesReceived"),
599 packets_lost("packetsLost"),
600 jitter("jitter"),
601 fraction_lost("fractionLost"),
hbosa7a9be12017-03-01 01:02:45 -0800602 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700603 packets_discarded("packetsDiscarded"),
604 packets_repaired("packetsRepaired"),
605 burst_packets_lost("burstPacketsLost"),
606 burst_packets_discarded("burstPacketsDiscarded"),
607 burst_loss_count("burstLossCount"),
608 burst_discard_count("burstDiscardCount"),
609 burst_loss_rate("burstLossRate"),
610 burst_discard_rate("burstDiscardRate"),
611 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800612 gap_discard_rate("gapDiscardRate"),
613 frames_decoded("framesDecoded") {
hboseeafe942016-11-01 03:00:17 -0700614}
615
616RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
617 const RTCInboundRTPStreamStats& other)
618 : RTCRTPStreamStats(other),
619 packets_received(other.packets_received),
620 bytes_received(other.bytes_received),
621 packets_lost(other.packets_lost),
622 jitter(other.jitter),
623 fraction_lost(other.fraction_lost),
hbosa7a9be12017-03-01 01:02:45 -0800624 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700625 packets_discarded(other.packets_discarded),
626 packets_repaired(other.packets_repaired),
627 burst_packets_lost(other.burst_packets_lost),
628 burst_packets_discarded(other.burst_packets_discarded),
629 burst_loss_count(other.burst_loss_count),
630 burst_discard_count(other.burst_discard_count),
631 burst_loss_rate(other.burst_loss_rate),
632 burst_discard_rate(other.burst_discard_rate),
633 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800634 gap_discard_rate(other.gap_discard_rate),
635 frames_decoded(other.frames_decoded) {
hboseeafe942016-11-01 03:00:17 -0700636}
637
638RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {
639}
640
Steve Antond6a5cbd2017-08-18 09:40:25 -0700641// clang-format off
hboseeafe942016-11-01 03:00:17 -0700642WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700643 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
644 &packets_sent,
645 &bytes_sent,
646 &target_bitrate,
hbos6769c492017-01-02 08:35:13 -0800647 &frames_encoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700648// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700649
650RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
651 const std::string& id, int64_t timestamp_us)
652 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {
653}
654
655RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
656 std::string&& id, int64_t timestamp_us)
657 : RTCRTPStreamStats(std::move(id), timestamp_us),
658 packets_sent("packetsSent"),
659 bytes_sent("bytesSent"),
660 target_bitrate("targetBitrate"),
hbos6769c492017-01-02 08:35:13 -0800661 frames_encoded("framesEncoded") {
hbos6ded1902016-11-01 01:50:46 -0700662}
663
664RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
665 const RTCOutboundRTPStreamStats& other)
666 : RTCRTPStreamStats(other),
667 packets_sent(other.packets_sent),
668 bytes_sent(other.bytes_sent),
669 target_bitrate(other.target_bitrate),
hbos6769c492017-01-02 08:35:13 -0800670 frames_encoded(other.frames_encoded) {
hbos6ded1902016-11-01 01:50:46 -0700671}
672
673RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {
674}
675
Steve Antond6a5cbd2017-08-18 09:40:25 -0700676// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700677WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
678 &bytes_sent,
679 &bytes_received,
680 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800681 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700682 &selected_candidate_pair_id,
683 &local_certificate_id,
684 &remote_certificate_id);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700685// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700686
687RTCTransportStats::RTCTransportStats(
688 const std::string& id, int64_t timestamp_us)
689 : RTCTransportStats(std::string(id), timestamp_us) {
690}
691
692RTCTransportStats::RTCTransportStats(
693 std::string&& id, int64_t timestamp_us)
694 : RTCStats(std::move(id), timestamp_us),
695 bytes_sent("bytesSent"),
696 bytes_received("bytesReceived"),
697 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800698 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700699 selected_candidate_pair_id("selectedCandidatePairId"),
700 local_certificate_id("localCertificateId"),
701 remote_certificate_id("remoteCertificateId") {
702}
703
704RTCTransportStats::RTCTransportStats(
705 const RTCTransportStats& other)
706 : RTCStats(other.id(), other.timestamp_us()),
707 bytes_sent(other.bytes_sent),
708 bytes_received(other.bytes_received),
709 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800710 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700711 selected_candidate_pair_id(other.selected_candidate_pair_id),
712 local_certificate_id(other.local_certificate_id),
713 remote_certificate_id(other.remote_certificate_id) {
714}
715
716RTCTransportStats::~RTCTransportStats() {
717}
718
hbosd565b732016-08-30 14:04:35 -0700719} // namespace webrtc