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

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

Issue 2675923002: RTCIceCandidatePairStats.available[Outgoing/Incoming]Bitrate collected. (Closed)
Patch Set: Rebase with master Created 3 years, 10 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/pc/rtcstatscollector.h ('k') | webrtc/pc/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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 pc_->session()->GetStats(*channel_name_pairs_); 700 pc_->session()->GetStats(*channel_name_pairs_);
701 if (session_stats) { 701 if (session_stats) {
702 std::map<std::string, CertificateStatsPair> transport_cert_stats = 702 std::map<std::string, CertificateStatsPair> transport_cert_stats =
703 PrepareTransportCertificateStats_n(*session_stats); 703 PrepareTransportCertificateStats_n(*session_stats);
704 704
705 ProduceCertificateStats_n( 705 ProduceCertificateStats_n(
706 timestamp_us, transport_cert_stats, report.get()); 706 timestamp_us, transport_cert_stats, report.get());
707 ProduceCodecStats_n( 707 ProduceCodecStats_n(
708 timestamp_us, *track_media_info_map_, report.get()); 708 timestamp_us, *track_media_info_map_, report.get());
709 ProduceIceCandidateAndPairStats_n( 709 ProduceIceCandidateAndPairStats_n(
710 timestamp_us, *session_stats, report.get()); 710 timestamp_us, *session_stats, track_media_info_map_->video_media_info(),
711 report.get());
711 ProduceRTPStreamStats_n( 712 ProduceRTPStreamStats_n(
712 timestamp_us, *session_stats, *track_media_info_map_, report.get()); 713 timestamp_us, *session_stats, *track_media_info_map_, report.get());
713 ProduceTransportStats_n( 714 ProduceTransportStats_n(
714 timestamp_us, *session_stats, transport_cert_stats, report.get()); 715 timestamp_us, *session_stats, transport_cert_stats, report.get());
715 } 716 }
716 717
717 AddPartialResults(report); 718 AddPartialResults(report);
718 } 719 }
719 720
720 void RTCStatsCollector::AddPartialResults( 721 void RTCStatsCollector::AddPartialResults(
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 data_channel_stats->messages_sent = data_channel->messages_sent(); 831 data_channel_stats->messages_sent = data_channel->messages_sent();
831 data_channel_stats->bytes_sent = data_channel->bytes_sent(); 832 data_channel_stats->bytes_sent = data_channel->bytes_sent();
832 data_channel_stats->messages_received = data_channel->messages_received(); 833 data_channel_stats->messages_received = data_channel->messages_received();
833 data_channel_stats->bytes_received = data_channel->bytes_received(); 834 data_channel_stats->bytes_received = data_channel->bytes_received();
834 report->AddStats(std::move(data_channel_stats)); 835 report->AddStats(std::move(data_channel_stats));
835 } 836 }
836 } 837 }
837 838
838 void RTCStatsCollector::ProduceIceCandidateAndPairStats_n( 839 void RTCStatsCollector::ProduceIceCandidateAndPairStats_n(
839 int64_t timestamp_us, const SessionStats& session_stats, 840 int64_t timestamp_us, const SessionStats& session_stats,
841 const cricket::VideoMediaInfo* video_media_info,
840 RTCStatsReport* report) const { 842 RTCStatsReport* report) const {
841 RTC_DCHECK(network_thread_->IsCurrent()); 843 RTC_DCHECK(network_thread_->IsCurrent());
842 for (const auto& transport_stats : session_stats.transport_stats) { 844 for (const auto& transport_stats : session_stats.transport_stats) {
843 for (const auto& channel_stats : transport_stats.second.channel_stats) { 845 for (const auto& channel_stats : transport_stats.second.channel_stats) {
844 std::string transport_id = RTCTransportStatsIDFromTransportChannel( 846 std::string transport_id = RTCTransportStatsIDFromTransportChannel(
845 transport_stats.second.transport_name, channel_stats.component); 847 transport_stats.second.transport_name, channel_stats.component);
846 for (const cricket::ConnectionInfo& info : 848 for (const cricket::ConnectionInfo& info :
847 channel_stats.connection_infos) { 849 channel_stats.connection_infos) {
848 std::unique_ptr<RTCIceCandidatePairStats> candidate_pair_stats( 850 std::unique_ptr<RTCIceCandidatePairStats> candidate_pair_stats(
849 new RTCIceCandidatePairStats( 851 new RTCIceCandidatePairStats(
(...skipping 18 matching lines...) Expand all
868 candidate_pair_stats->writable = info.writable; 870 candidate_pair_stats->writable = info.writable;
869 candidate_pair_stats->bytes_sent = 871 candidate_pair_stats->bytes_sent =
870 static_cast<uint64_t>(info.sent_total_bytes); 872 static_cast<uint64_t>(info.sent_total_bytes);
871 candidate_pair_stats->bytes_received = 873 candidate_pair_stats->bytes_received =
872 static_cast<uint64_t>(info.recv_total_bytes); 874 static_cast<uint64_t>(info.recv_total_bytes);
873 // TODO(hbos): The |info.rtt| measurement is smoothed. It shouldn't be 875 // TODO(hbos): The |info.rtt| measurement is smoothed. It shouldn't be
874 // smoothed according to the spec. crbug.com/633550. See 876 // smoothed according to the spec. crbug.com/633550. See
875 // https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-curr entrtt 877 // https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-curr entrtt
876 candidate_pair_stats->current_round_trip_time = 878 candidate_pair_stats->current_round_trip_time =
877 static_cast<double>(info.rtt) / rtc::kNumMillisecsPerSec; 879 static_cast<double>(info.rtt) / rtc::kNumMillisecsPerSec;
880 if (info.best_connection && video_media_info &&
881 !video_media_info->bw_estimations.empty()) {
882 // The bandwidth estimations we have are for the selected candidate
883 // pair ("info.best_connection").
884 RTC_DCHECK_EQ(video_media_info->bw_estimations.size(), 1);
885 RTC_DCHECK_GE(
886 video_media_info->bw_estimations[0].available_send_bandwidth, 0);
887 RTC_DCHECK_GE(
888 video_media_info->bw_estimations[0].available_recv_bandwidth, 0);
889 if (video_media_info->bw_estimations[0].available_send_bandwidth) {
890 candidate_pair_stats->available_outgoing_bitrate =
891 static_cast<double>(video_media_info->bw_estimations[0]
892 .available_send_bandwidth);
893 }
894 if (video_media_info->bw_estimations[0].available_recv_bandwidth) {
895 candidate_pair_stats->available_incoming_bitrate =
896 static_cast<double>(video_media_info->bw_estimations[0]
897 .available_recv_bandwidth);
898 }
899 }
878 candidate_pair_stats->requests_received = 900 candidate_pair_stats->requests_received =
879 static_cast<uint64_t>(info.recv_ping_requests); 901 static_cast<uint64_t>(info.recv_ping_requests);
880 candidate_pair_stats->requests_sent = static_cast<uint64_t>( 902 candidate_pair_stats->requests_sent = static_cast<uint64_t>(
881 info.sent_ping_requests_before_first_response); 903 info.sent_ping_requests_before_first_response);
882 candidate_pair_stats->responses_received = 904 candidate_pair_stats->responses_received =
883 static_cast<uint64_t>(info.recv_ping_responses); 905 static_cast<uint64_t>(info.recv_ping_responses);
884 candidate_pair_stats->responses_sent = 906 candidate_pair_stats->responses_sent =
885 static_cast<uint64_t>(info.sent_ping_responses); 907 static_cast<uint64_t>(info.sent_ping_responses);
886 RTC_DCHECK_GE(info.sent_ping_requests_total, 908 RTC_DCHECK_GE(info.sent_ping_requests_total,
887 info.sent_ping_requests_before_first_response); 909 info.sent_ping_requests_before_first_response);
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « webrtc/pc/rtcstatscollector.h ('k') | webrtc/pc/rtcstatscollector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698