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

Unified Diff: webrtc/pc/rtcstatscollector.cc

Issue 2675923002: RTCIceCandidatePairStats.available[Outgoing/Incoming]Bitrate collected. (Closed)
Patch Set: 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
Index: webrtc/pc/rtcstatscollector.cc
diff --git a/webrtc/pc/rtcstatscollector.cc b/webrtc/pc/rtcstatscollector.cc
index 6344d87c105d8a7dd3c0334315c00be85d09acb0..bc69f701e27e18f9cd9fea7b1d2813acdf5d0227 100644
--- a/webrtc/pc/rtcstatscollector.cc
+++ b/webrtc/pc/rtcstatscollector.cc
@@ -687,7 +687,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(
@@ -817,6 +818,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) {
@@ -855,6 +857,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 &&
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
+ !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>(

Powered by Google App Engine
This is Rietveld 408576698