Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: webrtc/api/rtcstatscollector.cc

Issue 2597963002: RTCIceCandidateStats.transportId added and collected. (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 int64_t timestamp_us, const cricket::Candidate& candidate, bool is_local, 258 int64_t timestamp_us, const cricket::Candidate& candidate, bool is_local,
259 RTCStatsReport* report) { 259 RTCStatsReport* report) {
260 const std::string& id = "RTCIceCandidate_" + candidate.id(); 260 const std::string& id = "RTCIceCandidate_" + candidate.id();
261 const RTCStats* stats = report->Get(id); 261 const RTCStats* stats = report->Get(id);
262 if (!stats) { 262 if (!stats) {
263 std::unique_ptr<RTCIceCandidateStats> candidate_stats; 263 std::unique_ptr<RTCIceCandidateStats> candidate_stats;
264 if (is_local) 264 if (is_local)
265 candidate_stats.reset(new RTCLocalIceCandidateStats(id, timestamp_us)); 265 candidate_stats.reset(new RTCLocalIceCandidateStats(id, timestamp_us));
266 else 266 else
267 candidate_stats.reset(new RTCRemoteIceCandidateStats(id, timestamp_us)); 267 candidate_stats.reset(new RTCRemoteIceCandidateStats(id, timestamp_us));
268 if (!candidate.transport_name().empty()) {
Taylor Brandstetter 2016/12/22 19:28:31 Using the transport_name on the candidate isn't re
hbos 2016/12/23 14:25:17 Done.
269 candidate_stats->transport_id = RTCTransportStatsIDFromTransportChannel(
270 candidate.transport_name(), candidate.component());
271 }
268 candidate_stats->ip = candidate.address().ipaddr().ToString(); 272 candidate_stats->ip = candidate.address().ipaddr().ToString();
269 candidate_stats->port = static_cast<int32_t>(candidate.address().port()); 273 candidate_stats->port = static_cast<int32_t>(candidate.address().port());
270 candidate_stats->protocol = candidate.protocol(); 274 candidate_stats->protocol = candidate.protocol();
271 candidate_stats->candidate_type = CandidateTypeToRTCIceCandidateType( 275 candidate_stats->candidate_type = CandidateTypeToRTCIceCandidateType(
272 candidate.type()); 276 candidate.type());
273 candidate_stats->priority = static_cast<int32_t>(candidate.priority()); 277 candidate_stats->priority = static_cast<int32_t>(candidate.priority());
274 278
275 stats = candidate_stats.get(); 279 stats = candidate_stats.get();
276 report->AddStats(std::move(candidate_stats)); 280 report->AddStats(std::move(candidate_stats));
277 } 281 }
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 report->AddStats(std::move(data_channel_stats)); 644 report->AddStats(std::move(data_channel_stats));
641 } 645 }
642 } 646 }
643 647
644 void RTCStatsCollector::ProduceIceCandidateAndPairStats_n( 648 void RTCStatsCollector::ProduceIceCandidateAndPairStats_n(
645 int64_t timestamp_us, const SessionStats& session_stats, 649 int64_t timestamp_us, const SessionStats& session_stats,
646 RTCStatsReport* report) const { 650 RTCStatsReport* report) const {
647 RTC_DCHECK(network_thread_->IsCurrent()); 651 RTC_DCHECK(network_thread_->IsCurrent());
648 for (const auto& transport_stats : session_stats.transport_stats) { 652 for (const auto& transport_stats : session_stats.transport_stats) {
649 for (const auto& channel_stats : transport_stats.second.channel_stats) { 653 for (const auto& channel_stats : transport_stats.second.channel_stats) {
650 std::string transport_id = RTCTransportStatsIDFromTransportChannel( 654 std::string transport_id = RTCTransportStatsIDFromTransportChannel(
Taylor Brandstetter 2016/12/22 19:28:31 Here's the transport ID you can pass into ProduceI
hbos 2016/12/23 14:25:17 OK, I was wondering if it was the same information
651 transport_stats.second.transport_name, channel_stats.component); 655 transport_stats.second.transport_name, channel_stats.component);
652 for (const cricket::ConnectionInfo& info : 656 for (const cricket::ConnectionInfo& info :
653 channel_stats.connection_infos) { 657 channel_stats.connection_infos) {
654 std::unique_ptr<RTCIceCandidatePairStats> candidate_pair_stats( 658 std::unique_ptr<RTCIceCandidatePairStats> candidate_pair_stats(
655 new RTCIceCandidatePairStats( 659 new RTCIceCandidatePairStats(
656 RTCIceCandidatePairStatsIDFromConnectionInfo(info), 660 RTCIceCandidatePairStatsIDFromConnectionInfo(info),
657 timestamp_us)); 661 timestamp_us));
658 662
659 candidate_pair_stats->transport_id = transport_id; 663 candidate_pair_stats->transport_id = transport_id;
660 // TODO(hbos): There could be other candidates that are not paired with 664 // TODO(hbos): There could be other candidates that are not paired with
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 const std::string& type) { 969 const std::string& type) {
966 return CandidateTypeToRTCIceCandidateType(type); 970 return CandidateTypeToRTCIceCandidateType(type);
967 } 971 }
968 972
969 const char* DataStateToRTCDataChannelStateForTesting( 973 const char* DataStateToRTCDataChannelStateForTesting(
970 DataChannelInterface::DataState state) { 974 DataChannelInterface::DataState state) {
971 return DataStateToRTCDataChannelState(state); 975 return DataStateToRTCDataChannelState(state);
972 } 976 }
973 977
974 } // namespace webrtc 978 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698