blob: 284dfe0b760c053f7b8f189d5d3ac6ddc357230d [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
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,
386 &concealed_samples);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700387// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800388
389RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
hbos160e4a72017-01-17 02:53:23 -0800390 const std::string& id, int64_t timestamp_us, const char* kind)
391 : RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) {
hbos09bc1282016-11-08 06:29:22 -0800392}
393
zsteine76bd3a2017-07-14 12:17:49 -0700394RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(std::string&& id,
395 int64_t timestamp_us,
396 const char* kind)
hbos09bc1282016-11-08 06:29:22 -0800397 : RTCStats(std::move(id), timestamp_us),
398 track_identifier("trackIdentifier"),
399 remote_source("remoteSource"),
400 ended("ended"),
401 detached("detached"),
hbos160e4a72017-01-17 02:53:23 -0800402 kind("kind", kind),
hbos09bc1282016-11-08 06:29:22 -0800403 frame_width("frameWidth"),
404 frame_height("frameHeight"),
405 frames_per_second("framesPerSecond"),
406 frames_sent("framesSent"),
407 frames_received("framesReceived"),
408 frames_decoded("framesDecoded"),
409 frames_dropped("framesDropped"),
410 frames_corrupted("framesCorrupted"),
411 partial_frames_lost("partialFramesLost"),
412 full_frames_lost("fullFramesLost"),
413 audio_level("audioLevel"),
zsteine76bd3a2017-07-14 12:17:49 -0700414 total_audio_energy("totalAudioEnergy"),
hbos09bc1282016-11-08 06:29:22 -0800415 echo_return_loss("echoReturnLoss"),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700416 echo_return_loss_enhancement("echoReturnLossEnhancement"),
417 total_samples_received("totalSamplesReceived"),
418 total_samples_duration("totalSamplesDuration"),
419 concealed_samples("concealedSamples") {
hbos160e4a72017-01-17 02:53:23 -0800420 RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
421 kind == RTCMediaStreamTrackKind::kVideo);
hbos09bc1282016-11-08 06:29:22 -0800422}
423
424RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
425 const RTCMediaStreamTrackStats& other)
426 : RTCStats(other.id(), other.timestamp_us()),
427 track_identifier(other.track_identifier),
428 remote_source(other.remote_source),
429 ended(other.ended),
430 detached(other.detached),
hbos160e4a72017-01-17 02:53:23 -0800431 kind(other.kind),
hbos09bc1282016-11-08 06:29:22 -0800432 frame_width(other.frame_width),
433 frame_height(other.frame_height),
434 frames_per_second(other.frames_per_second),
435 frames_sent(other.frames_sent),
436 frames_received(other.frames_received),
437 frames_decoded(other.frames_decoded),
438 frames_dropped(other.frames_dropped),
439 frames_corrupted(other.frames_corrupted),
440 partial_frames_lost(other.partial_frames_lost),
441 full_frames_lost(other.full_frames_lost),
442 audio_level(other.audio_level),
zsteine76bd3a2017-07-14 12:17:49 -0700443 total_audio_energy(other.total_audio_energy),
hbos09bc1282016-11-08 06:29:22 -0800444 echo_return_loss(other.echo_return_loss),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700445 echo_return_loss_enhancement(other.echo_return_loss_enhancement),
446 total_samples_received(other.total_samples_received),
447 total_samples_duration(other.total_samples_duration),
448 concealed_samples(other.concealed_samples) {}
hbos09bc1282016-11-08 06:29:22 -0800449
450RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {
451}
452
Steve Antond6a5cbd2017-08-18 09:40:25 -0700453// clang-format off
hbosfc5e0502016-10-06 02:06:10 -0700454WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
455 &data_channels_opened,
456 &data_channels_closed);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700457// clang-format on
hbosd565b732016-08-30 14:04:35 -0700458
459RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700460 const std::string& id, int64_t timestamp_us)
461 : RTCPeerConnectionStats(std::string(id), timestamp_us) {
hbosd565b732016-08-30 14:04:35 -0700462}
463
464RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700465 std::string&& id, int64_t timestamp_us)
466 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700467 data_channels_opened("dataChannelsOpened"),
468 data_channels_closed("dataChannelsClosed") {
469}
470
hbosfc5e0502016-10-06 02:06:10 -0700471RTCPeerConnectionStats::RTCPeerConnectionStats(
472 const RTCPeerConnectionStats& other)
473 : RTCStats(other.id(), other.timestamp_us()),
474 data_channels_opened(other.data_channels_opened),
475 data_channels_closed(other.data_channels_closed) {
476}
477
478RTCPeerConnectionStats::~RTCPeerConnectionStats() {
479}
480
Steve Antond6a5cbd2017-08-18 09:40:25 -0700481// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700482WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
483 &ssrc,
484 &associate_stats_id,
485 &is_remote,
486 &media_type,
hbosb0ae9202017-01-27 06:35:16 -0800487 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700488 &transport_id,
489 &codec_id,
490 &fir_count,
491 &pli_count,
492 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800493 &sli_count,
494 &qp_sum);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700495// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700496
497RTCRTPStreamStats::RTCRTPStreamStats(
498 const std::string& id, int64_t timestamp_us)
499 : RTCRTPStreamStats(std::string(id), timestamp_us) {
500}
501
502RTCRTPStreamStats::RTCRTPStreamStats(
503 std::string&& id, int64_t timestamp_us)
504 : RTCStats(std::move(id), timestamp_us),
505 ssrc("ssrc"),
506 associate_stats_id("associateStatsId"),
507 is_remote("isRemote", false),
508 media_type("mediaType"),
hbosb0ae9202017-01-27 06:35:16 -0800509 track_id("trackId"),
hbos6ded1902016-11-01 01:50:46 -0700510 transport_id("transportId"),
511 codec_id("codecId"),
512 fir_count("firCount"),
513 pli_count("pliCount"),
514 nack_count("nackCount"),
hbos6769c492017-01-02 08:35:13 -0800515 sli_count("sliCount"),
516 qp_sum("qpSum") {
hbos6ded1902016-11-01 01:50:46 -0700517}
518
519RTCRTPStreamStats::RTCRTPStreamStats(
520 const RTCRTPStreamStats& other)
521 : RTCStats(other.id(), other.timestamp_us()),
522 ssrc(other.ssrc),
523 associate_stats_id(other.associate_stats_id),
524 is_remote(other.is_remote),
525 media_type(other.media_type),
hbosb0ae9202017-01-27 06:35:16 -0800526 track_id(other.track_id),
hbos6ded1902016-11-01 01:50:46 -0700527 transport_id(other.transport_id),
528 codec_id(other.codec_id),
529 fir_count(other.fir_count),
530 pli_count(other.pli_count),
531 nack_count(other.nack_count),
hbos6769c492017-01-02 08:35:13 -0800532 sli_count(other.sli_count),
533 qp_sum(other.qp_sum) {
hbos6ded1902016-11-01 01:50:46 -0700534}
535
536RTCRTPStreamStats::~RTCRTPStreamStats() {
537}
538
Steve Antond6a5cbd2017-08-18 09:40:25 -0700539// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700540WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700541 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
542 &packets_received,
543 &bytes_received,
544 &packets_lost,
545 &jitter,
546 &fraction_lost,
hbosa7a9be12017-03-01 01:02:45 -0800547 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700548 &packets_discarded,
549 &packets_repaired,
550 &burst_packets_lost,
551 &burst_packets_discarded,
552 &burst_loss_count,
553 &burst_discard_count,
554 &burst_loss_rate,
555 &burst_discard_rate,
556 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800557 &gap_discard_rate,
558 &frames_decoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700559// clang-format on
hboseeafe942016-11-01 03:00:17 -0700560
561RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
562 const std::string& id, int64_t timestamp_us)
563 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {
564}
565
566RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
567 std::string&& id, int64_t timestamp_us)
568 : RTCRTPStreamStats(std::move(id), timestamp_us),
569 packets_received("packetsReceived"),
570 bytes_received("bytesReceived"),
571 packets_lost("packetsLost"),
572 jitter("jitter"),
573 fraction_lost("fractionLost"),
hbosa7a9be12017-03-01 01:02:45 -0800574 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700575 packets_discarded("packetsDiscarded"),
576 packets_repaired("packetsRepaired"),
577 burst_packets_lost("burstPacketsLost"),
578 burst_packets_discarded("burstPacketsDiscarded"),
579 burst_loss_count("burstLossCount"),
580 burst_discard_count("burstDiscardCount"),
581 burst_loss_rate("burstLossRate"),
582 burst_discard_rate("burstDiscardRate"),
583 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800584 gap_discard_rate("gapDiscardRate"),
585 frames_decoded("framesDecoded") {
hboseeafe942016-11-01 03:00:17 -0700586}
587
588RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
589 const RTCInboundRTPStreamStats& other)
590 : RTCRTPStreamStats(other),
591 packets_received(other.packets_received),
592 bytes_received(other.bytes_received),
593 packets_lost(other.packets_lost),
594 jitter(other.jitter),
595 fraction_lost(other.fraction_lost),
hbosa7a9be12017-03-01 01:02:45 -0800596 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700597 packets_discarded(other.packets_discarded),
598 packets_repaired(other.packets_repaired),
599 burst_packets_lost(other.burst_packets_lost),
600 burst_packets_discarded(other.burst_packets_discarded),
601 burst_loss_count(other.burst_loss_count),
602 burst_discard_count(other.burst_discard_count),
603 burst_loss_rate(other.burst_loss_rate),
604 burst_discard_rate(other.burst_discard_rate),
605 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800606 gap_discard_rate(other.gap_discard_rate),
607 frames_decoded(other.frames_decoded) {
hboseeafe942016-11-01 03:00:17 -0700608}
609
610RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {
611}
612
Steve Antond6a5cbd2017-08-18 09:40:25 -0700613// clang-format off
hboseeafe942016-11-01 03:00:17 -0700614WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700615 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
616 &packets_sent,
617 &bytes_sent,
618 &target_bitrate,
hbos6769c492017-01-02 08:35:13 -0800619 &frames_encoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700620// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700621
622RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
623 const std::string& id, int64_t timestamp_us)
624 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {
625}
626
627RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
628 std::string&& id, int64_t timestamp_us)
629 : RTCRTPStreamStats(std::move(id), timestamp_us),
630 packets_sent("packetsSent"),
631 bytes_sent("bytesSent"),
632 target_bitrate("targetBitrate"),
hbos6769c492017-01-02 08:35:13 -0800633 frames_encoded("framesEncoded") {
hbos6ded1902016-11-01 01:50:46 -0700634}
635
636RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
637 const RTCOutboundRTPStreamStats& other)
638 : RTCRTPStreamStats(other),
639 packets_sent(other.packets_sent),
640 bytes_sent(other.bytes_sent),
641 target_bitrate(other.target_bitrate),
hbos6769c492017-01-02 08:35:13 -0800642 frames_encoded(other.frames_encoded) {
hbos6ded1902016-11-01 01:50:46 -0700643}
644
645RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {
646}
647
Steve Antond6a5cbd2017-08-18 09:40:25 -0700648// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700649WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
650 &bytes_sent,
651 &bytes_received,
652 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800653 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700654 &selected_candidate_pair_id,
655 &local_certificate_id,
656 &remote_certificate_id);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700657// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700658
659RTCTransportStats::RTCTransportStats(
660 const std::string& id, int64_t timestamp_us)
661 : RTCTransportStats(std::string(id), timestamp_us) {
662}
663
664RTCTransportStats::RTCTransportStats(
665 std::string&& id, int64_t timestamp_us)
666 : RTCStats(std::move(id), timestamp_us),
667 bytes_sent("bytesSent"),
668 bytes_received("bytesReceived"),
669 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800670 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700671 selected_candidate_pair_id("selectedCandidatePairId"),
672 local_certificate_id("localCertificateId"),
673 remote_certificate_id("remoteCertificateId") {
674}
675
676RTCTransportStats::RTCTransportStats(
677 const RTCTransportStats& other)
678 : RTCStats(other.id(), other.timestamp_us()),
679 bytes_sent(other.bytes_sent),
680 bytes_received(other.bytes_received),
681 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800682 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700683 selected_candidate_pair_id(other.selected_candidate_pair_id),
684 local_certificate_id(other.local_certificate_id),
685 remote_certificate_id(other.remote_certificate_id) {
686}
687
688RTCTransportStats::~RTCTransportStats() {
689}
690
hbosd565b732016-08-30 14:04:35 -0700691} // namespace webrtc