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

Unified Diff: webrtc/video/send_statistics_proxy_unittest.cc

Issue 2564373002: Properly report number of quality downscales in stats. (Closed)
Patch Set: clarify check for initialized encoder in simulcast adapter Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/video/send_statistics_proxy.cc ('k') | webrtc/video/vie_encoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « webrtc/video/send_statistics_proxy.cc ('k') | webrtc/video/vie_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698