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

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

Issue 2625993002: RTCTransportStats.dtlsState replaces .activeConnection (Closed)
Patch Set: Rebase with master Created 3 years, 11 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
« no previous file with comments | « webrtc/api/rtcstats_integrationtest.cc ('k') | webrtc/api/rtcstatscollector_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 case cricket::IceCandidatePairState::SUCCEEDED: 124 case cricket::IceCandidatePairState::SUCCEEDED:
125 return RTCStatsIceCandidatePairState::kSucceeded; 125 return RTCStatsIceCandidatePairState::kSucceeded;
126 case cricket::IceCandidatePairState::FAILED: 126 case cricket::IceCandidatePairState::FAILED:
127 return RTCStatsIceCandidatePairState::kFailed; 127 return RTCStatsIceCandidatePairState::kFailed;
128 default: 128 default:
129 RTC_NOTREACHED(); 129 RTC_NOTREACHED();
130 return nullptr; 130 return nullptr;
131 } 131 }
132 } 132 }
133 133
134 const char* DtlsTransportStateToRTCDtlsTransportState(
135 cricket::DtlsTransportState state) {
136 switch (state) {
137 case cricket::DTLS_TRANSPORT_NEW:
138 return RTCDtlsTransportState::kNew;
139 case cricket::DTLS_TRANSPORT_CONNECTING:
140 return RTCDtlsTransportState::kConnecting;
141 case cricket::DTLS_TRANSPORT_CONNECTED:
142 return RTCDtlsTransportState::kConnected;
143 case cricket::DTLS_TRANSPORT_CLOSED:
144 return RTCDtlsTransportState::kClosed;
145 case cricket::DTLS_TRANSPORT_FAILED:
146 return RTCDtlsTransportState::kFailed;
147 default:
148 RTC_NOTREACHED();
149 return nullptr;
150 }
151 }
152
134 std::unique_ptr<RTCCodecStats> CodecStatsFromRtpCodecParameters( 153 std::unique_ptr<RTCCodecStats> CodecStatsFromRtpCodecParameters(
135 uint64_t timestamp_us, bool inbound, bool audio, 154 uint64_t timestamp_us, bool inbound, bool audio,
136 const RtpCodecParameters& codec_params) { 155 const RtpCodecParameters& codec_params) {
137 RTC_DCHECK_GE(codec_params.payload_type, 0); 156 RTC_DCHECK_GE(codec_params.payload_type, 0);
138 RTC_DCHECK_LE(codec_params.payload_type, 127); 157 RTC_DCHECK_LE(codec_params.payload_type, 127);
139 uint32_t payload_type = static_cast<uint32_t>(codec_params.payload_type); 158 uint32_t payload_type = static_cast<uint32_t>(codec_params.payload_type);
140 std::unique_ptr<RTCCodecStats> codec_stats(new RTCCodecStats( 159 std::unique_ptr<RTCCodecStats> codec_stats(new RTCCodecStats(
141 RTCCodecStatsIDFromDirectionMediaAndPayload(inbound, audio, payload_type), 160 RTCCodecStatsIDFromDirectionMediaAndPayload(inbound, audio, payload_type),
142 timestamp_us)); 161 timestamp_us));
143 codec_stats->payload_type = payload_type; 162 codec_stats->payload_type = payload_type;
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 890
872 // There is one transport stats for each channel. 891 // There is one transport stats for each channel.
873 for (const auto& channel_stats : transport.second.channel_stats) { 892 for (const auto& channel_stats : transport.second.channel_stats) {
874 std::unique_ptr<RTCTransportStats> transport_stats( 893 std::unique_ptr<RTCTransportStats> transport_stats(
875 new RTCTransportStats( 894 new RTCTransportStats(
876 RTCTransportStatsIDFromTransportChannel( 895 RTCTransportStatsIDFromTransportChannel(
877 transport.second.transport_name, channel_stats.component), 896 transport.second.transport_name, channel_stats.component),
878 timestamp_us)); 897 timestamp_us));
879 transport_stats->bytes_sent = 0; 898 transport_stats->bytes_sent = 0;
880 transport_stats->bytes_received = 0; 899 transport_stats->bytes_received = 0;
881 transport_stats->active_connection = false; 900 transport_stats->dtls_state = DtlsTransportStateToRTCDtlsTransportState(
901 channel_stats.dtls_state);
882 for (const cricket::ConnectionInfo& info : 902 for (const cricket::ConnectionInfo& info :
883 channel_stats.connection_infos) { 903 channel_stats.connection_infos) {
884 *transport_stats->bytes_sent += info.sent_total_bytes; 904 *transport_stats->bytes_sent += info.sent_total_bytes;
885 *transport_stats->bytes_received += info.recv_total_bytes; 905 *transport_stats->bytes_received += info.recv_total_bytes;
886 if (info.best_connection) { 906 if (info.best_connection) {
887 transport_stats->active_connection = true;
888 transport_stats->selected_candidate_pair_id = 907 transport_stats->selected_candidate_pair_id =
889 RTCIceCandidatePairStatsIDFromConnectionInfo(info); 908 RTCIceCandidatePairStatsIDFromConnectionInfo(info);
890 } 909 }
891 } 910 }
892 if (channel_stats.component != cricket::ICE_CANDIDATE_COMPONENT_RTCP && 911 if (channel_stats.component != cricket::ICE_CANDIDATE_COMPONENT_RTCP &&
893 !rtcp_transport_stats_id.empty()) { 912 !rtcp_transport_stats_id.empty()) {
894 transport_stats->rtcp_transport_stats_id = rtcp_transport_stats_id; 913 transport_stats->rtcp_transport_stats_id = rtcp_transport_stats_id;
895 } 914 }
896 if (!local_certificate_id.empty()) 915 if (!local_certificate_id.empty())
897 transport_stats->local_certificate_id = local_certificate_id; 916 transport_stats->local_certificate_id = local_certificate_id;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 const std::string& type) { 996 const std::string& type) {
978 return CandidateTypeToRTCIceCandidateType(type); 997 return CandidateTypeToRTCIceCandidateType(type);
979 } 998 }
980 999
981 const char* DataStateToRTCDataChannelStateForTesting( 1000 const char* DataStateToRTCDataChannelStateForTesting(
982 DataChannelInterface::DataState state) { 1001 DataChannelInterface::DataState state) {
983 return DataStateToRTCDataChannelState(state); 1002 return DataStateToRTCDataChannelState(state);
984 } 1003 }
985 1004
986 } // namespace webrtc 1005 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/rtcstats_integrationtest.cc ('k') | webrtc/api/rtcstatscollector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698