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

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

Issue 2995143002: Report max interframe delay over window insdead of interframe delay sum (Closed)
Patch Set: Implement more Kwiberg@ comments Created 3 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
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 25 matching lines...) Expand all
36 // Low means low enough to be bad, high means high enough to be good 36 // Low means low enough to be bad, high means high enough to be good
37 const int kLowFpsThreshold = 12; 37 const int kLowFpsThreshold = 12;
38 const int kHighFpsThreshold = 14; 38 const int kHighFpsThreshold = 14;
39 // For qp and fps variance: 39 // For qp and fps variance:
40 // Low means low enough to be good, high means high enough to be bad 40 // Low means low enough to be good, high means high enough to be bad
41 const int kLowQpThresholdVp8 = 60; 41 const int kLowQpThresholdVp8 = 60;
42 const int kHighQpThresholdVp8 = 70; 42 const int kHighQpThresholdVp8 = 70;
43 const int kLowVarianceThreshold = 1; 43 const int kLowVarianceThreshold = 1;
44 const int kHighVarianceThreshold = 2; 44 const int kHighVarianceThreshold = 2;
45 45
46 // Some metrics are reported as a maximum over this period.
47 const int kMovingMaxWindowMs = 10000;
48
46 // How large window we use to calculate the framerate/bitrate. 49 // How large window we use to calculate the framerate/bitrate.
47 const int kRateStatisticsWindowSizeMs = 1000; 50 const int kRateStatisticsWindowSizeMs = 1000;
48 } // namespace 51 } // namespace
49 52
50 ReceiveStatisticsProxy::ReceiveStatisticsProxy( 53 ReceiveStatisticsProxy::ReceiveStatisticsProxy(
51 const VideoReceiveStream::Config* config, 54 const VideoReceiveStream::Config* config,
52 Clock* clock) 55 Clock* clock)
53 : clock_(clock), 56 : clock_(clock),
54 config_(*config), 57 config_(*config),
55 start_ms_(clock->TimeInMilliseconds()), 58 start_ms_(clock->TimeInMilliseconds()),
(...skipping 15 matching lines...) Expand all
71 // 1000ms window, scale 1000 for ms to s. 74 // 1000ms window, scale 1000 for ms to s.
72 decode_fps_estimator_(1000, 1000), 75 decode_fps_estimator_(1000, 1000),
73 renders_fps_estimator_(1000, 1000), 76 renders_fps_estimator_(1000, 1000),
74 render_fps_tracker_(100, 10u), 77 render_fps_tracker_(100, 10u),
75 render_pixel_tracker_(100, 10u), 78 render_pixel_tracker_(100, 10u),
76 total_byte_tracker_(100, 10u), // bucket_interval_ms, bucket_count 79 total_byte_tracker_(100, 10u), // bucket_interval_ms, bucket_count
77 e2e_delay_max_ms_video_(-1), 80 e2e_delay_max_ms_video_(-1),
78 e2e_delay_max_ms_screenshare_(-1), 81 e2e_delay_max_ms_screenshare_(-1),
79 interframe_delay_max_ms_video_(-1), 82 interframe_delay_max_ms_video_(-1),
80 interframe_delay_max_ms_screenshare_(-1), 83 interframe_delay_max_ms_screenshare_(-1),
84 interframe_delay_max_moving_(kMovingMaxWindowMs),
81 freq_offset_counter_(clock, nullptr, kFreqOffsetProcessIntervalMs), 85 freq_offset_counter_(clock, nullptr, kFreqOffsetProcessIntervalMs),
82 first_report_block_time_ms_(-1), 86 first_report_block_time_ms_(-1),
83 avg_rtt_ms_(0), 87 avg_rtt_ms_(0),
84 last_content_type_(VideoContentType::UNSPECIFIED) { 88 last_content_type_(VideoContentType::UNSPECIFIED) {
85 stats_.ssrc = config_.rtp.remote_ssrc; 89 stats_.ssrc = config_.rtp.remote_ssrc;
86 // TODO(brandtr): Replace |rtx_stats_| with a single instance of 90 // TODO(brandtr): Replace |rtx_stats_| with a single instance of
87 // StreamDataCounters. 91 // StreamDataCounters.
88 if (config_.rtp.rtx_ssrc) { 92 if (config_.rtp.rtx_ssrc) {
89 rtx_stats_[config_.rtp.rtx_ssrc] = StreamDataCounters(); 93 rtx_stats_[config_.rtp.rtx_ssrc] = StreamDataCounters();
90 } 94 }
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 VideoReceiveStream::Stats ReceiveStatisticsProxy::GetStats() const { 391 VideoReceiveStream::Stats ReceiveStatisticsProxy::GetStats() const {
388 rtc::CritScope lock(&crit_); 392 rtc::CritScope lock(&crit_);
389 // Get current frame rates here, as only updating them on new frames prevents 393 // Get current frame rates here, as only updating them on new frames prevents
390 // us from ever correctly displaying frame rate of 0. 394 // us from ever correctly displaying frame rate of 0.
391 int64_t now_ms = clock_->TimeInMilliseconds(); 395 int64_t now_ms = clock_->TimeInMilliseconds();
392 UpdateFramerate(now_ms); 396 UpdateFramerate(now_ms);
393 stats_.render_frame_rate = renders_fps_estimator_.Rate(now_ms).value_or(0); 397 stats_.render_frame_rate = renders_fps_estimator_.Rate(now_ms).value_or(0);
394 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now_ms).value_or(0); 398 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now_ms).value_or(0);
395 stats_.total_bitrate_bps = 399 stats_.total_bitrate_bps =
396 static_cast<int>(total_byte_tracker_.ComputeRate() * 8); 400 static_cast<int>(total_byte_tracker_.ComputeRate() * 8);
401 stats_.interframe_delay_max_ms =
402 interframe_delay_max_moving_.Max(now_ms).value_or(-1);
397 return stats_; 403 return stats_;
398 } 404 }
399 405
400 rtc::Optional<TimingFrameInfo> 406 rtc::Optional<TimingFrameInfo>
401 ReceiveStatisticsProxy::GetAndResetTimingFrameInfo() { 407 ReceiveStatisticsProxy::GetAndResetTimingFrameInfo() {
402 rtc::CritScope lock(&crit_); 408 rtc::CritScope lock(&crit_);
403 rtc::Optional<TimingFrameInfo> info = timing_frame_info_; 409 rtc::Optional<TimingFrameInfo> info = timing_frame_info_;
404 // Reset reported value to empty, so it will be always 410 // Reset reported value to empty, so it will be always
405 // overwritten in |OnTimingFrameInfoUpdated|, thus allowing to store new 411 // overwritten in |OnTimingFrameInfoUpdated|, thus allowing to store new
406 // value instead of reported one. 412 // value instead of reported one.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 } else if (stats_.qp_sum) { 543 } else if (stats_.qp_sum) {
538 LOG(LS_WARNING) 544 LOG(LS_WARNING)
539 << "QP sum was already set and no QP was given for a frame."; 545 << "QP sum was already set and no QP was given for a frame.";
540 stats_.qp_sum = rtc::Optional<uint64_t>(); 546 stats_.qp_sum = rtc::Optional<uint64_t>();
541 } 547 }
542 last_content_type_ = content_type; 548 last_content_type_ = content_type;
543 decode_fps_estimator_.Update(1, now); 549 decode_fps_estimator_.Update(1, now);
544 if (last_decoded_frame_time_ms_) { 550 if (last_decoded_frame_time_ms_) {
545 int64_t interframe_delay_ms = now - *last_decoded_frame_time_ms_; 551 int64_t interframe_delay_ms = now - *last_decoded_frame_time_ms_;
546 RTC_DCHECK_GE(interframe_delay_ms, 0); 552 RTC_DCHECK_GE(interframe_delay_ms, 0);
547 stats_.interframe_delay_sum_ms += interframe_delay_ms; 553 interframe_delay_max_moving_.Add(interframe_delay_ms, now);
548 if (last_content_type_ == VideoContentType::SCREENSHARE) { 554 if (last_content_type_ == VideoContentType::SCREENSHARE) {
549 interframe_delay_counter_screenshare_.Add(interframe_delay_ms); 555 interframe_delay_counter_screenshare_.Add(interframe_delay_ms);
550 if (interframe_delay_max_ms_screenshare_ < interframe_delay_ms) { 556 if (interframe_delay_max_ms_screenshare_ < interframe_delay_ms) {
551 interframe_delay_max_ms_screenshare_ = interframe_delay_ms; 557 interframe_delay_max_ms_screenshare_ = interframe_delay_ms;
552 } 558 }
553 } else { 559 } else {
554 interframe_delay_counter_video_.Add(interframe_delay_ms); 560 interframe_delay_counter_video_.Add(interframe_delay_ms);
555 if (interframe_delay_max_ms_video_ < interframe_delay_ms) { 561 if (interframe_delay_max_ms_video_ < interframe_delay_ms) {
556 interframe_delay_max_ms_video_ = interframe_delay_ms; 562 interframe_delay_max_ms_video_ = interframe_delay_ms;
557 } 563 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 sum = 0; 671 sum = 0;
666 } 672 }
667 673
668 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms, 674 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms,
669 int64_t max_rtt_ms) { 675 int64_t max_rtt_ms) {
670 rtc::CritScope lock(&crit_); 676 rtc::CritScope lock(&crit_);
671 avg_rtt_ms_ = avg_rtt_ms; 677 avg_rtt_ms_ = avg_rtt_ms;
672 } 678 }
673 679
674 } // namespace webrtc 680 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/receive_statistics_proxy.h ('k') | webrtc/video/receive_statistics_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698