blob: 3d1d369407811e48a1fb3d6887fea63781f2f4cd [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(
350 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
351 &packets_sent,
352 &bytes_sent,
353 &target_bitrate,
354 &round_trip_time);
355
356RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
357 const std::string& id, int64_t timestamp_us)
358 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {
359}
360
361RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
362 std::string&& id, int64_t timestamp_us)
363 : RTCRTPStreamStats(std::move(id), timestamp_us),
364 packets_sent("packetsSent"),
365 bytes_sent("bytesSent"),
366 target_bitrate("targetBitrate"),
367 round_trip_time("roundTripTime") {
368}
369
370RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
371 const RTCOutboundRTPStreamStats& other)
372 : RTCRTPStreamStats(other),
373 packets_sent(other.packets_sent),
374 bytes_sent(other.bytes_sent),
375 target_bitrate(other.target_bitrate),
376 round_trip_time(other.round_trip_time) {
377}
378
379RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {
380}
381
hbos2fa7c672016-10-24 04:00:05 -0700382WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
383 &bytes_sent,
384 &bytes_received,
385 &rtcp_transport_stats_id,
386 &active_connection,
387 &selected_candidate_pair_id,
388 &local_certificate_id,
389 &remote_certificate_id);
390
391RTCTransportStats::RTCTransportStats(
392 const std::string& id, int64_t timestamp_us)
393 : RTCTransportStats(std::string(id), timestamp_us) {
394}
395
396RTCTransportStats::RTCTransportStats(
397 std::string&& id, int64_t timestamp_us)
398 : RTCStats(std::move(id), timestamp_us),
399 bytes_sent("bytesSent"),
400 bytes_received("bytesReceived"),
401 rtcp_transport_stats_id("rtcpTransportStatsId"),
402 active_connection("activeConnection"),
403 selected_candidate_pair_id("selectedCandidatePairId"),
404 local_certificate_id("localCertificateId"),
405 remote_certificate_id("remoteCertificateId") {
406}
407
408RTCTransportStats::RTCTransportStats(
409 const RTCTransportStats& other)
410 : RTCStats(other.id(), other.timestamp_us()),
411 bytes_sent(other.bytes_sent),
412 bytes_received(other.bytes_received),
413 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
414 active_connection(other.active_connection),
415 selected_candidate_pair_id(other.selected_candidate_pair_id),
416 local_certificate_id(other.local_certificate_id),
417 remote_certificate_id(other.remote_certificate_id) {
418}
419
420RTCTransportStats::~RTCTransportStats() {
421}
422
hbosd565b732016-08-30 14:04:35 -0700423} // namespace webrtc