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

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

Issue 2597423003: RTCIceCandidatePairStats.[state/priority] added, ConnectionInfo updated. (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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 case DataChannelInterface::kClosing: 107 case DataChannelInterface::kClosing:
108 return RTCDataChannelState::kClosing; 108 return RTCDataChannelState::kClosing;
109 case DataChannelInterface::kClosed: 109 case DataChannelInterface::kClosed:
110 return RTCDataChannelState::kClosed; 110 return RTCDataChannelState::kClosed;
111 default: 111 default:
112 RTC_NOTREACHED(); 112 RTC_NOTREACHED();
113 return nullptr; 113 return nullptr;
114 } 114 }
115 } 115 }
116 116
117 const char* IceCandidatePairStateToRTCStatsIceCandidatePairState(
118 cricket::IceCandidatePairState state) {
119 switch (state) {
120 case cricket::IceCandidatePairState::WAITING:
121 return RTCStatsIceCandidatePairState::kWaiting;
122 case cricket::IceCandidatePairState::IN_PROGRESS:
123 return RTCStatsIceCandidatePairState::kInProgress;
124 case cricket::IceCandidatePairState::SUCCEEDED:
125 return RTCStatsIceCandidatePairState::kSucceeded;
126 case cricket::IceCandidatePairState::FAILED:
127 return RTCStatsIceCandidatePairState::kFailed;
128 default:
129 RTC_NOTREACHED();
130 return nullptr;
131 }
132 }
133
117 std::unique_ptr<RTCCodecStats> CodecStatsFromRtpCodecParameters( 134 std::unique_ptr<RTCCodecStats> CodecStatsFromRtpCodecParameters(
118 uint64_t timestamp_us, bool inbound, bool audio, 135 uint64_t timestamp_us, bool inbound, bool audio,
119 const RtpCodecParameters& codec_params) { 136 const RtpCodecParameters& codec_params) {
120 RTC_DCHECK_GE(codec_params.payload_type, 0); 137 RTC_DCHECK_GE(codec_params.payload_type, 0);
121 RTC_DCHECK_LE(codec_params.payload_type, 127); 138 RTC_DCHECK_LE(codec_params.payload_type, 127);
122 uint32_t payload_type = static_cast<uint32_t>(codec_params.payload_type); 139 uint32_t payload_type = static_cast<uint32_t>(codec_params.payload_type);
123 std::unique_ptr<RTCCodecStats> codec_stats(new RTCCodecStats( 140 std::unique_ptr<RTCCodecStats> codec_stats(new RTCCodecStats(
124 RTCCodecStatsIDFromDirectionMediaAndPayload(inbound, audio, payload_type), 141 RTCCodecStatsIDFromDirectionMediaAndPayload(inbound, audio, payload_type),
125 timestamp_us)); 142 timestamp_us));
126 codec_stats->payload_type = payload_type; 143 codec_stats->payload_type = payload_type;
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 675
659 candidate_pair_stats->transport_id = transport_id; 676 candidate_pair_stats->transport_id = transport_id;
660 // TODO(hbos): There could be other candidates that are not paired with 677 // TODO(hbos): There could be other candidates that are not paired with
661 // anything. We don't have a complete list. Local candidates come from 678 // anything. We don't have a complete list. Local candidates come from
662 // Port objects, and prflx candidates (both local and remote) are only 679 // Port objects, and prflx candidates (both local and remote) are only
663 // stored in candidate pairs. crbug.com/632723 680 // stored in candidate pairs. crbug.com/632723
664 candidate_pair_stats->local_candidate_id = ProduceIceCandidateStats( 681 candidate_pair_stats->local_candidate_id = ProduceIceCandidateStats(
665 timestamp_us, info.local_candidate, true, report); 682 timestamp_us, info.local_candidate, true, report);
666 candidate_pair_stats->remote_candidate_id = ProduceIceCandidateStats( 683 candidate_pair_stats->remote_candidate_id = ProduceIceCandidateStats(
667 timestamp_us, info.remote_candidate, false, report); 684 timestamp_us, info.remote_candidate, false, report);
685 candidate_pair_stats->state =
686 IceCandidatePairStateToRTCStatsIceCandidatePairState(info.state);
687 candidate_pair_stats->priority = info.priority;
668 // TODO(hbos): This writable is different than the spec. It goes to 688 // TODO(hbos): This writable is different than the spec. It goes to
669 // false after a certain amount of time without a response passes. 689 // false after a certain amount of time without a response passes.
670 // crbug.com/633550 690 // crbug.com/633550
671 candidate_pair_stats->writable = info.writable; 691 candidate_pair_stats->writable = info.writable;
672 candidate_pair_stats->bytes_sent = 692 candidate_pair_stats->bytes_sent =
673 static_cast<uint64_t>(info.sent_total_bytes); 693 static_cast<uint64_t>(info.sent_total_bytes);
674 candidate_pair_stats->bytes_received = 694 candidate_pair_stats->bytes_received =
675 static_cast<uint64_t>(info.recv_total_bytes); 695 static_cast<uint64_t>(info.recv_total_bytes);
676 // TODO(hbos): The |info.rtt| measurement is smoothed. It shouldn't be 696 // TODO(hbos): The |info.rtt| measurement is smoothed. It shouldn't be
677 // smoothed according to the spec. crbug.com/633550. See 697 // smoothed according to the spec. crbug.com/633550. See
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 const std::string& type) { 985 const std::string& type) {
966 return CandidateTypeToRTCIceCandidateType(type); 986 return CandidateTypeToRTCIceCandidateType(type);
967 } 987 }
968 988
969 const char* DataStateToRTCDataChannelStateForTesting( 989 const char* DataStateToRTCDataChannelStateForTesting(
970 DataChannelInterface::DataState state) { 990 DataChannelInterface::DataState state) {
971 return DataStateToRTCDataChannelState(state); 991 return DataStateToRTCDataChannelState(state);
972 } 992 }
973 993
974 } // namespace webrtc 994 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698