Chromium Code Reviews| Index: remoting/codec/codec_test.cc |
| diff --git a/remoting/codec/codec_test.cc b/remoting/codec/codec_test.cc |
| index 8b9511ce7bea16809d286058e00ce7fc7a95144e..6cf3dc628129fe1a7d5cc0e669c6be790707c212 100644 |
| --- a/remoting/codec/codec_test.cc |
| +++ b/remoting/codec/codec_test.cc |
| @@ -247,7 +247,7 @@ scoped_ptr<DesktopFrame> PrepareFrame(const DesktopSize& size) { |
| static void TestEncodingRects(VideoEncoder* encoder, |
| VideoEncoderTester* tester, |
| - webrtc::DesktopFrame* frame, |
| + DesktopFrame* frame, |
| const DesktopRect* rects, |
| int count) { |
| frame->mutable_updated_region()->Clear(); |
| @@ -267,7 +267,7 @@ void TestVideoEncoder(VideoEncoder* encoder, bool strict) { |
| for (size_t xi = 0; xi < arraysize(kSizes); ++xi) { |
| for (size_t yi = 0; yi < arraysize(kSizes); ++yi) { |
| DesktopSize size = DesktopSize(kSizes[xi], kSizes[yi]); |
| - scoped_ptr<webrtc::DesktopFrame> frame = PrepareFrame(size); |
| + scoped_ptr<DesktopFrame> frame = PrepareFrame(size); |
| std::vector<std::vector<DesktopRect> > test_rect_lists = |
| MakeTestRectLists(size); |
| for (size_t i = 0; i < test_rect_lists.size(); ++i) { |
| @@ -275,10 +275,33 @@ void TestVideoEncoder(VideoEncoder* encoder, bool strict) { |
| TestEncodingRects(encoder, &tester, frame.get(), |
| &test_rects[0], test_rects.size()); |
| } |
| + |
| + // Pass some empty frames through the encoder. |
| + for (int i = 0; i < 10; ++i) { |
| + TestEncodingRects(encoder, &tester, frame.get(), nullptr, 0); |
| + } |
| } |
| } |
| } |
| +void TestVideoEncoderEmptyFrames(VideoEncoder* encoder, int max_topoff_frames) { |
| + const DesktopSize kSize(640, 480); |
| + scoped_ptr<DesktopFrame> frame(PrepareFrame(kSize)); |
| + frame->mutable_updated_region()->SetRect( |
| + webrtc::DesktopRect::MakeSize(kSize)); |
| + EXPECT_TRUE(encoder->Encode(*frame)); |
| + |
| + frame->mutable_updated_region()->Clear(); |
| + int topoff_frame_count = 0; |
| + do { |
|
Sergey Ulanov
2015/06/09 05:32:43
nit: this can be a simpler for loop:
for (int i
Wez
2015/06/09 22:00:37
That implementation would enforce that there are e
|
| + bool topped_off = encoder->Encode(*frame) != nullptr; |
| + if (!topped_off) |
| + break; |
| + topoff_frame_count++; |
| + } while (topoff_frame_count <= max_topoff_frames); |
| + EXPECT_LE(topoff_frame_count, max_topoff_frames); |
| +} |
| + |
| static void TestEncodeDecodeRects(VideoEncoder* encoder, |
| VideoEncoderTester* encoder_tester, |
| VideoDecoderTester* decoder_tester, |