Do not report cpu limited resolution stats when degradation preference is disabled and no scaling is done.

When degradation preference is kDegradationDisabled, do not update WebRTC.Video.CpuLimitedResolutionInPercent.

BUG=webrtc:6634

Review-Url: https://codereview.webrtc.org/2807133002
Cr-Commit-Position: refs/heads/master@{#17757}
This commit is contained in:
asapersson
2017-04-19 02:01:06 -07:00
committed by Commit bot
parent 939df96500
commit f4e44af724
3 changed files with 43 additions and 4 deletions

View File

@ -709,7 +709,10 @@ void SendStatisticsProxy::OnIncomingFrame(int width, int height) {
uma_container_->input_fps_counter_.Add(1);
uma_container_->input_width_counter_.Add(width);
uma_container_->input_height_counter_.Add(height);
uma_container_->cpu_limited_frame_counter_.Add(stats_.cpu_limited_resolution);
if (cpu_downscales_ >= 0) {
uma_container_->cpu_limited_frame_counter_.Add(
stats_.cpu_limited_resolution);
}
TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.InputFrameRate",
"frame_rate", round(
uma_container_->input_frame_rate_tracker_.ComputeRate()),

View File

@ -841,7 +841,22 @@ TEST_F(SendStatisticsProxyTest, SentFpsHistogramExcludesSuspendedTime) {
EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.SentFramesPerSecond", kFps));
}
TEST_F(SendStatisticsProxyTest, CpuLimitedResolutionUpdated) {
TEST_F(SendStatisticsProxyTest, CpuLimitedHistogramNotUpdatedWhenDisabled) {
const int kNumDownscales = -1;
statistics_proxy_->SetQualityScalingStats(kNumDownscales);
for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i)
statistics_proxy_->OnIncomingFrame(kWidth, kHeight);
statistics_proxy_.reset();
EXPECT_EQ(0,
metrics::NumSamples("WebRTC.Video.CpuLimitedResolutionInPercent"));
}
TEST_F(SendStatisticsProxyTest, CpuLimitedHistogramUpdated) {
const int kNumDownscales = 0;
statistics_proxy_->SetCpuScalingStats(kNumDownscales);
for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i)
statistics_proxy_->OnIncomingFrame(kWidth, kHeight);

View File

@ -1425,9 +1425,8 @@ TEST_F(ViEEncoderTest, DoesNotScaleBelowSetLimit) {
vie_encoder_->Stop();
}
TEST_F(ViEEncoderTest, UMACpuLimitedResolutionInPercent) {
TEST_F(ViEEncoderTest, CpuLimitedHistogramIsReported) {
vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
const int kWidth = 640;
const int kHeight = 360;
@ -1454,6 +1453,28 @@ TEST_F(ViEEncoderTest, UMACpuLimitedResolutionInPercent) {
1, metrics::NumEvents("WebRTC.Video.CpuLimitedResolutionInPercent", 50));
}
TEST_F(ViEEncoderTest, CpuLimitedHistogramIsNotReportedForDisabledDegradation) {
vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
const int kWidth = 640;
const int kHeight = 360;
vie_encoder_->SetSource(
&video_source_,
VideoSendStream::DegradationPreference::kDegradationDisabled);
for (int i = 1; i <= SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) {
video_source_.IncomingCapturedFrame(CreateFrame(i, kWidth, kHeight));
sink_.WaitForEncodedFrame(i);
}
vie_encoder_->Stop();
vie_encoder_.reset();
stats_proxy_.reset();
EXPECT_EQ(0,
metrics::NumSamples("WebRTC.Video.CpuLimitedResolutionInPercent"));
}
TEST_F(ViEEncoderTest, CallsBitrateObserver) {
class MockBitrateObserver : public VideoBitrateAllocationObserver {
public: