Add ability for inject custom codec factories in VP integration test.
This makes it easier to add new test cases without modifying the actual test class. Bug: None Change-Id: I48e4f14e26cd6610678ffb07ce9fd56e6bc1ac4e Reviewed-on: https://webrtc-review.googlesource.com/69600 Commit-Queue: Kári Helgason <kthelgason@webrtc.org> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22840}
This commit is contained in:
committed by
Commit Bot
parent
98a91ad454
commit
c3f8c759c4
@ -16,8 +16,6 @@
|
||||
|
||||
#if defined(WEBRTC_ANDROID)
|
||||
#include "modules/video_coding/codecs/test/android_codec_factory_helper.h"
|
||||
#elif defined(WEBRTC_IOS)
|
||||
#include "modules/video_coding/codecs/test/objc_codec_factory_helper.h"
|
||||
#endif
|
||||
|
||||
#include "api/video_codecs/sdp_video_format.h"
|
||||
@ -298,35 +296,37 @@ void VideoProcessorIntegrationTest::VerifyVideoStatistic(
|
||||
}
|
||||
}
|
||||
|
||||
void VideoProcessorIntegrationTest::CreateEncoderAndDecoder() {
|
||||
if (config_.hw_encoder) {
|
||||
#if defined(WEBRTC_ANDROID)
|
||||
encoder_factory_ = CreateAndroidEncoderFactory();
|
||||
#elif defined(WEBRTC_IOS)
|
||||
EXPECT_EQ(kVideoCodecH264, config_.codec_settings.codecType)
|
||||
<< "iOS HW codecs only support H264.";
|
||||
encoder_factory_ = CreateObjCEncoderFactory();
|
||||
#else
|
||||
RTC_NOTREACHED() << "Only support HW encoder on Android and iOS.";
|
||||
#endif
|
||||
} else {
|
||||
encoder_factory_ = rtc::MakeUnique<InternalEncoderFactory>();
|
||||
}
|
||||
|
||||
std::unique_ptr<VideoDecoderFactory> decoder_factory;
|
||||
std::unique_ptr<VideoDecoderFactory>
|
||||
VideoProcessorIntegrationTest::CreateDecoderFactory() {
|
||||
if (config_.hw_decoder) {
|
||||
#if defined(WEBRTC_ANDROID)
|
||||
decoder_factory = CreateAndroidDecoderFactory();
|
||||
#elif defined(WEBRTC_IOS)
|
||||
EXPECT_EQ(kVideoCodecH264, config_.codec_settings.codecType)
|
||||
<< "iOS HW codecs only support H264.";
|
||||
decoder_factory = CreateObjCDecoderFactory();
|
||||
return CreateAndroidDecoderFactory();
|
||||
#else
|
||||
RTC_NOTREACHED() << "Only support HW decoder on Android and iOS.";
|
||||
RTC_NOTREACHED() << "Only support HW decoder on Android.";
|
||||
return nullptr;
|
||||
#endif
|
||||
} else {
|
||||
decoder_factory = rtc::MakeUnique<InternalDecoderFactory>();
|
||||
return rtc::MakeUnique<InternalDecoderFactory>();
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<VideoEncoderFactory>
|
||||
VideoProcessorIntegrationTest::CreateEncoderFactory() {
|
||||
if (config_.hw_encoder) {
|
||||
#if defined(WEBRTC_ANDROID)
|
||||
return CreateAndroidEncoderFactory();
|
||||
#else
|
||||
RTC_NOTREACHED() << "Only support HW encoder on Android.";
|
||||
return nullptr;
|
||||
#endif
|
||||
} else {
|
||||
return rtc::MakeUnique<InternalEncoderFactory>();
|
||||
}
|
||||
}
|
||||
|
||||
void VideoProcessorIntegrationTest::CreateEncoderAndDecoder() {
|
||||
encoder_factory_ = CreateEncoderFactory();
|
||||
std::unique_ptr<VideoDecoderFactory> decoder_factory = CreateDecoderFactory();
|
||||
|
||||
const SdpVideoFormat format = config_.ToSdpVideoFormat();
|
||||
if (config_.simulcast_adapted_encoder) {
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "api/video_codecs/video_decoder_factory.h"
|
||||
#include "api/video_codecs/video_encoder_factory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "common_video/h264/h264_common.h"
|
||||
@ -98,6 +99,11 @@ class VideoProcessorIntegrationTest : public testing::Test {
|
||||
// Can be used by all H.264 tests.
|
||||
const H264KeyframeChecker h264_keyframe_checker_;
|
||||
|
||||
protected:
|
||||
// Overwrite in subclasses for custom codec factories.
|
||||
virtual std::unique_ptr<VideoDecoderFactory> CreateDecoderFactory();
|
||||
virtual std::unique_ptr<VideoEncoderFactory> CreateEncoderFactory();
|
||||
|
||||
private:
|
||||
class CpuProcessTime;
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "modules/video_coding/codecs/test/objc_codec_factory_helper.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/testsupport/fileutils.h"
|
||||
|
||||
@ -33,12 +34,32 @@ class VideoProcessorIntegrationTestVideoToolbox
|
||||
config_.hw_decoder = true;
|
||||
config_.encoded_frame_checker = &h264_keyframe_checker_;
|
||||
}
|
||||
|
||||
std::unique_ptr<VideoDecoderFactory> CreateDecoderFactory() override {
|
||||
if (config_.hw_decoder) {
|
||||
EXPECT_EQ(kVideoCodecH264, config_.codec_settings.codecType)
|
||||
<< "iOS HW codecs only support H264.";
|
||||
return CreateObjCDecoderFactory();
|
||||
}
|
||||
RTC_NOTREACHED() << "Only support HW decoder on iOS.";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<VideoEncoderFactory> CreateEncoderFactory() override {
|
||||
if (config_.hw_encoder) {
|
||||
EXPECT_EQ(kVideoCodecH264, config_.codec_settings.codecType)
|
||||
<< "iOS HW codecs only support H264.";
|
||||
return CreateObjCEncoderFactory();
|
||||
}
|
||||
RTC_NOTREACHED() << "Only support HW encoder on iOS.";
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
// TODO(webrtc:9099): Disabled until the issue is fixed.
|
||||
// HW codecs don't work on simulators. Only run these tests on device.
|
||||
// #if TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
|
||||
// #define MAYBE_TEST_F TEST_F
|
||||
// #define MAYBE_TEST_F TEST_F
|
||||
// #else
|
||||
#define MAYBE_TEST_F(s, name) TEST_F(s, DISABLED_##name)
|
||||
// #endif
|
||||
|
||||
Reference in New Issue
Block a user