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

Unified Diff: webrtc/video_engine/vie_channel.cc

Issue 1279543005: Add average rtt to CallStatsObserver and an average rtt histogram. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added guards Created 5 years, 4 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/video_engine/vie_channel.h ('k') | webrtc/video_engine/vie_channel_group.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video_engine/vie_channel.cc
diff --git a/webrtc/video_engine/vie_channel.cc b/webrtc/video_engine/vie_channel.cc
index 8f4d2c6d59a9f3737fba29cdfcf3384186605ffb..2f88a50e2ff23b1608073629dc5a145a53cf7dd0 100644
--- a/webrtc/video_engine/vie_channel.cc
+++ b/webrtc/video_engine/vie_channel.cc
@@ -50,8 +50,8 @@ class ChannelStatsObserver : public CallStatsObserver {
virtual ~ChannelStatsObserver() {}
// Implements StatsObserver.
- virtual void OnRttUpdate(int64_t rtt) {
- owner_->OnRttUpdate(rtt);
+ virtual void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) {
+ owner_->OnRttUpdate(avg_rtt_ms, max_rtt_ms);
}
private:
@@ -119,6 +119,9 @@ ViEChannel::ViEChannel(int32_t channel_id,
max_nack_reordering_threshold_(kMaxPacketAgeToNack),
pre_render_callback_(NULL),
report_block_stats_sender_(new ReportBlockStats()),
+ time_of_first_rtt_ms_(-1),
+ rtt_sum_ms_(0),
+ num_rtts_(0),
rtp_rtcp_modules_(
CreateRtpRtcpModules(ViEModuleId(engine_id_, channel_id_),
!sender,
@@ -196,6 +199,17 @@ ViEChannel::~ViEChannel() {
void ViEChannel::UpdateHistograms() {
int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds();
+ {
+ CriticalSectionScoped cs(crit_.get());
+ int64_t elapsed_sec = (now - time_of_first_rtt_ms_) / 1000;
+ if (time_of_first_rtt_ms_ != -1 && num_rtts_ > 0 &&
+ elapsed_sec > metrics::kMinRunTimeInSeconds) {
+ int64_t avg_rtt_ms = (rtt_sum_ms_ + num_rtts_ / 2) / num_rtts_;
+ RTC_HISTOGRAM_COUNTS_10000(
+ "WebRTC.Video.AverageRoundTripTimeInMilliseconds", avg_rtt_ms);
+ }
+ }
+
if (sender_) {
RtcpPacketTypeCounter rtcp_counter;
GetSendRtcpPacketTypeCounter(&rtcp_counter);
@@ -1092,8 +1106,14 @@ bool ViEChannel::ChannelDecodeProcess() {
return true;
}
-void ViEChannel::OnRttUpdate(int64_t rtt) {
- vcm_->SetReceiveChannelParameters(rtt);
+void ViEChannel::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) {
+ vcm_->SetReceiveChannelParameters(max_rtt_ms);
+
+ CriticalSectionScoped cs(crit_.get());
+ if (time_of_first_rtt_ms_ == -1)
+ time_of_first_rtt_ms_ = Clock::GetRealTimeClock()->TimeInMilliseconds();
+ rtt_sum_ms_ += avg_rtt_ms;
+ ++num_rtts_;
}
int ViEChannel::ProtectionRequest(const FecProtectionParams* delta_fec_params,
« no previous file with comments | « webrtc/video_engine/vie_channel.h ('k') | webrtc/video_engine/vie_channel_group.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698