| Index: webrtc/video/send_statistics_proxy_unittest.cc
|
| diff --git a/webrtc/video/send_statistics_proxy_unittest.cc b/webrtc/video/send_statistics_proxy_unittest.cc
|
| index 4cee1046ddb0509980a9e6a46673adeb19c30057..acb8a306cae1e83f16e51e6c60ea0c8e583b45ef 100644
|
| --- a/webrtc/video/send_statistics_proxy_unittest.cc
|
| +++ b/webrtc/video/send_statistics_proxy_unittest.cc
|
| @@ -31,6 +31,12 @@ const int kWidth = 640;
|
| const int kHeight = 480;
|
| const int kQpIdx0 = 21;
|
| const int kQpIdx1 = 39;
|
| +const CodecSpecificInfo kDefaultCodecInfo = []() {
|
| + CodecSpecificInfo codec_info;
|
| + codec_info.codecType = kVideoCodecVP8;
|
| + codec_info.codecSpecific.VP8.simulcastIdx = 0;
|
| + return codec_info;
|
| +}();
|
| } // namespace
|
|
|
| class SendStatisticsProxyTest : public ::testing::Test {
|
| @@ -659,10 +665,10 @@ TEST_F(SendStatisticsProxyTest,
|
| TEST_F(SendStatisticsProxyTest,
|
| QualityLimitedHistogramsNotUpdatedWhenDisabled) {
|
| EncodedImage encoded_image;
|
| - // encoded_image.adapt_reason_.quality_resolution_downscales disabled by
|
| - // default: -1
|
| + statistics_proxy_->SetResolutionRestrictionStats(false /* scaling_enabled */,
|
| + 0, 0);
|
| for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i)
|
| - statistics_proxy_->OnSendEncodedImage(encoded_image, nullptr);
|
| + statistics_proxy_->OnSendEncodedImage(encoded_image, &kDefaultCodecInfo);
|
|
|
| // Histograms are updated when the statistics_proxy_ is deleted.
|
| statistics_proxy_.reset();
|
| @@ -674,11 +680,9 @@ TEST_F(SendStatisticsProxyTest,
|
|
|
| TEST_F(SendStatisticsProxyTest,
|
| QualityLimitedHistogramsUpdatedWhenEnabled_NoResolutionDownscale) {
|
| - const int kDownscales = 0;
|
| EncodedImage encoded_image;
|
| - encoded_image.adapt_reason_.quality_resolution_downscales = kDownscales;
|
| for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i)
|
| - statistics_proxy_->OnSendEncodedImage(encoded_image, nullptr);
|
| + statistics_proxy_->OnSendEncodedImage(encoded_image, &kDefaultCodecInfo);
|
|
|
| // Histograms are updated when the statistics_proxy_ is deleted.
|
| statistics_proxy_.reset();
|
| @@ -695,10 +699,9 @@ TEST_F(SendStatisticsProxyTest,
|
| QualityLimitedHistogramsUpdatedWhenEnabled_TwoResolutionDownscales) {
|
| const int kDownscales = 2;
|
| EncodedImage encoded_image;
|
| - encoded_image.adapt_reason_.quality_resolution_downscales = kDownscales;
|
| + statistics_proxy_->OnQualityRestrictedResolutionChanged(kDownscales);
|
| for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i)
|
| - statistics_proxy_->OnSendEncodedImage(encoded_image, nullptr);
|
| -
|
| + statistics_proxy_->OnSendEncodedImage(encoded_image, &kDefaultCodecInfo);
|
| // Histograms are updated when the statistics_proxy_ is deleted.
|
| statistics_proxy_.reset();
|
| EXPECT_EQ(
|
| @@ -720,12 +723,18 @@ TEST_F(SendStatisticsProxyTest, GetStatsReportsBandwidthLimitedResolution) {
|
| EncodedImage encoded_image;
|
| statistics_proxy_->OnSendEncodedImage(encoded_image, nullptr);
|
| EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution);
|
| - // Resolution not scaled.
|
| +
|
| + // Simulcast disabled resolutions
|
| + encoded_image.adapt_reason_.bw_resolutions_disabled = 1;
|
| + statistics_proxy_->OnSendEncodedImage(encoded_image, nullptr);
|
| + EXPECT_TRUE(statistics_proxy_->GetStats().bw_limited_resolution);
|
| +
|
| encoded_image.adapt_reason_.bw_resolutions_disabled = 0;
|
| statistics_proxy_->OnSendEncodedImage(encoded_image, nullptr);
|
| EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution);
|
| - // Resolution scaled due to bandwidth.
|
| - encoded_image.adapt_reason_.bw_resolutions_disabled = 1;
|
| +
|
| + // Resolution scaled due to quality.
|
| + statistics_proxy_->OnQualityRestrictedResolutionChanged(1);
|
| statistics_proxy_->OnSendEncodedImage(encoded_image, nullptr);
|
| EXPECT_TRUE(statistics_proxy_->GetStats().bw_limited_resolution);
|
| }
|
|
|