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:
@ -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()),
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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:
|
||||
|
||||
Reference in New Issue
Block a user