blob: e643e121e696f945594a5b960da91a10e00db608 [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
Steve Antond6a5cbd2017-08-18 09:40:25 -070041// clang-format off
hbos2fa7c672016-10-24 04:00:05 -070042WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
43 &fingerprint,
44 &fingerprint_algorithm,
45 &base64_certificate,
46 &issuer_certificate_id);
Steve Antond6a5cbd2017-08-18 09:40:25 -070047// clang-format on
hbos2fa7c672016-10-24 04:00:05 -070048
49RTCCertificateStats::RTCCertificateStats(
50 const std::string& id, int64_t timestamp_us)
51 : RTCCertificateStats(std::string(id), timestamp_us) {
52}
53
54RTCCertificateStats::RTCCertificateStats(
55 std::string&& id, int64_t timestamp_us)
56 : RTCStats(std::move(id), timestamp_us),
57 fingerprint("fingerprint"),
58 fingerprint_algorithm("fingerprintAlgorithm"),
59 base64_certificate("base64Certificate"),
60 issuer_certificate_id("issuerCertificateId") {
61}
62
63RTCCertificateStats::RTCCertificateStats(
64 const RTCCertificateStats& other)
65 : RTCStats(other.id(), other.timestamp_us()),
66 fingerprint(other.fingerprint),
67 fingerprint_algorithm(other.fingerprint_algorithm),
68 base64_certificate(other.base64_certificate),
69 issuer_certificate_id(other.issuer_certificate_id) {
70}
71
72RTCCertificateStats::~RTCCertificateStats() {
73}
74
Steve Antond6a5cbd2017-08-18 09:40:25 -070075// clang-format off
hbos0adb8282016-11-23 02:32:06 -080076WEBRTC_RTCSTATS_IMPL(RTCCodecStats, RTCStats, "codec",
77 &payload_type,
hbos13f54b22017-02-28 06:56:04 -080078 &mime_type,
hbos0adb8282016-11-23 02:32:06 -080079 &clock_rate,
80 &channels,
hbos13f54b22017-02-28 06:56:04 -080081 &sdp_fmtp_line,
hbos0adb8282016-11-23 02:32:06 -080082 &implementation);
Steve Antond6a5cbd2017-08-18 09:40:25 -070083// clang-format on
hbos0adb8282016-11-23 02:32:06 -080084
85RTCCodecStats::RTCCodecStats(
86 const std::string& id, int64_t timestamp_us)
87 : RTCCodecStats(std::string(id), timestamp_us) {
88}
89
90RTCCodecStats::RTCCodecStats(
91 std::string&& id, int64_t timestamp_us)
92 : RTCStats(std::move(id), timestamp_us),
93 payload_type("payloadType"),
hbos13f54b22017-02-28 06:56:04 -080094 mime_type("mimeType"),
hbos0adb8282016-11-23 02:32:06 -080095 clock_rate("clockRate"),
96 channels("channels"),
hbos13f54b22017-02-28 06:56:04 -080097 sdp_fmtp_line("sdpFmtpLine"),
hbos0adb8282016-11-23 02:32:06 -080098 implementation("implementation") {
99}
100
101RTCCodecStats::RTCCodecStats(
102 const RTCCodecStats& other)
103 : RTCStats(other.id(), other.timestamp_us()),
104 payload_type(other.payload_type),
hbos13f54b22017-02-28 06:56:04 -0800105 mime_type(other.mime_type),
hbos0adb8282016-11-23 02:32:06 -0800106 clock_rate(other.clock_rate),
107 channels(other.channels),
hbos13f54b22017-02-28 06:56:04 -0800108 sdp_fmtp_line(other.sdp_fmtp_line),
hbos0adb8282016-11-23 02:32:06 -0800109 implementation(other.implementation) {
110}
111
112RTCCodecStats::~RTCCodecStats() {
113}
114
Steve Antond6a5cbd2017-08-18 09:40:25 -0700115// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700116WEBRTC_RTCSTATS_IMPL(RTCDataChannelStats, RTCStats, "data-channel",
117 &label,
118 &protocol,
119 &datachannelid,
120 &state,
121 &messages_sent,
122 &bytes_sent,
123 &messages_received,
124 &bytes_received);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700125// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700126
127RTCDataChannelStats::RTCDataChannelStats(
128 const std::string& id, int64_t timestamp_us)
129 : RTCDataChannelStats(std::string(id), timestamp_us) {
130}
131
132RTCDataChannelStats::RTCDataChannelStats(
133 std::string&& id, int64_t timestamp_us)
134 : RTCStats(std::move(id), timestamp_us),
135 label("label"),
136 protocol("protocol"),
137 datachannelid("datachannelid"),
138 state("state"),
139 messages_sent("messagesSent"),
140 bytes_sent("bytesSent"),
141 messages_received("messagesReceived"),
142 bytes_received("bytesReceived") {
143}
144
145RTCDataChannelStats::RTCDataChannelStats(
146 const RTCDataChannelStats& other)
147 : RTCStats(other.id(), other.timestamp_us()),
148 label(other.label),
149 protocol(other.protocol),
150 datachannelid(other.datachannelid),
151 state(other.state),
152 messages_sent(other.messages_sent),
153 bytes_sent(other.bytes_sent),
154 messages_received(other.messages_received),
155 bytes_received(other.bytes_received) {
156}
157
158RTCDataChannelStats::~RTCDataChannelStats() {
159}
160
Steve Antond6a5cbd2017-08-18 09:40:25 -0700161// clang-format off
hbosc47a0c32016-10-11 14:54:49 -0700162WEBRTC_RTCSTATS_IMPL(RTCIceCandidatePairStats, RTCStats, "candidate-pair",
163 &transport_id,
164 &local_candidate_id,
165 &remote_candidate_id,
166 &state,
167 &priority,
168 &nominated,
169 &writable,
170 &readable,
171 &bytes_sent,
172 &bytes_received,
hbos3168c7a2016-12-15 06:17:08 -0800173 &total_round_trip_time,
174 &current_round_trip_time,
hbosc47a0c32016-10-11 14:54:49 -0700175 &available_outgoing_bitrate,
176 &available_incoming_bitrate,
177 &requests_received,
178 &requests_sent,
179 &responses_received,
180 &responses_sent,
181 &retransmissions_received,
182 &retransmissions_sent,
183 &consent_requests_received,
184 &consent_requests_sent,
185 &consent_responses_received,
186 &consent_responses_sent);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700187// clang-format on
hbosc47a0c32016-10-11 14:54:49 -0700188
189RTCIceCandidatePairStats::RTCIceCandidatePairStats(
190 const std::string& id, int64_t timestamp_us)
191 : RTCIceCandidatePairStats(std::string(id), timestamp_us) {
192}
193
194RTCIceCandidatePairStats::RTCIceCandidatePairStats(
195 std::string&& id, int64_t timestamp_us)
196 : RTCStats(std::move(id), timestamp_us),
197 transport_id("transportId"),
198 local_candidate_id("localCandidateId"),
199 remote_candidate_id("remoteCandidateId"),
200 state("state"),
201 priority("priority"),
202 nominated("nominated"),
203 writable("writable"),
204 readable("readable"),
205 bytes_sent("bytesSent"),
206 bytes_received("bytesReceived"),
hbos3168c7a2016-12-15 06:17:08 -0800207 total_round_trip_time("totalRoundTripTime"),
208 current_round_trip_time("currentRoundTripTime"),
hbosc47a0c32016-10-11 14:54:49 -0700209 available_outgoing_bitrate("availableOutgoingBitrate"),
210 available_incoming_bitrate("availableIncomingBitrate"),
211 requests_received("requestsReceived"),
212 requests_sent("requestsSent"),
213 responses_received("responsesReceived"),
214 responses_sent("responsesSent"),
215 retransmissions_received("retransmissionsReceived"),
216 retransmissions_sent("retransmissionsSent"),
217 consent_requests_received("consentRequestsReceived"),
218 consent_requests_sent("consentRequestsSent"),
219 consent_responses_received("consentResponsesReceived"),
220 consent_responses_sent("consentResponsesSent") {
221}
222
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),
249 consent_responses_sent(other.consent_responses_sent) {
250}
251
252RTCIceCandidatePairStats::~RTCIceCandidatePairStats() {
253}
254
Steve Antond6a5cbd2017-08-18 09:40:25 -0700255// clang-format off
hbosab9f6e42016-10-07 02:18:47 -0700256WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "ice-candidate",
hbosb4e426e2017-01-02 09:59:31 -0800257 &transport_id,
hbosc3a2b7f2017-01-02 04:46:15 -0800258 &is_remote,
hbosab9f6e42016-10-07 02:18:47 -0700259 &ip,
260 &port,
261 &protocol,
262 &candidate_type,
263 &priority,
hbosd17a5a72017-01-02 08:09:59 -0800264 &url,
265 &deleted);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700266// clang-format on
hbosab9f6e42016-10-07 02:18:47 -0700267
268RTCIceCandidateStats::RTCIceCandidateStats(
hbosc3a2b7f2017-01-02 04:46:15 -0800269 const std::string& id, int64_t timestamp_us, bool is_remote)
270 : RTCIceCandidateStats(std::string(id), timestamp_us, is_remote) {
hbosab9f6e42016-10-07 02:18:47 -0700271}
272
273RTCIceCandidateStats::RTCIceCandidateStats(
hbosc3a2b7f2017-01-02 04:46:15 -0800274 std::string&& id, int64_t timestamp_us, bool is_remote)
hbosab9f6e42016-10-07 02:18:47 -0700275 : RTCStats(std::move(id), timestamp_us),
hbosb4e426e2017-01-02 09:59:31 -0800276 transport_id("transportId"),
hbosc3a2b7f2017-01-02 04:46:15 -0800277 is_remote("isRemote", is_remote),
hbosab9f6e42016-10-07 02:18:47 -0700278 ip("ip"),
279 port("port"),
280 protocol("protocol"),
281 candidate_type("candidateType"),
282 priority("priority"),
hbosd17a5a72017-01-02 08:09:59 -0800283 url("url"),
284 deleted("deleted", false) {
hbosab9f6e42016-10-07 02:18:47 -0700285}
286
287RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
288 : RTCStats(other.id(), other.timestamp_us()),
hbosb4e426e2017-01-02 09:59:31 -0800289 transport_id(other.transport_id),
hbosc3a2b7f2017-01-02 04:46:15 -0800290 is_remote(other.is_remote),
hbosab9f6e42016-10-07 02:18:47 -0700291 ip(other.ip),
292 port(other.port),
293 protocol(other.protocol),
294 candidate_type(other.candidate_type),
295 priority(other.priority),
hbosd17a5a72017-01-02 08:09:59 -0800296 url(other.url),
297 deleted(other.deleted) {
hbosab9f6e42016-10-07 02:18:47 -0700298}
299
300RTCIceCandidateStats::~RTCIceCandidateStats() {
301}
302
303const char RTCLocalIceCandidateStats::kType[] = "local-candidate";
304
305RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(
306 const std::string& id, int64_t timestamp_us)
hbosc3a2b7f2017-01-02 04:46:15 -0800307 : RTCIceCandidateStats(id, timestamp_us, false) {
hbosab9f6e42016-10-07 02:18:47 -0700308}
309
310RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(
311 std::string&& id, int64_t timestamp_us)
hbosc3a2b7f2017-01-02 04:46:15 -0800312 : RTCIceCandidateStats(std::move(id), timestamp_us, false) {
hbosab9f6e42016-10-07 02:18:47 -0700313}
314
315const char* RTCLocalIceCandidateStats::type() const {
316 return kType;
317}
318
319const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate";
320
321RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(
322 const std::string& id, int64_t timestamp_us)
hbosc3a2b7f2017-01-02 04:46:15 -0800323 : RTCIceCandidateStats(id, timestamp_us, true) {
hbosab9f6e42016-10-07 02:18:47 -0700324}
325
326RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(
327 std::string&& id, int64_t timestamp_us)
hbosc3a2b7f2017-01-02 04:46:15 -0800328 : RTCIceCandidateStats(std::move(id), timestamp_us, true) {
hbosab9f6e42016-10-07 02:18:47 -0700329}
330
331const char* RTCRemoteIceCandidateStats::type() const {
332 return kType;
333}
334
Steve Antond6a5cbd2017-08-18 09:40:25 -0700335// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800336WEBRTC_RTCSTATS_IMPL(RTCMediaStreamStats, RTCStats, "stream",
337 &stream_identifier,
338 &track_ids);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700339// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800340
341RTCMediaStreamStats::RTCMediaStreamStats(
342 const std::string& id, int64_t timestamp_us)
343 : RTCMediaStreamStats(std::string(id), timestamp_us) {
344}
345
346RTCMediaStreamStats::RTCMediaStreamStats(
347 std::string&& id, int64_t timestamp_us)
348 : RTCStats(std::move(id), timestamp_us),
349 stream_identifier("streamIdentifier"),
350 track_ids("trackIds") {
351}
352
353RTCMediaStreamStats::RTCMediaStreamStats(
354 const RTCMediaStreamStats& other)
355 : RTCStats(other.id(), other.timestamp_us()),
356 stream_identifier(other.stream_identifier),
357 track_ids(other.track_ids) {
358}
359
360RTCMediaStreamStats::~RTCMediaStreamStats() {
361}
362
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,
366 &remote_source,
367 &ended,
368 &detached,
369 &kind,
370 &frame_width,
371 &frame_height,
372 &frames_per_second,
373 &frames_sent,
374 &frames_received,
375 &frames_decoded,
376 &frames_dropped,
377 &frames_corrupted,
378 &partial_frames_lost,
379 &full_frames_lost,
380 &audio_level,
381 &total_audio_energy,
zsteine76bd3a2017-07-14 12:17:49 -0700382 &echo_return_loss,
Steve Anton2dbc69f2017-08-24 17:15:13 -0700383 &echo_return_loss_enhancement,
384 &total_samples_received,
385 &total_samples_duration,
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200386 &concealed_samples,
387 &concealment_events);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700388// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800389
390RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
hbos160e4a72017-01-17 02:53:23 -0800391 const std::string& id, int64_t timestamp_us, const char* kind)
392 : RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) {
hbos09bc1282016-11-08 06:29:22 -0800393}
394
zsteine76bd3a2017-07-14 12:17:49 -0700395RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(std::string&& id,
396 int64_t timestamp_us,
397 const char* kind)
hbos09bc1282016-11-08 06:29:22 -0800398 : RTCStats(std::move(id), timestamp_us),
399 track_identifier("trackIdentifier"),
400 remote_source("remoteSource"),
401 ended("ended"),
402 detached("detached"),
hbos160e4a72017-01-17 02:53:23 -0800403 kind("kind", kind),
hbos09bc1282016-11-08 06:29:22 -0800404 frame_width("frameWidth"),
405 frame_height("frameHeight"),
406 frames_per_second("framesPerSecond"),
407 frames_sent("framesSent"),
408 frames_received("framesReceived"),
409 frames_decoded("framesDecoded"),
410 frames_dropped("framesDropped"),
411 frames_corrupted("framesCorrupted"),
412 partial_frames_lost("partialFramesLost"),
413 full_frames_lost("fullFramesLost"),
414 audio_level("audioLevel"),
zsteine76bd3a2017-07-14 12:17:49 -0700415 total_audio_energy("totalAudioEnergy"),
hbos09bc1282016-11-08 06:29:22 -0800416 echo_return_loss("echoReturnLoss"),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700417 echo_return_loss_enhancement("echoReturnLossEnhancement"),
418 total_samples_received("totalSamplesReceived"),
419 total_samples_duration("totalSamplesDuration"),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200420 concealed_samples("concealedSamples"),
421 concealment_events("concealmentEvents") {
hbos160e4a72017-01-17 02:53:23 -0800422 RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
423 kind == RTCMediaStreamTrackKind::kVideo);
hbos09bc1282016-11-08 06:29:22 -0800424}
425
426RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
427 const RTCMediaStreamTrackStats& other)
428 : RTCStats(other.id(), other.timestamp_us()),
429 track_identifier(other.track_identifier),
430 remote_source(other.remote_source),
431 ended(other.ended),
432 detached(other.detached),
hbos160e4a72017-01-17 02:53:23 -0800433 kind(other.kind),
hbos09bc1282016-11-08 06:29:22 -0800434 frame_width(other.frame_width),
435 frame_height(other.frame_height),
436 frames_per_second(other.frames_per_second),
437 frames_sent(other.frames_sent),
438 frames_received(other.frames_received),
439 frames_decoded(other.frames_decoded),
440 frames_dropped(other.frames_dropped),
441 frames_corrupted(other.frames_corrupted),
442 partial_frames_lost(other.partial_frames_lost),
443 full_frames_lost(other.full_frames_lost),
444 audio_level(other.audio_level),
zsteine76bd3a2017-07-14 12:17:49 -0700445 total_audio_energy(other.total_audio_energy),
hbos09bc1282016-11-08 06:29:22 -0800446 echo_return_loss(other.echo_return_loss),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700447 echo_return_loss_enhancement(other.echo_return_loss_enhancement),
448 total_samples_received(other.total_samples_received),
449 total_samples_duration(other.total_samples_duration),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200450 concealed_samples(other.concealed_samples),
451 concealment_events(other.concealment_events) {}
hbos09bc1282016-11-08 06:29:22 -0800452
453RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {
454}
455
Steve Antond6a5cbd2017-08-18 09:40:25 -0700456// clang-format off
hbosfc5e0502016-10-06 02:06:10 -0700457WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
458 &data_channels_opened,
459 &data_channels_closed);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700460// clang-format on
hbosd565b732016-08-30 14:04:35 -0700461
462RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700463 const std::string& id, int64_t timestamp_us)
464 : RTCPeerConnectionStats(std::string(id), timestamp_us) {
hbosd565b732016-08-30 14:04:35 -0700465}
466
467RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700468 std::string&& id, int64_t timestamp_us)
469 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700470 data_channels_opened("dataChannelsOpened"),
471 data_channels_closed("dataChannelsClosed") {
472}
473
hbosfc5e0502016-10-06 02:06:10 -0700474RTCPeerConnectionStats::RTCPeerConnectionStats(
475 const RTCPeerConnectionStats& other)
476 : RTCStats(other.id(), other.timestamp_us()),
477 data_channels_opened(other.data_channels_opened),
478 data_channels_closed(other.data_channels_closed) {
479}
480
481RTCPeerConnectionStats::~RTCPeerConnectionStats() {
482}
483
Steve Antond6a5cbd2017-08-18 09:40:25 -0700484// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700485WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
486 &ssrc,
487 &associate_stats_id,
488 &is_remote,
489 &media_type,
hbosb0ae9202017-01-27 06:35:16 -0800490 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700491 &transport_id,
492 &codec_id,
493 &fir_count,
494 &pli_count,
495 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800496 &sli_count,
497 &qp_sum);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700498// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700499
500RTCRTPStreamStats::RTCRTPStreamStats(
501 const std::string& id, int64_t timestamp_us)
502 : RTCRTPStreamStats(std::string(id), timestamp_us) {
503}
504
505RTCRTPStreamStats::RTCRTPStreamStats(
506 std::string&& id, int64_t timestamp_us)
507 : RTCStats(std::move(id), timestamp_us),
508 ssrc("ssrc"),
509 associate_stats_id("associateStatsId"),
510 is_remote("isRemote", false),
511 media_type("mediaType"),
hbosb0ae9202017-01-27 06:35:16 -0800512 track_id("trackId"),
hbos6ded1902016-11-01 01:50:46 -0700513 transport_id("transportId"),
514 codec_id("codecId"),
515 fir_count("firCount"),
516 pli_count("pliCount"),
517 nack_count("nackCount"),
hbos6769c492017-01-02 08:35:13 -0800518 sli_count("sliCount"),
519 qp_sum("qpSum") {
hbos6ded1902016-11-01 01:50:46 -0700520}
521
522RTCRTPStreamStats::RTCRTPStreamStats(
523 const RTCRTPStreamStats& other)
524 : RTCStats(other.id(), other.timestamp_us()),
525 ssrc(other.ssrc),
526 associate_stats_id(other.associate_stats_id),
527 is_remote(other.is_remote),
528 media_type(other.media_type),
hbosb0ae9202017-01-27 06:35:16 -0800529 track_id(other.track_id),
hbos6ded1902016-11-01 01:50:46 -0700530 transport_id(other.transport_id),
531 codec_id(other.codec_id),
532 fir_count(other.fir_count),
533 pli_count(other.pli_count),
534 nack_count(other.nack_count),
hbos6769c492017-01-02 08:35:13 -0800535 sli_count(other.sli_count),
536 qp_sum(other.qp_sum) {
hbos6ded1902016-11-01 01:50:46 -0700537}
538
539RTCRTPStreamStats::~RTCRTPStreamStats() {
540}
541
Steve Antond6a5cbd2017-08-18 09:40:25 -0700542// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700543WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700544 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
545 &packets_received,
546 &bytes_received,
547 &packets_lost,
548 &jitter,
549 &fraction_lost,
hbosa7a9be12017-03-01 01:02:45 -0800550 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700551 &packets_discarded,
552 &packets_repaired,
553 &burst_packets_lost,
554 &burst_packets_discarded,
555 &burst_loss_count,
556 &burst_discard_count,
557 &burst_loss_rate,
558 &burst_discard_rate,
559 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800560 &gap_discard_rate,
561 &frames_decoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700562// clang-format on
hboseeafe942016-11-01 03:00:17 -0700563
564RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
565 const std::string& id, int64_t timestamp_us)
566 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {
567}
568
569RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
570 std::string&& id, int64_t timestamp_us)
571 : RTCRTPStreamStats(std::move(id), timestamp_us),
572 packets_received("packetsReceived"),
573 bytes_received("bytesReceived"),
574 packets_lost("packetsLost"),
575 jitter("jitter"),
576 fraction_lost("fractionLost"),
hbosa7a9be12017-03-01 01:02:45 -0800577 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700578 packets_discarded("packetsDiscarded"),
579 packets_repaired("packetsRepaired"),
580 burst_packets_lost("burstPacketsLost"),
581 burst_packets_discarded("burstPacketsDiscarded"),
582 burst_loss_count("burstLossCount"),
583 burst_discard_count("burstDiscardCount"),
584 burst_loss_rate("burstLossRate"),
585 burst_discard_rate("burstDiscardRate"),
586 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800587 gap_discard_rate("gapDiscardRate"),
588 frames_decoded("framesDecoded") {
hboseeafe942016-11-01 03:00:17 -0700589}
590
591RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
592 const RTCInboundRTPStreamStats& other)
593 : RTCRTPStreamStats(other),
594 packets_received(other.packets_received),
595 bytes_received(other.bytes_received),
596 packets_lost(other.packets_lost),
597 jitter(other.jitter),
598 fraction_lost(other.fraction_lost),
hbosa7a9be12017-03-01 01:02:45 -0800599 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700600 packets_discarded(other.packets_discarded),
601 packets_repaired(other.packets_repaired),
602 burst_packets_lost(other.burst_packets_lost),
603 burst_packets_discarded(other.burst_packets_discarded),
604 burst_loss_count(other.burst_loss_count),
605 burst_discard_count(other.burst_discard_count),
606 burst_loss_rate(other.burst_loss_rate),
607 burst_discard_rate(other.burst_discard_rate),
608 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800609 gap_discard_rate(other.gap_discard_rate),
610 frames_decoded(other.frames_decoded) {
hboseeafe942016-11-01 03:00:17 -0700611}
612
613RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {
614}
615
Steve Antond6a5cbd2017-08-18 09:40:25 -0700616// clang-format off
hboseeafe942016-11-01 03:00:17 -0700617WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700618 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
619 &packets_sent,
620 &bytes_sent,
621 &target_bitrate,
hbos6769c492017-01-02 08:35:13 -0800622 &frames_encoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700623// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700624
625RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
626 const std::string& id, int64_t timestamp_us)
627 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {
628}
629
630RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
631 std::string&& id, int64_t timestamp_us)
632 : RTCRTPStreamStats(std::move(id), timestamp_us),
633 packets_sent("packetsSent"),
634 bytes_sent("bytesSent"),
635 target_bitrate("targetBitrate"),
hbos6769c492017-01-02 08:35:13 -0800636 frames_encoded("framesEncoded") {
hbos6ded1902016-11-01 01:50:46 -0700637}
638
639RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
640 const RTCOutboundRTPStreamStats& other)
641 : RTCRTPStreamStats(other),
642 packets_sent(other.packets_sent),
643 bytes_sent(other.bytes_sent),
644 target_bitrate(other.target_bitrate),
hbos6769c492017-01-02 08:35:13 -0800645 frames_encoded(other.frames_encoded) {
hbos6ded1902016-11-01 01:50:46 -0700646}
647
648RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {
649}
650
Steve Antond6a5cbd2017-08-18 09:40:25 -0700651// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700652WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
653 &bytes_sent,
654 &bytes_received,
655 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800656 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700657 &selected_candidate_pair_id,
658 &local_certificate_id,
659 &remote_certificate_id);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700660// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700661
662RTCTransportStats::RTCTransportStats(
663 const std::string& id, int64_t timestamp_us)
664 : RTCTransportStats(std::string(id), timestamp_us) {
665}
666
667RTCTransportStats::RTCTransportStats(
668 std::string&& id, int64_t timestamp_us)
669 : RTCStats(std::move(id), timestamp_us),
670 bytes_sent("bytesSent"),
671 bytes_received("bytesReceived"),
672 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800673 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700674 selected_candidate_pair_id("selectedCandidatePairId"),
675 local_certificate_id("localCertificateId"),
676 remote_certificate_id("remoteCertificateId") {
677}
678
679RTCTransportStats::RTCTransportStats(
680 const RTCTransportStats& other)
681 : RTCStats(other.id(), other.timestamp_us()),
682 bytes_sent(other.bytes_sent),
683 bytes_received(other.bytes_received),
684 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800685 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700686 selected_candidate_pair_id(other.selected_candidate_pair_id),
687 local_certificate_id(other.local_certificate_id),
688 remote_certificate_id(other.remote_certificate_id) {
689}
690
691RTCTransportStats::~RTCTransportStats() {
692}
693
hbosd565b732016-08-30 14:04:35 -0700694} // namespace webrtc