blob: b6bc4c0f9e4bf6a9896ce9537f7bdf6e275c5f6f [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
Gary Liu37e489c2017-11-21 10:49:36 -080041// https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype
42const char* const RTCNetworkType::kBluetooth = "bluetooth";
43const char* const RTCNetworkType::kCellular = "cellular";
44const char* const RTCNetworkType::kEthernet = "ethernet";
45const char* const RTCNetworkType::kWifi = "wifi";
46const char* const RTCNetworkType::kWimax = "wimax";
47const char* const RTCNetworkType::kVpn = "vpn";
48const char* const RTCNetworkType::kUnknown = "unknown";
49
Steve Antond6a5cbd2017-08-18 09:40:25 -070050// clang-format off
hbos2fa7c672016-10-24 04:00:05 -070051WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
52 &fingerprint,
53 &fingerprint_algorithm,
54 &base64_certificate,
55 &issuer_certificate_id);
Steve Antond6a5cbd2017-08-18 09:40:25 -070056// clang-format on
hbos2fa7c672016-10-24 04:00:05 -070057
58RTCCertificateStats::RTCCertificateStats(
59 const std::string& id, int64_t timestamp_us)
60 : RTCCertificateStats(std::string(id), timestamp_us) {
61}
62
63RTCCertificateStats::RTCCertificateStats(
64 std::string&& id, int64_t timestamp_us)
65 : RTCStats(std::move(id), timestamp_us),
66 fingerprint("fingerprint"),
67 fingerprint_algorithm("fingerprintAlgorithm"),
68 base64_certificate("base64Certificate"),
69 issuer_certificate_id("issuerCertificateId") {
70}
71
72RTCCertificateStats::RTCCertificateStats(
73 const RTCCertificateStats& other)
74 : RTCStats(other.id(), other.timestamp_us()),
75 fingerprint(other.fingerprint),
76 fingerprint_algorithm(other.fingerprint_algorithm),
77 base64_certificate(other.base64_certificate),
78 issuer_certificate_id(other.issuer_certificate_id) {
79}
80
81RTCCertificateStats::~RTCCertificateStats() {
82}
83
Steve Antond6a5cbd2017-08-18 09:40:25 -070084// clang-format off
hbos0adb8282016-11-23 02:32:06 -080085WEBRTC_RTCSTATS_IMPL(RTCCodecStats, RTCStats, "codec",
86 &payload_type,
hbos13f54b22017-02-28 06:56:04 -080087 &mime_type,
hbos0adb8282016-11-23 02:32:06 -080088 &clock_rate,
89 &channels,
hbos13f54b22017-02-28 06:56:04 -080090 &sdp_fmtp_line,
hbos0adb8282016-11-23 02:32:06 -080091 &implementation);
Steve Antond6a5cbd2017-08-18 09:40:25 -070092// clang-format on
hbos0adb8282016-11-23 02:32:06 -080093
94RTCCodecStats::RTCCodecStats(
95 const std::string& id, int64_t timestamp_us)
96 : RTCCodecStats(std::string(id), timestamp_us) {
97}
98
99RTCCodecStats::RTCCodecStats(
100 std::string&& id, int64_t timestamp_us)
101 : RTCStats(std::move(id), timestamp_us),
102 payload_type("payloadType"),
hbos13f54b22017-02-28 06:56:04 -0800103 mime_type("mimeType"),
hbos0adb8282016-11-23 02:32:06 -0800104 clock_rate("clockRate"),
105 channels("channels"),
hbos13f54b22017-02-28 06:56:04 -0800106 sdp_fmtp_line("sdpFmtpLine"),
hbos0adb8282016-11-23 02:32:06 -0800107 implementation("implementation") {
108}
109
110RTCCodecStats::RTCCodecStats(
111 const RTCCodecStats& other)
112 : RTCStats(other.id(), other.timestamp_us()),
113 payload_type(other.payload_type),
hbos13f54b22017-02-28 06:56:04 -0800114 mime_type(other.mime_type),
hbos0adb8282016-11-23 02:32:06 -0800115 clock_rate(other.clock_rate),
116 channels(other.channels),
hbos13f54b22017-02-28 06:56:04 -0800117 sdp_fmtp_line(other.sdp_fmtp_line),
hbos0adb8282016-11-23 02:32:06 -0800118 implementation(other.implementation) {
119}
120
121RTCCodecStats::~RTCCodecStats() {
122}
123
Steve Antond6a5cbd2017-08-18 09:40:25 -0700124// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700125WEBRTC_RTCSTATS_IMPL(RTCDataChannelStats, RTCStats, "data-channel",
126 &label,
127 &protocol,
128 &datachannelid,
129 &state,
130 &messages_sent,
131 &bytes_sent,
132 &messages_received,
133 &bytes_received);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700134// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700135
136RTCDataChannelStats::RTCDataChannelStats(
137 const std::string& id, int64_t timestamp_us)
138 : RTCDataChannelStats(std::string(id), timestamp_us) {
139}
140
141RTCDataChannelStats::RTCDataChannelStats(
142 std::string&& id, int64_t timestamp_us)
143 : RTCStats(std::move(id), timestamp_us),
144 label("label"),
145 protocol("protocol"),
146 datachannelid("datachannelid"),
147 state("state"),
148 messages_sent("messagesSent"),
149 bytes_sent("bytesSent"),
150 messages_received("messagesReceived"),
151 bytes_received("bytesReceived") {
152}
153
154RTCDataChannelStats::RTCDataChannelStats(
155 const RTCDataChannelStats& other)
156 : RTCStats(other.id(), other.timestamp_us()),
157 label(other.label),
158 protocol(other.protocol),
159 datachannelid(other.datachannelid),
160 state(other.state),
161 messages_sent(other.messages_sent),
162 bytes_sent(other.bytes_sent),
163 messages_received(other.messages_received),
164 bytes_received(other.bytes_received) {
165}
166
167RTCDataChannelStats::~RTCDataChannelStats() {
168}
169
Steve Antond6a5cbd2017-08-18 09:40:25 -0700170// clang-format off
hbosc47a0c32016-10-11 14:54:49 -0700171WEBRTC_RTCSTATS_IMPL(RTCIceCandidatePairStats, RTCStats, "candidate-pair",
172 &transport_id,
173 &local_candidate_id,
174 &remote_candidate_id,
175 &state,
176 &priority,
177 &nominated,
178 &writable,
179 &readable,
180 &bytes_sent,
181 &bytes_received,
hbos3168c7a2016-12-15 06:17:08 -0800182 &total_round_trip_time,
183 &current_round_trip_time,
hbosc47a0c32016-10-11 14:54:49 -0700184 &available_outgoing_bitrate,
185 &available_incoming_bitrate,
186 &requests_received,
187 &requests_sent,
188 &responses_received,
189 &responses_sent,
190 &retransmissions_received,
191 &retransmissions_sent,
192 &consent_requests_received,
193 &consent_requests_sent,
194 &consent_responses_received,
195 &consent_responses_sent);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700196// clang-format on
hbosc47a0c32016-10-11 14:54:49 -0700197
198RTCIceCandidatePairStats::RTCIceCandidatePairStats(
199 const std::string& id, int64_t timestamp_us)
200 : RTCIceCandidatePairStats(std::string(id), timestamp_us) {
201}
202
203RTCIceCandidatePairStats::RTCIceCandidatePairStats(
204 std::string&& id, int64_t timestamp_us)
205 : RTCStats(std::move(id), timestamp_us),
206 transport_id("transportId"),
207 local_candidate_id("localCandidateId"),
208 remote_candidate_id("remoteCandidateId"),
209 state("state"),
210 priority("priority"),
211 nominated("nominated"),
212 writable("writable"),
213 readable("readable"),
214 bytes_sent("bytesSent"),
215 bytes_received("bytesReceived"),
hbos3168c7a2016-12-15 06:17:08 -0800216 total_round_trip_time("totalRoundTripTime"),
217 current_round_trip_time("currentRoundTripTime"),
hbosc47a0c32016-10-11 14:54:49 -0700218 available_outgoing_bitrate("availableOutgoingBitrate"),
219 available_incoming_bitrate("availableIncomingBitrate"),
220 requests_received("requestsReceived"),
221 requests_sent("requestsSent"),
222 responses_received("responsesReceived"),
223 responses_sent("responsesSent"),
224 retransmissions_received("retransmissionsReceived"),
225 retransmissions_sent("retransmissionsSent"),
226 consent_requests_received("consentRequestsReceived"),
227 consent_requests_sent("consentRequestsSent"),
228 consent_responses_received("consentResponsesReceived"),
229 consent_responses_sent("consentResponsesSent") {
230}
231
232RTCIceCandidatePairStats::RTCIceCandidatePairStats(
233 const RTCIceCandidatePairStats& other)
234 : RTCStats(other.id(), other.timestamp_us()),
235 transport_id(other.transport_id),
236 local_candidate_id(other.local_candidate_id),
237 remote_candidate_id(other.remote_candidate_id),
238 state(other.state),
239 priority(other.priority),
240 nominated(other.nominated),
241 writable(other.writable),
242 readable(other.readable),
243 bytes_sent(other.bytes_sent),
244 bytes_received(other.bytes_received),
hbos3168c7a2016-12-15 06:17:08 -0800245 total_round_trip_time(other.total_round_trip_time),
246 current_round_trip_time(other.current_round_trip_time),
hbosc47a0c32016-10-11 14:54:49 -0700247 available_outgoing_bitrate(other.available_outgoing_bitrate),
248 available_incoming_bitrate(other.available_incoming_bitrate),
249 requests_received(other.requests_received),
250 requests_sent(other.requests_sent),
251 responses_received(other.responses_received),
252 responses_sent(other.responses_sent),
253 retransmissions_received(other.retransmissions_received),
254 retransmissions_sent(other.retransmissions_sent),
255 consent_requests_received(other.consent_requests_received),
256 consent_requests_sent(other.consent_requests_sent),
257 consent_responses_received(other.consent_responses_received),
258 consent_responses_sent(other.consent_responses_sent) {
259}
260
261RTCIceCandidatePairStats::~RTCIceCandidatePairStats() {
262}
263
Steve Antond6a5cbd2017-08-18 09:40:25 -0700264// clang-format off
hbosab9f6e42016-10-07 02:18:47 -0700265WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "ice-candidate",
hbosb4e426e2017-01-02 09:59:31 -0800266 &transport_id,
hbosc3a2b7f2017-01-02 04:46:15 -0800267 &is_remote,
Gary Liu37e489c2017-11-21 10:49:36 -0800268 &network_type,
hbosab9f6e42016-10-07 02:18:47 -0700269 &ip,
270 &port,
271 &protocol,
272 &candidate_type,
273 &priority,
hbosd17a5a72017-01-02 08:09:59 -0800274 &url,
275 &deleted);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700276// clang-format on
hbosab9f6e42016-10-07 02:18:47 -0700277
278RTCIceCandidateStats::RTCIceCandidateStats(
hbosc3a2b7f2017-01-02 04:46:15 -0800279 const std::string& id, int64_t timestamp_us, bool is_remote)
280 : RTCIceCandidateStats(std::string(id), timestamp_us, is_remote) {
hbosab9f6e42016-10-07 02:18:47 -0700281}
282
Gary Liu37e489c2017-11-21 10:49:36 -0800283RTCIceCandidateStats::RTCIceCandidateStats(std::string&& id,
284 int64_t timestamp_us,
285 bool is_remote)
hbosab9f6e42016-10-07 02:18:47 -0700286 : RTCStats(std::move(id), timestamp_us),
hbosb4e426e2017-01-02 09:59:31 -0800287 transport_id("transportId"),
hbosc3a2b7f2017-01-02 04:46:15 -0800288 is_remote("isRemote", is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800289 network_type("networkType"),
hbosab9f6e42016-10-07 02:18:47 -0700290 ip("ip"),
291 port("port"),
292 protocol("protocol"),
293 candidate_type("candidateType"),
294 priority("priority"),
hbosd17a5a72017-01-02 08:09:59 -0800295 url("url"),
Gary Liu37e489c2017-11-21 10:49:36 -0800296 deleted("deleted", false) {}
hbosab9f6e42016-10-07 02:18:47 -0700297
298RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
299 : RTCStats(other.id(), other.timestamp_us()),
hbosb4e426e2017-01-02 09:59:31 -0800300 transport_id(other.transport_id),
hbosc3a2b7f2017-01-02 04:46:15 -0800301 is_remote(other.is_remote),
Gary Liu37e489c2017-11-21 10:49:36 -0800302 network_type(other.network_type),
hbosab9f6e42016-10-07 02:18:47 -0700303 ip(other.ip),
304 port(other.port),
305 protocol(other.protocol),
306 candidate_type(other.candidate_type),
307 priority(other.priority),
hbosd17a5a72017-01-02 08:09:59 -0800308 url(other.url),
Gary Liu37e489c2017-11-21 10:49:36 -0800309 deleted(other.deleted) {}
hbosab9f6e42016-10-07 02:18:47 -0700310
311RTCIceCandidateStats::~RTCIceCandidateStats() {
312}
313
314const char RTCLocalIceCandidateStats::kType[] = "local-candidate";
315
316RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(
317 const std::string& id, int64_t timestamp_us)
hbosc3a2b7f2017-01-02 04:46:15 -0800318 : RTCIceCandidateStats(id, timestamp_us, false) {
hbosab9f6e42016-10-07 02:18:47 -0700319}
320
321RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(
322 std::string&& id, int64_t timestamp_us)
hbosc3a2b7f2017-01-02 04:46:15 -0800323 : RTCIceCandidateStats(std::move(id), timestamp_us, false) {
hbosab9f6e42016-10-07 02:18:47 -0700324}
325
326const char* RTCLocalIceCandidateStats::type() const {
327 return kType;
328}
329
330const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate";
331
332RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(
333 const std::string& id, int64_t timestamp_us)
hbosc3a2b7f2017-01-02 04:46:15 -0800334 : RTCIceCandidateStats(id, timestamp_us, true) {
hbosab9f6e42016-10-07 02:18:47 -0700335}
336
337RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(
338 std::string&& id, int64_t timestamp_us)
hbosc3a2b7f2017-01-02 04:46:15 -0800339 : RTCIceCandidateStats(std::move(id), timestamp_us, true) {
hbosab9f6e42016-10-07 02:18:47 -0700340}
341
342const char* RTCRemoteIceCandidateStats::type() const {
343 return kType;
344}
345
Steve Antond6a5cbd2017-08-18 09:40:25 -0700346// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800347WEBRTC_RTCSTATS_IMPL(RTCMediaStreamStats, RTCStats, "stream",
348 &stream_identifier,
349 &track_ids);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700350// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800351
352RTCMediaStreamStats::RTCMediaStreamStats(
353 const std::string& id, int64_t timestamp_us)
354 : RTCMediaStreamStats(std::string(id), timestamp_us) {
355}
356
357RTCMediaStreamStats::RTCMediaStreamStats(
358 std::string&& id, int64_t timestamp_us)
359 : RTCStats(std::move(id), timestamp_us),
360 stream_identifier("streamIdentifier"),
361 track_ids("trackIds") {
362}
363
364RTCMediaStreamStats::RTCMediaStreamStats(
365 const RTCMediaStreamStats& other)
366 : RTCStats(other.id(), other.timestamp_us()),
367 stream_identifier(other.stream_identifier),
368 track_ids(other.track_ids) {
369}
370
371RTCMediaStreamStats::~RTCMediaStreamStats() {
372}
373
Steve Antond6a5cbd2017-08-18 09:40:25 -0700374// clang-format off
hbos09bc1282016-11-08 06:29:22 -0800375WEBRTC_RTCSTATS_IMPL(RTCMediaStreamTrackStats, RTCStats, "track",
zsteine76bd3a2017-07-14 12:17:49 -0700376 &track_identifier,
377 &remote_source,
378 &ended,
379 &detached,
380 &kind,
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200381 &jitter_buffer_delay,
zsteine76bd3a2017-07-14 12:17:49 -0700382 &frame_width,
383 &frame_height,
384 &frames_per_second,
385 &frames_sent,
386 &frames_received,
387 &frames_decoded,
388 &frames_dropped,
389 &frames_corrupted,
390 &partial_frames_lost,
391 &full_frames_lost,
392 &audio_level,
393 &total_audio_energy,
zsteine76bd3a2017-07-14 12:17:49 -0700394 &echo_return_loss,
Steve Anton2dbc69f2017-08-24 17:15:13 -0700395 &echo_return_loss_enhancement,
396 &total_samples_received,
397 &total_samples_duration,
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200398 &concealed_samples,
399 &concealment_events);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700400// clang-format on
hbos09bc1282016-11-08 06:29:22 -0800401
402RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
hbos160e4a72017-01-17 02:53:23 -0800403 const std::string& id, int64_t timestamp_us, const char* kind)
404 : RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) {
hbos09bc1282016-11-08 06:29:22 -0800405}
406
zsteine76bd3a2017-07-14 12:17:49 -0700407RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(std::string&& id,
408 int64_t timestamp_us,
409 const char* kind)
hbos09bc1282016-11-08 06:29:22 -0800410 : RTCStats(std::move(id), timestamp_us),
411 track_identifier("trackIdentifier"),
412 remote_source("remoteSource"),
413 ended("ended"),
414 detached("detached"),
hbos160e4a72017-01-17 02:53:23 -0800415 kind("kind", kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200416 jitter_buffer_delay("jitterBufferDelay"),
hbos09bc1282016-11-08 06:29:22 -0800417 frame_width("frameWidth"),
418 frame_height("frameHeight"),
419 frames_per_second("framesPerSecond"),
420 frames_sent("framesSent"),
421 frames_received("framesReceived"),
422 frames_decoded("framesDecoded"),
423 frames_dropped("framesDropped"),
424 frames_corrupted("framesCorrupted"),
425 partial_frames_lost("partialFramesLost"),
426 full_frames_lost("fullFramesLost"),
427 audio_level("audioLevel"),
zsteine76bd3a2017-07-14 12:17:49 -0700428 total_audio_energy("totalAudioEnergy"),
hbos09bc1282016-11-08 06:29:22 -0800429 echo_return_loss("echoReturnLoss"),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700430 echo_return_loss_enhancement("echoReturnLossEnhancement"),
431 total_samples_received("totalSamplesReceived"),
432 total_samples_duration("totalSamplesDuration"),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200433 concealed_samples("concealedSamples"),
434 concealment_events("concealmentEvents") {
hbos160e4a72017-01-17 02:53:23 -0800435 RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
436 kind == RTCMediaStreamTrackKind::kVideo);
hbos09bc1282016-11-08 06:29:22 -0800437}
438
439RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
440 const RTCMediaStreamTrackStats& other)
441 : RTCStats(other.id(), other.timestamp_us()),
442 track_identifier(other.track_identifier),
443 remote_source(other.remote_source),
444 ended(other.ended),
445 detached(other.detached),
hbos160e4a72017-01-17 02:53:23 -0800446 kind(other.kind),
Gustaf Ullbergb0a02072017-10-02 12:00:34 +0200447 jitter_buffer_delay(other.jitter_buffer_delay),
hbos09bc1282016-11-08 06:29:22 -0800448 frame_width(other.frame_width),
449 frame_height(other.frame_height),
450 frames_per_second(other.frames_per_second),
451 frames_sent(other.frames_sent),
452 frames_received(other.frames_received),
453 frames_decoded(other.frames_decoded),
454 frames_dropped(other.frames_dropped),
455 frames_corrupted(other.frames_corrupted),
456 partial_frames_lost(other.partial_frames_lost),
457 full_frames_lost(other.full_frames_lost),
458 audio_level(other.audio_level),
zsteine76bd3a2017-07-14 12:17:49 -0700459 total_audio_energy(other.total_audio_energy),
hbos09bc1282016-11-08 06:29:22 -0800460 echo_return_loss(other.echo_return_loss),
Steve Anton2dbc69f2017-08-24 17:15:13 -0700461 echo_return_loss_enhancement(other.echo_return_loss_enhancement),
462 total_samples_received(other.total_samples_received),
463 total_samples_duration(other.total_samples_duration),
Gustaf Ullberg9a2e9062017-09-18 09:28:20 +0200464 concealed_samples(other.concealed_samples),
465 concealment_events(other.concealment_events) {}
hbos09bc1282016-11-08 06:29:22 -0800466
467RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {
468}
469
Steve Antond6a5cbd2017-08-18 09:40:25 -0700470// clang-format off
hbosfc5e0502016-10-06 02:06:10 -0700471WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
472 &data_channels_opened,
473 &data_channels_closed);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700474// clang-format on
hbosd565b732016-08-30 14:04:35 -0700475
476RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700477 const std::string& id, int64_t timestamp_us)
478 : RTCPeerConnectionStats(std::string(id), timestamp_us) {
hbosd565b732016-08-30 14:04:35 -0700479}
480
481RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700482 std::string&& id, int64_t timestamp_us)
483 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700484 data_channels_opened("dataChannelsOpened"),
485 data_channels_closed("dataChannelsClosed") {
486}
487
hbosfc5e0502016-10-06 02:06:10 -0700488RTCPeerConnectionStats::RTCPeerConnectionStats(
489 const RTCPeerConnectionStats& other)
490 : RTCStats(other.id(), other.timestamp_us()),
491 data_channels_opened(other.data_channels_opened),
492 data_channels_closed(other.data_channels_closed) {
493}
494
495RTCPeerConnectionStats::~RTCPeerConnectionStats() {
496}
497
Steve Antond6a5cbd2017-08-18 09:40:25 -0700498// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700499WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
500 &ssrc,
501 &associate_stats_id,
502 &is_remote,
503 &media_type,
hbosb0ae9202017-01-27 06:35:16 -0800504 &track_id,
hbos6ded1902016-11-01 01:50:46 -0700505 &transport_id,
506 &codec_id,
507 &fir_count,
508 &pli_count,
509 &nack_count,
hbos6769c492017-01-02 08:35:13 -0800510 &sli_count,
511 &qp_sum);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700512// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700513
514RTCRTPStreamStats::RTCRTPStreamStats(
515 const std::string& id, int64_t timestamp_us)
516 : RTCRTPStreamStats(std::string(id), timestamp_us) {
517}
518
519RTCRTPStreamStats::RTCRTPStreamStats(
520 std::string&& id, int64_t timestamp_us)
521 : RTCStats(std::move(id), timestamp_us),
522 ssrc("ssrc"),
523 associate_stats_id("associateStatsId"),
524 is_remote("isRemote", false),
525 media_type("mediaType"),
hbosb0ae9202017-01-27 06:35:16 -0800526 track_id("trackId"),
hbos6ded1902016-11-01 01:50:46 -0700527 transport_id("transportId"),
528 codec_id("codecId"),
529 fir_count("firCount"),
530 pli_count("pliCount"),
531 nack_count("nackCount"),
hbos6769c492017-01-02 08:35:13 -0800532 sli_count("sliCount"),
533 qp_sum("qpSum") {
hbos6ded1902016-11-01 01:50:46 -0700534}
535
536RTCRTPStreamStats::RTCRTPStreamStats(
537 const RTCRTPStreamStats& other)
538 : RTCStats(other.id(), other.timestamp_us()),
539 ssrc(other.ssrc),
540 associate_stats_id(other.associate_stats_id),
541 is_remote(other.is_remote),
542 media_type(other.media_type),
hbosb0ae9202017-01-27 06:35:16 -0800543 track_id(other.track_id),
hbos6ded1902016-11-01 01:50:46 -0700544 transport_id(other.transport_id),
545 codec_id(other.codec_id),
546 fir_count(other.fir_count),
547 pli_count(other.pli_count),
548 nack_count(other.nack_count),
hbos6769c492017-01-02 08:35:13 -0800549 sli_count(other.sli_count),
550 qp_sum(other.qp_sum) {
hbos6ded1902016-11-01 01:50:46 -0700551}
552
553RTCRTPStreamStats::~RTCRTPStreamStats() {
554}
555
Steve Antond6a5cbd2017-08-18 09:40:25 -0700556// clang-format off
hbos6ded1902016-11-01 01:50:46 -0700557WEBRTC_RTCSTATS_IMPL(
hboseeafe942016-11-01 03:00:17 -0700558 RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
559 &packets_received,
560 &bytes_received,
561 &packets_lost,
562 &jitter,
563 &fraction_lost,
hbosa7a9be12017-03-01 01:02:45 -0800564 &round_trip_time,
hboseeafe942016-11-01 03:00:17 -0700565 &packets_discarded,
566 &packets_repaired,
567 &burst_packets_lost,
568 &burst_packets_discarded,
569 &burst_loss_count,
570 &burst_discard_count,
571 &burst_loss_rate,
572 &burst_discard_rate,
573 &gap_loss_rate,
hbos6769c492017-01-02 08:35:13 -0800574 &gap_discard_rate,
575 &frames_decoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700576// clang-format on
hboseeafe942016-11-01 03:00:17 -0700577
578RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
579 const std::string& id, int64_t timestamp_us)
580 : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {
581}
582
583RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
584 std::string&& id, int64_t timestamp_us)
585 : RTCRTPStreamStats(std::move(id), timestamp_us),
586 packets_received("packetsReceived"),
587 bytes_received("bytesReceived"),
588 packets_lost("packetsLost"),
589 jitter("jitter"),
590 fraction_lost("fractionLost"),
hbosa7a9be12017-03-01 01:02:45 -0800591 round_trip_time("roundTripTime"),
hboseeafe942016-11-01 03:00:17 -0700592 packets_discarded("packetsDiscarded"),
593 packets_repaired("packetsRepaired"),
594 burst_packets_lost("burstPacketsLost"),
595 burst_packets_discarded("burstPacketsDiscarded"),
596 burst_loss_count("burstLossCount"),
597 burst_discard_count("burstDiscardCount"),
598 burst_loss_rate("burstLossRate"),
599 burst_discard_rate("burstDiscardRate"),
600 gap_loss_rate("gapLossRate"),
hbos6769c492017-01-02 08:35:13 -0800601 gap_discard_rate("gapDiscardRate"),
602 frames_decoded("framesDecoded") {
hboseeafe942016-11-01 03:00:17 -0700603}
604
605RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
606 const RTCInboundRTPStreamStats& other)
607 : RTCRTPStreamStats(other),
608 packets_received(other.packets_received),
609 bytes_received(other.bytes_received),
610 packets_lost(other.packets_lost),
611 jitter(other.jitter),
612 fraction_lost(other.fraction_lost),
hbosa7a9be12017-03-01 01:02:45 -0800613 round_trip_time(other.round_trip_time),
hboseeafe942016-11-01 03:00:17 -0700614 packets_discarded(other.packets_discarded),
615 packets_repaired(other.packets_repaired),
616 burst_packets_lost(other.burst_packets_lost),
617 burst_packets_discarded(other.burst_packets_discarded),
618 burst_loss_count(other.burst_loss_count),
619 burst_discard_count(other.burst_discard_count),
620 burst_loss_rate(other.burst_loss_rate),
621 burst_discard_rate(other.burst_discard_rate),
622 gap_loss_rate(other.gap_loss_rate),
hbos6769c492017-01-02 08:35:13 -0800623 gap_discard_rate(other.gap_discard_rate),
624 frames_decoded(other.frames_decoded) {
hboseeafe942016-11-01 03:00:17 -0700625}
626
627RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {
628}
629
Steve Antond6a5cbd2017-08-18 09:40:25 -0700630// clang-format off
hboseeafe942016-11-01 03:00:17 -0700631WEBRTC_RTCSTATS_IMPL(
hbos6ded1902016-11-01 01:50:46 -0700632 RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
633 &packets_sent,
634 &bytes_sent,
635 &target_bitrate,
hbos6769c492017-01-02 08:35:13 -0800636 &frames_encoded);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700637// clang-format on
hbos6ded1902016-11-01 01:50:46 -0700638
639RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
640 const std::string& id, int64_t timestamp_us)
641 : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {
642}
643
644RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
645 std::string&& id, int64_t timestamp_us)
646 : RTCRTPStreamStats(std::move(id), timestamp_us),
647 packets_sent("packetsSent"),
648 bytes_sent("bytesSent"),
649 target_bitrate("targetBitrate"),
hbos6769c492017-01-02 08:35:13 -0800650 frames_encoded("framesEncoded") {
hbos6ded1902016-11-01 01:50:46 -0700651}
652
653RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
654 const RTCOutboundRTPStreamStats& other)
655 : RTCRTPStreamStats(other),
656 packets_sent(other.packets_sent),
657 bytes_sent(other.bytes_sent),
658 target_bitrate(other.target_bitrate),
hbos6769c492017-01-02 08:35:13 -0800659 frames_encoded(other.frames_encoded) {
hbos6ded1902016-11-01 01:50:46 -0700660}
661
662RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {
663}
664
Steve Antond6a5cbd2017-08-18 09:40:25 -0700665// clang-format off
hbos2fa7c672016-10-24 04:00:05 -0700666WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
667 &bytes_sent,
668 &bytes_received,
669 &rtcp_transport_stats_id,
hbos7064d592017-01-16 07:38:02 -0800670 &dtls_state,
hbos2fa7c672016-10-24 04:00:05 -0700671 &selected_candidate_pair_id,
672 &local_certificate_id,
673 &remote_certificate_id);
Steve Antond6a5cbd2017-08-18 09:40:25 -0700674// clang-format on
hbos2fa7c672016-10-24 04:00:05 -0700675
676RTCTransportStats::RTCTransportStats(
677 const std::string& id, int64_t timestamp_us)
678 : RTCTransportStats(std::string(id), timestamp_us) {
679}
680
681RTCTransportStats::RTCTransportStats(
682 std::string&& id, int64_t timestamp_us)
683 : RTCStats(std::move(id), timestamp_us),
684 bytes_sent("bytesSent"),
685 bytes_received("bytesReceived"),
686 rtcp_transport_stats_id("rtcpTransportStatsId"),
hbos7064d592017-01-16 07:38:02 -0800687 dtls_state("dtlsState"),
hbos2fa7c672016-10-24 04:00:05 -0700688 selected_candidate_pair_id("selectedCandidatePairId"),
689 local_certificate_id("localCertificateId"),
690 remote_certificate_id("remoteCertificateId") {
691}
692
693RTCTransportStats::RTCTransportStats(
694 const RTCTransportStats& other)
695 : RTCStats(other.id(), other.timestamp_us()),
696 bytes_sent(other.bytes_sent),
697 bytes_received(other.bytes_received),
698 rtcp_transport_stats_id(other.rtcp_transport_stats_id),
hbos7064d592017-01-16 07:38:02 -0800699 dtls_state(other.dtls_state),
hbos2fa7c672016-10-24 04:00:05 -0700700 selected_candidate_pair_id(other.selected_candidate_pair_id),
701 local_certificate_id(other.local_certificate_id),
702 remote_certificate_id(other.remote_certificate_id) {
703}
704
705RTCTransportStats::~RTCTransportStats() {
706}
707
hbosd565b732016-08-30 14:04:35 -0700708} // namespace webrtc