blob: 2523e36a88731e72a23f3858a50ddf760d86b5b9 [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
hbosfc5e0502016-10-06 02:06:10 -0700270WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
271 &data_channels_opened,
272 &data_channels_closed);
hbosd565b732016-08-30 14:04:35 -0700273
274RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700275 const std::string& id, int64_t timestamp_us)
276 : RTCPeerConnectionStats(std::string(id), timestamp_us) {
hbosd565b732016-08-30 14:04:35 -0700277}
278
279RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700280 std::string&& id, int64_t timestamp_us)
281 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700282 data_channels_opened("dataChannelsOpened"),
283 data_channels_closed("dataChannelsClosed") {
284}
285
hbosfc5e0502016-10-06 02:06:10 -0700286RTCPeerConnectionStats::RTCPeerConnectionStats(
287 const RTCPeerConnectionStats& other)
288 : RTCStats(other.id(), other.timestamp_us()),
289 data_channels_opened(other.data_channels_opened),
290 data_channels_closed(other.data_channels_closed) {
291}
292
293RTCPeerConnectionStats::~RTCPeerConnectionStats() {
294}
295
hbos6ded1902016-11-01 01:50:46 -0700296WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
297 &ssrc,
298 &associate_stats_id,
299 &is_remote,
300 &media_type,
301 &media_track_id,
302 &transport_id,
303 &codec_id,
304 &fir_count,
305 &pli_count,
306 &nack_count,
307 &sli_count);
308
309RTCRTPStreamStats::RTCRTPStreamStats(
310 const std::string& id, int64_t timestamp_us)
311 : RTCRTPStreamStats(std::string(id), timestamp_us) {
312}
313
314RTCRTPStreamStats::RTCRTPStreamStats(
315 std::string&& id, int64_t timestamp_us)
316 : RTCStats(std::move(id), timestamp_us),
317 ssrc("ssrc"),
318 associate_stats_id("associateStatsId"),
319 is_remote("isRemote", false),
320 media_type("mediaType"),
321 media_track_id("mediaTrackId"),
322 transport_id("transportId"),
323 codec_id("codecId"),
324 fir_count("firCount"),
325 pli_count("pliCount"),
326 nack_count("nackCount"),
327 sli_count("sliCount") {
328}
329
330RTCRTPStreamStats::RTCRTPStreamStats(
331 const RTCRTPStreamStats& other)
332 : RTCStats(other.id(), other.timestamp_us()),
333 ssrc(other.ssrc),
334 associate_stats_id(other.associate_stats_id),
335 is_remote(other.is_remote),
336 media_type(other.media_type),
337 media_track_id(other.media_track_id),
338 transport_id(other.transport_id),
339 codec_id(other.codec_id),
340 fir_count(other.fir_count),
341 pli_count(other.pli_count),
342 nack_count(other.nack_count),
343 sli_count(other.sli_count) {
344}
345
346RTCRTPStreamStats::~RTCRTPStreamStats() {
347}
348
349WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700350 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
351 &packets_received,
352 &bytes_received,
353 &packets_lost,
354 &jitter,
355 &fraction_lost,
356 &packets_discarded,
357 &packets_repaired,
358 &burst_packets_lost,
359 &burst_packets_discarded,
360 &burst_loss_count,
361 &burst_discard_count,
362 &burst_loss_rate,
363 &burst_discard_rate,
364 &gap_loss_rate,
365 &gap_discard_rate);
366
367RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
368 const std::string& id, int64_t timestamp_us)
369 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {
370}
371
372RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
373 std::string&& id, int64_t timestamp_us)
374 : RTCRTPStreamStats(std::move(id), timestamp_us),
375 packets_received("packetsReceived"),
376 bytes_received("bytesReceived"),
377 packets_lost("packetsLost"),
378 jitter("jitter"),
379 fraction_lost("fractionLost"),
380 packets_discarded("packetsDiscarded"),
381 packets_repaired("packetsRepaired"),
382 burst_packets_lost("burstPacketsLost"),
383 burst_packets_discarded("burstPacketsDiscarded"),
384 burst_loss_count("burstLossCount"),
385 burst_discard_count("burstDiscardCount"),
386 burst_loss_rate("burstLossRate"),
387 burst_discard_rate("burstDiscardRate"),
388 gap_loss_rate("gapLossRate"),
389 gap_discard_rate("gapDiscardRate") {
390}
391
392RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
393 const RTCInboundRTPStreamStats& other)
394 : RTCRTPStreamStats(other),
395 packets_received(other.packets_received),
396 bytes_received(other.bytes_received),
397 packets_lost(other.packets_lost),
398 jitter(other.jitter),
399 fraction_lost(other.fraction_lost),
400 packets_discarded(other.packets_discarded),
401 packets_repaired(other.packets_repaired),
402 burst_packets_lost(other.burst_packets_lost),
403 burst_packets_discarded(other.burst_packets_discarded),
404 burst_loss_count(other.burst_loss_count),
405 burst_discard_count(other.burst_discard_count),
406 burst_loss_rate(other.burst_loss_rate),
407 burst_discard_rate(other.burst_discard_rate),
408 gap_loss_rate(other.gap_loss_rate),
409 gap_discard_rate(other.gap_discard_rate) {
410}
411
412RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {
413}
414
415WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700416 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
417 &packets_sent,
418 &bytes_sent,
419 &target_bitrate,
420 &round_trip_time);
421
422RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
423 const std::string& id, int64_t timestamp_us)
424 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {
425}
426
427RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
428 std::string&& id, int64_t timestamp_us)
429 : RTCRTPStreamStats(std::move(id), timestamp_us),
430 packets_sent("packetsSent"),
431 bytes_sent("bytesSent"),
432 target_bitrate("targetBitrate"),
433 round_trip_time("roundTripTime") {
434}
435
436RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
437 const RTCOutboundRTPStreamStats& other)
438 : RTCRTPStreamStats(other),
439 packets_sent(other.packets_sent),
440 bytes_sent(other.bytes_sent),
441 target_bitrate(other.target_bitrate),
442 round_trip_time(other.round_trip_time) {
443}
444
445RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {
446}
447
hbos2fa7c672016-10-24 04:00:05 -0700448WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
449 &bytes_sent,
450 &bytes_received,
451 &rtcp_transport_stats_id,
452 &active_connection,
453 &selected_candidate_pair_id,
454 &local_certificate_id,
455 &remote_certificate_id);
456
457RTCTransportStats::RTCTransportStats(
458 const std::string& id, int64_t timestamp_us)
459 : RTCTransportStats(std::string(id), timestamp_us) {
460}
461
462RTCTransportStats::RTCTransportStats(
463 std::string&& id, int64_t timestamp_us)
464 : RTCStats(std::move(id), timestamp_us),
465 bytes_sent("bytesSent"),
466 bytes_received("bytesReceived"),
467 rtcp_transport_stats_id("rtcpTransportStatsId"),
468 active_connection("activeConnection"),
469 selected_candidate_pair_id("selectedCandidatePairId"),
470 local_certificate_id("localCertificateId"),
471 remote_certificate_id("remoteCertificateId") {
472}
473
474RTCTransportStats::RTCTransportStats(
475 const RTCTransportStats& other)
476 : RTCStats(other.id(), other.timestamp_us()),
477 bytes_sent(other.bytes_sent),
478 bytes_received(other.bytes_received),
479 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
480 active_connection(other.active_connection),
481 selected_candidate_pair_id(other.selected_candidate_pair_id),
482 local_certificate_id(other.local_certificate_id),
483 remote_certificate_id(other.remote_certificate_id) {
484}
485
486RTCTransportStats::~RTCTransportStats() {
487}
488
hbosd565b732016-08-30 14:04:35 -0700489} // namespace webrtc