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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 outbound_video->nack_count = | 226 outbound_video->nack_count = |
227 static_cast<uint32_t>(video_sender_info.nacks_rcvd); | 227 static_cast<uint32_t>(video_sender_info.nacks_rcvd); |
228 } | 228 } |
229 | 229 |
230 void ProduceCertificateStatsFromSSLCertificateStats( | 230 void ProduceCertificateStatsFromSSLCertificateStats( |
231 int64_t timestamp_us, const rtc::SSLCertificateStats& certificate_stats, | 231 int64_t timestamp_us, const rtc::SSLCertificateStats& certificate_stats, |
232 RTCStatsReport* report) { | 232 RTCStatsReport* report) { |
233 RTCCertificateStats* prev_certificate_stats = nullptr; | 233 RTCCertificateStats* prev_certificate_stats = nullptr; |
234 for (const rtc::SSLCertificateStats* s = &certificate_stats; s; | 234 for (const rtc::SSLCertificateStats* s = &certificate_stats; s; |
235 s = s->issuer.get()) { | 235 s = s->issuer.get()) { |
| 236 std::string certificate_stats_id = |
| 237 RTCCertificateIDFromFingerprint(s->fingerprint); |
| 238 // It is possible for the same certificate to show up multiple times, e.g. |
| 239 // if local and remote side use the same certificate in a loopback call. |
| 240 // If the report already contains stats for this certificate, skip it. |
| 241 if (report->Get(certificate_stats_id)) { |
| 242 RTC_DCHECK_EQ(s, &certificate_stats); |
| 243 break; |
| 244 } |
236 RTCCertificateStats* certificate_stats = new RTCCertificateStats( | 245 RTCCertificateStats* certificate_stats = new RTCCertificateStats( |
237 RTCCertificateIDFromFingerprint(s->fingerprint), timestamp_us); | 246 certificate_stats_id, timestamp_us); |
238 certificate_stats->fingerprint = s->fingerprint; | 247 certificate_stats->fingerprint = s->fingerprint; |
239 certificate_stats->fingerprint_algorithm = s->fingerprint_algorithm; | 248 certificate_stats->fingerprint_algorithm = s->fingerprint_algorithm; |
240 certificate_stats->base64_certificate = s->base64_certificate; | 249 certificate_stats->base64_certificate = s->base64_certificate; |
241 if (prev_certificate_stats) | 250 if (prev_certificate_stats) |
242 prev_certificate_stats->issuer_certificate_id = certificate_stats->id(); | 251 prev_certificate_stats->issuer_certificate_id = certificate_stats->id(); |
243 report->AddStats(std::unique_ptr<RTCCertificateStats>(certificate_stats)); | 252 report->AddStats(std::unique_ptr<RTCCertificateStats>(certificate_stats)); |
244 prev_certificate_stats = certificate_stats; | 253 prev_certificate_stats = certificate_stats; |
245 } | 254 } |
246 } | 255 } |
247 | 256 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 // crbug.com/659137 | 290 // crbug.com/659137 |
282 // TODO(hbos): Return stats of detached tracks. We have to perform stats | 291 // TODO(hbos): Return stats of detached tracks. We have to perform stats |
283 // gathering at the time of detachment to get accurate stats and timestamps. | 292 // gathering at the time of detachment to get accurate stats and timestamps. |
284 // crbug.com/659137 | 293 // crbug.com/659137 |
285 if (!streams) | 294 if (!streams) |
286 return; | 295 return; |
287 for (size_t i = 0; i < streams->count(); ++i) { | 296 for (size_t i = 0; i < streams->count(); ++i) { |
288 MediaStreamInterface* stream = streams->at(i); | 297 MediaStreamInterface* stream = streams->at(i); |
289 | 298 |
290 std::unique_ptr<RTCMediaStreamStats> stream_stats( | 299 std::unique_ptr<RTCMediaStreamStats> stream_stats( |
291 new RTCMediaStreamStats("RTCMediaStream_" + stream->label(), | 300 new RTCMediaStreamStats( |
292 timestamp_us)); | 301 (is_local ? "RTCMediaStream_local_" : "RTCMediaStream_remote_") + |
| 302 stream->label(), timestamp_us)); |
293 stream_stats->stream_identifier = stream->label(); | 303 stream_stats->stream_identifier = stream->label(); |
294 stream_stats->track_ids = std::vector<std::string>(); | 304 stream_stats->track_ids = std::vector<std::string>(); |
295 // Audio Tracks | 305 // Audio Tracks |
296 for (const rtc::scoped_refptr<AudioTrackInterface>& audio_track : | 306 for (const rtc::scoped_refptr<AudioTrackInterface>& audio_track : |
297 stream->GetAudioTracks()) { | 307 stream->GetAudioTracks()) { |
298 std::string id = RTCMediaStreamTrackStatsIDFromMediaStreamTrackInterface( | 308 std::string id = RTCMediaStreamTrackStatsIDFromMediaStreamTrackInterface( |
299 *audio_track.get()); | 309 *audio_track.get()); |
300 if (report->Get(id)) { | 310 if (report->Get(id)) { |
301 // Skip track, stats already exist for it. | 311 // Skip track, stats already exist for it. |
302 continue; | 312 continue; |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 const std::string& type) { | 965 const std::string& type) { |
956 return CandidateTypeToRTCIceCandidateType(type); | 966 return CandidateTypeToRTCIceCandidateType(type); |
957 } | 967 } |
958 | 968 |
959 const char* DataStateToRTCDataChannelStateForTesting( | 969 const char* DataStateToRTCDataChannelStateForTesting( |
960 DataChannelInterface::DataState state) { | 970 DataChannelInterface::DataState state) { |
961 return DataStateToRTCDataChannelState(state); | 971 return DataStateToRTCDataChannelState(state); |
962 } | 972 } |
963 | 973 |
964 } // namespace webrtc | 974 } // namespace webrtc |
OLD | NEW |