Chromium Code Reviews| 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..9108ce73352cf4c0c37f0b17a8fe357f9e1505f5 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,12 @@ TEST_F(SendStatisticsProxyTest, |
| TEST_F(SendStatisticsProxyTest, |
| QualityLimitedHistogramsNotUpdatedWhenDisabled) { |
| EncodedImage encoded_image; |
| - // encoded_image.adapt_reason_.quality_resolution_downscales disabled by |
| - // default: -1 |
| + // Quality limited histograms are only enabled for stream 0 |
| + // in simulcast; |
| + CodecSpecificInfo codec_info = kDefaultCodecInfo; |
| + codec_info.codecSpecific.VP8.simulcastIdx = 1; |
| for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) |
| - statistics_proxy_->OnSendEncodedImage(encoded_image, nullptr); |
| + statistics_proxy_->OnSendEncodedImage(encoded_image, &codec_info); |
| // Histograms are updated when the statistics_proxy_ is deleted. |
| statistics_proxy_.reset(); |
| @@ -674,11 +682,9 @@ TEST_F(SendStatisticsProxyTest, |
| TEST_F(SendStatisticsProxyTest, |
| QualityLimitedHistogramsUpdatedWhenEnabled_NoResolutionDownscale) { |
|
åsapersson
2016/12/14 09:25:13
Seems like the stats can also be reported if scali
kthelgason
2016/12/15 10:33:54
Right. I fixed this and added a test for that case
|
| - 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 +701,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 +725,9 @@ TEST_F(SendStatisticsProxyTest, GetStatsReportsBandwidthLimitedResolution) { |
| EncodedImage encoded_image; |
| statistics_proxy_->OnSendEncodedImage(encoded_image, nullptr); |
| EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution); |
| - // Resolution not scaled. |
| - encoded_image.adapt_reason_.bw_resolutions_disabled = 0; |
| - statistics_proxy_->OnSendEncodedImage(encoded_image, nullptr); |
| - EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution); |
|
åsapersson
2016/12/14 09:25:13
I think this should still be tested and not remove
kthelgason
2016/12/15 10:33:54
Acknowledged.
|
| + |
| // Resolution scaled due to bandwidth. |
| - encoded_image.adapt_reason_.bw_resolutions_disabled = 1; |
|
åsapersson
2016/12/14 09:25:13
ditto
kthelgason
2016/12/15 10:33:54
Acknowledged.
|
| + statistics_proxy_->OnQualityRestrictedResolutionChanged(1); |
| statistics_proxy_->OnSendEncodedImage(encoded_image, nullptr); |
| EXPECT_TRUE(statistics_proxy_->GetStats().bw_limited_resolution); |
| } |