Rename VideoCodecTest to VideoCodecUnitTest.

The VideoCodecTest class is a fixture base class for the
libvpx-VP8, libvpx-VP9, and OpenH264 unit tests. It is unrelated
to the VideoProcessor tests, which we colloquially refer to as
the "codec test".

This rename is thus to reduce this confusion. It should have no
functional impact.

Bug: webrtc:8448
Change-Id: If73443bda5df0f29a71ce6ce069ac128795ff0ad
Reviewed-on: https://webrtc-review.googlesource.com/47160
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Commit-Queue: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21867}
This commit is contained in:
Rasmus Brandt
2018-02-01 15:45:38 +01:00
committed by Commit Bot
parent 682dc619f2
commit 98a867ccd2
7 changed files with 32 additions and 30 deletions

View File

@ -508,8 +508,8 @@ if (rtc_include_tests) {
"codecs/test/stats.h",
"codecs/test/test_config.cc",
"codecs/test/test_config.h",
"codecs/test/video_codec_test.cc",
"codecs/test/video_codec_test.h",
"codecs/test/video_codec_unittest.cc",
"codecs/test/video_codec_unittest.h",
"codecs/test/videoprocessor.cc",
"codecs/test/videoprocessor.h",
]

View File

@ -10,11 +10,11 @@
#include "common_video/libyuv/include/webrtc_libyuv.h"
#include "modules/video_coding/codecs/h264/include/h264.h"
#include "modules/video_coding/codecs/test/video_codec_test.h"
#include "modules/video_coding/codecs/test/video_codec_unittest.h"
namespace webrtc {
class TestH264Impl : public VideoCodecTest {
class TestH264Impl : public VideoCodecUnitTest {
protected:
std::unique_ptr<VideoEncoder> CreateEncoder() override {
return H264Encoder::Create(cricket::VideoCodec(cricket::kH264CodecName));

View File

@ -17,7 +17,7 @@
#include "modules/video_coding/codecs/multiplex/include/multiplex_decoder_adapter.h"
#include "modules/video_coding/codecs/multiplex/include/multiplex_encoded_image_packer.h"
#include "modules/video_coding/codecs/multiplex/include/multiplex_encoder_adapter.h"
#include "modules/video_coding/codecs/test/video_codec_test.h"
#include "modules/video_coding/codecs/test/video_codec_unittest.h"
#include "modules/video_coding/codecs/vp9/include/vp9.h"
#include "rtc_base/keep_ref_until_done.h"
#include "rtc_base/ptr_util.h"
@ -31,7 +31,7 @@ constexpr const char* kMultiplexAssociatedCodecName = cricket::kVp9CodecName;
const VideoCodecType kMultiplexAssociatedCodecType =
PayloadStringToCodecType(kMultiplexAssociatedCodecName);
class TestMultiplexAdapter : public VideoCodecTest {
class TestMultiplexAdapter : public VideoCodecUnitTest {
public:
TestMultiplexAdapter()
: decoder_factory_(new webrtc::MockVideoDecoderFactory),
@ -101,14 +101,14 @@ class TestMultiplexAdapter : public VideoCodecTest {
.WillOnce(Return(encoder1))
.WillOnce(Return(encoder2));
VideoCodecTest::SetUp();
VideoCodecUnitTest::SetUp();
}
const std::unique_ptr<webrtc::MockVideoDecoderFactory> decoder_factory_;
const std::unique_ptr<webrtc::MockVideoEncoderFactory> encoder_factory_;
};
// TODO(emircan): Currently VideoCodecTest tests do a complete setup
// TODO(emircan): Currently VideoCodecUnitTest tests do a complete setup
// step that goes beyond constructing |decoder_|. Simplify these tests to do
// less.
TEST_F(TestMultiplexAdapter, ConstructAndDestructDecoder) {

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "modules/video_coding/codecs/test/video_codec_test.h"
#include "modules/video_coding/codecs/test/video_codec_unittest.h"
#include "api/video/i420_buffer.h"
#include "modules/video_coding/include/video_error_codes.h"
@ -28,7 +28,7 @@ static const int kMaxFramerate = 30; // Arbitrary value.
namespace webrtc {
EncodedImageCallback::Result
VideoCodecTest::FakeEncodeCompleteCallback::OnEncodedImage(
VideoCodecUnitTest::FakeEncodeCompleteCallback::OnEncodedImage(
const EncodedImage& frame,
const CodecSpecificInfo* codec_specific_info,
const RTPFragmentationHeader* fragmentation) {
@ -49,7 +49,7 @@ VideoCodecTest::FakeEncodeCompleteCallback::OnEncodedImage(
return Result(Result::OK);
}
void VideoCodecTest::FakeDecodeCompleteCallback::Decoded(
void VideoCodecUnitTest::FakeDecodeCompleteCallback::Decoded(
VideoFrame& frame,
rtc::Optional<int32_t> decode_time_ms,
rtc::Optional<uint8_t> qp) {
@ -59,7 +59,7 @@ void VideoCodecTest::FakeDecodeCompleteCallback::Decoded(
test_->decoded_frame_event_.Set();
}
void VideoCodecTest::SetUp() {
void VideoCodecUnitTest::SetUp() {
// Using a QCIF image. Processing only one frame.
FILE* source_file_ =
fopen(test::ResourcePath("paris_qcif", "yuv").c_str(), "rb");
@ -77,7 +77,7 @@ void VideoCodecTest::SetUp() {
InitCodecs();
}
bool VideoCodecTest::WaitForEncodedFrame(
bool VideoCodecUnitTest::WaitForEncodedFrame(
EncodedImage* frame,
CodecSpecificInfo* codec_specific_info) {
std::vector<EncodedImage> frames;
@ -91,12 +91,12 @@ bool VideoCodecTest::WaitForEncodedFrame(
return true;
}
void VideoCodecTest::SetWaitForEncodedFramesThreshold(size_t num_frames) {
void VideoCodecUnitTest::SetWaitForEncodedFramesThreshold(size_t num_frames) {
rtc::CritScope lock(&encoded_frame_section_);
wait_for_encoded_frames_threshold_ = num_frames;
}
bool VideoCodecTest::WaitForEncodedFrames(
bool VideoCodecUnitTest::WaitForEncodedFrames(
std::vector<EncodedImage>* frames,
std::vector<CodecSpecificInfo>* codec_specific_info) {
EXPECT_TRUE(encoded_frame_event_.Wait(kEncodeTimeoutMs))
@ -118,8 +118,8 @@ bool VideoCodecTest::WaitForEncodedFrames(
}
}
bool VideoCodecTest::WaitForDecodedFrame(std::unique_ptr<VideoFrame>* frame,
rtc::Optional<uint8_t>* qp) {
bool VideoCodecUnitTest::WaitForDecodedFrame(std::unique_ptr<VideoFrame>* frame,
rtc::Optional<uint8_t>* qp) {
bool ret = decoded_frame_event_.Wait(kDecodeTimeoutMs);
EXPECT_TRUE(ret) << "Timed out while waiting for a decoded frame.";
// This becomes unsafe if there are multiple threads waiting for frames.
@ -135,7 +135,7 @@ bool VideoCodecTest::WaitForDecodedFrame(std::unique_ptr<VideoFrame>* frame,
}
}
void VideoCodecTest::InitCodecs() {
void VideoCodecUnitTest::InitCodecs() {
codec_settings_ = codec_settings();
codec_settings_.startBitrate = kStartBitrate;
codec_settings_.targetBitrate = kTargetBitrate;

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_TEST_H_
#define MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_TEST_H_
#ifndef MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_UNITTEST_H_
#define MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_UNITTEST_H_
#include <memory>
#include <vector>
@ -26,9 +26,9 @@
namespace webrtc {
class VideoCodecTest : public ::testing::Test {
class VideoCodecUnitTest : public ::testing::Test {
public:
VideoCodecTest()
VideoCodecUnitTest()
: encode_complete_callback_(this),
decode_complete_callback_(this),
encoded_frame_event_(false /* manual reset */,
@ -40,19 +40,21 @@ class VideoCodecTest : public ::testing::Test {
protected:
class FakeEncodeCompleteCallback : public webrtc::EncodedImageCallback {
public:
explicit FakeEncodeCompleteCallback(VideoCodecTest* test) : test_(test) {}
explicit FakeEncodeCompleteCallback(VideoCodecUnitTest* test)
: test_(test) {}
Result OnEncodedImage(const EncodedImage& frame,
const CodecSpecificInfo* codec_specific_info,
const RTPFragmentationHeader* fragmentation);
private:
VideoCodecTest* const test_;
VideoCodecUnitTest* const test_;
};
class FakeDecodeCompleteCallback : public webrtc::DecodedImageCallback {
public:
explicit FakeDecodeCompleteCallback(VideoCodecTest* test) : test_(test) {}
explicit FakeDecodeCompleteCallback(VideoCodecUnitTest* test)
: test_(test) {}
int32_t Decoded(VideoFrame& frame) override {
RTC_NOTREACHED();
@ -67,7 +69,7 @@ class VideoCodecTest : public ::testing::Test {
rtc::Optional<uint8_t> qp) override;
private:
VideoCodecTest* const test_;
VideoCodecUnitTest* const test_;
};
virtual std::unique_ptr<VideoEncoder> CreateEncoder() = 0;
@ -123,4 +125,4 @@ class VideoCodecTest : public ::testing::Test {
} // namespace webrtc
#endif // MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_TEST_H_
#endif // MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_UNITTEST_H_

View File

@ -15,9 +15,9 @@
#include "api/optional.h"
#include "api/video/i420_buffer.h"
#include "common_video/libyuv/include/webrtc_libyuv.h"
#include "modules/video_coding/codecs/test/video_codec_test.h"
#include "modules/video_coding/codecs/vp8/include/vp8.h"
#include "modules/video_coding/codecs/vp8/temporal_layers.h"
#include "modules/video_coding/utility/vp8_header_parser.h"
#include "rtc_base/checks.h"
#include "rtc_base/timeutils.h"
#include "test/field_trial.h"

View File

@ -9,8 +9,8 @@
*/
#include "common_video/libyuv/include/webrtc_libyuv.h"
#include "modules/video_coding/codecs/test/video_codec_unittest.h"
#include "modules/video_coding/codecs/vp9/include/vp9.h"
#include "modules/video_coding/codecs/test/video_codec_test.h"
namespace webrtc {
@ -18,7 +18,7 @@ namespace {
constexpr uint32_t kTimestampIncrementPerFrame = 3000;
} // namespace
class TestVp9Impl : public VideoCodecTest {
class TestVp9Impl : public VideoCodecUnitTest {
protected:
std::unique_ptr<VideoEncoder> CreateEncoder() override {
return VP9Encoder::Create();