| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 certificate_stats->base64_certificate = s->base64_certificate; | 270 certificate_stats->base64_certificate = s->base64_certificate; |
| 271 if (prev_certificate_stats) | 271 if (prev_certificate_stats) |
| 272 prev_certificate_stats->issuer_certificate_id = certificate_stats->id(); | 272 prev_certificate_stats->issuer_certificate_id = certificate_stats->id(); |
| 273 report->AddStats(std::unique_ptr<RTCCertificateStats>(certificate_stats)); | 273 report->AddStats(std::unique_ptr<RTCCertificateStats>(certificate_stats)); |
| 274 prev_certificate_stats = certificate_stats; | 274 prev_certificate_stats = certificate_stats; |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 | 277 |
| 278 const std::string& ProduceIceCandidateStats( | 278 const std::string& ProduceIceCandidateStats( |
| 279 int64_t timestamp_us, const cricket::Candidate& candidate, bool is_local, | 279 int64_t timestamp_us, const cricket::Candidate& candidate, bool is_local, |
| 280 RTCStatsReport* report) { | 280 const std::string& transport_id, RTCStatsReport* report) { |
| 281 const std::string& id = "RTCIceCandidate_" + candidate.id(); | 281 const std::string& id = "RTCIceCandidate_" + candidate.id(); |
| 282 const RTCStats* stats = report->Get(id); | 282 const RTCStats* stats = report->Get(id); |
| 283 if (!stats) { | 283 if (!stats) { |
| 284 std::unique_ptr<RTCIceCandidateStats> candidate_stats; | 284 std::unique_ptr<RTCIceCandidateStats> candidate_stats; |
| 285 if (is_local) | 285 if (is_local) |
| 286 candidate_stats.reset(new RTCLocalIceCandidateStats(id, timestamp_us)); | 286 candidate_stats.reset(new RTCLocalIceCandidateStats(id, timestamp_us)); |
| 287 else | 287 else |
| 288 candidate_stats.reset(new RTCRemoteIceCandidateStats(id, timestamp_us)); | 288 candidate_stats.reset(new RTCRemoteIceCandidateStats(id, timestamp_us)); |
| 289 candidate_stats->transport_id = transport_id; |
| 289 candidate_stats->ip = candidate.address().ipaddr().ToString(); | 290 candidate_stats->ip = candidate.address().ipaddr().ToString(); |
| 290 candidate_stats->port = static_cast<int32_t>(candidate.address().port()); | 291 candidate_stats->port = static_cast<int32_t>(candidate.address().port()); |
| 291 candidate_stats->protocol = candidate.protocol(); | 292 candidate_stats->protocol = candidate.protocol(); |
| 292 candidate_stats->candidate_type = CandidateTypeToRTCIceCandidateType( | 293 candidate_stats->candidate_type = CandidateTypeToRTCIceCandidateType( |
| 293 candidate.type()); | 294 candidate.type()); |
| 294 candidate_stats->priority = static_cast<int32_t>(candidate.priority()); | 295 candidate_stats->priority = static_cast<int32_t>(candidate.priority()); |
| 295 | 296 |
| 296 stats = candidate_stats.get(); | 297 stats = candidate_stats.get(); |
| 297 report->AddStats(std::move(candidate_stats)); | 298 report->AddStats(std::move(candidate_stats)); |
| 298 } | 299 } |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 new RTCIceCandidatePairStats( | 658 new RTCIceCandidatePairStats( |
| 658 RTCIceCandidatePairStatsIDFromConnectionInfo(info), | 659 RTCIceCandidatePairStatsIDFromConnectionInfo(info), |
| 659 timestamp_us)); | 660 timestamp_us)); |
| 660 | 661 |
| 661 candidate_pair_stats->transport_id = transport_id; | 662 candidate_pair_stats->transport_id = transport_id; |
| 662 // TODO(hbos): There could be other candidates that are not paired with | 663 // TODO(hbos): There could be other candidates that are not paired with |
| 663 // anything. We don't have a complete list. Local candidates come from | 664 // anything. We don't have a complete list. Local candidates come from |
| 664 // Port objects, and prflx candidates (both local and remote) are only | 665 // Port objects, and prflx candidates (both local and remote) are only |
| 665 // stored in candidate pairs. crbug.com/632723 | 666 // stored in candidate pairs. crbug.com/632723 |
| 666 candidate_pair_stats->local_candidate_id = ProduceIceCandidateStats( | 667 candidate_pair_stats->local_candidate_id = ProduceIceCandidateStats( |
| 667 timestamp_us, info.local_candidate, true, report); | 668 timestamp_us, info.local_candidate, true, transport_id, report); |
| 668 candidate_pair_stats->remote_candidate_id = ProduceIceCandidateStats( | 669 candidate_pair_stats->remote_candidate_id = ProduceIceCandidateStats( |
| 669 timestamp_us, info.remote_candidate, false, report); | 670 timestamp_us, info.remote_candidate, false, transport_id, report); |
| 670 candidate_pair_stats->state = | 671 candidate_pair_stats->state = |
| 671 IceCandidatePairStateToRTCStatsIceCandidatePairState(info.state); | 672 IceCandidatePairStateToRTCStatsIceCandidatePairState(info.state); |
| 672 candidate_pair_stats->priority = info.priority; | 673 candidate_pair_stats->priority = info.priority; |
| 673 // TODO(hbos): This writable is different than the spec. It goes to | 674 // TODO(hbos): This writable is different than the spec. It goes to |
| 674 // false after a certain amount of time without a response passes. | 675 // false after a certain amount of time without a response passes. |
| 675 // crbug.com/633550 | 676 // crbug.com/633550 |
| 676 candidate_pair_stats->writable = info.writable; | 677 candidate_pair_stats->writable = info.writable; |
| 677 candidate_pair_stats->bytes_sent = | 678 candidate_pair_stats->bytes_sent = |
| 678 static_cast<uint64_t>(info.sent_total_bytes); | 679 static_cast<uint64_t>(info.sent_total_bytes); |
| 679 candidate_pair_stats->bytes_received = | 680 candidate_pair_stats->bytes_received = |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 const std::string& type) { | 971 const std::string& type) { |
| 971 return CandidateTypeToRTCIceCandidateType(type); | 972 return CandidateTypeToRTCIceCandidateType(type); |
| 972 } | 973 } |
| 973 | 974 |
| 974 const char* DataStateToRTCDataChannelStateForTesting( | 975 const char* DataStateToRTCDataChannelStateForTesting( |
| 975 DataChannelInterface::DataState state) { | 976 DataChannelInterface::DataState state) { |
| 976 return DataStateToRTCDataChannelState(state); | 977 return DataStateToRTCDataChannelState(state); |
| 977 } | 978 } |
| 978 | 979 |
| 979 } // namespace webrtc | 980 } // namespace webrtc |
| OLD | NEW |