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

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

Issue 2783213002: Do not report quality limited resolution stats when quality scaler is disabled. (Closed)
Patch Set: rebase 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 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 360
361 TEST_F(SendStatisticsProxyTest, OnSendEncodedImageWithoutQpQpSumWontExist) { 361 TEST_F(SendStatisticsProxyTest, OnSendEncodedImageWithoutQpQpSumWontExist) {
362 EncodedImage encoded_image; 362 EncodedImage encoded_image;
363 CodecSpecificInfo codec_info; 363 CodecSpecificInfo codec_info;
364 encoded_image.qp_ = -1; 364 encoded_image.qp_ = -1;
365 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); 365 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum);
366 statistics_proxy_->OnSendEncodedImage(encoded_image, &codec_info); 366 statistics_proxy_->OnSendEncodedImage(encoded_image, &codec_info);
367 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); 367 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum);
368 } 368 }
369 369
370 TEST_F(SendStatisticsProxyTest, SetCpuRestrictionUpdatesStats) {
371 const bool kQualityScalingEnabled = true;
372 const bool kCpuRestricted = true;
373 const int kQualityDownscales = 0;
374 EXPECT_FALSE(statistics_proxy_->GetStats().cpu_limited_resolution);
375 EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution);
376
377 // Cpu restricted and cpu scaling enabled, stats should be cpu limited.
378 statistics_proxy_->SetResolutionRestrictionStats(
379 true, // cpu_scaling_enabled
380 kQualityScalingEnabled, kCpuRestricted, kQualityDownscales);
381 EXPECT_TRUE(statistics_proxy_->GetStats().cpu_limited_resolution);
382 EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution);
383
384 // Cpu restricted but cpu scaling disabled, stats should not be cpu limited.
385 statistics_proxy_->SetResolutionRestrictionStats(
386 false, // cpu_scaling_enabled
387 kQualityScalingEnabled, kCpuRestricted, kQualityDownscales);
388 EXPECT_FALSE(statistics_proxy_->GetStats().cpu_limited_resolution);
389 EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution);
390 }
391
392 TEST_F(SendStatisticsProxyTest, SetQualityRestrictionUpdatesStats) {
393 const bool kCpuScalingEnabled = true;
394 const bool kCpuRestricted = false;
395 const int kQualityDownscales = 1;
396 EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution);
397 EXPECT_FALSE(statistics_proxy_->GetStats().cpu_limited_resolution);
398
399 // Quality downscaled and quality scaling enabled, stats should be bw limited.
400 statistics_proxy_->SetResolutionRestrictionStats(
401 kCpuScalingEnabled,
402 true, // quality_scaling_enabled
403 kCpuRestricted, kQualityDownscales);
404 EXPECT_TRUE(statistics_proxy_->GetStats().bw_limited_resolution);
405 EXPECT_FALSE(statistics_proxy_->GetStats().cpu_limited_resolution);
406
407 // Quality downscaled but quality scaling disabled, stats should not be bw
408 // limited.
409 statistics_proxy_->SetResolutionRestrictionStats(
410 kCpuScalingEnabled,
411 false, // quality_scaling_enabled
412 kCpuRestricted, kQualityDownscales);
413 EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution);
414 EXPECT_FALSE(statistics_proxy_->GetStats().cpu_limited_resolution);
415 }
416
370 TEST_F(SendStatisticsProxyTest, SwitchContentTypeUpdatesHistograms) { 417 TEST_F(SendStatisticsProxyTest, SwitchContentTypeUpdatesHistograms) {
371 for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) 418 for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i)
372 statistics_proxy_->OnIncomingFrame(kWidth, kHeight); 419 statistics_proxy_->OnIncomingFrame(kWidth, kHeight);
373 420
374 // No switch, stats should not be updated. 421 // No switch, stats should not be updated.
375 VideoEncoderConfig config; 422 VideoEncoderConfig config;
376 config.content_type = VideoEncoderConfig::ContentType::kRealtimeVideo; 423 config.content_type = VideoEncoderConfig::ContentType::kRealtimeVideo;
377 statistics_proxy_->OnEncoderReconfigured(config, 50); 424 statistics_proxy_->OnEncoderReconfigured(config, 50);
378 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InputWidthInPixels")); 425 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InputWidthInPixels"));
379 426
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 EXPECT_EQ(1, metrics::NumSamples( 820 EXPECT_EQ(1, metrics::NumSamples(
774 "WebRTC.Video.BandwidthLimitedResolutionsDisabled")); 821 "WebRTC.Video.BandwidthLimitedResolutionsDisabled"));
775 EXPECT_EQ( 822 EXPECT_EQ(
776 1, metrics::NumEvents("WebRTC.Video.BandwidthLimitedResolutionsDisabled", 823 1, metrics::NumEvents("WebRTC.Video.BandwidthLimitedResolutionsDisabled",
777 kResolutionsDisabled)); 824 kResolutionsDisabled));
778 } 825 }
779 826
780 TEST_F(SendStatisticsProxyTest, 827 TEST_F(SendStatisticsProxyTest,
781 QualityLimitedHistogramsNotUpdatedWhenDisabled) { 828 QualityLimitedHistogramsNotUpdatedWhenDisabled) {
782 EncodedImage encoded_image; 829 EncodedImage encoded_image;
783 statistics_proxy_->SetResolutionRestrictionStats(false /* scaling_enabled */, 830 statistics_proxy_->SetResolutionRestrictionStats(
784 0, 0); 831 true /* cpu_scaling_enabled */, false /* quality_scaling_enabled */,
832 false, 0);
785 for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) 833 for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i)
786 statistics_proxy_->OnSendEncodedImage(encoded_image, &kDefaultCodecInfo); 834 statistics_proxy_->OnSendEncodedImage(encoded_image, &kDefaultCodecInfo);
787 835
788 // Histograms are updated when the statistics_proxy_ is deleted. 836 // Histograms are updated when the statistics_proxy_ is deleted.
789 statistics_proxy_.reset(); 837 statistics_proxy_.reset();
790 EXPECT_EQ( 838 EXPECT_EQ(
791 0, metrics::NumSamples("WebRTC.Video.QualityLimitedResolutionInPercent")); 839 0, metrics::NumSamples("WebRTC.Video.QualityLimitedResolutionInPercent"));
792 EXPECT_EQ(0, metrics::NumSamples( 840 EXPECT_EQ(0, metrics::NumSamples(
793 "WebRTC.Video.QualityLimitedResolutionDownscales")); 841 "WebRTC.Video.QualityLimitedResolutionDownscales"));
794 } 842 }
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 fake_clock_.AdvanceTimeMilliseconds(kPeriodIntervalMs); 1392 fake_clock_.AdvanceTimeMilliseconds(kPeriodIntervalMs);
1345 proxy->DataCountersUpdated(counters, kFirstSsrc); 1393 proxy->DataCountersUpdated(counters, kFirstSsrc);
1346 } 1394 }
1347 1395
1348 // FEC not enabled. 1396 // FEC not enabled.
1349 statistics_proxy_.reset(); 1397 statistics_proxy_.reset();
1350 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.FecBitrateSentInKbps")); 1398 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.FecBitrateSentInKbps"));
1351 } 1399 }
1352 1400
1353 } // namespace webrtc 1401 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698