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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/pc/rtcstatscollector.h ('k') | webrtc/pc/rtcstatscollector_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/rtcstatscollector.cc
diff --git a/webrtc/pc/rtcstatscollector.cc b/webrtc/pc/rtcstatscollector.cc
index 38b729a047cb7262fabd86382e864adee3fd6373..41ab9b31589770905984dd4ce54676a2831389c8 100644
--- a/webrtc/pc/rtcstatscollector.cc
+++ b/webrtc/pc/rtcstatscollector.cc
@@ -707,7 +707,8 @@ void RTCStatsCollector::ProducePartialResultsOnNetworkThread(
ProduceCodecStats_n(
timestamp_us, *track_media_info_map_, report.get());
ProduceIceCandidateAndPairStats_n(
- timestamp_us, *session_stats, report.get());
+ 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(
@@ -837,6 +838,7 @@ void RTCStatsCollector::ProduceDataChannelStats_s(
void RTCStatsCollector::ProduceIceCandidateAndPairStats_n(
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) {
@@ -875,6 +877,26 @@ void RTCStatsCollector::ProduceIceCandidateAndPairStats_n(
// https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-currentrtt
candidate_pair_stats->current_round_trip_time =
static_cast<double>(info.rtt) / rtc::kNumMillisecsPerSec;
+ 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_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>(video_media_info->bw_estimations[0]
+ .available_send_bandwidth);
+ }
+ if (video_media_info->bw_estimations[0].available_recv_bandwidth) {
+ candidate_pair_stats->available_incoming_bitrate =
+ static_cast<double>(video_media_info->bw_estimations[0]
+ .available_recv_bandwidth);
+ }
+ }
candidate_pair_stats->requests_received =
static_cast<uint64_t>(info.recv_ping_requests);
candidate_pair_stats->requests_sent = static_cast<uint64_t>(
« 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