Index: webrtc/pc/statscollector.cc |
diff --git a/webrtc/pc/statscollector.cc b/webrtc/pc/statscollector.cc |
index e91f873824a245ee7284f5a6e154908be627e258..c0b18de6a1f7904ee108a18108547497b43dfd11 100644 |
--- a/webrtc/pc/statscollector.cc |
+++ b/webrtc/pc/statscollector.cc |
@@ -287,7 +287,6 @@ void ExtractStats(const cricket::VideoSenderInfo& info, StatsReport* report) { |
void ExtractStats(const cricket::BandwidthEstimationInfo& info, |
double stats_gathering_started, |
- PeerConnectionInterface::StatsOutputLevel level, |
StatsReport* report) { |
RTC_DCHECK(report->type() == StatsReport::kStatsReportTypeBwe); |
@@ -506,6 +505,7 @@ StatsCollector::UpdateStats(PeerConnectionInterface::StatsOutputLevel level) { |
// since we'd be creating/updating the stats report objects consistently on |
// the same thread (this class has no locks right now). |
ExtractSessionInfo(); |
+ ExtractBweInfo(); |
ExtractVoiceInfo(); |
ExtractVideoInfo(level); |
ExtractSenderInfo(); |
@@ -767,6 +767,28 @@ void StatsCollector::ExtractSessionInfo() { |
} |
} |
+void StatsCollector::ExtractBweInfo() { |
+ RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent()); |
+ |
+ if (pc_->session()->state() == WebRtcSession::State::STATE_CLOSED) |
+ return; |
+ |
+ webrtc::Call::Stats call_stats = pc_->session()->GetCallStats(); |
+ cricket::BandwidthEstimationInfo bwe_info; |
+ bwe_info.available_send_bandwidth = call_stats.send_bandwidth_bps; |
+ bwe_info.available_recv_bandwidth = call_stats.recv_bandwidth_bps; |
+ bwe_info.bucket_delay = call_stats.pacer_delay_ms; |
+ // Fill in target encoder bitrate, actual encoder bitrate, rtx bitrate, etc. |
+ // TODO(holmer): Also fill this in for audio. |
+ if (!pc_->session()->video_channel()) { |
+ return; |
+ } |
+ pc_->session()->video_channel()->FillBitrateInfo(&bwe_info); |
+ StatsReport::Id report_id(StatsReport::NewBandwidthEstimationId()); |
+ StatsReport* report = reports_.FindOrAddNew(report_id); |
+ ExtractStats(bwe_info, stats_gathering_started_, report); |
+} |
+ |
void StatsCollector::ExtractVoiceInfo() { |
RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent()); |
@@ -827,14 +849,6 @@ void StatsCollector::ExtractVideoInfo( |
StatsReport::kReceive); |
ExtractStatsFromList(video_info.senders, transport_id, this, |
StatsReport::kSend); |
- if (video_info.bw_estimations.size() != 1) { |
- LOG(LS_ERROR) << "BWEs count: " << video_info.bw_estimations.size(); |
- } else { |
- StatsReport::Id report_id(StatsReport::NewBandwidthEstimationId()); |
- StatsReport* report = reports_.FindOrAddNew(report_id); |
- ExtractStats( |
- video_info.bw_estimations[0], stats_gathering_started_, level, report); |
- } |
} |
void StatsCollector::ExtractSenderInfo() { |