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

Side by Side Diff: webrtc/video/receive_statistics_proxy.cc

Issue 1905563002: Add histogram for end-to-end delay. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 7 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/receive_statistics_proxy.h ('k') | webrtc/video/video_receive_stream.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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 if (target_delay_ms != -1) { 86 if (target_delay_ms != -1) {
87 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.TargetDelayInMs", 87 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.TargetDelayInMs",
88 target_delay_ms); 88 target_delay_ms);
89 } 89 }
90 int current_delay_ms = current_delay_counter_.Avg(kMinRequiredDecodeSamples); 90 int current_delay_ms = current_delay_counter_.Avg(kMinRequiredDecodeSamples);
91 if (current_delay_ms != -1) { 91 if (current_delay_ms != -1) {
92 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.CurrentDelayInMs", 92 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.CurrentDelayInMs",
93 current_delay_ms); 93 current_delay_ms);
94 } 94 }
95 95
96 int delay_ms = delay_counter_.Avg(kMinRequiredDecodeSamples); 96 int delay_ms = e2e_delay_counter_.Avg(kMinRequiredSamples);
97 if (delay_ms != -1) 97 if (delay_ms != -1)
98 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", delay_ms); 98 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", delay_ms);
99 99
100 StreamDataCounters rtp = stats_.rtp_stats; 100 StreamDataCounters rtp = stats_.rtp_stats;
101 StreamDataCounters rtx; 101 StreamDataCounters rtx;
102 for (auto it : rtx_stats_) 102 for (auto it : rtx_stats_)
103 rtx.Add(it.second); 103 rtx.Add(it.second);
104 StreamDataCounters rtp_rtx = rtp; 104 StreamDataCounters rtp_rtx = rtp;
105 rtp_rtx.Add(rtx); 105 rtp_rtx.Add(rtx);
106 int64_t elapsed_sec = 106 int64_t elapsed_sec =
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 stats_.decode_ms = decode_ms; 181 stats_.decode_ms = decode_ms;
182 stats_.max_decode_ms = max_decode_ms; 182 stats_.max_decode_ms = max_decode_ms;
183 stats_.current_delay_ms = current_delay_ms; 183 stats_.current_delay_ms = current_delay_ms;
184 stats_.target_delay_ms = target_delay_ms; 184 stats_.target_delay_ms = target_delay_ms;
185 stats_.jitter_buffer_ms = jitter_buffer_ms; 185 stats_.jitter_buffer_ms = jitter_buffer_ms;
186 stats_.min_playout_delay_ms = min_playout_delay_ms; 186 stats_.min_playout_delay_ms = min_playout_delay_ms;
187 stats_.render_delay_ms = render_delay_ms; 187 stats_.render_delay_ms = render_delay_ms;
188 decode_time_counter_.Add(decode_ms); 188 decode_time_counter_.Add(decode_ms);
189 jitter_buffer_delay_counter_.Add(jitter_buffer_ms); 189 jitter_buffer_delay_counter_.Add(jitter_buffer_ms);
190 target_delay_counter_.Add(target_delay_ms); 190 target_delay_counter_.Add(target_delay_ms);
191 current_delay_counter_.Add(current_delay_ms); 191 current_delay_counter_.Add(current_delay_ms);
åsapersson 2016/04/28 07:42:18 Should we let target delay replace this metric and
mflodman 2016/05/06 08:23:42 I'd prefer to have a new stat tracking this in par
åsapersson 2016/09/22 12:23:08 Added end-to-end delay as a separate metric.
192 // Network delay (rtt/2) + target_delay_ms (jitter delay + decode time +
193 // render delay).
194 delay_counter_.Add(target_delay_ms + rtt_ms / 2);
195 } 192 }
196 193
197 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated( 194 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated(
198 uint32_t ssrc, 195 uint32_t ssrc,
199 const RtcpPacketTypeCounter& packet_counter) { 196 const RtcpPacketTypeCounter& packet_counter) {
200 rtc::CritScope lock(&crit_); 197 rtc::CritScope lock(&crit_);
201 if (stats_.ssrc != ssrc) 198 if (stats_.ssrc != ssrc)
202 return; 199 return;
203 stats_.rtcp_packet_type_counts = packet_counter; 200 stats_.rtcp_packet_type_counts = packet_counter;
204 } 201 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 238 }
242 239
243 void ReceiveStatisticsProxy::OnDecodedFrame() { 240 void ReceiveStatisticsProxy::OnDecodedFrame() {
244 uint64_t now = clock_->TimeInMilliseconds(); 241 uint64_t now = clock_->TimeInMilliseconds();
245 242
246 rtc::CritScope lock(&crit_); 243 rtc::CritScope lock(&crit_);
247 decode_fps_estimator_.Update(1, now); 244 decode_fps_estimator_.Update(1, now);
248 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now); 245 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now);
249 } 246 }
250 247
251 void ReceiveStatisticsProxy::OnRenderedFrame(int width, int height) { 248 void ReceiveStatisticsProxy::OnRenderedFrame(const VideoFrame& frame) {
249 int width = frame.width();
250 int height = frame.height();
252 RTC_DCHECK_GT(width, 0); 251 RTC_DCHECK_GT(width, 0);
253 RTC_DCHECK_GT(height, 0); 252 RTC_DCHECK_GT(height, 0);
254 uint64_t now = clock_->TimeInMilliseconds(); 253 uint64_t now = clock_->TimeInMilliseconds();
255 254
256 rtc::CritScope lock(&crit_); 255 rtc::CritScope lock(&crit_);
257 renders_fps_estimator_.Update(1, now); 256 renders_fps_estimator_.Update(1, now);
258 stats_.render_frame_rate = renders_fps_estimator_.Rate(now); 257 stats_.render_frame_rate = renders_fps_estimator_.Rate(now);
259 render_width_counter_.Add(width); 258 render_width_counter_.Add(width);
260 render_height_counter_.Add(height); 259 render_height_counter_.Add(height);
261 render_fps_tracker_.AddSamples(1); 260 render_fps_tracker_.AddSamples(1);
262 render_pixel_tracker_.AddSamples(sqrt(width * height)); 261 render_pixel_tracker_.AddSamples(sqrt(width * height));
262
263 if (frame.ntp_time_ms() > 0) {
264 int64_t delay_ms = clock_->CurrentNtpInMilliseconds() - frame.ntp_time_ms();
265 if (delay_ms >= 0)
266 e2e_delay_counter_.Add(delay_ms);
267 }
263 } 268 }
264 269
265 void ReceiveStatisticsProxy::OnSyncOffsetUpdated(int64_t sync_offset_ms) { 270 void ReceiveStatisticsProxy::OnSyncOffsetUpdated(int64_t sync_offset_ms) {
266 rtc::CritScope lock(&crit_); 271 rtc::CritScope lock(&crit_);
267 sync_offset_counter_.Add(std::abs(sync_offset_ms)); 272 sync_offset_counter_.Add(std::abs(sync_offset_ms));
268 stats_.sync_offset_ms = sync_offset_ms; 273 stats_.sync_offset_ms = sync_offset_ms;
269 } 274 }
270 275
271 void ReceiveStatisticsProxy::OnReceiveRatesUpdated(uint32_t bitRate, 276 void ReceiveStatisticsProxy::OnReceiveRatesUpdated(uint32_t bitRate,
272 uint32_t frameRate) { 277 uint32_t frameRate) {
(...skipping 26 matching lines...) Expand all
299 ++num_samples; 304 ++num_samples;
300 } 305 }
301 306
302 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { 307 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const {
303 if (num_samples < min_required_samples || num_samples == 0) 308 if (num_samples < min_required_samples || num_samples == 0)
304 return -1; 309 return -1;
305 return sum / num_samples; 310 return sum / num_samples;
306 } 311 }
307 312
308 } // namespace webrtc 313 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/receive_statistics_proxy.h ('k') | webrtc/video/video_receive_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698