hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 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 | |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 11 | #include "webrtc/api/rtcstatscollector.h" |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 12 | |
| 13 | #include <memory> |
| 14 | #include <utility> |
| 15 | #include <vector> |
| 16 | |
| 17 | #include "webrtc/api/peerconnection.h" |
hbos | 6ab97ce | 2016-10-03 14:16:56 -0700 | [diff] [blame] | 18 | #include "webrtc/api/webrtcsession.h" |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 19 | #include "webrtc/base/checks.h" |
hbos | 6ab97ce | 2016-10-03 14:16:56 -0700 | [diff] [blame] | 20 | #include "webrtc/base/sslidentity.h" |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 21 | #include "webrtc/p2p/base/candidate.h" |
| 22 | #include "webrtc/p2p/base/port.h" |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 23 | |
| 24 | namespace webrtc { |
| 25 | |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 26 | const char* CandidateTypeToRTCIceCandidateType(const std::string& type) { |
| 27 | if (type == cricket::LOCAL_PORT_TYPE) |
| 28 | return RTCIceCandidateType::kHost; |
| 29 | if (type == cricket::STUN_PORT_TYPE) |
| 30 | return RTCIceCandidateType::kSrflx; |
| 31 | if (type == cricket::PRFLX_PORT_TYPE) |
| 32 | return RTCIceCandidateType::kPrflx; |
| 33 | if (type == cricket::RELAY_PORT_TYPE) |
| 34 | return RTCIceCandidateType::kRelay; |
| 35 | RTC_NOTREACHED(); |
| 36 | return nullptr; |
| 37 | } |
| 38 | |
hbos | c82f2e1 | 2016-09-05 01:36:50 -0700 | [diff] [blame] | 39 | rtc::scoped_refptr<RTCStatsCollector> RTCStatsCollector::Create( |
| 40 | PeerConnection* pc, int64_t cache_lifetime_us) { |
| 41 | return rtc::scoped_refptr<RTCStatsCollector>( |
| 42 | new rtc::RefCountedObject<RTCStatsCollector>(pc, cache_lifetime_us)); |
| 43 | } |
| 44 | |
| 45 | RTCStatsCollector::RTCStatsCollector(PeerConnection* pc, |
| 46 | int64_t cache_lifetime_us) |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 47 | : pc_(pc), |
hbos | c82f2e1 | 2016-09-05 01:36:50 -0700 | [diff] [blame] | 48 | signaling_thread_(pc->session()->signaling_thread()), |
| 49 | worker_thread_(pc->session()->worker_thread()), |
| 50 | network_thread_(pc->session()->network_thread()), |
| 51 | num_pending_partial_reports_(0), |
| 52 | partial_report_timestamp_us_(0), |
hbos | 0e6758d | 2016-08-31 07:57:36 -0700 | [diff] [blame] | 53 | cache_timestamp_us_(0), |
| 54 | cache_lifetime_us_(cache_lifetime_us) { |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 55 | RTC_DCHECK(pc_); |
hbos | c82f2e1 | 2016-09-05 01:36:50 -0700 | [diff] [blame] | 56 | RTC_DCHECK(signaling_thread_); |
| 57 | RTC_DCHECK(worker_thread_); |
| 58 | RTC_DCHECK(network_thread_); |
hbos | 0e6758d | 2016-08-31 07:57:36 -0700 | [diff] [blame] | 59 | RTC_DCHECK_GE(cache_lifetime_us_, 0); |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 60 | } |
| 61 | |
hbos | c82f2e1 | 2016-09-05 01:36:50 -0700 | [diff] [blame] | 62 | void RTCStatsCollector::GetStatsReport( |
| 63 | rtc::scoped_refptr<RTCStatsCollectorCallback> callback) { |
| 64 | RTC_DCHECK(signaling_thread_->IsCurrent()); |
| 65 | RTC_DCHECK(callback); |
| 66 | callbacks_.push_back(callback); |
| 67 | |
hbos | 0e6758d | 2016-08-31 07:57:36 -0700 | [diff] [blame] | 68 | // "Now" using a monotonically increasing timer. |
| 69 | int64_t cache_now_us = rtc::TimeMicros(); |
| 70 | if (cached_report_ && |
| 71 | cache_now_us - cache_timestamp_us_ <= cache_lifetime_us_) { |
hbos | c82f2e1 | 2016-09-05 01:36:50 -0700 | [diff] [blame] | 72 | // We have a fresh cached report to deliver. |
| 73 | DeliverCachedReport(); |
| 74 | } else if (!num_pending_partial_reports_) { |
| 75 | // Only start gathering stats if we're not already gathering stats. In the |
| 76 | // case of already gathering stats, |callback_| will be invoked when there |
| 77 | // are no more pending partial reports. |
| 78 | |
| 79 | // "Now" using a system clock, relative to the UNIX epoch (Jan 1, 1970, |
| 80 | // UTC), in microseconds. The system clock could be modified and is not |
| 81 | // necessarily monotonically increasing. |
nisse | cdf37a9 | 2016-09-13 23:41:47 -0700 | [diff] [blame] | 82 | int64_t timestamp_us = rtc::TimeUTCMicros(); |
hbos | c82f2e1 | 2016-09-05 01:36:50 -0700 | [diff] [blame] | 83 | |
| 84 | num_pending_partial_reports_ = 3; |
| 85 | partial_report_timestamp_us_ = cache_now_us; |
| 86 | invoker_.AsyncInvoke<void>(RTC_FROM_HERE, signaling_thread_, |
| 87 | rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnSignalingThread, |
| 88 | rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us)); |
| 89 | invoker_.AsyncInvoke<void>(RTC_FROM_HERE, worker_thread_, |
| 90 | rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnWorkerThread, |
| 91 | rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us)); |
| 92 | invoker_.AsyncInvoke<void>(RTC_FROM_HERE, network_thread_, |
| 93 | rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnNetworkThread, |
| 94 | rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us)); |
hbos | 0e6758d | 2016-08-31 07:57:36 -0700 | [diff] [blame] | 95 | } |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | void RTCStatsCollector::ClearCachedStatsReport() { |
hbos | c82f2e1 | 2016-09-05 01:36:50 -0700 | [diff] [blame] | 99 | RTC_DCHECK(signaling_thread_->IsCurrent()); |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 100 | cached_report_ = nullptr; |
| 101 | } |
| 102 | |
hbos | c82f2e1 | 2016-09-05 01:36:50 -0700 | [diff] [blame] | 103 | void RTCStatsCollector::ProducePartialResultsOnSignalingThread( |
| 104 | int64_t timestamp_us) { |
| 105 | RTC_DCHECK(signaling_thread_->IsCurrent()); |
| 106 | rtc::scoped_refptr<RTCStatsReport> report = RTCStatsReport::Create(); |
| 107 | |
hbos | 6ab97ce | 2016-10-03 14:16:56 -0700 | [diff] [blame] | 108 | SessionStats session_stats; |
| 109 | if (pc_->session()->GetTransportStats(&session_stats)) { |
| 110 | ProduceCertificateStats_s(timestamp_us, session_stats, report.get()); |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 111 | ProduceIceCandidateAndPairStats_s(timestamp_us, session_stats, |
| 112 | report.get()); |
hbos | 6ab97ce | 2016-10-03 14:16:56 -0700 | [diff] [blame] | 113 | } |
| 114 | ProducePeerConnectionStats_s(timestamp_us, report.get()); |
hbos | c82f2e1 | 2016-09-05 01:36:50 -0700 | [diff] [blame] | 115 | |
| 116 | AddPartialResults(report); |
| 117 | } |
| 118 | |
| 119 | void RTCStatsCollector::ProducePartialResultsOnWorkerThread( |
| 120 | int64_t timestamp_us) { |
| 121 | RTC_DCHECK(worker_thread_->IsCurrent()); |
| 122 | rtc::scoped_refptr<RTCStatsReport> report = RTCStatsReport::Create(); |
| 123 | |
| 124 | // TODO(hbos): Gather stats on worker thread. |
| 125 | |
| 126 | AddPartialResults(report); |
| 127 | } |
| 128 | |
| 129 | void RTCStatsCollector::ProducePartialResultsOnNetworkThread( |
| 130 | int64_t timestamp_us) { |
| 131 | RTC_DCHECK(network_thread_->IsCurrent()); |
| 132 | rtc::scoped_refptr<RTCStatsReport> report = RTCStatsReport::Create(); |
| 133 | |
| 134 | // TODO(hbos): Gather stats on network thread. |
| 135 | |
| 136 | AddPartialResults(report); |
| 137 | } |
| 138 | |
| 139 | void RTCStatsCollector::AddPartialResults( |
| 140 | const rtc::scoped_refptr<RTCStatsReport>& partial_report) { |
| 141 | if (!signaling_thread_->IsCurrent()) { |
| 142 | invoker_.AsyncInvoke<void>(RTC_FROM_HERE, signaling_thread_, |
| 143 | rtc::Bind(&RTCStatsCollector::AddPartialResults_s, |
| 144 | rtc::scoped_refptr<RTCStatsCollector>(this), |
| 145 | partial_report)); |
| 146 | return; |
| 147 | } |
| 148 | AddPartialResults_s(partial_report); |
| 149 | } |
| 150 | |
| 151 | void RTCStatsCollector::AddPartialResults_s( |
| 152 | rtc::scoped_refptr<RTCStatsReport> partial_report) { |
| 153 | RTC_DCHECK(signaling_thread_->IsCurrent()); |
| 154 | RTC_DCHECK_GT(num_pending_partial_reports_, 0); |
| 155 | if (!partial_report_) |
| 156 | partial_report_ = partial_report; |
| 157 | else |
| 158 | partial_report_->TakeMembersFrom(partial_report); |
| 159 | --num_pending_partial_reports_; |
| 160 | if (!num_pending_partial_reports_) { |
| 161 | cache_timestamp_us_ = partial_report_timestamp_us_; |
| 162 | cached_report_ = partial_report_; |
| 163 | partial_report_ = nullptr; |
| 164 | DeliverCachedReport(); |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | void RTCStatsCollector::DeliverCachedReport() { |
| 169 | RTC_DCHECK(signaling_thread_->IsCurrent()); |
| 170 | RTC_DCHECK(!callbacks_.empty()); |
| 171 | RTC_DCHECK(cached_report_); |
| 172 | for (const rtc::scoped_refptr<RTCStatsCollectorCallback>& callback : |
| 173 | callbacks_) { |
| 174 | callback->OnStatsDelivered(cached_report_); |
| 175 | } |
| 176 | callbacks_.clear(); |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 177 | } |
| 178 | |
hbos | 6ab97ce | 2016-10-03 14:16:56 -0700 | [diff] [blame] | 179 | void RTCStatsCollector::ProduceCertificateStats_s( |
| 180 | int64_t timestamp_us, const SessionStats& session_stats, |
| 181 | RTCStatsReport* report) const { |
| 182 | RTC_DCHECK(signaling_thread_->IsCurrent()); |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame^] | 183 | for (const auto& transport_stats : session_stats.transport_stats) { |
hbos | 6ab97ce | 2016-10-03 14:16:56 -0700 | [diff] [blame] | 184 | rtc::scoped_refptr<rtc::RTCCertificate> local_certificate; |
| 185 | if (pc_->session()->GetLocalCertificate( |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame^] | 186 | transport_stats.second.transport_name, &local_certificate)) { |
hbos | 6ab97ce | 2016-10-03 14:16:56 -0700 | [diff] [blame] | 187 | ProduceCertificateStatsFromSSLCertificateAndChain_s( |
| 188 | timestamp_us, local_certificate->ssl_certificate(), report); |
| 189 | } |
| 190 | std::unique_ptr<rtc::SSLCertificate> remote_certificate = |
| 191 | pc_->session()->GetRemoteSSLCertificate( |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame^] | 192 | transport_stats.second.transport_name); |
hbos | 6ab97ce | 2016-10-03 14:16:56 -0700 | [diff] [blame] | 193 | if (remote_certificate) { |
| 194 | ProduceCertificateStatsFromSSLCertificateAndChain_s( |
| 195 | timestamp_us, *remote_certificate.get(), report); |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | void RTCStatsCollector::ProduceCertificateStatsFromSSLCertificateAndChain_s( |
| 201 | int64_t timestamp_us, const rtc::SSLCertificate& certificate, |
| 202 | RTCStatsReport* report) const { |
| 203 | RTC_DCHECK(signaling_thread_->IsCurrent()); |
| 204 | std::unique_ptr<rtc::SSLCertificateStats> ssl_stats = |
| 205 | certificate.GetStats(); |
| 206 | RTCCertificateStats* prev_stats = nullptr; |
| 207 | for (rtc::SSLCertificateStats* s = ssl_stats.get(); s; |
| 208 | s = s->issuer.get()) { |
| 209 | RTCCertificateStats* stats = new RTCCertificateStats( |
| 210 | "RTCCertificate_" + s->fingerprint, timestamp_us); |
| 211 | stats->fingerprint = s->fingerprint; |
| 212 | stats->fingerprint_algorithm = s->fingerprint_algorithm; |
| 213 | stats->base64_certificate = s->base64_certificate; |
| 214 | if (prev_stats) |
| 215 | prev_stats->issuer_certificate_id = stats->id(); |
| 216 | report->AddStats(std::unique_ptr<RTCCertificateStats>(stats)); |
| 217 | prev_stats = stats; |
| 218 | } |
| 219 | } |
| 220 | |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 221 | void RTCStatsCollector::ProduceIceCandidateAndPairStats_s( |
| 222 | int64_t timestamp_us, const SessionStats& session_stats, |
| 223 | RTCStatsReport* report) const { |
| 224 | RTC_DCHECK(signaling_thread_->IsCurrent()); |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame^] | 225 | for (const auto& transport_stats : session_stats.transport_stats) { |
| 226 | for (const auto& channel_stats : transport_stats.second.channel_stats) { |
| 227 | for (const cricket::ConnectionInfo& info : |
| 228 | channel_stats.connection_infos) { |
| 229 | const std::string& id = "RTCIceCandidatePair_" + |
| 230 | info.local_candidate.id() + "_" + info.remote_candidate.id(); |
| 231 | std::unique_ptr<RTCIceCandidatePairStats> candidate_pair_stats( |
| 232 | new RTCIceCandidatePairStats(id, timestamp_us)); |
| 233 | |
| 234 | // TODO(hbos): Set all of the |RTCIceCandidatePairStats|'s members, |
| 235 | // crbug.com/633550. |
| 236 | |
| 237 | // TODO(hbos): Set candidate_pair_stats->transport_id. Should be ID to |
| 238 | // RTCTransportStats which does not exist yet: crbug.com/653873. |
| 239 | |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 240 | // TODO(hbos): There could be other candidates that are not paired with |
| 241 | // anything. We don't have a complete list. Local candidates come from |
| 242 | // Port objects, and prflx candidates (both local and remote) are only |
| 243 | // stored in candidate pairs. crbug.com/632723 |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame^] | 244 | candidate_pair_stats->local_candidate_id = ProduceIceCandidateStats_s( |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 245 | timestamp_us, info.local_candidate, true, report); |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame^] | 246 | candidate_pair_stats->remote_candidate_id = ProduceIceCandidateStats_s( |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 247 | timestamp_us, info.remote_candidate, false, report); |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame^] | 248 | |
| 249 | // TODO(hbos): Set candidate_pair_stats->state. |
| 250 | // TODO(hbos): Set candidate_pair_stats->priority. |
| 251 | // TODO(hbos): Set candidate_pair_stats->nominated. |
| 252 | // TODO(hbos): This writable is different than the spec. It goes to |
| 253 | // false after a certain amount of time without a response passes. |
| 254 | // crbug.com/633550 |
| 255 | candidate_pair_stats->writable = info.writable; |
| 256 | // TODO(hbos): Set candidate_pair_stats->readable. |
| 257 | candidate_pair_stats->bytes_sent = |
| 258 | static_cast<uint64_t>(info.sent_total_bytes); |
| 259 | candidate_pair_stats->bytes_received = |
| 260 | static_cast<uint64_t>(info.recv_total_bytes); |
| 261 | // TODO(hbos): Set candidate_pair_stats->total_rtt. |
| 262 | // TODO(hbos): The |info.rtt| measurement is smoothed. It shouldn't be |
| 263 | // smoothed according to the spec. crbug.com/633550. See |
| 264 | // https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-currentrtt |
| 265 | candidate_pair_stats->current_rtt = |
| 266 | static_cast<double>(info.rtt) / 1000.0; |
| 267 | // TODO(hbos): Set candidate_pair_stats->available_outgoing_bitrate. |
| 268 | // TODO(hbos): Set candidate_pair_stats->available_incoming_bitrate. |
| 269 | // TODO(hbos): Set candidate_pair_stats->requests_received. |
| 270 | candidate_pair_stats->requests_sent = |
| 271 | static_cast<uint64_t>(info.sent_ping_requests_total); |
| 272 | candidate_pair_stats->responses_received = |
| 273 | static_cast<uint64_t>(info.recv_ping_responses); |
| 274 | candidate_pair_stats->responses_sent = |
| 275 | static_cast<uint64_t>(info.sent_ping_responses); |
| 276 | // TODO(hbos): Set candidate_pair_stats->retransmissions_received. |
| 277 | // TODO(hbos): Set candidate_pair_stats->retransmissions_sent. |
| 278 | // TODO(hbos): Set candidate_pair_stats->consent_requests_received. |
| 279 | // TODO(hbos): Set candidate_pair_stats->consent_requests_sent. |
| 280 | // TODO(hbos): Set candidate_pair_stats->consent_responses_received. |
| 281 | // TODO(hbos): Set candidate_pair_stats->consent_responses_sent. |
| 282 | |
| 283 | report->AddStats(std::move(candidate_pair_stats)); |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 284 | } |
| 285 | } |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | const std::string& RTCStatsCollector::ProduceIceCandidateStats_s( |
| 290 | int64_t timestamp_us, const cricket::Candidate& candidate, bool is_local, |
| 291 | RTCStatsReport* report) const { |
| 292 | RTC_DCHECK(signaling_thread_->IsCurrent()); |
| 293 | const std::string& id = "RTCIceCandidate_" + candidate.id(); |
| 294 | const RTCStats* stats = report->Get(id); |
| 295 | if (!stats) { |
| 296 | std::unique_ptr<RTCIceCandidateStats> candidate_stats; |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame^] | 297 | if (is_local) |
| 298 | candidate_stats.reset(new RTCLocalIceCandidateStats(id, timestamp_us)); |
| 299 | else |
| 300 | candidate_stats.reset(new RTCRemoteIceCandidateStats(id, timestamp_us)); |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 301 | candidate_stats->ip = candidate.address().ipaddr().ToString(); |
| 302 | candidate_stats->port = static_cast<int32_t>(candidate.address().port()); |
| 303 | candidate_stats->protocol = candidate.protocol(); |
| 304 | candidate_stats->candidate_type = CandidateTypeToRTCIceCandidateType( |
| 305 | candidate.type()); |
| 306 | candidate_stats->priority = static_cast<int32_t>(candidate.priority()); |
| 307 | // TODO(hbos): Define candidate_stats->url. crbug.com/632723 |
| 308 | |
| 309 | stats = candidate_stats.get(); |
| 310 | report->AddStats(std::move(candidate_stats)); |
| 311 | } |
| 312 | RTC_DCHECK_EQ(stats->type(), is_local ? RTCLocalIceCandidateStats::kType |
| 313 | : RTCRemoteIceCandidateStats::kType); |
| 314 | return stats->id(); |
| 315 | } |
| 316 | |
hbos | 6ab97ce | 2016-10-03 14:16:56 -0700 | [diff] [blame] | 317 | void RTCStatsCollector::ProducePeerConnectionStats_s( |
| 318 | int64_t timestamp_us, RTCStatsReport* report) const { |
hbos | c82f2e1 | 2016-09-05 01:36:50 -0700 | [diff] [blame] | 319 | RTC_DCHECK(signaling_thread_->IsCurrent()); |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 320 | // TODO(hbos): If data channels are removed from the peer connection this will |
| 321 | // yield incorrect counts. Address before closing crbug.com/636818. See |
| 322 | // https://w3c.github.io/webrtc-stats/webrtc-stats.html#pcstats-dict*. |
| 323 | uint32_t data_channels_opened = 0; |
| 324 | const std::vector<rtc::scoped_refptr<DataChannel>>& data_channels = |
| 325 | pc_->sctp_data_channels(); |
| 326 | for (const rtc::scoped_refptr<DataChannel>& data_channel : data_channels) { |
| 327 | if (data_channel->state() == DataChannelInterface::kOpen) |
| 328 | ++data_channels_opened; |
| 329 | } |
| 330 | // There is always just one |RTCPeerConnectionStats| so its |id| can be a |
| 331 | // constant. |
| 332 | std::unique_ptr<RTCPeerConnectionStats> stats( |
hbos | 0e6758d | 2016-08-31 07:57:36 -0700 | [diff] [blame] | 333 | new RTCPeerConnectionStats("RTCPeerConnection", timestamp_us)); |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 334 | stats->data_channels_opened = data_channels_opened; |
| 335 | stats->data_channels_closed = static_cast<uint32_t>(data_channels.size()) - |
| 336 | data_channels_opened; |
hbos | 6ab97ce | 2016-10-03 14:16:56 -0700 | [diff] [blame] | 337 | report->AddStats(std::move(stats)); |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 338 | } |
| 339 | |
| 340 | } // namespace webrtc |