• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2012 The WebM project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 #include "third_party/googletest/src/include/gtest/gtest.h"
11 #include "test/codec_factory.h"
12 #include "test/encode_test_driver.h"
13 #include "test/util.h"
14 #include "test/video_source.h"
15 
16 namespace {
17 
18 class ConfigTest
19     : public ::libvpx_test::EncoderTest,
20       public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
21  protected:
ConfigTest()22   ConfigTest()
23       : EncoderTest(GET_PARAM(0)), frame_count_in_(0), frame_count_out_(0),
24         frame_count_max_(0) {}
~ConfigTest()25   virtual ~ConfigTest() {}
26 
SetUp()27   virtual void SetUp() {
28     InitializeConfig();
29     SetMode(GET_PARAM(1));
30   }
31 
BeginPassHook(unsigned int)32   virtual void BeginPassHook(unsigned int /*pass*/) {
33     frame_count_in_ = 0;
34     frame_count_out_ = 0;
35   }
36 
PreEncodeFrameHook(libvpx_test::VideoSource *)37   virtual void PreEncodeFrameHook(libvpx_test::VideoSource * /*video*/) {
38     ++frame_count_in_;
39     abort_ |= (frame_count_in_ >= frame_count_max_);
40   }
41 
FramePktHook(const vpx_codec_cx_pkt_t *)42   virtual void FramePktHook(const vpx_codec_cx_pkt_t * /*pkt*/) {
43     ++frame_count_out_;
44   }
45 
46   unsigned int frame_count_in_;
47   unsigned int frame_count_out_;
48   unsigned int frame_count_max_;
49 };
50 
TEST_P(ConfigTest,LagIsDisabled)51 TEST_P(ConfigTest, LagIsDisabled) {
52   frame_count_max_ = 2;
53   cfg_.g_lag_in_frames = 15;
54 
55   libvpx_test::DummyVideoSource video;
56   ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
57 
58   EXPECT_EQ(frame_count_in_, frame_count_out_);
59 }
60 
61 VP8_INSTANTIATE_TEST_CASE(ConfigTest, ONE_PASS_TEST_MODES);
62 }  // namespace
63