Remove adapter bools from VideoCodecTestFixture::Config.
It should be the responsibility of the fixture user to provide the exact codecs that should be tested instead. This reduces the coupling between the test fixture and the codec instantiation. Bug: webrtc:9317 Change-Id: I60d8f5c4b516ba33e2293d574ba17602c39f992b Reviewed-on: https://webrtc-review.googlesource.com/79147 Commit-Queue: Rasmus Brandt <brandtr@webrtc.org> Reviewed-by: Sergey Silkin <ssilkin@webrtc.org> Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23425}
This commit is contained in:

committed by
Commit Bot

parent
b92f4800d7
commit
2aae2733a7
@ -18,16 +18,12 @@
|
||||
#include "call/video_config.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "media/base/h264_profile_level_id.h"
|
||||
#include "media/base/mediaconstants.h"
|
||||
#include "media/engine/internaldecoderfactory.h"
|
||||
#include "media/engine/internalencoderfactory.h"
|
||||
#include "media/engine/simulcast.h"
|
||||
#include "media/engine/simulcast_encoder_adapter.h"
|
||||
#include "media/engine/videodecodersoftwarefallbackwrapper.h"
|
||||
#include "media/engine/videoencodersoftwarefallbackwrapper.h"
|
||||
#include "modules/video_coding/codecs/vp8/include/vp8_common_types.h"
|
||||
#include "modules/video_coding/codecs/vp9/svc_config.h"
|
||||
#include "modules/video_coding/include/video_codec_interface.h"
|
||||
#include "modules/video_coding/include/video_coding.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/cpu_time.h"
|
||||
#include "rtc_base/event.h"
|
||||
@ -559,39 +555,17 @@ void VideoCodecTestFixtureImpl::CreateEncoderAndDecoder() {
|
||||
params = {};
|
||||
}
|
||||
SdpVideoFormat format(config_.codec_name);
|
||||
if (config_.simulcast_adapted_encoder) {
|
||||
EXPECT_EQ("VP8", format.name);
|
||||
encoder_.reset(new SimulcastEncoderAdapter(encoder_factory_.get(), format));
|
||||
} else {
|
||||
encoder_ = encoder_factory_->CreateVideoEncoder(format);
|
||||
}
|
||||
|
||||
encoder_ = encoder_factory_->CreateVideoEncoder(format);
|
||||
EXPECT_TRUE(encoder_) << "Encoder not successfully created.";
|
||||
|
||||
const size_t num_simulcast_or_spatial_layers = std::max(
|
||||
config_.NumberOfSimulcastStreams(), config_.NumberOfSpatialLayers());
|
||||
|
||||
for (size_t i = 0; i < num_simulcast_or_spatial_layers; ++i) {
|
||||
decoders_.push_back(std::unique_ptr<VideoDecoder>(
|
||||
decoder_factory_->CreateVideoDecoder(format)));
|
||||
}
|
||||
|
||||
if (config_.sw_fallback_encoder) {
|
||||
EXPECT_FALSE(config_.simulcast_adapted_encoder)
|
||||
<< "SimulcastEncoderAdapter and VideoEncoderSoftwareFallbackWrapper "
|
||||
"are not jointly supported.";
|
||||
encoder_ = rtc::MakeUnique<VideoEncoderSoftwareFallbackWrapper>(
|
||||
InternalEncoderFactory().CreateVideoEncoder(format),
|
||||
std::move(encoder_));
|
||||
}
|
||||
if (config_.sw_fallback_decoder) {
|
||||
for (auto& decoder : decoders_) {
|
||||
decoder = rtc::MakeUnique<VideoDecoderSoftwareFallbackWrapper>(
|
||||
InternalDecoderFactory().CreateVideoDecoder(format),
|
||||
std::move(decoder));
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_TRUE(encoder_) << "Encoder not successfully created.";
|
||||
|
||||
for (const auto& decoder : decoders_) {
|
||||
EXPECT_TRUE(decoder) << "Decoder not successfully created.";
|
||||
}
|
||||
|
@ -11,10 +11,15 @@
|
||||
#include <vector>
|
||||
|
||||
#include "api/test/create_videocodec_test_fixture.h"
|
||||
#include "api/video_codecs/sdp_video_format.h"
|
||||
#include "media/base/mediaconstants.h"
|
||||
#include "media/engine/internaldecoderfactory.h"
|
||||
#include "media/engine/internalencoderfactory.h"
|
||||
#include "media/engine/simulcast_encoder_adapter.h"
|
||||
#include "modules/video_coding/utility/vp8_header_parser.h"
|
||||
#include "modules/video_coding/utility/vp9_uncompressed_header_parser.h"
|
||||
#include "rtc_base/ptr_util.h"
|
||||
#include "test/function_video_encoder_factory.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/testsupport/fileutils.h"
|
||||
|
||||
@ -374,12 +379,23 @@ TEST(VideoCodecTestLibvpx, MAYBE_SimulcastVP8) {
|
||||
config.filename = "ConferenceMotion_1280_720_50";
|
||||
config.filepath = ResourcePath(config.filename, "yuv");
|
||||
config.num_frames = 100;
|
||||
config.simulcast_adapted_encoder = true;
|
||||
config.SetCodecSettings(cricket::kVp8CodecName, 3, 1, 3, true, true, false,
|
||||
1280, 720);
|
||||
const auto frame_checker = rtc::MakeUnique<QpFrameChecker>();
|
||||
config.encoded_frame_checker = frame_checker.get();
|
||||
auto fixture = CreateVideoCodecTestFixture(config);
|
||||
|
||||
InternalEncoderFactory internal_encoder_factory;
|
||||
std::unique_ptr<VideoEncoderFactory> adapted_encoder_factory =
|
||||
rtc::MakeUnique<FunctionVideoEncoderFactory>([&]() {
|
||||
return rtc::MakeUnique<SimulcastEncoderAdapter>(
|
||||
&internal_encoder_factory, SdpVideoFormat(cricket::kVp8CodecName));
|
||||
});
|
||||
std::unique_ptr<InternalDecoderFactory> internal_decoder_factory(
|
||||
new InternalDecoderFactory());
|
||||
|
||||
auto fixture =
|
||||
CreateVideoCodecTestFixture(config, std::move(internal_decoder_factory),
|
||||
std::move(adapted_encoder_factory));
|
||||
|
||||
std::vector<RateProfile> rate_profiles = {{1500, 30, config.num_frames}};
|
||||
|
||||
|
Reference in New Issue
Block a user