Chromium Code Reviews| 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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 680 pc_->session()->GetStats(*channel_name_pairs_); | 680 pc_->session()->GetStats(*channel_name_pairs_); |
| 681 if (session_stats) { | 681 if (session_stats) { |
| 682 std::map<std::string, CertificateStatsPair> transport_cert_stats = | 682 std::map<std::string, CertificateStatsPair> transport_cert_stats = |
| 683 PrepareTransportCertificateStats_n(*session_stats); | 683 PrepareTransportCertificateStats_n(*session_stats); |
| 684 | 684 |
| 685 ProduceCertificateStats_n( | 685 ProduceCertificateStats_n( |
| 686 timestamp_us, transport_cert_stats, report.get()); | 686 timestamp_us, transport_cert_stats, report.get()); |
| 687 ProduceCodecStats_n( | 687 ProduceCodecStats_n( |
| 688 timestamp_us, *track_media_info_map_, report.get()); | 688 timestamp_us, *track_media_info_map_, report.get()); |
| 689 ProduceIceCandidateAndPairStats_n( | 689 ProduceIceCandidateAndPairStats_n( |
| 690 timestamp_us, *session_stats, report.get()); | 690 timestamp_us, *session_stats, track_media_info_map_->video_media_info(), |
| 691 report.get()); | |
| 691 ProduceRTPStreamStats_n( | 692 ProduceRTPStreamStats_n( |
| 692 timestamp_us, *session_stats, *track_media_info_map_, report.get()); | 693 timestamp_us, *session_stats, *track_media_info_map_, report.get()); |
| 693 ProduceTransportStats_n( | 694 ProduceTransportStats_n( |
| 694 timestamp_us, *session_stats, transport_cert_stats, report.get()); | 695 timestamp_us, *session_stats, transport_cert_stats, report.get()); |
| 695 } | 696 } |
| 696 | 697 |
| 697 AddPartialResults(report); | 698 AddPartialResults(report); |
| 698 } | 699 } |
| 699 | 700 |
| 700 void RTCStatsCollector::AddPartialResults( | 701 void RTCStatsCollector::AddPartialResults( |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 810 data_channel_stats->messages_sent = data_channel->messages_sent(); | 811 data_channel_stats->messages_sent = data_channel->messages_sent(); |
| 811 data_channel_stats->bytes_sent = data_channel->bytes_sent(); | 812 data_channel_stats->bytes_sent = data_channel->bytes_sent(); |
| 812 data_channel_stats->messages_received = data_channel->messages_received(); | 813 data_channel_stats->messages_received = data_channel->messages_received(); |
| 813 data_channel_stats->bytes_received = data_channel->bytes_received(); | 814 data_channel_stats->bytes_received = data_channel->bytes_received(); |
| 814 report->AddStats(std::move(data_channel_stats)); | 815 report->AddStats(std::move(data_channel_stats)); |
| 815 } | 816 } |
| 816 } | 817 } |
| 817 | 818 |
| 818 void RTCStatsCollector::ProduceIceCandidateAndPairStats_n( | 819 void RTCStatsCollector::ProduceIceCandidateAndPairStats_n( |
| 819 int64_t timestamp_us, const SessionStats& session_stats, | 820 int64_t timestamp_us, const SessionStats& session_stats, |
| 821 const cricket::VideoMediaInfo* video_media_info, | |
| 820 RTCStatsReport* report) const { | 822 RTCStatsReport* report) const { |
| 821 RTC_DCHECK(network_thread_->IsCurrent()); | 823 RTC_DCHECK(network_thread_->IsCurrent()); |
| 822 for (const auto& transport_stats : session_stats.transport_stats) { | 824 for (const auto& transport_stats : session_stats.transport_stats) { |
| 823 for (const auto& channel_stats : transport_stats.second.channel_stats) { | 825 for (const auto& channel_stats : transport_stats.second.channel_stats) { |
| 824 std::string transport_id = RTCTransportStatsIDFromTransportChannel( | 826 std::string transport_id = RTCTransportStatsIDFromTransportChannel( |
| 825 transport_stats.second.transport_name, channel_stats.component); | 827 transport_stats.second.transport_name, channel_stats.component); |
| 826 for (const cricket::ConnectionInfo& info : | 828 for (const cricket::ConnectionInfo& info : |
| 827 channel_stats.connection_infos) { | 829 channel_stats.connection_infos) { |
| 828 std::unique_ptr<RTCIceCandidatePairStats> candidate_pair_stats( | 830 std::unique_ptr<RTCIceCandidatePairStats> candidate_pair_stats( |
| 829 new RTCIceCandidatePairStats( | 831 new RTCIceCandidatePairStats( |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 848 candidate_pair_stats->writable = info.writable; | 850 candidate_pair_stats->writable = info.writable; |
| 849 candidate_pair_stats->bytes_sent = | 851 candidate_pair_stats->bytes_sent = |
| 850 static_cast<uint64_t>(info.sent_total_bytes); | 852 static_cast<uint64_t>(info.sent_total_bytes); |
| 851 candidate_pair_stats->bytes_received = | 853 candidate_pair_stats->bytes_received = |
| 852 static_cast<uint64_t>(info.recv_total_bytes); | 854 static_cast<uint64_t>(info.recv_total_bytes); |
| 853 // TODO(hbos): The |info.rtt| measurement is smoothed. It shouldn't be | 855 // TODO(hbos): The |info.rtt| measurement is smoothed. It shouldn't be |
| 854 // smoothed according to the spec. crbug.com/633550. See | 856 // smoothed according to the spec. crbug.com/633550. See |
| 855 // https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-curr entrtt | 857 // https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-curr entrtt |
| 856 candidate_pair_stats->current_round_trip_time = | 858 candidate_pair_stats->current_round_trip_time = |
| 857 static_cast<double>(info.rtt) / rtc::kNumMillisecsPerSec; | 859 static_cast<double>(info.rtt) / rtc::kNumMillisecsPerSec; |
| 860 if (info.best_connection && video_media_info && | |
|
stefan-webrtc
2017/02/06 16:08:17
Is best_connection always the connection in used?
hbos
2017/02/06 16:12:37
To my understanding, yes. +deadbeef, do you know?
Taylor Brandstetter
2017/02/06 19:32:13
Yes, it is. It was even renamed from "best_connect
| |
| 861 !video_media_info->bw_estimations.empty()) { | |
| 862 // The bandwidth estimations we have are for the selected candidate | |
| 863 // pair ("info.best_connection"). | |
| 864 RTC_DCHECK_EQ(video_media_info->bw_estimations.size(), 1); | |
| 865 RTC_DCHECK_GE( | |
| 866 video_media_info->bw_estimations[0].available_send_bandwidth, 0); | |
| 867 RTC_DCHECK_GE( | |
| 868 video_media_info->bw_estimations[0].available_recv_bandwidth, 0); | |
| 869 if (video_media_info->bw_estimations[0].available_send_bandwidth) { | |
| 870 candidate_pair_stats->available_outgoing_bitrate = | |
| 871 static_cast<double>(video_media_info->bw_estimations[0] | |
| 872 .available_send_bandwidth); | |
| 873 } | |
| 874 if (video_media_info->bw_estimations[0].available_recv_bandwidth) { | |
| 875 candidate_pair_stats->available_incoming_bitrate = | |
| 876 static_cast<double>(video_media_info->bw_estimations[0] | |
| 877 .available_recv_bandwidth); | |
| 878 } | |
| 879 } | |
| 858 candidate_pair_stats->requests_received = | 880 candidate_pair_stats->requests_received = |
| 859 static_cast<uint64_t>(info.recv_ping_requests); | 881 static_cast<uint64_t>(info.recv_ping_requests); |
| 860 candidate_pair_stats->requests_sent = static_cast<uint64_t>( | 882 candidate_pair_stats->requests_sent = static_cast<uint64_t>( |
| 861 info.sent_ping_requests_before_first_response); | 883 info.sent_ping_requests_before_first_response); |
| 862 candidate_pair_stats->responses_received = | 884 candidate_pair_stats->responses_received = |
| 863 static_cast<uint64_t>(info.recv_ping_responses); | 885 static_cast<uint64_t>(info.recv_ping_responses); |
| 864 candidate_pair_stats->responses_sent = | 886 candidate_pair_stats->responses_sent = |
| 865 static_cast<uint64_t>(info.sent_ping_responses); | 887 static_cast<uint64_t>(info.sent_ping_responses); |
| 866 RTC_DCHECK_GE(info.sent_ping_requests_total, | 888 RTC_DCHECK_GE(info.sent_ping_requests_total, |
| 867 info.sent_ping_requests_before_first_response); | 889 info.sent_ping_requests_before_first_response); |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1222 const std::string& type) { | 1244 const std::string& type) { |
| 1223 return CandidateTypeToRTCIceCandidateType(type); | 1245 return CandidateTypeToRTCIceCandidateType(type); |
| 1224 } | 1246 } |
| 1225 | 1247 |
| 1226 const char* DataStateToRTCDataChannelStateForTesting( | 1248 const char* DataStateToRTCDataChannelStateForTesting( |
| 1227 DataChannelInterface::DataState state) { | 1249 DataChannelInterface::DataState state) { |
| 1228 return DataStateToRTCDataChannelState(state); | 1250 return DataStateToRTCDataChannelState(state); |
| 1229 } | 1251 } |
| 1230 | 1252 |
| 1231 } // namespace webrtc | 1253 } // namespace webrtc |
| OLD | NEW |