2012-06-13 20:59:12 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2012 The WebM project authors. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
*/
|
|
|
|
#include "third_party/googletest/src/include/gtest/gtest.h"
|
2013-01-18 20:51:12 +01:00
|
|
|
#include "test/codec_factory.h"
|
2012-06-13 20:59:12 +02:00
|
|
|
#include "test/encode_test_driver.h"
|
2013-01-18 20:51:12 +01:00
|
|
|
#include "test/util.h"
|
2012-06-13 20:59:12 +02:00
|
|
|
#include "test/video_source.h"
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
class ConfigTest : public ::libvpx_test::EncoderTest,
|
2013-01-18 20:51:12 +01:00
|
|
|
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
2012-06-13 20:59:12 +02:00
|
|
|
protected:
|
2013-01-18 20:51:12 +01:00
|
|
|
ConfigTest() : EncoderTest(GET_PARAM(0)),
|
|
|
|
frame_count_in_(0), frame_count_out_(0), frame_count_max_(0) {}
|
|
|
|
|
2012-06-13 20:59:12 +02:00
|
|
|
virtual void SetUp() {
|
|
|
|
InitializeConfig();
|
2013-01-18 20:51:12 +01:00
|
|
|
SetMode(GET_PARAM(1));
|
2012-06-13 20:59:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void BeginPassHook(unsigned int /*pass*/) {
|
|
|
|
frame_count_in_ = 0;
|
|
|
|
frame_count_out_ = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void PreEncodeFrameHook(libvpx_test::VideoSource* /*video*/) {
|
|
|
|
++frame_count_in_;
|
|
|
|
abort_ |= (frame_count_in_ >= frame_count_max_);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void FramePktHook(const vpx_codec_cx_pkt_t* /*pkt*/) {
|
|
|
|
++frame_count_out_;
|
|
|
|
}
|
|
|
|
|
2012-08-08 02:44:33 +02:00
|
|
|
virtual bool Continue() const {
|
2012-06-13 20:59:12 +02:00
|
|
|
return !HasFatalFailure() && !abort_;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int frame_count_in_;
|
|
|
|
unsigned int frame_count_out_;
|
|
|
|
unsigned int frame_count_max_;
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST_P(ConfigTest, LagIsDisabled) {
|
|
|
|
frame_count_max_ = 2;
|
|
|
|
cfg_.g_lag_in_frames = 15;
|
|
|
|
|
|
|
|
libvpx_test::DummyVideoSource video;
|
|
|
|
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
|
|
|
|
|
|
|
EXPECT_EQ(frame_count_in_, frame_count_out_);
|
|
|
|
}
|
|
|
|
|
2013-01-18 20:51:12 +01:00
|
|
|
VP8_INSTANTIATE_TEST_CASE(ConfigTest, ONE_PASS_TEST_MODES);
|
2012-06-13 20:59:12 +02:00
|
|
|
} // namespace
|