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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 static const int kMaxTargetDelayMs = 10000; 43 static const int kMaxTargetDelayMs = 10000;
44 static const float kMaxIncompleteTimeMultiplier = 3.5f; 44 static const float kMaxIncompleteTimeMultiplier = 3.5f;
45 45
46 // Helper class receiving statistics callbacks. 46 // Helper class receiving statistics callbacks.
47 class ChannelStatsObserver : public CallStatsObserver { 47 class ChannelStatsObserver : public CallStatsObserver {
48 public: 48 public:
49 explicit ChannelStatsObserver(ViEChannel* owner) : owner_(owner) {} 49 explicit ChannelStatsObserver(ViEChannel* owner) : owner_(owner) {}
50 virtual ~ChannelStatsObserver() {} 50 virtual ~ChannelStatsObserver() {}
51 51
52 // Implements StatsObserver. 52 // Implements StatsObserver.
53 virtual void OnRttUpdate(int64_t rtt) { 53 virtual void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) {
54 owner_->OnRttUpdate(rtt); 54 owner_->OnRttUpdate(avg_rtt_ms, max_rtt_ms);
55 } 55 }
56 56
57 private: 57 private:
58 ViEChannel* const owner_; 58 ViEChannel* const owner_;
59 }; 59 };
60 60
61 class ViEChannelProtectionCallback : public VCMProtectionCallback { 61 class ViEChannelProtectionCallback : public VCMProtectionCallback {
62 public: 62 public:
63 ViEChannelProtectionCallback(ViEChannel* owner) : owner_(owner) {} 63 ViEChannelProtectionCallback(ViEChannel* owner) : owner_(owner) {}
64 ~ViEChannelProtectionCallback() {} 64 ~ViEChannelProtectionCallback() {}
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 intra_frame_observer_(intra_frame_observer), 112 intra_frame_observer_(intra_frame_observer),
113 rtt_stats_(rtt_stats), 113 rtt_stats_(rtt_stats),
114 paced_sender_(paced_sender), 114 paced_sender_(paced_sender),
115 packet_router_(packet_router), 115 packet_router_(packet_router),
116 bandwidth_observer_(bandwidth_observer), 116 bandwidth_observer_(bandwidth_observer),
117 decoder_reset_(true), 117 decoder_reset_(true),
118 nack_history_size_sender_(kSendSidePacketHistorySize), 118 nack_history_size_sender_(kSendSidePacketHistorySize),
119 max_nack_reordering_threshold_(kMaxPacketAgeToNack), 119 max_nack_reordering_threshold_(kMaxPacketAgeToNack),
120 pre_render_callback_(NULL), 120 pre_render_callback_(NULL),
121 report_block_stats_sender_(new ReportBlockStats()), 121 report_block_stats_sender_(new ReportBlockStats()),
122 time_of_first_rtt_ms_(-1),
123 rtt_sum_ms_(0),
124 num_rtts_(0),
122 rtp_rtcp_modules_( 125 rtp_rtcp_modules_(
123 CreateRtpRtcpModules(ViEModuleId(engine_id_, channel_id_), 126 CreateRtpRtcpModules(ViEModuleId(engine_id_, channel_id_),
124 !sender, 127 !sender,
125 vie_receiver_.GetReceiveStatistics(), 128 vie_receiver_.GetReceiveStatistics(),
126 transport, 129 transport,
127 sender ? intra_frame_observer_ : nullptr, 130 sender ? intra_frame_observer_ : nullptr,
128 sender ? bandwidth_observer_.get() : nullptr, 131 sender ? bandwidth_observer_.get() : nullptr,
129 rtt_stats_, 132 rtt_stats_,
130 &rtcp_packet_type_counter_observer_, 133 &rtcp_packet_type_counter_observer_,
131 remote_bitrate_estimator, 134 remote_bitrate_estimator,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 if (decode_thread_) { 192 if (decode_thread_) {
190 StopDecodeThread(); 193 StopDecodeThread();
191 } 194 }
192 // Release modules. 195 // Release modules.
193 VideoCodingModule::Destroy(vcm_); 196 VideoCodingModule::Destroy(vcm_);
194 } 197 }
195 198
196 void ViEChannel::UpdateHistograms() { 199 void ViEChannel::UpdateHistograms() {
197 int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds(); 200 int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds();
198 201
202 {
203 CriticalSectionScoped cs(crit_.get());
204 int64_t elapsed_sec = (now - time_of_first_rtt_ms_) / 1000;
205 if (time_of_first_rtt_ms_ != -1 && num_rtts_ > 0 &&
206 elapsed_sec > metrics::kMinRunTimeInSeconds) {
207 int64_t avg_rtt_ms = (rtt_sum_ms_ + num_rtts_ / 2) / num_rtts_;
208 RTC_HISTOGRAM_COUNTS_10000(
209 "WebRTC.Video.AverageRoundTripTimeInMilliseconds", avg_rtt_ms);
210 }
211 }
212
199 if (sender_) { 213 if (sender_) {
200 RtcpPacketTypeCounter rtcp_counter; 214 RtcpPacketTypeCounter rtcp_counter;
201 GetSendRtcpPacketTypeCounter(&rtcp_counter); 215 GetSendRtcpPacketTypeCounter(&rtcp_counter);
202 int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000; 216 int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000;
203 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { 217 if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
204 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsReceivedPerMinute", 218 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsReceivedPerMinute",
205 rtcp_counter.nack_packets * 60 / elapsed_sec); 219 rtcp_counter.nack_packets * 60 / elapsed_sec);
206 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsReceivedPerMinute", 220 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsReceivedPerMinute",
207 rtcp_counter.fir_packets * 60 / elapsed_sec); 221 rtcp_counter.fir_packets * 60 / elapsed_sec);
208 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsReceivedPerMinute", 222 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsReceivedPerMinute",
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 1099
1086 bool ViEChannel::ChannelDecodeThreadFunction(void* obj) { 1100 bool ViEChannel::ChannelDecodeThreadFunction(void* obj) {
1087 return static_cast<ViEChannel*>(obj)->ChannelDecodeProcess(); 1101 return static_cast<ViEChannel*>(obj)->ChannelDecodeProcess();
1088 } 1102 }
1089 1103
1090 bool ViEChannel::ChannelDecodeProcess() { 1104 bool ViEChannel::ChannelDecodeProcess() {
1091 vcm_->Decode(kMaxDecodeWaitTimeMs); 1105 vcm_->Decode(kMaxDecodeWaitTimeMs);
1092 return true; 1106 return true;
1093 } 1107 }
1094 1108
1095 void ViEChannel::OnRttUpdate(int64_t rtt) { 1109 void ViEChannel::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) {
1096 vcm_->SetReceiveChannelParameters(rtt); 1110 vcm_->SetReceiveChannelParameters(max_rtt_ms);
1111
1112 CriticalSectionScoped cs(crit_.get());
1113 if (time_of_first_rtt_ms_ == -1)
1114 time_of_first_rtt_ms_ = Clock::GetRealTimeClock()->TimeInMilliseconds();
1115 rtt_sum_ms_ += avg_rtt_ms;
1116 ++num_rtts_;
1097 } 1117 }
1098 1118
1099 int ViEChannel::ProtectionRequest(const FecProtectionParams* delta_fec_params, 1119 int ViEChannel::ProtectionRequest(const FecProtectionParams* delta_fec_params,
1100 const FecProtectionParams* key_fec_params, 1120 const FecProtectionParams* key_fec_params,
1101 uint32_t* video_rate_bps, 1121 uint32_t* video_rate_bps,
1102 uint32_t* nack_rate_bps, 1122 uint32_t* nack_rate_bps,
1103 uint32_t* fec_rate_bps) { 1123 uint32_t* fec_rate_bps) {
1104 *video_rate_bps = 0; 1124 *video_rate_bps = 0;
1105 *nack_rate_bps = 0; 1125 *nack_rate_bps = 0;
1106 *fec_rate_bps = 0; 1126 *fec_rate_bps = 0;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 CriticalSectionScoped cs(crit_.get()); 1268 CriticalSectionScoped cs(crit_.get());
1249 vcm_receive_stats_callback_ = receive_statistics_proxy; 1269 vcm_receive_stats_callback_ = receive_statistics_proxy;
1250 } 1270 }
1251 1271
1252 void ViEChannel::SetIncomingVideoStream( 1272 void ViEChannel::SetIncomingVideoStream(
1253 IncomingVideoStream* incoming_video_stream) { 1273 IncomingVideoStream* incoming_video_stream) {
1254 CriticalSectionScoped cs(crit_.get()); 1274 CriticalSectionScoped cs(crit_.get());
1255 incoming_video_stream_ = incoming_video_stream; 1275 incoming_video_stream_ = incoming_video_stream;
1256 } 1276 }
1257 } // namespace webrtc 1277 } // namespace webrtc
OLDNEW
« 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