blob: b1698cfe710839d2b93cf81435f9a429b4f8d924 [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,
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200370 &jitter_buffer_delay,
zsteine76bd3a2017-07-14 12:17:49 -0700371 &frame_width,
372 &frame_height,
373 &frames_per_second,
374 &frames_sent,
375 &frames_received,
376 &frames_decoded,
377 &frames_dropped,
378 &frames_corrupted,
379 &partial_frames_lost,
380 &full_frames_lost,
381 &audio_level,
382 &total_audio_energy,
zsteine76bd3a2017-07-14 12:17:49 -0700383 &echo_return_loss,
Steve Anton2dbc69f2017-08-24 17:15:13 -0700384 &echo_return_loss_enhancement,
385 &total_samples_received,
386 &total_samples_duration,
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200387 &concealed_samples,
388 &concealment_events);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700389// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800390
391RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
hbos160e4a72017-01-17 02:53:23 -0800392 const std::string& id, int64_t timestamp_us, const char* kind)
393 : RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) {
hbos09bc1282016-11-08 06:29:22 -0800394}
395
zsteine76bd3a2017-07-14 12:17:49 -0700396RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(std::string&& id,
397 int64_t timestamp_us,
398 const char* kind)
hbos09bc1282016-11-08 06:29:22 -0800399 : RTCStats(std::move(id), timestamp_us),
400 track_identifier("trackIdentifier"),
401 remote_source("remoteSource"),
402 ended("ended"),
403 detached("detached"),
hbos160e4a72017-01-17 02:53:23 -0800404 kind("kind", kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200405 jitter_buffer_delay("jitterBufferDelay"),
hbos09bc1282016-11-08 06:29:22 -0800406 frame_width("frameWidth"),
407 frame_height("frameHeight"),
408 frames_per_second("framesPerSecond"),
409 frames_sent("framesSent"),
410 frames_received("framesReceived"),
411 frames_decoded("framesDecoded"),
412 frames_dropped("framesDropped"),
413 frames_corrupted("framesCorrupted"),
414 partial_frames_lost("partialFramesLost"),
415 full_frames_lost("fullFramesLost"),
416 audio_level("audioLevel"),
zsteine76bd3a2017-07-14 12:17:49 -0700417 total_audio_energy("totalAudioEnergy"),
hbos09bc1282016-11-08 06:29:22 -0800418 echo_return_loss("echoReturnLoss"),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700419 echo_return_loss_enhancement("echoReturnLossEnhancement"),
420 total_samples_received("totalSamplesReceived"),
421 total_samples_duration("totalSamplesDuration"),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200422 concealed_samples("concealedSamples"),
423 concealment_events("concealmentEvents") {
hbos160e4a72017-01-17 02:53:23 -0800424 RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
425 kind == RTCMediaStreamTrackKind::kVideo);
hbos09bc1282016-11-08 06:29:22 -0800426}
427
428RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
429 const RTCMediaStreamTrackStats& other)
430 : RTCStats(other.id(), other.timestamp_us()),
431 track_identifier(other.track_identifier),
432 remote_source(other.remote_source),
433 ended(other.ended),
434 detached(other.detached),
hbos160e4a72017-01-17 02:53:23 -0800435 kind(other.kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200436 jitter_buffer_delay(other.jitter_buffer_delay),
hbos09bc1282016-11-08 06:29:22 -0800437 frame_width(other.frame_width),
438 frame_height(other.frame_height),
439 frames_per_second(other.frames_per_second),
440 frames_sent(other.frames_sent),
441 frames_received(other.frames_received),
442 frames_decoded(other.frames_decoded),
443 frames_dropped(other.frames_dropped),
444 frames_corrupted(other.frames_corrupted),
445 partial_frames_lost(other.partial_frames_lost),
446 full_frames_lost(other.full_frames_lost),
447 audio_level(other.audio_level),
zsteine76bd3a2017-07-14 12:17:49 -0700448 total_audio_energy(other.total_audio_energy),
hbos09bc1282016-11-08 06:29:22 -0800449 echo_return_loss(other.echo_return_loss),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700450 echo_return_loss_enhancement(other.echo_return_loss_enhancement),
451 total_samples_received(other.total_samples_received),
452 total_samples_duration(other.total_samples_duration),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200453 concealed_samples(other.concealed_samples),
454 concealment_events(other.concealment_events) {}
hbos09bc1282016-11-08 06:29:22 -0800455
456RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {
457}
458
Steve Antond6a5cbd2017-08-18 09:40:25 -0700459// clang-format off
hbosfc5e0502016-10-06 02:06:10 -0700460WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
461 &data_channels_opened,
462 &data_channels_closed);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700463// clang-format on
hbosd565b732016-08-30 14:04:35 -0700464
465RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700466 const std::string& id, int64_t timestamp_us)
467 : RTCPeerConnectionStats(std::string(id), timestamp_us) {
hbosd565b732016-08-30 14:04:35 -0700468}
469
470RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700471 std::string&& id, int64_t timestamp_us)
472 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700473 data_channels_opened("dataChannelsOpened"),
474 data_channels_closed("dataChannelsClosed") {
475}
476
hbosfc5e0502016-10-06 02:06:10 -0700477RTCPeerConnectionStats::RTCPeerConnectionStats(
478 const RTCPeerConnectionStats& other)
479 : RTCStats(other.id(), other.timestamp_us()),
480 data_channels_opened(other.data_channels_opened),
481 data_channels_closed(other.data_channels_closed) {
482}
483
484RTCPeerConnectionStats::~RTCPeerConnectionStats() {
485}
486
Steve Antond6a5cbd2017-08-18 09:40:25 -0700487// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700488WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
489 &ssrc,
490 &associate_stats_id,
491 &is_remote,
492 &media_type,
hbosb0ae9202017-01-27 06:35:16 -0800493 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700494 &transport_id,
495 &codec_id,
496 &fir_count,
497 &pli_count,
498 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800499 &sli_count,
500 &qp_sum);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700501// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700502
503RTCRTPStreamStats::RTCRTPStreamStats(
504 const std::string& id, int64_t timestamp_us)
505 : RTCRTPStreamStats(std::string(id), timestamp_us) {
506}
507
508RTCRTPStreamStats::RTCRTPStreamStats(
509 std::string&& id, int64_t timestamp_us)
510 : RTCStats(std::move(id), timestamp_us),
511 ssrc("ssrc"),
512 associate_stats_id("associateStatsId"),
513 is_remote("isRemote", false),
514 media_type("mediaType"),
hbosb0ae9202017-01-27 06:35:16 -0800515 track_id("trackId"),
hbos6ded1902016-11-01 01:50:46 -0700516 transport_id("transportId"),
517 codec_id("codecId"),
518 fir_count("firCount"),
519 pli_count("pliCount"),
520 nack_count("nackCount"),
hbos6769c492017-01-02 08:35:13 -0800521 sli_count("sliCount"),
522 qp_sum("qpSum") {
hbos6ded1902016-11-01 01:50:46 -0700523}
524
525RTCRTPStreamStats::RTCRTPStreamStats(
526 const RTCRTPStreamStats& other)
527 : RTCStats(other.id(), other.timestamp_us()),
528 ssrc(other.ssrc),
529 associate_stats_id(other.associate_stats_id),
530 is_remote(other.is_remote),
531 media_type(other.media_type),
hbosb0ae9202017-01-27 06:35:16 -0800532 track_id(other.track_id),
hbos6ded1902016-11-01 01:50:46 -0700533 transport_id(other.transport_id),
534 codec_id(other.codec_id),
535 fir_count(other.fir_count),
536 pli_count(other.pli_count),
537 nack_count(other.nack_count),
hbos6769c492017-01-02 08:35:13 -0800538 sli_count(other.sli_count),
539 qp_sum(other.qp_sum) {
hbos6ded1902016-11-01 01:50:46 -0700540}
541
542RTCRTPStreamStats::~RTCRTPStreamStats() {
543}
544
Steve Antond6a5cbd2017-08-18 09:40:25 -0700545// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700546WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700547 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
548 &packets_received,
549 &bytes_received,
550 &packets_lost,
551 &jitter,
552 &fraction_lost,
hbosa7a9be12017-03-01 01:02:45 -0800553 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700554 &packets_discarded,
555 &packets_repaired,
556 &burst_packets_lost,
557 &burst_packets_discarded,
558 &burst_loss_count,
559 &burst_discard_count,
560 &burst_loss_rate,
561 &burst_discard_rate,
562 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800563 &gap_discard_rate,
564 &frames_decoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700565// clang-format on
hboseeafe942016-11-01 03:00:17 -0700566
567RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
568 const std::string& id, int64_t timestamp_us)
569 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {
570}
571
572RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
573 std::string&& id, int64_t timestamp_us)
574 : RTCRTPStreamStats(std::move(id), timestamp_us),
575 packets_received("packetsReceived"),
576 bytes_received("bytesReceived"),
577 packets_lost("packetsLost"),
578 jitter("jitter"),
579 fraction_lost("fractionLost"),
hbosa7a9be12017-03-01 01:02:45 -0800580 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700581 packets_discarded("packetsDiscarded"),
582 packets_repaired("packetsRepaired"),
583 burst_packets_lost("burstPacketsLost"),
584 burst_packets_discarded("burstPacketsDiscarded"),
585 burst_loss_count("burstLossCount"),
586 burst_discard_count("burstDiscardCount"),
587 burst_loss_rate("burstLossRate"),
588 burst_discard_rate("burstDiscardRate"),
589 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800590 gap_discard_rate("gapDiscardRate"),
591 frames_decoded("framesDecoded") {
hboseeafe942016-11-01 03:00:17 -0700592}
593
594RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
595 const RTCInboundRTPStreamStats& other)
596 : RTCRTPStreamStats(other),
597 packets_received(other.packets_received),
598 bytes_received(other.bytes_received),
599 packets_lost(other.packets_lost),
600 jitter(other.jitter),
601 fraction_lost(other.fraction_lost),
hbosa7a9be12017-03-01 01:02:45 -0800602 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700603 packets_discarded(other.packets_discarded),
604 packets_repaired(other.packets_repaired),
605 burst_packets_lost(other.burst_packets_lost),
606 burst_packets_discarded(other.burst_packets_discarded),
607 burst_loss_count(other.burst_loss_count),
608 burst_discard_count(other.burst_discard_count),
609 burst_loss_rate(other.burst_loss_rate),
610 burst_discard_rate(other.burst_discard_rate),
611 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800612 gap_discard_rate(other.gap_discard_rate),
613 frames_decoded(other.frames_decoded) {
hboseeafe942016-11-01 03:00:17 -0700614}
615
616RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {
617}
618
Steve Antond6a5cbd2017-08-18 09:40:25 -0700619// clang-format off
hboseeafe942016-11-01 03:00:17 -0700620WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700621 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
622 &packets_sent,
623 &bytes_sent,
624 &target_bitrate,
hbos6769c492017-01-02 08:35:13 -0800625 &frames_encoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700626// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700627
628RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
629 const std::string& id, int64_t timestamp_us)
630 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {
631}
632
633RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
634 std::string&& id, int64_t timestamp_us)
635 : RTCRTPStreamStats(std::move(id), timestamp_us),
636 packets_sent("packetsSent"),
637 bytes_sent("bytesSent"),
638 target_bitrate("targetBitrate"),
hbos6769c492017-01-02 08:35:13 -0800639 frames_encoded("framesEncoded") {
hbos6ded1902016-11-01 01:50:46 -0700640}
641
642RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
643 const RTCOutboundRTPStreamStats& other)
644 : RTCRTPStreamStats(other),
645 packets_sent(other.packets_sent),
646 bytes_sent(other.bytes_sent),
647 target_bitrate(other.target_bitrate),
hbos6769c492017-01-02 08:35:13 -0800648 frames_encoded(other.frames_encoded) {
hbos6ded1902016-11-01 01:50:46 -0700649}
650
651RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {
652}
653
Steve Antond6a5cbd2017-08-18 09:40:25 -0700654// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700655WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
656 &bytes_sent,
657 &bytes_received,
658 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800659 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700660 &selected_candidate_pair_id,
661 &local_certificate_id,
662 &remote_certificate_id);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700663// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700664
665RTCTransportStats::RTCTransportStats(
666 const std::string& id, int64_t timestamp_us)
667 : RTCTransportStats(std::string(id), timestamp_us) {
668}
669
670RTCTransportStats::RTCTransportStats(
671 std::string&& id, int64_t timestamp_us)
672 : RTCStats(std::move(id), timestamp_us),
673 bytes_sent("bytesSent"),
674 bytes_received("bytesReceived"),
675 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800676 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700677 selected_candidate_pair_id("selectedCandidatePairId"),
678 local_certificate_id("localCertificateId"),
679 remote_certificate_id("remoteCertificateId") {
680}
681
682RTCTransportStats::RTCTransportStats(
683 const RTCTransportStats& other)
684 : RTCStats(other.id(), other.timestamp_us()),
685 bytes_sent(other.bytes_sent),
686 bytes_received(other.bytes_received),
687 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800688 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700689 selected_candidate_pair_id(other.selected_candidate_pair_id),
690 local_certificate_id(other.local_certificate_id),
691 remote_certificate_id(other.remote_certificate_id) {
692}
693
694RTCTransportStats::~RTCTransportStats() {
695}
696
hbosd565b732016-08-30 14:04:35 -0700697} // namespace webrtc