Index: webrtc/pc/rtcstatscollector.cc |
diff --git a/webrtc/pc/rtcstatscollector.cc b/webrtc/pc/rtcstatscollector.cc |
index ca995327d5f21d19623e36c290c5a2941f1df431..d9da0729eda2275986ded8535f334a5816c82d4b 100644 |
--- a/webrtc/pc/rtcstatscollector.cc |
+++ b/webrtc/pc/rtcstatscollector.cc |
@@ -652,16 +652,9 @@ |
// implemented to invoke on the signaling thread. |
track_to_id_ = PrepareTrackToID_s(); |
- // Prepare |call_stats_| here since GetCallStats() will hop to the worker |
- // thread. |
- // TODO(holmer): To avoid the hop we could move BWE and BWE stats to the |
- // network thread, where it more naturally belongs. |
- call_stats_ = pc_->session()->GetCallStats(); |
- |
- invoker_.AsyncInvoke<void>( |
- RTC_FROM_HERE, network_thread_, |
+ invoker_.AsyncInvoke<void>(RTC_FROM_HERE, network_thread_, |
rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnNetworkThread, |
- rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us)); |
+ rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us)); |
ProducePartialResultsOnSignalingThread(timestamp_us); |
} |
} |
@@ -711,9 +704,9 @@ |
timestamp_us, transport_cert_stats, report.get()); |
ProduceCodecStats_n( |
timestamp_us, *track_media_info_map_, report.get()); |
- ProduceIceCandidateAndPairStats_n(timestamp_us, *session_stats, |
- track_media_info_map_->video_media_info(), |
- call_stats_, report.get()); |
+ ProduceIceCandidateAndPairStats_n( |
+ timestamp_us, *session_stats, track_media_info_map_->video_media_info(), |
+ report.get()); |
ProduceRTPStreamStats_n( |
timestamp_us, *session_stats, *track_media_info_map_, report.get()); |
ProduceTransportStats_n( |
@@ -842,11 +835,9 @@ |
} |
void RTCStatsCollector::ProduceIceCandidateAndPairStats_n( |
- int64_t timestamp_us, |
- const SessionStats& session_stats, |
- const cricket::VideoMediaInfo* video_media_info, |
- const Call::Stats& call_stats, |
- RTCStatsReport* report) const { |
+ int64_t timestamp_us, const SessionStats& session_stats, |
+ const cricket::VideoMediaInfo* video_media_info, |
+ RTCStatsReport* report) const { |
RTC_DCHECK(network_thread_->IsCurrent()); |
for (const auto& transport_stats : session_stats.transport_stats) { |
for (const auto& channel_stats : transport_stats.second.channel_stats) { |
@@ -888,18 +879,24 @@ |
static_cast<double>(*info.current_round_trip_time_ms) / |
rtc::kNumMillisecsPerSec; |
} |
- if (info.best_connection) { |
+ if (info.best_connection && video_media_info && |
+ !video_media_info->bw_estimations.empty()) { |
// The bandwidth estimations we have are for the selected candidate |
// pair ("info.best_connection"). |
- RTC_DCHECK_GE(call_stats.send_bandwidth_bps, 0); |
- RTC_DCHECK_GE(call_stats.recv_bandwidth_bps, 0); |
- if (call_stats.send_bandwidth_bps > 0) { |
+ RTC_DCHECK_EQ(video_media_info->bw_estimations.size(), 1); |
+ RTC_DCHECK_GE( |
+ video_media_info->bw_estimations[0].available_send_bandwidth, 0); |
+ RTC_DCHECK_GE( |
+ video_media_info->bw_estimations[0].available_recv_bandwidth, 0); |
+ if (video_media_info->bw_estimations[0].available_send_bandwidth) { |
candidate_pair_stats->available_outgoing_bitrate = |
- static_cast<double>(call_stats.send_bandwidth_bps); |
+ static_cast<double>(video_media_info->bw_estimations[0] |
+ .available_send_bandwidth); |
} |
- if (call_stats.recv_bandwidth_bps > 0) { |
+ if (video_media_info->bw_estimations[0].available_recv_bandwidth) { |
candidate_pair_stats->available_incoming_bitrate = |
- static_cast<double>(call_stats.recv_bandwidth_bps); |
+ static_cast<double>(video_media_info->bw_estimations[0] |
+ .available_recv_bandwidth); |
} |
} |
candidate_pair_stats->requests_received = |