1 /*
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 
11 #include "webrtc/api/stats/rtcstats_objects.h"
12 
13 namespace webrtc {
14 
15 const char* RTCDataChannelState::kConnecting = "connecting";
16 const char* RTCDataChannelState::kOpen = "open";
17 const char* RTCDataChannelState::kClosing = "closing";
18 const char* RTCDataChannelState::kClosed = "closed";
19 
20 const char* RTCStatsIceCandidatePairState::kFrozen = "frozen";
21 const char* RTCStatsIceCandidatePairState::kWaiting = "waiting";
22 const char* RTCStatsIceCandidatePairState::kInProgress = "in-progress";
23 const char* RTCStatsIceCandidatePairState::kFailed = "failed";
24 const char* RTCStatsIceCandidatePairState::kSucceeded = "succeeded";
25 
26 // Strings defined in https://tools.ietf.org/html/rfc5245.
27 const char* RTCIceCandidateType::kHost = "host";
28 const char* RTCIceCandidateType::kSrflx = "srflx";
29 const char* RTCIceCandidateType::kPrflx = "prflx";
30 const char* RTCIceCandidateType::kRelay = "relay";
31 
32 const char* RTCDtlsTransportState::kNew = "new";
33 const char* RTCDtlsTransportState::kConnecting = "connecting";
34 const char* RTCDtlsTransportState::kConnected = "connected";
35 const char* RTCDtlsTransportState::kClosed = "closed";
36 const char* RTCDtlsTransportState::kFailed = "failed";
37 
38 const char* RTCMediaStreamTrackKind::kAudio = "audio";
39 const char* RTCMediaStreamTrackKind::kVideo = "video";
40 
41 WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
42     &fingerprint,
43     &fingerprint_algorithm,
44     &base64_certificate,
45     &issuer_certificate_id);
46 
RTCCertificateStats(const std::string & id,int64_t timestamp_us)47 RTCCertificateStats::RTCCertificateStats(
48     const std::string& id, int64_t timestamp_us)
49     : RTCCertificateStats(std::string(id), timestamp_us) {
50 }
51 
RTCCertificateStats(std::string && id,int64_t timestamp_us)52 RTCCertificateStats::RTCCertificateStats(
53     std::string&& id, int64_t timestamp_us)
54     : RTCStats(std::move(id), timestamp_us),
55       fingerprint("fingerprint"),
56       fingerprint_algorithm("fingerprintAlgorithm"),
57       base64_certificate("base64Certificate"),
58       issuer_certificate_id("issuerCertificateId") {
59 }
60 
RTCCertificateStats(const RTCCertificateStats & other)61 RTCCertificateStats::RTCCertificateStats(
62     const RTCCertificateStats& other)
63     : RTCStats(other.id(), other.timestamp_us()),
64       fingerprint(other.fingerprint),
65       fingerprint_algorithm(other.fingerprint_algorithm),
66       base64_certificate(other.base64_certificate),
67       issuer_certificate_id(other.issuer_certificate_id) {
68 }
69 
~RTCCertificateStats()70 RTCCertificateStats::~RTCCertificateStats() {
71 }
72 
73 WEBRTC_RTCSTATS_IMPL(RTCCodecStats, RTCStats, "codec",
74     &payload_type,
75     &codec,
76     &clock_rate,
77     &channels,
78     &parameters,
79     &implementation);
80 
RTCCodecStats(const std::string & id,int64_t timestamp_us)81 RTCCodecStats::RTCCodecStats(
82     const std::string& id, int64_t timestamp_us)
83     : RTCCodecStats(std::string(id), timestamp_us) {
84 }
85 
RTCCodecStats(std::string && id,int64_t timestamp_us)86 RTCCodecStats::RTCCodecStats(
87     std::string&& id, int64_t timestamp_us)
88     : RTCStats(std::move(id), timestamp_us),
89       payload_type("payloadType"),
90       codec("codec"),
91       clock_rate("clockRate"),
92       channels("channels"),
93       parameters("parameters"),
94       implementation("implementation") {
95 }
96 
RTCCodecStats(const RTCCodecStats & other)97 RTCCodecStats::RTCCodecStats(
98     const RTCCodecStats& other)
99     : RTCStats(other.id(), other.timestamp_us()),
100       payload_type(other.payload_type),
101       codec(other.codec),
102       clock_rate(other.clock_rate),
103       channels(other.channels),
104       parameters(other.parameters),
105       implementation(other.implementation) {
106 }
107 
~RTCCodecStats()108 RTCCodecStats::~RTCCodecStats() {
109 }
110 
111 WEBRTC_RTCSTATS_IMPL(RTCDataChannelStats, RTCStats, "data-channel",
112     &label,
113     &protocol,
114     &datachannelid,
115     &state,
116     &messages_sent,
117     &bytes_sent,
118     &messages_received,
119     &bytes_received);
120 
RTCDataChannelStats(const std::string & id,int64_t timestamp_us)121 RTCDataChannelStats::RTCDataChannelStats(
122     const std::string& id, int64_t timestamp_us)
123     : RTCDataChannelStats(std::string(id), timestamp_us) {
124 }
125 
RTCDataChannelStats(std::string && id,int64_t timestamp_us)126 RTCDataChannelStats::RTCDataChannelStats(
127     std::string&& id, int64_t timestamp_us)
128     : RTCStats(std::move(id), timestamp_us),
129       label("label"),
130       protocol("protocol"),
131       datachannelid("datachannelid"),
132       state("state"),
133       messages_sent("messagesSent"),
134       bytes_sent("bytesSent"),
135       messages_received("messagesReceived"),
136       bytes_received("bytesReceived") {
137 }
138 
RTCDataChannelStats(const RTCDataChannelStats & other)139 RTCDataChannelStats::RTCDataChannelStats(
140     const RTCDataChannelStats& other)
141     : RTCStats(other.id(), other.timestamp_us()),
142       label(other.label),
143       protocol(other.protocol),
144       datachannelid(other.datachannelid),
145       state(other.state),
146       messages_sent(other.messages_sent),
147       bytes_sent(other.bytes_sent),
148       messages_received(other.messages_received),
149       bytes_received(other.bytes_received) {
150 }
151 
~RTCDataChannelStats()152 RTCDataChannelStats::~RTCDataChannelStats() {
153 }
154 
155 WEBRTC_RTCSTATS_IMPL(RTCIceCandidatePairStats, RTCStats, "candidate-pair",
156     &transport_id,
157     &local_candidate_id,
158     &remote_candidate_id,
159     &state,
160     &priority,
161     &nominated,
162     &writable,
163     &readable,
164     &bytes_sent,
165     &bytes_received,
166     &total_round_trip_time,
167     &current_round_trip_time,
168     &available_outgoing_bitrate,
169     &available_incoming_bitrate,
170     &requests_received,
171     &requests_sent,
172     &responses_received,
173     &responses_sent,
174     &retransmissions_received,
175     &retransmissions_sent,
176     &consent_requests_received,
177     &consent_requests_sent,
178     &consent_responses_received,
179     &consent_responses_sent);
180 
RTCIceCandidatePairStats(const std::string & id,int64_t timestamp_us)181 RTCIceCandidatePairStats::RTCIceCandidatePairStats(
182     const std::string& id, int64_t timestamp_us)
183     : RTCIceCandidatePairStats(std::string(id), timestamp_us) {
184 }
185 
RTCIceCandidatePairStats(std::string && id,int64_t timestamp_us)186 RTCIceCandidatePairStats::RTCIceCandidatePairStats(
187     std::string&& id, int64_t timestamp_us)
188     : RTCStats(std::move(id), timestamp_us),
189       transport_id("transportId"),
190       local_candidate_id("localCandidateId"),
191       remote_candidate_id("remoteCandidateId"),
192       state("state"),
193       priority("priority"),
194       nominated("nominated"),
195       writable("writable"),
196       readable("readable"),
197       bytes_sent("bytesSent"),
198       bytes_received("bytesReceived"),
199       total_round_trip_time("totalRoundTripTime"),
200       current_round_trip_time("currentRoundTripTime"),
201       available_outgoing_bitrate("availableOutgoingBitrate"),
202       available_incoming_bitrate("availableIncomingBitrate"),
203       requests_received("requestsReceived"),
204       requests_sent("requestsSent"),
205       responses_received("responsesReceived"),
206       responses_sent("responsesSent"),
207       retransmissions_received("retransmissionsReceived"),
208       retransmissions_sent("retransmissionsSent"),
209       consent_requests_received("consentRequestsReceived"),
210       consent_requests_sent("consentRequestsSent"),
211       consent_responses_received("consentResponsesReceived"),
212       consent_responses_sent("consentResponsesSent") {
213 }
214 
RTCIceCandidatePairStats(const RTCIceCandidatePairStats & other)215 RTCIceCandidatePairStats::RTCIceCandidatePairStats(
216     const RTCIceCandidatePairStats& other)
217     : RTCStats(other.id(), other.timestamp_us()),
218       transport_id(other.transport_id),
219       local_candidate_id(other.local_candidate_id),
220       remote_candidate_id(other.remote_candidate_id),
221       state(other.state),
222       priority(other.priority),
223       nominated(other.nominated),
224       writable(other.writable),
225       readable(other.readable),
226       bytes_sent(other.bytes_sent),
227       bytes_received(other.bytes_received),
228       total_round_trip_time(other.total_round_trip_time),
229       current_round_trip_time(other.current_round_trip_time),
230       available_outgoing_bitrate(other.available_outgoing_bitrate),
231       available_incoming_bitrate(other.available_incoming_bitrate),
232       requests_received(other.requests_received),
233       requests_sent(other.requests_sent),
234       responses_received(other.responses_received),
235       responses_sent(other.responses_sent),
236       retransmissions_received(other.retransmissions_received),
237       retransmissions_sent(other.retransmissions_sent),
238       consent_requests_received(other.consent_requests_received),
239       consent_requests_sent(other.consent_requests_sent),
240       consent_responses_received(other.consent_responses_received),
241       consent_responses_sent(other.consent_responses_sent) {
242 }
243 
~RTCIceCandidatePairStats()244 RTCIceCandidatePairStats::~RTCIceCandidatePairStats() {
245 }
246 
247 WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "ice-candidate",
248     &transport_id,
249     &is_remote,
250     &ip,
251     &port,
252     &protocol,
253     &candidate_type,
254     &priority,
255     &url,
256     &deleted);
257 
RTCIceCandidateStats(const std::string & id,int64_t timestamp_us,bool is_remote)258 RTCIceCandidateStats::RTCIceCandidateStats(
259     const std::string& id, int64_t timestamp_us, bool is_remote)
260     : RTCIceCandidateStats(std::string(id), timestamp_us, is_remote) {
261 }
262 
RTCIceCandidateStats(std::string && id,int64_t timestamp_us,bool is_remote)263 RTCIceCandidateStats::RTCIceCandidateStats(
264     std::string&& id, int64_t timestamp_us, bool is_remote)
265     : RTCStats(std::move(id), timestamp_us),
266       transport_id("transportId"),
267       is_remote("isRemote", is_remote),
268       ip("ip"),
269       port("port"),
270       protocol("protocol"),
271       candidate_type("candidateType"),
272       priority("priority"),
273       url("url"),
274       deleted("deleted", false) {
275 }
276 
RTCIceCandidateStats(const RTCIceCandidateStats & other)277 RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
278     : RTCStats(other.id(), other.timestamp_us()),
279       transport_id(other.transport_id),
280       is_remote(other.is_remote),
281       ip(other.ip),
282       port(other.port),
283       protocol(other.protocol),
284       candidate_type(other.candidate_type),
285       priority(other.priority),
286       url(other.url),
287       deleted(other.deleted) {
288 }
289 
~RTCIceCandidateStats()290 RTCIceCandidateStats::~RTCIceCandidateStats() {
291 }
292 
293 const char RTCLocalIceCandidateStats::kType[] = "local-candidate";
294 
RTCLocalIceCandidateStats(const std::string & id,int64_t timestamp_us)295 RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(
296     const std::string& id, int64_t timestamp_us)
297     : RTCIceCandidateStats(id, timestamp_us, false) {
298 }
299 
RTCLocalIceCandidateStats(std::string && id,int64_t timestamp_us)300 RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(
301     std::string&& id, int64_t timestamp_us)
302     : RTCIceCandidateStats(std::move(id), timestamp_us, false) {
303 }
304 
type() const305 const char* RTCLocalIceCandidateStats::type() const {
306   return kType;
307 }
308 
309 const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate";
310 
RTCRemoteIceCandidateStats(const std::string & id,int64_t timestamp_us)311 RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(
312     const std::string& id, int64_t timestamp_us)
313     : RTCIceCandidateStats(id, timestamp_us, true) {
314 }
315 
RTCRemoteIceCandidateStats(std::string && id,int64_t timestamp_us)316 RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(
317     std::string&& id, int64_t timestamp_us)
318     : RTCIceCandidateStats(std::move(id), timestamp_us, true) {
319 }
320 
type() const321 const char* RTCRemoteIceCandidateStats::type() const {
322   return kType;
323 }
324 
325 WEBRTC_RTCSTATS_IMPL(RTCMediaStreamStats, RTCStats, "stream",
326     &stream_identifier,
327     &track_ids);
328 
RTCMediaStreamStats(const std::string & id,int64_t timestamp_us)329 RTCMediaStreamStats::RTCMediaStreamStats(
330     const std::string& id, int64_t timestamp_us)
331     : RTCMediaStreamStats(std::string(id), timestamp_us) {
332 }
333 
RTCMediaStreamStats(std::string && id,int64_t timestamp_us)334 RTCMediaStreamStats::RTCMediaStreamStats(
335     std::string&& id, int64_t timestamp_us)
336     : RTCStats(std::move(id), timestamp_us),
337       stream_identifier("streamIdentifier"),
338       track_ids("trackIds") {
339 }
340 
RTCMediaStreamStats(const RTCMediaStreamStats & other)341 RTCMediaStreamStats::RTCMediaStreamStats(
342     const RTCMediaStreamStats& other)
343     : RTCStats(other.id(), other.timestamp_us()),
344       stream_identifier(other.stream_identifier),
345       track_ids(other.track_ids) {
346 }
347 
~RTCMediaStreamStats()348 RTCMediaStreamStats::~RTCMediaStreamStats() {
349 }
350 
351 WEBRTC_RTCSTATS_IMPL(RTCMediaStreamTrackStats, RTCStats, "track",
352     &track_identifier,
353     &remote_source,
354     &ended,
355     &detached,
356     &kind,
357     &frame_width,
358     &frame_height,
359     &frames_per_second,
360     &frames_sent,
361     &frames_received,
362     &frames_decoded,
363     &frames_dropped,
364     &frames_corrupted,
365     &partial_frames_lost,
366     &full_frames_lost,
367     &audio_level,
368     &echo_return_loss,
369     &echo_return_loss_enhancement);
370 
RTCMediaStreamTrackStats(const std::string & id,int64_t timestamp_us,const char * kind)371 RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
372     const std::string& id, int64_t timestamp_us, const char* kind)
373     : RTCMediaStreamTrackStats(std::string(id), timestamp_us, kind) {
374 }
375 
RTCMediaStreamTrackStats(std::string && id,int64_t timestamp_us,const char * kind)376 RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
377     std::string&& id, int64_t timestamp_us, const char* kind)
378     : RTCStats(std::move(id), timestamp_us),
379       track_identifier("trackIdentifier"),
380       remote_source("remoteSource"),
381       ended("ended"),
382       detached("detached"),
383       kind("kind", kind),
384       frame_width("frameWidth"),
385       frame_height("frameHeight"),
386       frames_per_second("framesPerSecond"),
387       frames_sent("framesSent"),
388       frames_received("framesReceived"),
389       frames_decoded("framesDecoded"),
390       frames_dropped("framesDropped"),
391       frames_corrupted("framesCorrupted"),
392       partial_frames_lost("partialFramesLost"),
393       full_frames_lost("fullFramesLost"),
394       audio_level("audioLevel"),
395       echo_return_loss("echoReturnLoss"),
396       echo_return_loss_enhancement("echoReturnLossEnhancement") {
397   RTC_DCHECK(kind == RTCMediaStreamTrackKind::kAudio ||
398              kind == RTCMediaStreamTrackKind::kVideo);
399 }
400 
RTCMediaStreamTrackStats(const RTCMediaStreamTrackStats & other)401 RTCMediaStreamTrackStats::RTCMediaStreamTrackStats(
402     const RTCMediaStreamTrackStats& other)
403     : RTCStats(other.id(), other.timestamp_us()),
404       track_identifier(other.track_identifier),
405       remote_source(other.remote_source),
406       ended(other.ended),
407       detached(other.detached),
408       kind(other.kind),
409       frame_width(other.frame_width),
410       frame_height(other.frame_height),
411       frames_per_second(other.frames_per_second),
412       frames_sent(other.frames_sent),
413       frames_received(other.frames_received),
414       frames_decoded(other.frames_decoded),
415       frames_dropped(other.frames_dropped),
416       frames_corrupted(other.frames_corrupted),
417       partial_frames_lost(other.partial_frames_lost),
418       full_frames_lost(other.full_frames_lost),
419       audio_level(other.audio_level),
420       echo_return_loss(other.echo_return_loss),
421       echo_return_loss_enhancement(other.echo_return_loss_enhancement) {
422 }
423 
~RTCMediaStreamTrackStats()424 RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() {
425 }
426 
427 WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
428     &data_channels_opened,
429     &data_channels_closed);
430 
RTCPeerConnectionStats(const std::string & id,int64_t timestamp_us)431 RTCPeerConnectionStats::RTCPeerConnectionStats(
432     const std::string& id, int64_t timestamp_us)
433     : RTCPeerConnectionStats(std::string(id), timestamp_us) {
434 }
435 
RTCPeerConnectionStats(std::string && id,int64_t timestamp_us)436 RTCPeerConnectionStats::RTCPeerConnectionStats(
437     std::string&& id, int64_t timestamp_us)
438     : RTCStats(std::move(id), timestamp_us),
439       data_channels_opened("dataChannelsOpened"),
440       data_channels_closed("dataChannelsClosed") {
441 }
442 
RTCPeerConnectionStats(const RTCPeerConnectionStats & other)443 RTCPeerConnectionStats::RTCPeerConnectionStats(
444     const RTCPeerConnectionStats& other)
445     : RTCStats(other.id(), other.timestamp_us()),
446       data_channels_opened(other.data_channels_opened),
447       data_channels_closed(other.data_channels_closed) {
448 }
449 
~RTCPeerConnectionStats()450 RTCPeerConnectionStats::~RTCPeerConnectionStats() {
451 }
452 
453 WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
454     &ssrc,
455     &associate_stats_id,
456     &is_remote,
457     &media_type,
458     &media_track_id,
459     &transport_id,
460     &codec_id,
461     &fir_count,
462     &pli_count,
463     &nack_count,
464     &sli_count,
465     &qp_sum);
466 
RTCRTPStreamStats(const std::string & id,int64_t timestamp_us)467 RTCRTPStreamStats::RTCRTPStreamStats(
468     const std::string& id, int64_t timestamp_us)
469     : RTCRTPStreamStats(std::string(id), timestamp_us) {
470 }
471 
RTCRTPStreamStats(std::string && id,int64_t timestamp_us)472 RTCRTPStreamStats::RTCRTPStreamStats(
473     std::string&& id, int64_t timestamp_us)
474     : RTCStats(std::move(id), timestamp_us),
475       ssrc("ssrc"),
476       associate_stats_id("associateStatsId"),
477       is_remote("isRemote", false),
478       media_type("mediaType"),
479       media_track_id("mediaTrackId"),
480       transport_id("transportId"),
481       codec_id("codecId"),
482       fir_count("firCount"),
483       pli_count("pliCount"),
484       nack_count("nackCount"),
485       sli_count("sliCount"),
486       qp_sum("qpSum") {
487 }
488 
RTCRTPStreamStats(const RTCRTPStreamStats & other)489 RTCRTPStreamStats::RTCRTPStreamStats(
490     const RTCRTPStreamStats& other)
491     : RTCStats(other.id(), other.timestamp_us()),
492       ssrc(other.ssrc),
493       associate_stats_id(other.associate_stats_id),
494       is_remote(other.is_remote),
495       media_type(other.media_type),
496       media_track_id(other.media_track_id),
497       transport_id(other.transport_id),
498       codec_id(other.codec_id),
499       fir_count(other.fir_count),
500       pli_count(other.pli_count),
501       nack_count(other.nack_count),
502       sli_count(other.sli_count),
503       qp_sum(other.qp_sum) {
504 }
505 
~RTCRTPStreamStats()506 RTCRTPStreamStats::~RTCRTPStreamStats() {
507 }
508 
509 WEBRTC_RTCSTATS_IMPL(
510     RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
511     &packets_received,
512     &bytes_received,
513     &packets_lost,
514     &jitter,
515     &fraction_lost,
516     &packets_discarded,
517     &packets_repaired,
518     &burst_packets_lost,
519     &burst_packets_discarded,
520     &burst_loss_count,
521     &burst_discard_count,
522     &burst_loss_rate,
523     &burst_discard_rate,
524     &gap_loss_rate,
525     &gap_discard_rate,
526     &frames_decoded);
527 
RTCInboundRTPStreamStats(const std::string & id,int64_t timestamp_us)528 RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
529     const std::string& id, int64_t timestamp_us)
530     : RTCInboundRTPStreamStats(std::string(id), timestamp_us) {
531 }
532 
RTCInboundRTPStreamStats(std::string && id,int64_t timestamp_us)533 RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
534     std::string&& id, int64_t timestamp_us)
535     : RTCRTPStreamStats(std::move(id), timestamp_us),
536       packets_received("packetsReceived"),
537       bytes_received("bytesReceived"),
538       packets_lost("packetsLost"),
539       jitter("jitter"),
540       fraction_lost("fractionLost"),
541       packets_discarded("packetsDiscarded"),
542       packets_repaired("packetsRepaired"),
543       burst_packets_lost("burstPacketsLost"),
544       burst_packets_discarded("burstPacketsDiscarded"),
545       burst_loss_count("burstLossCount"),
546       burst_discard_count("burstDiscardCount"),
547       burst_loss_rate("burstLossRate"),
548       burst_discard_rate("burstDiscardRate"),
549       gap_loss_rate("gapLossRate"),
550       gap_discard_rate("gapDiscardRate"),
551       frames_decoded("framesDecoded") {
552 }
553 
RTCInboundRTPStreamStats(const RTCInboundRTPStreamStats & other)554 RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
555     const RTCInboundRTPStreamStats& other)
556     : RTCRTPStreamStats(other),
557       packets_received(other.packets_received),
558       bytes_received(other.bytes_received),
559       packets_lost(other.packets_lost),
560       jitter(other.jitter),
561       fraction_lost(other.fraction_lost),
562       packets_discarded(other.packets_discarded),
563       packets_repaired(other.packets_repaired),
564       burst_packets_lost(other.burst_packets_lost),
565       burst_packets_discarded(other.burst_packets_discarded),
566       burst_loss_count(other.burst_loss_count),
567       burst_discard_count(other.burst_discard_count),
568       burst_loss_rate(other.burst_loss_rate),
569       burst_discard_rate(other.burst_discard_rate),
570       gap_loss_rate(other.gap_loss_rate),
571       gap_discard_rate(other.gap_discard_rate),
572       frames_decoded(other.frames_decoded) {
573 }
574 
~RTCInboundRTPStreamStats()575 RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {
576 }
577 
578 WEBRTC_RTCSTATS_IMPL(
579     RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
580     &packets_sent,
581     &bytes_sent,
582     &target_bitrate,
583     &round_trip_time,
584     &frames_encoded);
585 
RTCOutboundRTPStreamStats(const std::string & id,int64_t timestamp_us)586 RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
587     const std::string& id, int64_t timestamp_us)
588     : RTCOutboundRTPStreamStats(std::string(id), timestamp_us) {
589 }
590 
RTCOutboundRTPStreamStats(std::string && id,int64_t timestamp_us)591 RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
592     std::string&& id, int64_t timestamp_us)
593     : RTCRTPStreamStats(std::move(id), timestamp_us),
594       packets_sent("packetsSent"),
595       bytes_sent("bytesSent"),
596       target_bitrate("targetBitrate"),
597       round_trip_time("roundTripTime"),
598       frames_encoded("framesEncoded") {
599 }
600 
RTCOutboundRTPStreamStats(const RTCOutboundRTPStreamStats & other)601 RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
602     const RTCOutboundRTPStreamStats& other)
603     : RTCRTPStreamStats(other),
604       packets_sent(other.packets_sent),
605       bytes_sent(other.bytes_sent),
606       target_bitrate(other.target_bitrate),
607       round_trip_time(other.round_trip_time),
608       frames_encoded(other.frames_encoded) {
609 }
610 
~RTCOutboundRTPStreamStats()611 RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {
612 }
613 
614 WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport",
615     &bytes_sent,
616     &bytes_received,
617     &rtcp_transport_stats_id,
618     &dtls_state,
619     &selected_candidate_pair_id,
620     &local_certificate_id,
621     &remote_certificate_id);
622 
RTCTransportStats(const std::string & id,int64_t timestamp_us)623 RTCTransportStats::RTCTransportStats(
624     const std::string& id, int64_t timestamp_us)
625     : RTCTransportStats(std::string(id), timestamp_us) {
626 }
627 
RTCTransportStats(std::string && id,int64_t timestamp_us)628 RTCTransportStats::RTCTransportStats(
629     std::string&& id, int64_t timestamp_us)
630     : RTCStats(std::move(id), timestamp_us),
631       bytes_sent("bytesSent"),
632       bytes_received("bytesReceived"),
633       rtcp_transport_stats_id("rtcpTransportStatsId"),
634       dtls_state("dtlsState"),
635       selected_candidate_pair_id("selectedCandidatePairId"),
636       local_certificate_id("localCertificateId"),
637       remote_certificate_id("remoteCertificateId") {
638 }
639 
RTCTransportStats(const RTCTransportStats & other)640 RTCTransportStats::RTCTransportStats(
641     const RTCTransportStats& other)
642     : RTCStats(other.id(), other.timestamp_us()),
643       bytes_sent(other.bytes_sent),
644       bytes_received(other.bytes_received),
645       rtcp_transport_stats_id(other.rtcp_transport_stats_id),
646       dtls_state(other.dtls_state),
647       selected_candidate_pair_id(other.selected_candidate_pair_id),
648       local_certificate_id(other.local_certificate_id),
649       remote_certificate_id(other.remote_certificate_id) {
650 }
651 
~RTCTransportStats()652 RTCTransportStats::~RTCTransportStats() {
653 }
654 
655 }  // namespace webrtc
656