OLD | NEW |
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 Loading... |
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, SetCpuScalingUpdatesStats) { |
| 371 EXPECT_FALSE(statistics_proxy_->GetStats().cpu_limited_resolution); |
| 372 statistics_proxy_->SetCpuScalingStats(true); |
| 373 EXPECT_TRUE(statistics_proxy_->GetStats().cpu_limited_resolution); |
| 374 statistics_proxy_->SetCpuScalingStats(false); |
| 375 EXPECT_FALSE(statistics_proxy_->GetStats().cpu_limited_resolution); |
| 376 } |
| 377 |
| 378 TEST_F(SendStatisticsProxyTest, SetQualityScalingUpdatesStats) { |
| 379 EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution); |
| 380 statistics_proxy_->SetQualityScalingStats(-1); |
| 381 EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution); |
| 382 statistics_proxy_->SetQualityScalingStats(0); |
| 383 EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution); |
| 384 statistics_proxy_->SetQualityScalingStats(1); |
| 385 EXPECT_TRUE(statistics_proxy_->GetStats().bw_limited_resolution); |
| 386 } |
| 387 |
370 TEST_F(SendStatisticsProxyTest, SwitchContentTypeUpdatesHistograms) { | 388 TEST_F(SendStatisticsProxyTest, SwitchContentTypeUpdatesHistograms) { |
371 for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) | 389 for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) |
372 statistics_proxy_->OnIncomingFrame(kWidth, kHeight); | 390 statistics_proxy_->OnIncomingFrame(kWidth, kHeight); |
373 | 391 |
374 // No switch, stats should not be updated. | 392 // No switch, stats should not be updated. |
375 VideoEncoderConfig config; | 393 VideoEncoderConfig config; |
376 config.content_type = VideoEncoderConfig::ContentType::kRealtimeVideo; | 394 config.content_type = VideoEncoderConfig::ContentType::kRealtimeVideo; |
377 statistics_proxy_->OnEncoderReconfigured(config, 50); | 395 statistics_proxy_->OnEncoderReconfigured(config, 50); |
378 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InputWidthInPixels")); | 396 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InputWidthInPixels")); |
379 | 397 |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 // Resolutions disabled. | 790 // Resolutions disabled. |
773 EXPECT_EQ(1, metrics::NumSamples( | 791 EXPECT_EQ(1, metrics::NumSamples( |
774 "WebRTC.Video.BandwidthLimitedResolutionsDisabled")); | 792 "WebRTC.Video.BandwidthLimitedResolutionsDisabled")); |
775 EXPECT_EQ( | 793 EXPECT_EQ( |
776 1, metrics::NumEvents("WebRTC.Video.BandwidthLimitedResolutionsDisabled", | 794 1, metrics::NumEvents("WebRTC.Video.BandwidthLimitedResolutionsDisabled", |
777 kResolutionsDisabled)); | 795 kResolutionsDisabled)); |
778 } | 796 } |
779 | 797 |
780 TEST_F(SendStatisticsProxyTest, | 798 TEST_F(SendStatisticsProxyTest, |
781 QualityLimitedHistogramsNotUpdatedWhenDisabled) { | 799 QualityLimitedHistogramsNotUpdatedWhenDisabled) { |
| 800 const int kNumDownscales = -1; |
782 EncodedImage encoded_image; | 801 EncodedImage encoded_image; |
783 statistics_proxy_->SetResolutionRestrictionStats(false /* scaling_enabled */, | 802 statistics_proxy_->SetQualityScalingStats(kNumDownscales); |
784 0, 0); | |
785 for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) | 803 for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) |
786 statistics_proxy_->OnSendEncodedImage(encoded_image, &kDefaultCodecInfo); | 804 statistics_proxy_->OnSendEncodedImage(encoded_image, &kDefaultCodecInfo); |
787 | 805 |
788 // Histograms are updated when the statistics_proxy_ is deleted. | 806 // Histograms are updated when the statistics_proxy_ is deleted. |
789 statistics_proxy_.reset(); | 807 statistics_proxy_.reset(); |
790 EXPECT_EQ( | 808 EXPECT_EQ( |
791 0, metrics::NumSamples("WebRTC.Video.QualityLimitedResolutionInPercent")); | 809 0, metrics::NumSamples("WebRTC.Video.QualityLimitedResolutionInPercent")); |
792 EXPECT_EQ(0, metrics::NumSamples( | 810 EXPECT_EQ(0, metrics::NumSamples( |
793 "WebRTC.Video.QualityLimitedResolutionDownscales")); | 811 "WebRTC.Video.QualityLimitedResolutionDownscales")); |
794 } | 812 } |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 fake_clock_.AdvanceTimeMilliseconds(kPeriodIntervalMs); | 1362 fake_clock_.AdvanceTimeMilliseconds(kPeriodIntervalMs); |
1345 proxy->DataCountersUpdated(counters, kFirstSsrc); | 1363 proxy->DataCountersUpdated(counters, kFirstSsrc); |
1346 } | 1364 } |
1347 | 1365 |
1348 // FEC not enabled. | 1366 // FEC not enabled. |
1349 statistics_proxy_.reset(); | 1367 statistics_proxy_.reset(); |
1350 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.FecBitrateSentInKbps")); | 1368 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.FecBitrateSentInKbps")); |
1351 } | 1369 } |
1352 | 1370 |
1353 } // namespace webrtc | 1371 } // namespace webrtc |
OLD | NEW |