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

Unified Diff: remoting/codec/codec_test.cc

Issue 1213323003: Supply empty frames until codec is done with top-off. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Loosen top-off frame count tests Created 5 years, 5 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 | « remoting/codec/codec_test.h ('k') | remoting/codec/video_encoder_vpx.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/codec/codec_test.cc
diff --git a/remoting/codec/codec_test.cc b/remoting/codec/codec_test.cc
index 51b52f03ee2358b8073051ba330e61d5bffafde2..c5e1daedc7ddd6c3b638d3421adafebe379b0677 100644
--- a/remoting/codec/codec_test.cc
+++ b/remoting/codec/codec_test.cc
@@ -284,7 +284,8 @@ void TestVideoEncoder(VideoEncoder* encoder, bool strict) {
}
}
-void TestVideoEncoderEmptyFrames(VideoEncoder* encoder, int topoff_frames) {
+void TestVideoEncoderEmptyFrames(VideoEncoder* encoder,
+ int max_topoff_frames) {
const DesktopSize kSize(640, 480);
scoped_ptr<DesktopFrame> frame(PrepareFrame(kSize));
@@ -292,12 +293,19 @@ void TestVideoEncoderEmptyFrames(VideoEncoder* encoder, int topoff_frames) {
webrtc::DesktopRect::MakeSize(kSize));
EXPECT_TRUE(encoder->Encode(*frame));
+ int topoff_frames = 0;
frame->mutable_updated_region()->Clear();
- for (int i=0; i < topoff_frames; ++i) {
- EXPECT_TRUE(encoder->Encode(*frame));
+ for (int i = 0; i < max_topoff_frames + 1; ++i) {
+ if (!encoder->Encode(*frame))
+ break;
+ topoff_frames++;
}
- EXPECT_FALSE(encoder->Encode(*frame));
+ // If top-off is enabled then our random frame contents should always
+ // trigger it, so expect at least one top-off frame - strictly, though,
+ // an encoder may not always need to top-off.
+ EXPECT_GE(topoff_frames, max_topoff_frames ? 1 : 0);
+ EXPECT_LE(topoff_frames, max_topoff_frames);
}
static void TestEncodeDecodeRects(VideoEncoder* encoder,
« no previous file with comments | « remoting/codec/codec_test.h ('k') | remoting/codec/video_encoder_vpx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698