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

Unified Diff: webrtc/video/receive_statistics_proxy.cc

Issue 2861663002: Update decode/render fps stats when calling VideoReceiveStream::GetStats (Closed)
Patch Set: Added unit test Created 3 years, 8 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 | « no previous file | webrtc/video/receive_statistics_proxy_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/receive_statistics_proxy.cc
diff --git a/webrtc/video/receive_statistics_proxy.cc b/webrtc/video/receive_statistics_proxy.cc
index c5fa7c004f112400e1b8e56c686cec510232e9d4..9485a54a04821f768aa6829190d82c2c924ffd69 100644
--- a/webrtc/video/receive_statistics_proxy.cc
+++ b/webrtc/video/receive_statistics_proxy.cc
@@ -349,7 +349,12 @@ void ReceiveStatisticsProxy::UpdateFramerate(int64_t now_ms) const {
VideoReceiveStream::Stats ReceiveStatisticsProxy::GetStats() const {
rtc::CritScope lock(&crit_);
- UpdateFramerate(clock_->TimeInMilliseconds());
+ // Get current frame rates here, as only updating them on new frames prevents
+ // us from ever correctly displaying frame rate of 0.
+ int64_t now_ms = clock_->TimeInMilliseconds();
+ UpdateFramerate(now_ms);
+ stats_.render_frame_rate = renders_fps_estimator_.Rate(now_ms).value_or(0);
+ stats_.decode_frame_rate = decode_fps_estimator_.Rate(now_ms).value_or(0);
stats_.total_bitrate_bps =
static_cast<int>(total_byte_tracker_.ComputeRate() * 8);
return stats_;
@@ -477,7 +482,6 @@ void ReceiveStatisticsProxy::OnDecodedFrame(rtc::Optional<uint8_t> qp,
}
last_content_type_ = content_type;
decode_fps_estimator_.Update(1, now);
- stats_.decode_frame_rate = decode_fps_estimator_.Rate(now).value_or(0);
}
void ReceiveStatisticsProxy::OnRenderedFrame(const VideoFrame& frame) {
@@ -489,7 +493,6 @@ void ReceiveStatisticsProxy::OnRenderedFrame(const VideoFrame& frame) {
rtc::CritScope lock(&crit_);
renders_fps_estimator_.Update(1, now);
- stats_.render_frame_rate = renders_fps_estimator_.Rate(now).value_or(0);
++stats_.frames_rendered;
stats_.width = width;
stats_.height = height;
« no previous file with comments | « no previous file | webrtc/video/receive_statistics_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698