blob: 54b587b1290f0450b9dd57bd6a3b80ec7ed5755c [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
hbos74e1a4f2016-09-15 23:33:01 -070011#include "webrtc/api/stats/rtcstats_objects.h"
hbosd565b732016-08-30 14:04:35 -070012
13namespace webrtc {
14
hboscc555c52016-10-18 12:48:31 -070015const char* RTCDataChannelState::kConnecting = "connecting";
16const char* RTCDataChannelState::kOpen = "open";
17const char* RTCDataChannelState::kClosing = "closing";
18const char* RTCDataChannelState::kClosed = "closed";
19
hbosc47a0c32016-10-11 14:54:49 -070020const char* RTCStatsIceCandidatePairState::kFrozen = "frozen";
21const char* RTCStatsIceCandidatePairState::kWaiting = "waiting";
22const char* RTCStatsIceCandidatePairState::kInProgress = "inprogress";
23const char* RTCStatsIceCandidatePairState::kFailed = "failed";
24const char* RTCStatsIceCandidatePairState::kSucceeded = "succeeded";
25const char* RTCStatsIceCandidatePairState::kCancelled = "cancelled";
26
27// Strings defined in https://tools.ietf.org/html/rfc5245.
hbosab9f6e42016-10-07 02:18:47 -070028const char* RTCIceCandidateType::kHost = "host";
29const char* RTCIceCandidateType::kSrflx = "srflx";
30const char* RTCIceCandidateType::kPrflx = "prflx";
31const char* RTCIceCandidateType::kRelay = "relay";
32
hbos2fa7c672016-10-24 04:00:05 -070033WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
34 &fingerprint,
35 &fingerprint_algorithm,
36 &base64_certificate,
37 &issuer_certificate_id);
38
39RTCCertificateStats::RTCCertificateStats(
40 const std::string& id, int64_t timestamp_us)
41 : RTCCertificateStats(std::string(id), timestamp_us) {
42}
43
44RTCCertificateStats::RTCCertificateStats(
45 std::string&& id, int64_t timestamp_us)
46 : RTCStats(std::move(id), timestamp_us),
47 fingerprint("fingerprint"),
48 fingerprint_algorithm("fingerprintAlgorithm"),
49 base64_certificate("base64Certificate"),
50 issuer_certificate_id("issuerCertificateId") {
51}
52
53RTCCertificateStats::RTCCertificateStats(
54 const RTCCertificateStats& other)
55 : RTCStats(other.id(), other.timestamp_us()),
56 fingerprint(other.fingerprint),
57 fingerprint_algorithm(other.fingerprint_algorithm),
58 base64_certificate(other.base64_certificate),
59 issuer_certificate_id(other.issuer_certificate_id) {
60}
61
62RTCCertificateStats::~RTCCertificateStats() {
63}
64
65WEBRTC_RTCSTATS_IMPL(RTCDataChannelStats, RTCStats, "data-channel",
66 &label,
67 &protocol,
68 &datachannelid,
69 &state,
70 &messages_sent,
71 &bytes_sent,
72 &messages_received,
73 &bytes_received);
74
75RTCDataChannelStats::RTCDataChannelStats(
76 const std::string& id, int64_t timestamp_us)
77 : RTCDataChannelStats(std::string(id), timestamp_us) {
78}
79
80RTCDataChannelStats::RTCDataChannelStats(
81 std::string&& id, int64_t timestamp_us)
82 : RTCStats(std::move(id), timestamp_us),
83 label("label"),
84 protocol("protocol"),
85 datachannelid("datachannelid"),
86 state("state"),
87 messages_sent("messagesSent"),
88 bytes_sent("bytesSent"),
89 messages_received("messagesReceived"),
90 bytes_received("bytesReceived") {
91}
92
93RTCDataChannelStats::RTCDataChannelStats(
94 const RTCDataChannelStats& other)
95 : RTCStats(other.id(), other.timestamp_us()),
96 label(other.label),
97 protocol(other.protocol),
98 datachannelid(other.datachannelid),
99 state(other.state),
100 messages_sent(other.messages_sent),
101 bytes_sent(other.bytes_sent),
102 messages_received(other.messages_received),
103 bytes_received(other.bytes_received) {
104}
105
106RTCDataChannelStats::~RTCDataChannelStats() {
107}
108
hbosc47a0c32016-10-11 14:54:49 -0700109WEBRTC_RTCSTATS_IMPL(RTCIceCandidatePairStats, RTCStats, "candidate-pair",
110 &transport_id,
111 &local_candidate_id,
112 &remote_candidate_id,
113 &state,
114 &priority,
115 &nominated,
116 &writable,
117 &readable,
118 &bytes_sent,
119 &bytes_received,
120 &total_rtt,
121 &current_rtt,
122 &available_outgoing_bitrate,
123 &available_incoming_bitrate,
124 &requests_received,
125 &requests_sent,
126 &responses_received,
127 &responses_sent,
128 &retransmissions_received,
129 &retransmissions_sent,
130 &consent_requests_received,
131 &consent_requests_sent,
132 &consent_responses_received,
133 &consent_responses_sent);
134
135RTCIceCandidatePairStats::RTCIceCandidatePairStats(
136 const std::string& id, int64_t timestamp_us)
137 : RTCIceCandidatePairStats(std::string(id), timestamp_us) {
138}
139
140RTCIceCandidatePairStats::RTCIceCandidatePairStats(
141 std::string&& id, int64_t timestamp_us)
142 : RTCStats(std::move(id), timestamp_us),
143 transport_id("transportId"),
144 local_candidate_id("localCandidateId"),
145 remote_candidate_id("remoteCandidateId"),
146 state("state"),
147 priority("priority"),
148 nominated("nominated"),
149 writable("writable"),
150 readable("readable"),
151 bytes_sent("bytesSent"),
152 bytes_received("bytesReceived"),
153 total_rtt("totalRtt"),
154 current_rtt("currentRtt"),
155 available_outgoing_bitrate("availableOutgoingBitrate"),
156 available_incoming_bitrate("availableIncomingBitrate"),
157 requests_received("requestsReceived"),
158 requests_sent("requestsSent"),
159 responses_received("responsesReceived"),
160 responses_sent("responsesSent"),
161 retransmissions_received("retransmissionsReceived"),
162 retransmissions_sent("retransmissionsSent"),
163 consent_requests_received("consentRequestsReceived"),
164 consent_requests_sent("consentRequestsSent"),
165 consent_responses_received("consentResponsesReceived"),
166 consent_responses_sent("consentResponsesSent") {
167}
168
169RTCIceCandidatePairStats::RTCIceCandidatePairStats(
170 const RTCIceCandidatePairStats& other)
171 : RTCStats(other.id(), other.timestamp_us()),
172 transport_id(other.transport_id),
173 local_candidate_id(other.local_candidate_id),
174 remote_candidate_id(other.remote_candidate_id),
175 state(other.state),
176 priority(other.priority),
177 nominated(other.nominated),
178 writable(other.writable),
179 readable(other.readable),
180 bytes_sent(other.bytes_sent),
181 bytes_received(other.bytes_received),
182 total_rtt(other.total_rtt),
183 current_rtt(other.current_rtt),
184 available_outgoing_bitrate(other.available_outgoing_bitrate),
185 available_incoming_bitrate(other.available_incoming_bitrate),
186 requests_received(other.requests_received),
187 requests_sent(other.requests_sent),
188 responses_received(other.responses_received),
189 responses_sent(other.responses_sent),
190 retransmissions_received(other.retransmissions_received),
191 retransmissions_sent(other.retransmissions_sent),
192 consent_requests_received(other.consent_requests_received),
193 consent_requests_sent(other.consent_requests_sent),
194 consent_responses_received(other.consent_responses_received),
195 consent_responses_sent(other.consent_responses_sent) {
196}
197
198RTCIceCandidatePairStats::~RTCIceCandidatePairStats() {
199}
200
hbosab9f6e42016-10-07 02:18:47 -0700201WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "ice-candidate",
202 &ip,
203 &port,
204 &protocol,
205 &candidate_type,
206 &priority,
207 &url);
208
209RTCIceCandidateStats::RTCIceCandidateStats(
210 const std::string& id, int64_t timestamp_us)
211 : RTCIceCandidateStats(std::string(id), timestamp_us) {
212}
213
214RTCIceCandidateStats::RTCIceCandidateStats(
215 std::string&& id, int64_t timestamp_us)
216 : RTCStats(std::move(id), timestamp_us),
217 ip("ip"),
218 port("port"),
219 protocol("protocol"),
220 candidate_type("candidateType"),
221 priority("priority"),
222 url("url") {
223}
224
225RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
226 : RTCStats(other.id(), other.timestamp_us()),
227 ip(other.ip),
228 port(other.port),
229 protocol(other.protocol),
230 candidate_type(other.candidate_type),
231 priority(other.priority),
232 url(other.url) {
233}
234
235RTCIceCandidateStats::~RTCIceCandidateStats() {
236}
237
238const char RTCLocalIceCandidateStats::kType[] = "local-candidate";
239
240RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(
241 const std::string& id, int64_t timestamp_us)
242 : RTCIceCandidateStats(id, timestamp_us) {
243}
244
245RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(
246 std::string&& id, int64_t timestamp_us)
247 : RTCIceCandidateStats(std::move(id), timestamp_us) {
248}
249
250const char* RTCLocalIceCandidateStats::type() const {
251 return kType;
252}
253
254const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate";
255
256RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(
257 const std::string& id, int64_t timestamp_us)
258 : RTCIceCandidateStats(id, timestamp_us) {
259}
260
261RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(
262 std::string&& id, int64_t timestamp_us)
263 : RTCIceCandidateStats(std::move(id), timestamp_us) {
264}
265
266const char* RTCRemoteIceCandidateStats::type() const {
267 return kType;
268}
269
hbos09bc1282016-11-08 06:29:22 -0800270WEBRTC_RTCSTATS_IMPL(RTCMediaStreamStats, RTCStats, "stream",
271 &stream_identifier,
272 &track_ids);
273
274RTCMediaStreamStats::RTCMediaStreamStats(
275 const std::string& id, int64_t timestamp_us)
276 : RTCMediaStreamStats(std::string(id), timestamp_us) {
277}
278
279RTCMediaStreamStats::RTCMediaStreamStats(
280 std::string&& id, int64_t timestamp_us)
281 : RTCStats(std::move(id), timestamp_us),
282 stream_identifier("streamIdentifier"),
283 track_ids("trackIds") {
284}
285
286RTCMediaStreamStats::RTCMediaStreamStats(
287 const RTCMediaStreamStats& other)
288 : RTCStats(other.id(), other.timestamp_us()),
289 stream_identifier(other.stream_identifier),
290 track_ids(other.track_ids) {
291}
292
293RTCMediaStreamStats::~RTCMediaStreamStats() {
294}
295
296WEBRTC_RTCSTATS_IMPL(RTCMediaStreamTrackStats, RTCStats, "track",
297 &track_identifier,
298 &remote_source,
299 &ended,
300 &detached,
301 &ssrc_ids,
302 &frame_width,
303 &frame_height,
304 &frames_per_second,
305 &frames_sent,
306 &frames_received,
307 &frames_decoded,
308 &frames_dropped,
309 &frames_corrupted,
310 &partial_frames_lost,
311 &full_frames_lost,
312 &audio_level,
313 &echo_return_loss,
314 &echo_return_loss_enhancement);
315
316RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
317 const std::string& id, int64_t timestamp_us)
318 : RTCMediaStreamTrackStats(std::string(id), timestamp_us) {
319}
320
321RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
322 std::string&& id, int64_t timestamp_us)
323 : RTCStats(std::move(id), timestamp_us),
324 track_identifier("trackIdentifier"),
325 remote_source("remoteSource"),
326 ended("ended"),
327 detached("detached"),
328 ssrc_ids("ssrcIds"),
329 frame_width("frameWidth"),
330 frame_height("frameHeight"),
331 frames_per_second("framesPerSecond"),
332 frames_sent("framesSent"),
333 frames_received("framesReceived"),
334 frames_decoded("framesDecoded"),
335 frames_dropped("framesDropped"),
336 frames_corrupted("framesCorrupted"),
337 partial_frames_lost("partialFramesLost"),
338 full_frames_lost("fullFramesLost"),
339 audio_level("audioLevel"),
340 echo_return_loss("echoReturnLoss"),
341 echo_return_loss_enhancement("echoReturnLossEnhancement") {
342}
343
344RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
345 const RTCMediaStreamTrackStats& other)
346 : RTCStats(other.id(), other.timestamp_us()),
347 track_identifier(other.track_identifier),
348 remote_source(other.remote_source),
349 ended(other.ended),
350 detached(other.detached),
351 ssrc_ids(other.ssrc_ids),
352 frame_width(other.frame_width),
353 frame_height(other.frame_height),
354 frames_per_second(other.frames_per_second),
355 frames_sent(other.frames_sent),
356 frames_received(other.frames_received),
357 frames_decoded(other.frames_decoded),
358 frames_dropped(other.frames_dropped),
359 frames_corrupted(other.frames_corrupted),
360 partial_frames_lost(other.partial_frames_lost),
361 full_frames_lost(other.full_frames_lost),
362 audio_level(other.audio_level),
363 echo_return_loss(other.echo_return_loss),
364 echo_return_loss_enhancement(other.echo_return_loss_enhancement) {
365}
366
367RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {
368}
369
hbosfc5e0502016-10-06 02:06:10 -0700370WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
371 &data_channels_opened,
372 &data_channels_closed);
hbosd565b732016-08-30 14:04:35 -0700373
374RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700375 const std::string& id, int64_t timestamp_us)
376 : RTCPeerConnectionStats(std::string(id), timestamp_us) {
hbosd565b732016-08-30 14:04:35 -0700377}
378
379RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700380 std::string&& id, int64_t timestamp_us)
381 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700382 data_channels_opened("dataChannelsOpened"),
383 data_channels_closed("dataChannelsClosed") {
384}
385
hbosfc5e0502016-10-06 02:06:10 -0700386RTCPeerConnectionStats::RTCPeerConnectionStats(
387 const RTCPeerConnectionStats& other)
388 : RTCStats(other.id(), other.timestamp_us()),
389 data_channels_opened(other.data_channels_opened),
390 data_channels_closed(other.data_channels_closed) {
391}
392
393RTCPeerConnectionStats::~RTCPeerConnectionStats() {
394}
395
hbos6ded1902016-11-01 01:50:46 -0700396WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
397 &ssrc,
398 &associate_stats_id,
399 &is_remote,
400 &media_type,
401 &media_track_id,
402 &transport_id,
403 &codec_id,
404 &fir_count,
405 &pli_count,
406 &nack_count,
407 &sli_count);
408
409RTCRTPStreamStats::RTCRTPStreamStats(
410 const std::string& id, int64_t timestamp_us)
411 : RTCRTPStreamStats(std::string(id), timestamp_us) {
412}
413
414RTCRTPStreamStats::RTCRTPStreamStats(
415 std::string&& id, int64_t timestamp_us)
416 : RTCStats(std::move(id), timestamp_us),
417 ssrc("ssrc"),
418 associate_stats_id("associateStatsId"),
419 is_remote("isRemote", false),
420 media_type("mediaType"),
421 media_track_id("mediaTrackId"),
422 transport_id("transportId"),
423 codec_id("codecId"),
424 fir_count("firCount"),
425 pli_count("pliCount"),
426 nack_count("nackCount"),
427 sli_count("sliCount") {
428}
429
430RTCRTPStreamStats::RTCRTPStreamStats(
431 const RTCRTPStreamStats& other)
432 : RTCStats(other.id(), other.timestamp_us()),
433 ssrc(other.ssrc),
434 associate_stats_id(other.associate_stats_id),
435 is_remote(other.is_remote),
436 media_type(other.media_type),
437 media_track_id(other.media_track_id),
438 transport_id(other.transport_id),
439 codec_id(other.codec_id),
440 fir_count(other.fir_count),
441 pli_count(other.pli_count),
442 nack_count(other.nack_count),
443 sli_count(other.sli_count) {
444}
445
446RTCRTPStreamStats::~RTCRTPStreamStats() {
447}
448
449WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700450 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
451 &packets_received,
452 &bytes_received,
453 &packets_lost,
454 &jitter,
455 &fraction_lost,
456 &packets_discarded,
457 &packets_repaired,
458 &burst_packets_lost,
459 &burst_packets_discarded,
460 &burst_loss_count,
461 &burst_discard_count,
462 &burst_loss_rate,
463 &burst_discard_rate,
464 &gap_loss_rate,
465 &gap_discard_rate);
466
467RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
468 const std::string& id, int64_t timestamp_us)
469 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {
470}
471
472RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
473 std::string&& id, int64_t timestamp_us)
474 : RTCRTPStreamStats(std::move(id), timestamp_us),
475 packets_received("packetsReceived"),
476 bytes_received("bytesReceived"),
477 packets_lost("packetsLost"),
478 jitter("jitter"),
479 fraction_lost("fractionLost"),
480 packets_discarded("packetsDiscarded"),
481 packets_repaired("packetsRepaired"),
482 burst_packets_lost("burstPacketsLost"),
483 burst_packets_discarded("burstPacketsDiscarded"),
484 burst_loss_count("burstLossCount"),
485 burst_discard_count("burstDiscardCount"),
486 burst_loss_rate("burstLossRate"),
487 burst_discard_rate("burstDiscardRate"),
488 gap_loss_rate("gapLossRate"),
489 gap_discard_rate("gapDiscardRate") {
490}
491
492RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
493 const RTCInboundRTPStreamStats& other)
494 : RTCRTPStreamStats(other),
495 packets_received(other.packets_received),
496 bytes_received(other.bytes_received),
497 packets_lost(other.packets_lost),
498 jitter(other.jitter),
499 fraction_lost(other.fraction_lost),
500 packets_discarded(other.packets_discarded),
501 packets_repaired(other.packets_repaired),
502 burst_packets_lost(other.burst_packets_lost),
503 burst_packets_discarded(other.burst_packets_discarded),
504 burst_loss_count(other.burst_loss_count),
505 burst_discard_count(other.burst_discard_count),
506 burst_loss_rate(other.burst_loss_rate),
507 burst_discard_rate(other.burst_discard_rate),
508 gap_loss_rate(other.gap_loss_rate),
509 gap_discard_rate(other.gap_discard_rate) {
510}
511
512RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {
513}
514
515WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700516 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
517 &packets_sent,
518 &bytes_sent,
519 &target_bitrate,
520 &round_trip_time);
521
522RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
523 const std::string& id, int64_t timestamp_us)
524 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {
525}
526
527RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
528 std::string&& id, int64_t timestamp_us)
529 : RTCRTPStreamStats(std::move(id), timestamp_us),
530 packets_sent("packetsSent"),
531 bytes_sent("bytesSent"),
532 target_bitrate("targetBitrate"),
533 round_trip_time("roundTripTime") {
534}
535
536RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
537 const RTCOutboundRTPStreamStats& other)
538 : RTCRTPStreamStats(other),
539 packets_sent(other.packets_sent),
540 bytes_sent(other.bytes_sent),
541 target_bitrate(other.target_bitrate),
542 round_trip_time(other.round_trip_time) {
543}
544
545RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {
546}
547
hbos2fa7c672016-10-24 04:00:05 -0700548WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
549 &bytes_sent,
550 &bytes_received,
551 &rtcp_transport_stats_id,
552 &active_connection,
553 &selected_candidate_pair_id,
554 &local_certificate_id,
555 &remote_certificate_id);
556
557RTCTransportStats::RTCTransportStats(
558 const std::string& id, int64_t timestamp_us)
559 : RTCTransportStats(std::string(id), timestamp_us) {
560}
561
562RTCTransportStats::RTCTransportStats(
563 std::string&& id, int64_t timestamp_us)
564 : RTCStats(std::move(id), timestamp_us),
565 bytes_sent("bytesSent"),
566 bytes_received("bytesReceived"),
567 rtcp_transport_stats_id("rtcpTransportStatsId"),
568 active_connection("activeConnection"),
569 selected_candidate_pair_id("selectedCandidatePairId"),
570 local_certificate_id("localCertificateId"),
571 remote_certificate_id("remoteCertificateId") {
572}
573
574RTCTransportStats::RTCTransportStats(
575 const RTCTransportStats& other)
576 : RTCStats(other.id(), other.timestamp_us()),
577 bytes_sent(other.bytes_sent),
578 bytes_received(other.bytes_received),
579 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
580 active_connection(other.active_connection),
581 selected_candidate_pair_id(other.selected_candidate_pair_id),
582 local_certificate_id(other.local_certificate_id),
583 remote_certificate_id(other.remote_certificate_id) {
584}
585
586RTCTransportStats::~RTCTransportStats() {
587}
588
hbosd565b732016-08-30 14:04:35 -0700589} // namespace webrtc