Add stats for rendered pixels (sqrt(w*h)) per second:
- "WebRTC.Video.RenderSqrtPixelsPerSecond" BUG=chromium:512752 Review URL: https://codereview.webrtc.org/1366583002 Cr-Commit-Position: refs/heads/master@{#10208}
This commit is contained in:
@ -10,6 +10,9 @@
|
||||
|
||||
#include "webrtc/video/receive_statistics_proxy.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||
#include "webrtc/system_wrappers/interface/metrics.h"
|
||||
@ -21,7 +24,8 @@ ReceiveStatisticsProxy::ReceiveStatisticsProxy(uint32_t ssrc, Clock* clock)
|
||||
// 1000ms window, scale 1000 for ms to s.
|
||||
decode_fps_estimator_(1000, 1000),
|
||||
renders_fps_estimator_(1000, 1000),
|
||||
render_fps_tracker_(100u, 10u) {
|
||||
render_fps_tracker_(100u, 10u),
|
||||
render_pixel_tracker_(100u, 10u) {
|
||||
stats_.ssrc = ssrc;
|
||||
}
|
||||
|
||||
@ -35,12 +39,14 @@ void ReceiveStatisticsProxy::UpdateHistograms() {
|
||||
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.ReceivedPacketsLostInPercent",
|
||||
fraction_lost);
|
||||
}
|
||||
|
||||
int render_fps = static_cast<int>(render_fps_tracker_.ComputeTotalRate());
|
||||
if (render_fps > 0)
|
||||
RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.RenderFramesPerSecond", render_fps);
|
||||
|
||||
const int kMinRequiredSamples = 200;
|
||||
int samples = static_cast<int>(render_fps_tracker_.TotalSampleCount());
|
||||
if (samples > kMinRequiredSamples) {
|
||||
RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.RenderFramesPerSecond",
|
||||
static_cast<int>(render_fps_tracker_.ComputeTotalRate()));
|
||||
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Video.RenderSqrtPixelsPerSecond",
|
||||
static_cast<int>(render_pixel_tracker_.ComputeTotalRate()));
|
||||
}
|
||||
int width = render_width_counter_.Avg(kMinRequiredSamples);
|
||||
int height = render_height_counter_.Avg(kMinRequiredSamples);
|
||||
if (width != -1) {
|
||||
@ -146,6 +152,8 @@ void ReceiveStatisticsProxy::OnDecodedFrame() {
|
||||
}
|
||||
|
||||
void ReceiveStatisticsProxy::OnRenderedFrame(int width, int height) {
|
||||
RTC_DCHECK_GT(width, 0);
|
||||
RTC_DCHECK_GT(height, 0);
|
||||
uint64_t now = clock_->TimeInMilliseconds();
|
||||
|
||||
rtc::CritScope lock(&crit_);
|
||||
@ -154,6 +162,7 @@ void ReceiveStatisticsProxy::OnRenderedFrame(int width, int height) {
|
||||
render_width_counter_.Add(width);
|
||||
render_height_counter_.Add(height);
|
||||
render_fps_tracker_.AddSamples(1);
|
||||
render_pixel_tracker_.AddSamples(sqrt(width * height));
|
||||
}
|
||||
|
||||
void ReceiveStatisticsProxy::OnReceiveRatesUpdated(uint32_t bitRate,
|
||||
|
@ -92,6 +92,7 @@ class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback,
|
||||
RateStatistics decode_fps_estimator_ GUARDED_BY(crit_);
|
||||
RateStatistics renders_fps_estimator_ GUARDED_BY(crit_);
|
||||
rtc::RateTracker render_fps_tracker_ GUARDED_BY(crit_);
|
||||
rtc::RateTracker render_pixel_tracker_ GUARDED_BY(crit_);
|
||||
SampleCounter render_width_counter_ GUARDED_BY(crit_);
|
||||
SampleCounter render_height_counter_ GUARDED_BY(crit_);
|
||||
SampleCounter decode_time_counter_ GUARDED_BY(crit_);
|
||||
|
Reference in New Issue
Block a user