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

Unified Diff: webrtc/modules/video_coding/utility/quality_scaler_unittest.cc

Issue 2789483002: Make sure we observe enough frames before scaling. (Closed)
Patch Set: Add test for new behaviour Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/video_coding/utility/quality_scaler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/utility/quality_scaler_unittest.cc
diff --git a/webrtc/modules/video_coding/utility/quality_scaler_unittest.cc b/webrtc/modules/video_coding/utility/quality_scaler_unittest.cc
index 32d0aa9aea85f3a1cea0f30d3f1b8db079fb01d4..93b5fcd43137b678df0c2f723e4753b0681bab15 100644
--- a/webrtc/modules/video_coding/utility/quality_scaler_unittest.cc
+++ b/webrtc/modules/video_coding/utility/quality_scaler_unittest.cc
@@ -131,9 +131,11 @@ TEST_F(QualityScalerTest, DownscalesAboveHighQp) {
TEST_F(QualityScalerTest, DownscalesAfterTwoThirdsFramedrop) {
DO_SYNC(q_, {
- qs_->ReportDroppedFrame();
- qs_->ReportDroppedFrame();
- qs_->ReportQP(kHighQp);
+ for (int i = 0; i < kFramerate * 5; ++i) {
+ qs_->ReportDroppedFrame();
+ qs_->ReportDroppedFrame();
+ qs_->ReportQP(kHighQp);
+ }
});
EXPECT_TRUE(observer_->event.Wait(kDefaultTimeoutMs));
EXPECT_EQ(1, observer_->adapt_down_events_);
@@ -149,8 +151,10 @@ TEST_F(QualityScalerTest, DoesNotDownscaleOnNormalQp) {
TEST_F(QualityScalerTest, DoesNotDownscaleAfterHalfFramedrop) {
DO_SYNC(q_, {
- qs_->ReportDroppedFrame();
- qs_->ReportQP(kHighQp);
+ for (int i = 0; i < kFramerate * 5; ++i) {
+ qs_->ReportDroppedFrame();
+ qs_->ReportQP(kHighQp);
+ }
});
EXPECT_FALSE(observer_->event.Wait(kDefaultTimeoutMs));
EXPECT_EQ(0, observer_->adapt_down_events_);
@@ -174,5 +178,25 @@ TEST_F(QualityScalerTest, ScalesDownAndBackUp) {
EXPECT_EQ(1, observer_->adapt_down_events_);
EXPECT_EQ(1, observer_->adapt_up_events_);
}
+
+TEST_F(QualityScalerTest, DoesNotScaleUntilEnoughFramesObserved) {
+ DO_SYNC(q_, {
+ // Send 30 frames. This should not be enough to make a decision.
+ for (int i = 0; i < kFramerate; ++i) {
+ qs_->ReportQP(kLowQp);
+ }
+ });
+ EXPECT_FALSE(observer_->event.Wait(kDefaultTimeoutMs));
+ DO_SYNC(q_, {
+ // Send 30 more. This should result in an adapt request as
+ // enough frames have now been observed.
+ for (int i = 0; i < kFramerate; ++i) {
+ qs_->ReportQP(kLowQp);
+ }
+ });
+ EXPECT_TRUE(observer_->event.Wait(kDefaultTimeoutMs));
+ EXPECT_EQ(0, observer_->adapt_down_events_);
+ EXPECT_EQ(1, observer_->adapt_up_events_);
+}
} // namespace webrtc
#undef DO_SYNC
« no previous file with comments | « webrtc/modules/video_coding/utility/quality_scaler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698