Convert MediaOmx tests to parameterized gtest
Bug: 142950220 Test: atest VtsHalMediaOmxV1_0TargetMasterTest \ VtsHalMediaOmxV1_0TargetComponentTest \ VtsHalMediaOmxV1_0TargetAudioEncTest \ VtsHalMediaOmxV1_0TargetAudioDecTest \ VtsHalMediaOmxV1_0TargetVideoDecTest \ VtsHalMediaOmxV1_0TargetVideoEncTest Change-Id: Id1b8f6073c98db36c0ac86a881e7220ecfd0a71f Merged-In: Id1b8f6073c98db36c0ac86a881e7220ecfd0a71f
This commit is contained in:
parent
03a34b7964
commit
d6fea1eaa1
22 changed files with 709 additions and 441 deletions
27
media/Android.bp
Normal file
27
media/Android.bp
Normal file
|
@ -0,0 +1,27 @@
|
|||
//
|
||||
// Copyright (C) 2020 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
filegroup {
|
||||
name: "media_omx_audio_res",
|
||||
path: "res",
|
||||
srcs: ["res/*hz*"],
|
||||
}
|
||||
|
||||
filegroup {
|
||||
name: "media_omx_video_res",
|
||||
path: "res",
|
||||
srcs: ["res/*fps*"],
|
||||
}
|
|
@ -6,29 +6,27 @@ The scope of the tests presented here is not restricted solely to testing omx ha
|
|||
#### master :
|
||||
Functionality of master is to enumerate all the omx components (and the roles it supports) available in android media framework.
|
||||
|
||||
usage: VtsHalMediaOmxV1\_0TargetMasterTest -I default
|
||||
usage: atest VtsHalMediaOmxV1\_0TargetMasterTest
|
||||
|
||||
#### component :
|
||||
This folder includes test fixtures that tests aspects common to all omx compatible components. For instance, port enabling/disabling, enumerating port formats, state transitions, flush, ..., stay common to all components irrespective of the service they offer. Test fixtures here are directed towards testing these (omx core). Every standard OMX compatible component is expected to pass these tests.
|
||||
|
||||
usage: VtsHalMediaOmxV1\_0TargetComponentTest -I default -C <comp name> -R <comp role>
|
||||
usage: atest VtsHalMediaOmxV1\_0TargetComponentTest
|
||||
|
||||
#### audio :
|
||||
This folder includes test fixtures associated with testing audio encoder and decoder components such as simple encoding of a raw clip or decoding of an elementary stream, end of stream test, timestamp deviations test, flush test and so on. These tests are aimed towards testing the plugin that connects the component to the omx core.
|
||||
|
||||
usage:
|
||||
|
||||
VtsHalMediaOmxV1\_0TargetAudioDecTest -I default -C <comp name> -R audio_decoder.<comp class> -P /data/local/tmp/media/
|
||||
atest VtsHalMediaOmxV1\_0TargetAudioDecTest
|
||||
|
||||
VtsHalMediaOmxV1\_0TargetAudioEncTest -I default -C <comp name> -R audio_encoder.<comp class> -P /data/local/tmp/media/
|
||||
atest VtsHalMediaOmxV1\_0TargetAudioEncTest
|
||||
|
||||
#### video :
|
||||
This folder includes test fixtures associated with testing video encoder and decoder components such as simple encoding of a raw clip or decoding of an elementary stream, end of stream test, timestamp deviations test, flush test and so on. These tests are aimed towards testing the plugin that connects the component to the omx core.
|
||||
|
||||
usage:
|
||||
|
||||
VtsHalMediaOmxV1\_0TargetVideoDecTest -I default -C <comp name> -R video_decoder.<comp class> -P /data/local/tmp/media/
|
||||
atest VtsHalMediaOmxV1\_0TargetVideoDecTest
|
||||
|
||||
VtsHalMediaOmxV1\_0TargetVideoEncTest -I default -C <comp name> -R video_encoder.<comp class> -P /data/local/tmp/media/
|
||||
|
||||
While tesing audio/video encoder, decoder components, test fixtures require input files. These input are files are present in the folder 'res'. Before running the tests all the files in 'res' have to be placed in '/data/local/tmp/media' or a path of your choice and this path needs to be provided as an argument to the test application
|
||||
atest VtsHalMediaOmxV1\_0TargetVideoEncTest
|
||||
|
|
|
@ -16,22 +16,30 @@
|
|||
|
||||
cc_test {
|
||||
name: "VtsHalMediaOmxV1_0TargetAudioEncTest",
|
||||
stem: "vts_hal_media_omx_v1_0_audio_enc_test",
|
||||
defaults: ["VtsHalMediaOmxV1_0Defaults"],
|
||||
srcs: [
|
||||
"VtsHalMediaOmxV1_0TargetAudioEncTest.cpp",
|
||||
"media_audio_hidl_test_common.cpp"
|
||||
"media_audio_hidl_test_common.cpp",
|
||||
],
|
||||
data: [":media_omx_audio_res"],
|
||||
test_config: "VtsHalMediaOmxV1_0TargetAudioEncTest.xml",
|
||||
test_suites: [
|
||||
"vts-core",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
}
|
||||
|
||||
cc_test {
|
||||
name: "VtsHalMediaOmxV1_0TargetAudioDecTest",
|
||||
stem: "vts_hal_media_omx_v1_0_audio_dec_test",
|
||||
defaults: ["VtsHalMediaOmxV1_0Defaults"],
|
||||
srcs: [
|
||||
"VtsHalMediaOmxV1_0TargetAudioDecTest.cpp",
|
||||
"media_audio_hidl_test_common.cpp"
|
||||
"media_audio_hidl_test_common.cpp",
|
||||
],
|
||||
data: [":media_omx_audio_res"],
|
||||
test_config: "VtsHalMediaOmxV1_0TargetAudioDecTest.xml",
|
||||
test_suites: [
|
||||
"vts-core",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <android/hidl/allocator/1.0/IAllocator.h>
|
||||
#include <android/hidl/memory/1.0/IMapper.h>
|
||||
#include <android/hidl/memory/1.0/IMemory.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
|
||||
using ::android::hardware::media::omx::V1_0::IOmx;
|
||||
using ::android::hardware::media::omx::V1_0::IOmxObserver;
|
||||
|
@ -44,48 +46,45 @@ using ::android::hardware::hidl_vec;
|
|||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <getopt.h>
|
||||
#include <media_audio_hidl_test_common.h>
|
||||
#include <media_hidl_test_common.h>
|
||||
#include <fstream>
|
||||
|
||||
static ComponentTestEnvironment* gEnv = nullptr;
|
||||
// Resource directory
|
||||
std::string sResourceDir = "";
|
||||
|
||||
// audio decoder test fixture class
|
||||
class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
private:
|
||||
typedef ::testing::VtsHalHidlTargetTestBase Super;
|
||||
public:
|
||||
::std::string getTestCaseInfo() const override {
|
||||
return ::std::string() +
|
||||
"Component: " + gEnv->getComponent().c_str() + " | " +
|
||||
"Role: " + gEnv->getRole().c_str() + " | " +
|
||||
"Instance: " + gEnv->getInstance().c_str() + " | " +
|
||||
"Res: " + gEnv->getRes().c_str();
|
||||
class AudioDecHidlTest
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string, std::string>> {
|
||||
public:
|
||||
::std::string getTestCaseInfo() const {
|
||||
return ::std::string() + "Component: " + component_ + " | " + "Role: " + role_ + " | " +
|
||||
"Instance: " + instance_ + " | " + "Res: " + sResourceDir;
|
||||
}
|
||||
|
||||
virtual void SetUp() override {
|
||||
Super::SetUp();
|
||||
instance_ = std::get<0>(GetParam());
|
||||
component_ = std::get<1>(GetParam());
|
||||
role_ = std::get<2>(GetParam());
|
||||
ASSERT_NE(sResourceDir.empty(), true);
|
||||
|
||||
disableTest = false;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
omx = Super::getService<IOmx>(gEnv->getInstance());
|
||||
omx = IOmx::getService(instance_);
|
||||
ASSERT_NE(omx, nullptr);
|
||||
observer =
|
||||
new CodecObserver([this](Message msg, const BufferInfo* buffer) {
|
||||
handleMessage(msg, buffer);
|
||||
});
|
||||
ASSERT_NE(observer, nullptr);
|
||||
if (strncmp(gEnv->getComponent().c_str(), "OMX.", 4) != 0)
|
||||
disableTest = true;
|
||||
EXPECT_TRUE(omx->allocateNode(
|
||||
gEnv->getComponent(), observer,
|
||||
[&](android::hardware::media::omx::V1_0::Status _s,
|
||||
sp<IOmxNode> const& _nl) {
|
||||
status = _s;
|
||||
this->omxNode = _nl;
|
||||
})
|
||||
.isOk());
|
||||
if (component_.find("OMX.") != 0) disableTest = true;
|
||||
EXPECT_TRUE(omx->allocateNode(component_, observer,
|
||||
[&](android::hardware::media::omx::V1_0::Status _s,
|
||||
sp<IOmxNode> const& _nl) {
|
||||
status = _s;
|
||||
this->omxNode = _nl;
|
||||
})
|
||||
.isOk());
|
||||
if (status == android::hardware::media::omx::V1_0::Status::NAME_NOT_FOUND) {
|
||||
disableTest = true;
|
||||
std::cout << "[ WARN ] Test Disabled, component not present\n";
|
||||
|
@ -93,7 +92,7 @@ class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
}
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_NE(omxNode, nullptr);
|
||||
ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
|
||||
ASSERT_NE(role_.empty(), true) << "Invalid Component Role";
|
||||
struct StringToName {
|
||||
const char* Name;
|
||||
standardComp CompName;
|
||||
|
@ -108,7 +107,7 @@ class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
sizeof(kStringToName) / sizeof(kStringToName[0]);
|
||||
const char* pch;
|
||||
char substring[OMX_MAX_STRINGNAME_SIZE];
|
||||
strcpy(substring, gEnv->getRole().c_str());
|
||||
strcpy(substring, role_.c_str());
|
||||
pch = strchr(substring, '.');
|
||||
ASSERT_NE(pch, nullptr);
|
||||
compName = unknown_comp;
|
||||
|
@ -153,11 +152,8 @@ class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
timestampDevTest = false;
|
||||
isSecure = false;
|
||||
size_t suffixLen = strlen(".secure");
|
||||
if (strlen(gEnv->getComponent().c_str()) >= suffixLen) {
|
||||
isSecure =
|
||||
!strcmp(gEnv->getComponent().c_str() +
|
||||
strlen(gEnv->getComponent().c_str()) - suffixLen,
|
||||
".secure");
|
||||
if (component_.rfind(".secure") == component_.length() - suffixLen) {
|
||||
isSecure = true;
|
||||
}
|
||||
if (isSecure) disableTest = true;
|
||||
if (disableTest) std::cout << "[ WARN ] Test Disabled \n";
|
||||
|
@ -172,7 +168,6 @@ class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
EXPECT_TRUE((omxNode->freeNode()).isOk());
|
||||
omxNode = nullptr;
|
||||
}
|
||||
Super::TearDown();
|
||||
}
|
||||
|
||||
// callback function to process messages received by onMessages() from IL
|
||||
|
@ -249,6 +244,10 @@ class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
unknown_comp,
|
||||
};
|
||||
|
||||
std::string component_;
|
||||
std::string role_;
|
||||
std::string instance_;
|
||||
|
||||
sp<IOmx> omx;
|
||||
sp<CodecObserver> observer;
|
||||
sp<IOmxNode> omxNode;
|
||||
|
@ -656,21 +655,21 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
}
|
||||
|
||||
// set component role
|
||||
TEST_F(AudioDecHidlTest, SetRole) {
|
||||
TEST_P(AudioDecHidlTest, SetRole) {
|
||||
description("Test Set Component Role");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
}
|
||||
|
||||
// port format enumeration
|
||||
TEST_F(AudioDecHidlTest, EnumeratePortFormat) {
|
||||
TEST_P(AudioDecHidlTest, EnumeratePortFormat) {
|
||||
description("Test Component on Mandatory Port Parameters (Port Format)");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
|
||||
|
@ -687,12 +686,12 @@ TEST_F(AudioDecHidlTest, EnumeratePortFormat) {
|
|||
|
||||
// test port settings reconfiguration, elementary stream decode and timestamp
|
||||
// deviation
|
||||
TEST_F(AudioDecHidlTest, DecodeTest) {
|
||||
TEST_P(AudioDecHidlTest, DecodeTest) {
|
||||
description("Tests Port Reconfiguration, Decode and timestamp deviation");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
|
||||
|
@ -702,8 +701,8 @@ TEST_F(AudioDecHidlTest, DecodeTest) {
|
|||
kPortIndexOutput = kPortIndexInput + 1;
|
||||
}
|
||||
char mURL[512], info[512];
|
||||
strcpy(mURL, gEnv->getRes().c_str());
|
||||
strcpy(info, gEnv->getRes().c_str());
|
||||
strcpy(mURL, sResourceDir.c_str());
|
||||
strcpy(info, sResourceDir.c_str());
|
||||
GetURLForComponent(compName, mURL, info);
|
||||
|
||||
std::ifstream eleStream, eleInfo;
|
||||
|
@ -776,12 +775,12 @@ TEST_F(AudioDecHidlTest, DecodeTest) {
|
|||
}
|
||||
|
||||
// end of sequence test
|
||||
TEST_F(AudioDecHidlTest, EOSTest_M) {
|
||||
TEST_P(AudioDecHidlTest, EOSTest_M) {
|
||||
description("Test end of stream monkeying");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
|
||||
|
@ -840,12 +839,12 @@ TEST_F(AudioDecHidlTest, EOSTest_M) {
|
|||
}
|
||||
|
||||
// end of sequence test
|
||||
TEST_F(AudioDecHidlTest, ThumbnailTest) {
|
||||
TEST_P(AudioDecHidlTest, ThumbnailTest) {
|
||||
description("Test Request for thumbnail");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
|
||||
|
@ -855,8 +854,8 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) {
|
|||
kPortIndexOutput = kPortIndexInput + 1;
|
||||
}
|
||||
char mURL[512], info[512];
|
||||
strcpy(mURL, gEnv->getRes().c_str());
|
||||
strcpy(info, gEnv->getRes().c_str());
|
||||
strcpy(mURL, sResourceDir.c_str());
|
||||
strcpy(info, sResourceDir.c_str());
|
||||
GetURLForComponent(compName, mURL, info);
|
||||
|
||||
std::ifstream eleStream, eleInfo;
|
||||
|
@ -954,12 +953,12 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) {
|
|||
}
|
||||
|
||||
// end of sequence test
|
||||
TEST_F(AudioDecHidlTest, SimpleEOSTest) {
|
||||
TEST_P(AudioDecHidlTest, SimpleEOSTest) {
|
||||
description("Test end of stream");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
|
||||
|
@ -969,8 +968,8 @@ TEST_F(AudioDecHidlTest, SimpleEOSTest) {
|
|||
kPortIndexOutput = kPortIndexInput + 1;
|
||||
}
|
||||
char mURL[512], info[512];
|
||||
strcpy(mURL, gEnv->getRes().c_str());
|
||||
strcpy(info, gEnv->getRes().c_str());
|
||||
strcpy(mURL, sResourceDir.c_str());
|
||||
strcpy(info, sResourceDir.c_str());
|
||||
GetURLForComponent(compName, mURL, info);
|
||||
|
||||
std::ifstream eleStream, eleInfo;
|
||||
|
@ -1046,12 +1045,12 @@ TEST_F(AudioDecHidlTest, SimpleEOSTest) {
|
|||
}
|
||||
|
||||
// test input/output port flush
|
||||
TEST_F(AudioDecHidlTest, FlushTest) {
|
||||
TEST_P(AudioDecHidlTest, FlushTest) {
|
||||
description("Test Flush");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
|
||||
|
@ -1061,8 +1060,8 @@ TEST_F(AudioDecHidlTest, FlushTest) {
|
|||
kPortIndexOutput = kPortIndexInput + 1;
|
||||
}
|
||||
char mURL[512], info[512];
|
||||
strcpy(mURL, gEnv->getRes().c_str());
|
||||
strcpy(info, gEnv->getRes().c_str());
|
||||
strcpy(mURL, sResourceDir.c_str());
|
||||
strcpy(info, sResourceDir.c_str());
|
||||
GetURLForComponent(compName, mURL, info);
|
||||
|
||||
std::ifstream eleStream, eleInfo;
|
||||
|
@ -1153,15 +1152,21 @@ TEST_F(AudioDecHidlTest, FlushTest) {
|
|||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(PerInstance, AudioDecHidlTest, testing::ValuesIn(kTestParameters),
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
gEnv = new ComponentTestEnvironment();
|
||||
::testing::AddGlobalTestEnvironment(gEnv);
|
||||
kTestParameters = getTestParameters("audio_decoder");
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
gEnv->init(&argc, argv);
|
||||
int status = gEnv->initFromOptions(argc, argv);
|
||||
if (status == 0) {
|
||||
status = RUN_ALL_TESTS();
|
||||
ALOGI("Test result = %d", status);
|
||||
|
||||
// Set the resource directory based on command line args.
|
||||
// Test will fail to set up if the argument is not set.
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-P") == 0 && i < argc - 1) {
|
||||
sResourceDir = argv[i + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2020 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the"License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an"AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<configuration description="Runs VtsHalMediaOmxV1_0TargetAudioDecTest.">
|
||||
<target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />
|
||||
|
||||
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
|
||||
<option name="cleanup" value="true" />
|
||||
<option name="push-file" key="vts_hal_media_omx_v1_0_audio_dec_test" value="/data/local/tmp/vts_hal_media_omx_v1_0_audio_dec_test" />
|
||||
|
||||
<!-- Files used for audio testing -->
|
||||
<option name="push-file" key="bbb_aac_stereo_128kbps_48000hz.aac" value="/data/local/tmp/media/bbb_aac_stereo_128kbps_48000hz.aac" />
|
||||
<option name="push-file" key="bbb_aac_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_aac_stereo_128kbps_48000hz.info" />
|
||||
<option name="push-file" key="bbb_amrwb_1ch_14kbps_16000hz.amrwb" value="/data/local/tmp/media/bbb_amrwb_1ch_14kbps_16000hz.amrwb" />
|
||||
<option name="push-file" key="bbb_amrwb_1ch_14kbps_16000hz.info" value="/data/local/tmp/media/bbb_amrwb_1ch_14kbps_16000hz.info" />
|
||||
<option name="push-file" key="bbb_flac_stereo_680kbps_48000hz.flac" value="/data/local/tmp/media/bbb_flac_stereo_680kbps_48000hz.flac" />
|
||||
<option name="push-file" key="bbb_flac_stereo_680kbps_48000hz.info" value="/data/local/tmp/media/bbb_flac_stereo_680kbps_48000hz.info" />
|
||||
<option name="push-file" key="bbb_g711alaw_1ch_8khz.info" value="/data/local/tmp/media/bbb_g711alaw_1ch_8khz.info" />
|
||||
<option name="push-file" key="bbb_g711alaw_1ch_8khz.raw" value="/data/local/tmp/media/bbb_g711alaw_1ch_8khz.raw" />
|
||||
<option name="push-file" key="bbb_g711mulaw_1ch_8khz.info" value="/data/local/tmp/media/bbb_g711mulaw_1ch_8khz.info" />
|
||||
<option name="push-file" key="bbb_g711mulaw_1ch_8khz.raw" value="/data/local/tmp/media/bbb_g711mulaw_1ch_8khz.raw" />
|
||||
<option name="push-file" key="bbb_gsm_1ch_8khz_13kbps.info" value="/data/local/tmp/media/bbb_gsm_1ch_8khz_13kbps.info" />
|
||||
<option name="push-file" key="bbb_gsm_1ch_8khz_13kbps.raw" value="/data/local/tmp/media/bbb_gsm_1ch_8khz_13kbps.raw" />
|
||||
<option name="push-file" key="bbb_mp3_stereo_192kbps_48000hz.info" value="/data/local/tmp/media/bbb_mp3_stereo_192kbps_48000hz.info" />
|
||||
<option name="push-file" key="bbb_mp3_stereo_192kbps_48000hz.mp3" value="/data/local/tmp/media/bbb_mp3_stereo_192kbps_48000hz.mp3" />
|
||||
<option name="push-file" key="bbb_opus_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_opus_stereo_128kbps_48000hz.info" />
|
||||
<option name="push-file" key="bbb_opus_stereo_128kbps_48000hz.opus" value="/data/local/tmp/media/bbb_opus_stereo_128kbps_48000hz.opus" />
|
||||
<option name="push-file" key="bbb_raw_1ch_16khz_s16le.raw" value="/data/local/tmp/media/bbb_raw_1ch_16khz_s16le.raw" />
|
||||
<option name="push-file" key="bbb_raw_1ch_8khz_s16le.raw" value="/data/local/tmp/media/bbb_raw_1ch_8khz_s16le.raw" />
|
||||
<option name="push-file" key="bbb_raw_1ch_8khz_s32le.info" value="/data/local/tmp/media/bbb_raw_1ch_8khz_s32le.info" />
|
||||
<option name="push-file" key="bbb_raw_1ch_8khz_s32le.raw" value="/data/local/tmp/media/bbb_raw_1ch_8khz_s32le.raw" />
|
||||
<option name="push-file" key="bbb_raw_2ch_48khz_s16le.raw" value="/data/local/tmp/media/bbb_raw_2ch_48khz_s16le.raw" />
|
||||
<option name="push-file" key="bbb_vorbis_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_vorbis_stereo_128kbps_48000hz.info" />
|
||||
<option name="push-file" key="bbb_vorbis_stereo_128kbps_48000hz.vorbis" value="/data/local/tmp/media/bbb_vorbis_stereo_128kbps_48000hz.vorbis" />
|
||||
<option name="push-file" key="sine_amrnb_1ch_12kbps_8000hz.amrnb" value="/data/local/tmp/media/sine_amrnb_1ch_12kbps_8000hz.amrnb" />
|
||||
<option name="push-file" key="sine_amrnb_1ch_12kbps_8000hz.info" value="/data/local/tmp/media/sine_amrnb_1ch_12kbps_8000hz.info" />
|
||||
</target_preparer>
|
||||
|
||||
<test class="com.android.tradefed.testtype.GTest" >
|
||||
<option name="native-test-device-path" value="/data/local/tmp" />
|
||||
<option name="module-name" value="vts_hal_media_omx_v1_0_audio_dec_test" />
|
||||
<option name="native-test-flag" value="-P /data/local/tmp/media/" />
|
||||
</test>
|
||||
</configuration>
|
|
@ -28,6 +28,8 @@
|
|||
#include <android/hidl/allocator/1.0/IAllocator.h>
|
||||
#include <android/hidl/memory/1.0/IMapper.h>
|
||||
#include <android/hidl/memory/1.0/IMemory.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
|
||||
using ::android::hardware::media::omx::V1_0::IOmx;
|
||||
using ::android::hardware::media::omx::V1_0::IOmxObserver;
|
||||
|
@ -44,48 +46,45 @@ using ::android::hardware::hidl_vec;
|
|||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <getopt.h>
|
||||
#include <media_audio_hidl_test_common.h>
|
||||
#include <media_hidl_test_common.h>
|
||||
#include <fstream>
|
||||
|
||||
static ComponentTestEnvironment* gEnv = nullptr;
|
||||
// Resource directory
|
||||
std::string sResourceDir = "";
|
||||
|
||||
// audio encoder test fixture class
|
||||
class AudioEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
private:
|
||||
typedef ::testing::VtsHalHidlTargetTestBase Super;
|
||||
public:
|
||||
::std::string getTestCaseInfo() const override {
|
||||
return ::std::string() +
|
||||
"Component: " + gEnv->getComponent().c_str() + " | " +
|
||||
"Role: " + gEnv->getRole().c_str() + " | " +
|
||||
"Instance: " + gEnv->getInstance().c_str() + " | " +
|
||||
"Res: " + gEnv->getRes().c_str();
|
||||
class AudioEncHidlTest
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string, std::string>> {
|
||||
public:
|
||||
::std::string getTestCaseInfo() const {
|
||||
return ::std::string() + "Component: " + component_ + " | " + "Role: " + role_ + " | " +
|
||||
"Instance: " + instance_ + " | " + "Res: " + sResourceDir;
|
||||
}
|
||||
|
||||
virtual void SetUp() override {
|
||||
Super::SetUp();
|
||||
instance_ = std::get<0>(GetParam());
|
||||
component_ = std::get<1>(GetParam());
|
||||
role_ = std::get<2>(GetParam());
|
||||
ASSERT_NE(sResourceDir.empty(), true);
|
||||
|
||||
disableTest = false;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
omx = Super::getService<IOmx>(gEnv->getInstance());
|
||||
omx = IOmx::getService(instance_);
|
||||
ASSERT_NE(omx, nullptr);
|
||||
observer =
|
||||
new CodecObserver([this](Message msg, const BufferInfo* buffer) {
|
||||
handleMessage(msg, buffer);
|
||||
});
|
||||
ASSERT_NE(observer, nullptr);
|
||||
if (strncmp(gEnv->getComponent().c_str(), "OMX.", 4) != 0)
|
||||
disableTest = true;
|
||||
EXPECT_TRUE(omx->allocateNode(
|
||||
gEnv->getComponent(), observer,
|
||||
[&](android::hardware::media::omx::V1_0::Status _s,
|
||||
sp<IOmxNode> const& _nl) {
|
||||
status = _s;
|
||||
this->omxNode = _nl;
|
||||
})
|
||||
.isOk());
|
||||
if (component_.find("OMX.") != 0) disableTest = true;
|
||||
EXPECT_TRUE(omx->allocateNode(component_, observer,
|
||||
[&](android::hardware::media::omx::V1_0::Status _s,
|
||||
sp<IOmxNode> const& _nl) {
|
||||
status = _s;
|
||||
this->omxNode = _nl;
|
||||
})
|
||||
.isOk());
|
||||
if (status == android::hardware::media::omx::V1_0::Status::NAME_NOT_FOUND) {
|
||||
disableTest = true;
|
||||
std::cout << "[ WARN ] Test Disabled, component not present\n";
|
||||
|
@ -93,7 +92,7 @@ class AudioEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
}
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_NE(omxNode, nullptr);
|
||||
ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
|
||||
ASSERT_NE(role_.empty(), true) << "Invalid Component Role";
|
||||
struct StringToName {
|
||||
const char* Name;
|
||||
standardComp CompName;
|
||||
|
@ -105,7 +104,7 @@ class AudioEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
sizeof(kStringToName) / sizeof(kStringToName[0]);
|
||||
const char* pch;
|
||||
char substring[OMX_MAX_STRINGNAME_SIZE];
|
||||
strcpy(substring, gEnv->getRole().c_str());
|
||||
strcpy(substring, role_.c_str());
|
||||
pch = strchr(substring, '.');
|
||||
ASSERT_NE(pch, nullptr);
|
||||
compName = unknown_comp;
|
||||
|
@ -149,7 +148,6 @@ class AudioEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
EXPECT_TRUE((omxNode->freeNode()).isOk());
|
||||
omxNode = nullptr;
|
||||
}
|
||||
Super::TearDown();
|
||||
}
|
||||
|
||||
// callback function to process messages received by onMessages() from IL
|
||||
|
@ -190,6 +188,10 @@ class AudioEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
unknown_comp,
|
||||
};
|
||||
|
||||
std::string component_;
|
||||
std::string role_;
|
||||
std::string instance_;
|
||||
|
||||
sp<IOmx> omx;
|
||||
sp<CodecObserver> observer;
|
||||
sp<IOmxNode> omxNode;
|
||||
|
@ -364,21 +366,21 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
}
|
||||
|
||||
// set component role
|
||||
TEST_F(AudioEncHidlTest, SetRole) {
|
||||
TEST_P(AudioEncHidlTest, SetRole) {
|
||||
description("Test Set Component Role");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_.c_str());
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
}
|
||||
|
||||
// port format enumeration
|
||||
TEST_F(AudioEncHidlTest, EnumeratePortFormat) {
|
||||
TEST_P(AudioEncHidlTest, EnumeratePortFormat) {
|
||||
description("Test Component on Mandatory Port Parameters (Port Format)");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
|
||||
|
@ -394,12 +396,12 @@ TEST_F(AudioEncHidlTest, EnumeratePortFormat) {
|
|||
}
|
||||
|
||||
// test raw stream encode
|
||||
TEST_F(AudioEncHidlTest, SimpleEncodeTest) {
|
||||
TEST_P(AudioEncHidlTest, SimpleEncodeTest) {
|
||||
description("Tests Basic encoding and EOS");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamAudioInit, ¶ms);
|
||||
|
@ -409,7 +411,7 @@ TEST_F(AudioEncHidlTest, SimpleEncodeTest) {
|
|||
kPortIndexOutput = kPortIndexInput + 1;
|
||||
}
|
||||
char mURL[512];
|
||||
strcpy(mURL, gEnv->getRes().c_str());
|
||||
strcpy(mURL, sResourceDir.c_str());
|
||||
GetURLForComponent(compName, mURL);
|
||||
|
||||
std::ifstream eleStream;
|
||||
|
@ -484,15 +486,21 @@ TEST_F(AudioEncHidlTest, SimpleEncodeTest) {
|
|||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(PerInstance, AudioEncHidlTest, testing::ValuesIn(kTestParameters),
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
gEnv = new ComponentTestEnvironment();
|
||||
::testing::AddGlobalTestEnvironment(gEnv);
|
||||
kTestParameters = getTestParameters("audio_encoder");
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
gEnv->init(&argc, argv);
|
||||
int status = gEnv->initFromOptions(argc, argv);
|
||||
if (status == 0) {
|
||||
status = RUN_ALL_TESTS();
|
||||
ALOGI("Test result = %d", status);
|
||||
|
||||
// Set the resource directory based on command line args.
|
||||
// Test will fail to set up if the argument is not set.
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-P") == 0 && i < argc - 1) {
|
||||
sResourceDir = argv[i + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2020 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the"License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an"AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<configuration description="Runs VtsHalMediaOmxV1_0TargetAudioEncTest.">
|
||||
<target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />
|
||||
|
||||
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
|
||||
<option name="cleanup" value="true" />
|
||||
<option name="push-file" key="vts_hal_media_omx_v1_0_audio_enc_test" value="/data/local/tmp/vts_hal_media_omx_v1_0_audio_enc_test" />
|
||||
|
||||
<!-- Files used for audio testing -->
|
||||
<option name="push-file" key="bbb_aac_stereo_128kbps_48000hz.aac" value="/data/local/tmp/media/bbb_aac_stereo_128kbps_48000hz.aac" />
|
||||
<option name="push-file" key="bbb_aac_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_aac_stereo_128kbps_48000hz.info" />
|
||||
<option name="push-file" key="bbb_amrwb_1ch_14kbps_16000hz.amrwb" value="/data/local/tmp/media/bbb_amrwb_1ch_14kbps_16000hz.amrwb" />
|
||||
<option name="push-file" key="bbb_amrwb_1ch_14kbps_16000hz.info" value="/data/local/tmp/media/bbb_amrwb_1ch_14kbps_16000hz.info" />
|
||||
<option name="push-file" key="bbb_flac_stereo_680kbps_48000hz.flac" value="/data/local/tmp/media/bbb_flac_stereo_680kbps_48000hz.flac" />
|
||||
<option name="push-file" key="bbb_flac_stereo_680kbps_48000hz.info" value="/data/local/tmp/media/bbb_flac_stereo_680kbps_48000hz.info" />
|
||||
<option name="push-file" key="bbb_g711alaw_1ch_8khz.info" value="/data/local/tmp/media/bbb_g711alaw_1ch_8khz.info" />
|
||||
<option name="push-file" key="bbb_g711alaw_1ch_8khz.raw" value="/data/local/tmp/media/bbb_g711alaw_1ch_8khz.raw" />
|
||||
<option name="push-file" key="bbb_g711mulaw_1ch_8khz.info" value="/data/local/tmp/media/bbb_g711mulaw_1ch_8khz.info" />
|
||||
<option name="push-file" key="bbb_g711mulaw_1ch_8khz.raw" value="/data/local/tmp/media/bbb_g711mulaw_1ch_8khz.raw" />
|
||||
<option name="push-file" key="bbb_gsm_1ch_8khz_13kbps.info" value="/data/local/tmp/media/bbb_gsm_1ch_8khz_13kbps.info" />
|
||||
<option name="push-file" key="bbb_gsm_1ch_8khz_13kbps.raw" value="/data/local/tmp/media/bbb_gsm_1ch_8khz_13kbps.raw" />
|
||||
<option name="push-file" key="bbb_mp3_stereo_192kbps_48000hz.info" value="/data/local/tmp/media/bbb_mp3_stereo_192kbps_48000hz.info" />
|
||||
<option name="push-file" key="bbb_mp3_stereo_192kbps_48000hz.mp3" value="/data/local/tmp/media/bbb_mp3_stereo_192kbps_48000hz.mp3" />
|
||||
<option name="push-file" key="bbb_opus_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_opus_stereo_128kbps_48000hz.info" />
|
||||
<option name="push-file" key="bbb_opus_stereo_128kbps_48000hz.opus" value="/data/local/tmp/media/bbb_opus_stereo_128kbps_48000hz.opus" />
|
||||
<option name="push-file" key="bbb_raw_1ch_16khz_s16le.raw" value="/data/local/tmp/media/bbb_raw_1ch_16khz_s16le.raw" />
|
||||
<option name="push-file" key="bbb_raw_1ch_8khz_s16le.raw" value="/data/local/tmp/media/bbb_raw_1ch_8khz_s16le.raw" />
|
||||
<option name="push-file" key="bbb_raw_1ch_8khz_s32le.info" value="/data/local/tmp/media/bbb_raw_1ch_8khz_s32le.info" />
|
||||
<option name="push-file" key="bbb_raw_1ch_8khz_s32le.raw" value="/data/local/tmp/media/bbb_raw_1ch_8khz_s32le.raw" />
|
||||
<option name="push-file" key="bbb_raw_2ch_48khz_s16le.raw" value="/data/local/tmp/media/bbb_raw_2ch_48khz_s16le.raw" />
|
||||
<option name="push-file" key="bbb_vorbis_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_vorbis_stereo_128kbps_48000hz.info" />
|
||||
<option name="push-file" key="bbb_vorbis_stereo_128kbps_48000hz.vorbis" value="/data/local/tmp/media/bbb_vorbis_stereo_128kbps_48000hz.vorbis" />
|
||||
<option name="push-file" key="sine_amrnb_1ch_12kbps_8000hz.amrnb" value="/data/local/tmp/media/sine_amrnb_1ch_12kbps_8000hz.amrnb" />
|
||||
<option name="push-file" key="sine_amrnb_1ch_12kbps_8000hz.info" value="/data/local/tmp/media/sine_amrnb_1ch_12kbps_8000hz.info" />
|
||||
</target_preparer>
|
||||
|
||||
<test class="com.android.tradefed.testtype.GTest" >
|
||||
<option name="native-test-device-path" value="/data/local/tmp" />
|
||||
<option name="module-name" value="vts_hal_media_omx_v1_0_audio_enc_test" />
|
||||
<option name="native-test-flag" value="-P /data/local/tmp/media/" />
|
||||
</test>
|
||||
</configuration>
|
|
@ -44,7 +44,6 @@ using ::android::hardware::hidl_vec;
|
|||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <hidlmemory/mapping.h>
|
||||
#include <media_audio_hidl_test_common.h>
|
||||
#include <media_hidl_test_common.h>
|
||||
|
|
|
@ -23,7 +23,7 @@ cc_library_static {
|
|||
export_include_dirs: ["."],
|
||||
|
||||
static_libs: [
|
||||
"VtsHalHidlTargetTestBase",
|
||||
"libgtest",
|
||||
"libhidlmemory",
|
||||
"android.hidl.allocator@1.0",
|
||||
"android.hidl.memory@1.0",
|
||||
|
|
|
@ -56,17 +56,16 @@ using ::android::hardware::hidl_vec;
|
|||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <hidlmemory/mapping.h>
|
||||
#include <media/hardware/HardwareAPI.h>
|
||||
#include <media_hidl_test_common.h>
|
||||
#include <memory>
|
||||
|
||||
// set component role
|
||||
Return<android::hardware::media::omx::V1_0::Status> setRole(
|
||||
sp<IOmxNode> omxNode, const char* role) {
|
||||
Return<android::hardware::media::omx::V1_0::Status> setRole(sp<IOmxNode> omxNode,
|
||||
const std::string& role) {
|
||||
OMX_PARAM_COMPONENTROLETYPE params;
|
||||
strcpy((char*)params.cRole, role);
|
||||
strcpy((char*)params.cRole, role.c_str());
|
||||
return setParam(omxNode, OMX_IndexParamStandardComponentRole, ¶ms);
|
||||
}
|
||||
|
||||
|
@ -759,3 +758,46 @@ void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
EXPECT_EQ(eosFlag, true);
|
||||
eosFlag = false;
|
||||
}
|
||||
|
||||
hidl_vec<IOmx::ComponentInfo> getComponentInfoList(sp<IOmx> omx) {
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
hidl_vec<IOmx::ComponentInfo> nodeList;
|
||||
omx->listNodes([&status, &nodeList](android::hardware::media::omx::V1_0::Status _s,
|
||||
hidl_vec<IOmx::ComponentInfo> const& _nl) {
|
||||
status = _s;
|
||||
nodeList = _nl;
|
||||
});
|
||||
if (status != android::hardware::media::omx::V1_0::Status::OK) {
|
||||
ALOGE("Failed to get ComponentInfo list for IOmx.");
|
||||
}
|
||||
return nodeList;
|
||||
}
|
||||
|
||||
// Return all test parameters, a list of tuple of <instance, component, role>
|
||||
const std::vector<std::tuple<std::string, std::string, std::string>>& getTestParameters(
|
||||
const std::string& filter) {
|
||||
static std::vector<std::tuple<std::string, std::string, std::string>> parameters;
|
||||
|
||||
auto instances = android::hardware::getAllHalInstanceNames(IOmx::descriptor);
|
||||
for (std::string instance : instances) {
|
||||
sp<IOmx> omx = IOmx::getService(instance);
|
||||
hidl_vec<IOmx::ComponentInfo> componentInfos = getComponentInfoList(omx);
|
||||
for (IOmx::ComponentInfo info : componentInfos) {
|
||||
for (std::string role : info.mRoles) {
|
||||
if (filter.empty()) {
|
||||
if (kWhiteListRoles.find(role.c_str()) == kWhiteListRoles.end()) {
|
||||
// This is for component test and the role is not in the white list.
|
||||
continue;
|
||||
}
|
||||
} else if (role.find(filter) == std::string::npos) {
|
||||
// The role doesn't match the given filter, e.g., video_decoder_vp8 role doesn't
|
||||
// need to run for audio_decoder tests.
|
||||
continue;
|
||||
}
|
||||
parameters.push_back(std::make_tuple(instance, info.mName.c_str(), role.c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return parameters;
|
||||
}
|
|
@ -32,6 +32,8 @@
|
|||
#include <android/hardware/graphics/mapper/2.0/types.h>
|
||||
#include <android/hardware/graphics/mapper/3.0/IMapper.h>
|
||||
#include <android/hardware/graphics/mapper/3.0/types.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
#include <media/stagefright/foundation/ALooper.h>
|
||||
#include <utils/Condition.h>
|
||||
#include <utils/List.h>
|
||||
|
@ -44,8 +46,6 @@
|
|||
#include <media/openmax/OMX_AudioExt.h>
|
||||
#include <media/openmax/OMX_VideoExt.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestEnvBase.h>
|
||||
|
||||
/* TIME OUTS (Wait time in dequeueMessage()) */
|
||||
|
||||
/* As component is switching states (loaded<->idle<->execute), dequeueMessage()
|
||||
|
@ -78,6 +78,20 @@ enum bufferOwner {
|
|||
unknown,
|
||||
};
|
||||
|
||||
// White list audio/video roles to be tested.
|
||||
static std::set<std::string> kWhiteListRoles{
|
||||
"audio_encoder.aac", "audio_encoder.amrnb", "audio_encoder.amrwb",
|
||||
"audio_encoder.flac", "audio_decoder.aac", "audio_decoder.amrnb",
|
||||
"audio_decoder.amrwb", "audio_decoder.flac", "audio_decoder.g711alaw",
|
||||
"audio_decoder.g711mlaw", "audio_decoder.gsm", "audio_decoder.mp3",
|
||||
"audio_decoder.opus", "audio_decoder.raw", "audio_decoder.vorbis",
|
||||
"video_encoder.avc", "video_encoder.h263", "video_encoder.mpeg4",
|
||||
"video_encoder.vp8", "video_encoder.vp9", "video_decoder.avc",
|
||||
"video_decoder.h263", "video_decoder.hevc", "video_decoder.mpeg4",
|
||||
"video_decoder.vp8", "video_decoder.vp9"};
|
||||
|
||||
static std::vector<std::tuple<std::string, std::string, std::string>> kTestParameters;
|
||||
|
||||
/*
|
||||
* TODO: below definitions are borrowed from Conversion.h.
|
||||
* This is not the ideal way to do it. Loose these definitions once you
|
||||
|
@ -328,8 +342,8 @@ struct GrallocV3 {
|
|||
using Rect = IMapper::Rect;
|
||||
};
|
||||
|
||||
Return<android::hardware::media::omx::V1_0::Status> setRole(
|
||||
sp<IOmxNode> omxNode, const char* role);
|
||||
Return<android::hardware::media::omx::V1_0::Status> setRole(sp<IOmxNode> omxNode,
|
||||
const std::string& role);
|
||||
|
||||
Return<android::hardware::media::omx::V1_0::Status> setPortBufferSize(
|
||||
sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_U32 size);
|
||||
|
@ -400,77 +414,10 @@ void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
portreconfig fptr = nullptr, OMX_U32 kPortIndexInput = 0,
|
||||
OMX_U32 kPortIndexOutput = 1, void* args = nullptr);
|
||||
|
||||
// A class for test environment setup
|
||||
class ComponentTestEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
|
||||
private:
|
||||
typedef ::testing::VtsHalHidlTargetTestEnvBase Super;
|
||||
hidl_vec<IOmx::ComponentInfo> getComponentInfoList(sp<IOmx> omx);
|
||||
|
||||
public:
|
||||
virtual void registerTestServices() override { registerTestService<IOmx>(); }
|
||||
|
||||
ComponentTestEnvironment() : res("/data/local/tmp/media/") {}
|
||||
|
||||
void setComponent(const char* _component) { component = _component; }
|
||||
|
||||
void setRole(const char* _role) { role = _role; }
|
||||
|
||||
void setRes(const char* _res) { res = _res; }
|
||||
|
||||
const hidl_string getInstance() { return Super::getServiceName<IOmx>(); }
|
||||
|
||||
const hidl_string getComponent() const { return component; }
|
||||
|
||||
const hidl_string getRole() const { return role; }
|
||||
|
||||
const hidl_string getRes() const { return res; }
|
||||
|
||||
int initFromOptions(int argc, char** argv) {
|
||||
static struct option options[] = {{"component", required_argument, 0, 'C'},
|
||||
{"role", required_argument, 0, 'R'},
|
||||
{"res", required_argument, 0, 'P'},
|
||||
{0, 0, 0, 0}};
|
||||
|
||||
while (true) {
|
||||
int index = 0;
|
||||
int c = getopt_long(argc, argv, "C:R:P:", options, &index);
|
||||
if (c == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (c) {
|
||||
case 'C':
|
||||
setComponent(optarg);
|
||||
break;
|
||||
case 'R':
|
||||
setRole(optarg);
|
||||
break;
|
||||
case 'P':
|
||||
setRes(optarg);
|
||||
break;
|
||||
case '?':
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc) {
|
||||
fprintf(stderr,
|
||||
"unrecognized option: %s\n\n"
|
||||
"usage: %s <gtest options> <test options>\n\n"
|
||||
"test options are:\n\n"
|
||||
"-C, --component: OMX component to test\n"
|
||||
"-R, --role: OMX component Role\n"
|
||||
"-P, --res: Resource files directory location\n",
|
||||
argv[optind ?: 1], argv[0]);
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
hidl_string instance;
|
||||
hidl_string component;
|
||||
hidl_string role;
|
||||
hidl_string res;
|
||||
};
|
||||
// Return all test parameters, a list of tuple of <instance, component, role>
|
||||
const std::vector<std::tuple<std::string, std::string, std::string>>& getTestParameters(
|
||||
const std::string& filter);
|
||||
|
||||
#endif // MEDIA_HIDL_TEST_COMMON_H
|
||||
|
|
|
@ -18,6 +18,7 @@ cc_test {
|
|||
name: "VtsHalMediaOmxV1_0TargetComponentTest",
|
||||
defaults: ["VtsHalMediaOmxV1_0Defaults"],
|
||||
srcs: ["VtsHalMediaOmxV1_0TargetComponentTest.cpp"],
|
||||
test_suites: ["general-tests"],
|
||||
test_suites: [
|
||||
"vts-core",
|
||||
],
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <android/hidl/allocator/1.0/IAllocator.h>
|
||||
#include <android/hidl/memory/1.0/IMapper.h>
|
||||
#include <android/hidl/memory/1.0/IMemory.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
|
||||
using ::android::hardware::media::omx::V1_0::IOmx;
|
||||
using ::android::hardware::media::omx::V1_0::IOmxObserver;
|
||||
|
@ -44,42 +46,37 @@ using ::android::hardware::hidl_vec;
|
|||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <getopt.h>
|
||||
#include <media_hidl_test_common.h>
|
||||
|
||||
static ComponentTestEnvironment* gEnv = nullptr;
|
||||
|
||||
// generic component test fixture class
|
||||
class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
private:
|
||||
typedef ::testing::VtsHalHidlTargetTestBase Super;
|
||||
public:
|
||||
::std::string getTestCaseInfo() const override {
|
||||
return ::std::string() +
|
||||
"Component: " + gEnv->getComponent().c_str() + " | " +
|
||||
"Role: " + gEnv->getRole().c_str() + " | " +
|
||||
"Instance: " + gEnv->getInstance().c_str();
|
||||
class ComponentHidlTest
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string, std::string>> {
|
||||
public:
|
||||
::std::string getTestCaseInfo() const {
|
||||
return ::std::string() + "Component: " + component_ + " | " + "Role: " + role_ + " | " +
|
||||
"Instance: " + instance_;
|
||||
}
|
||||
|
||||
virtual void SetUp() override {
|
||||
Super::SetUp();
|
||||
instance_ = std::get<0>(GetParam());
|
||||
component_ = std::get<1>(GetParam());
|
||||
role_ = std::get<2>(GetParam());
|
||||
|
||||
disableTest = false;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
omx = Super::getService<IOmx>(gEnv->getInstance());
|
||||
omx = IOmx::getService(instance_);
|
||||
ASSERT_NE(omx, nullptr);
|
||||
observer = new CodecObserver(nullptr);
|
||||
ASSERT_NE(observer, nullptr);
|
||||
if (strncmp(gEnv->getComponent().c_str(), "OMX.", 4) != 0)
|
||||
disableTest = true;
|
||||
EXPECT_TRUE(omx->allocateNode(
|
||||
gEnv->getComponent(), observer,
|
||||
[&](android::hardware::media::omx::V1_0::Status _s,
|
||||
sp<IOmxNode> const& _nl) {
|
||||
status = _s;
|
||||
this->omxNode = _nl;
|
||||
})
|
||||
.isOk());
|
||||
if (component_.find("OMX.") != 0) disableTest = true;
|
||||
EXPECT_TRUE(omx->allocateNode(component_, observer,
|
||||
[&](android::hardware::media::omx::V1_0::Status _s,
|
||||
sp<IOmxNode> const& _nl) {
|
||||
status = _s;
|
||||
this->omxNode = _nl;
|
||||
})
|
||||
.isOk());
|
||||
if (status == android::hardware::media::omx::V1_0::Status::NAME_NOT_FOUND) {
|
||||
disableTest = true;
|
||||
std::cout << "[ WARN ] Test Disabled, component not present\n";
|
||||
|
@ -87,7 +84,7 @@ class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
}
|
||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_NE(omxNode, nullptr);
|
||||
ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
|
||||
ASSERT_NE(role_.empty(), true) << "Invalid Component Role";
|
||||
struct StringToClass {
|
||||
const char* Class;
|
||||
standardCompClass CompClass;
|
||||
|
@ -102,7 +99,7 @@ class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
sizeof(kStringToClass) / sizeof(kStringToClass[0]);
|
||||
const char* pch;
|
||||
char substring[OMX_MAX_STRINGNAME_SIZE];
|
||||
strcpy(substring, gEnv->getRole().c_str());
|
||||
strcpy(substring, role_.c_str());
|
||||
pch = strchr(substring, '.');
|
||||
ASSERT_NE(pch, nullptr) << "Invalid Component Role";
|
||||
substring[pch - substring] = '\0';
|
||||
|
@ -117,11 +114,8 @@ class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
isSecure = false;
|
||||
mTunnel = false;
|
||||
size_t suffixLen = strlen(".secure");
|
||||
if (strlen(gEnv->getComponent().c_str()) >= suffixLen) {
|
||||
isSecure =
|
||||
!strcmp(gEnv->getComponent().c_str() +
|
||||
strlen(gEnv->getComponent().c_str()) - suffixLen,
|
||||
".secure");
|
||||
if (component_.rfind(".secure") == component_.length() - suffixLen) {
|
||||
isSecure = true;
|
||||
}
|
||||
if (compClass == video_decoder) {
|
||||
omxNode->configureVideoTunnelMode(
|
||||
|
@ -147,7 +141,6 @@ class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
EXPECT_TRUE((omxNode->freeNode()).isOk());
|
||||
omxNode = nullptr;
|
||||
}
|
||||
Super::TearDown();
|
||||
}
|
||||
|
||||
enum standardCompClass {
|
||||
|
@ -158,6 +151,10 @@ class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
unknown_class,
|
||||
};
|
||||
|
||||
std::string component_;
|
||||
std::string role_;
|
||||
std::string instance_;
|
||||
|
||||
sp<IOmx> omx;
|
||||
sp<CodecObserver> observer;
|
||||
sp<IOmxNode> omxNode;
|
||||
|
@ -191,7 +188,7 @@ void initPortMode(PortMode* pm, bool isSecure,
|
|||
}
|
||||
|
||||
// test dispatch message API call
|
||||
TEST_F(ComponentHidlTest, dispatchMsg) {
|
||||
TEST_P(ComponentHidlTest, dispatchMsg) {
|
||||
description("test dispatch message API call");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
|
@ -216,22 +213,22 @@ TEST_F(ComponentHidlTest, dispatchMsg) {
|
|||
}
|
||||
|
||||
// set component role
|
||||
TEST_F(ComponentHidlTest, SetRole) {
|
||||
TEST_P(ComponentHidlTest, SetRole) {
|
||||
description("Test Set Component Role");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
}
|
||||
|
||||
// port indices enumeration
|
||||
TEST_F(ComponentHidlTest, DISABLED_GetPortIndices) {
|
||||
TEST_P(ComponentHidlTest, DISABLED_GetPortIndices) {
|
||||
description("Test Component on Mandatory Port Parameters (Port Indices)");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
// Get Number of Ports and their Indices for all Domains
|
||||
|
@ -248,13 +245,13 @@ TEST_F(ComponentHidlTest, DISABLED_GetPortIndices) {
|
|||
}
|
||||
|
||||
// port format enumeration
|
||||
TEST_F(ComponentHidlTest, EnumeratePortFormat) {
|
||||
TEST_P(ComponentHidlTest, EnumeratePortFormat) {
|
||||
description("Test Component on Mandatory Port Parameters (Port Format)");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
if (compClass == audio_decoder || compClass == audio_encoder) {
|
||||
|
@ -308,14 +305,14 @@ TEST_F(ComponentHidlTest, EnumeratePortFormat) {
|
|||
}
|
||||
|
||||
// get/set default port settings of a component
|
||||
TEST_F(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
|
||||
TEST_P(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
|
||||
description(
|
||||
"Test Component on Mandatory Port Parameters (Port Definition)");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
if (compClass == audio_decoder || compClass == audio_encoder) {
|
||||
|
@ -398,7 +395,7 @@ TEST_F(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
|
|||
portDef = mirror;
|
||||
OMX_U32 nBufferSize = portDef.nBufferSize >> 1;
|
||||
if (nBufferSize != 0) {
|
||||
if (!strncmp(gEnv->getComponent().c_str(), "OMX.google.", 11)) {
|
||||
if (component_.find("OMX.google.") != 0) {
|
||||
portDef.nBufferSize = nBufferSize;
|
||||
} else {
|
||||
// Probable alignment requirements of vendor component
|
||||
|
@ -438,13 +435,13 @@ TEST_F(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
|
|||
}
|
||||
|
||||
// populate port test
|
||||
TEST_F(ComponentHidlTest, DISABLED_PopulatePort) {
|
||||
TEST_P(ComponentHidlTest, DISABLED_PopulatePort) {
|
||||
description("Verify bPopulated field of a component port");
|
||||
if (disableTest || isSecure) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
OMX_U32 portBase = 0;
|
||||
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
if (compClass == audio_decoder || compClass == audio_encoder) {
|
||||
|
@ -490,14 +487,14 @@ TEST_F(ComponentHidlTest, DISABLED_PopulatePort) {
|
|||
}
|
||||
|
||||
// Flush test
|
||||
TEST_F(ComponentHidlTest, Flush) {
|
||||
TEST_P(ComponentHidlTest, Flush) {
|
||||
description("Test Flush");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
Message msg;
|
||||
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
if (compClass == audio_decoder || compClass == audio_encoder) {
|
||||
|
@ -561,14 +558,14 @@ TEST_F(ComponentHidlTest, Flush) {
|
|||
}
|
||||
|
||||
// Flush test - monkeying
|
||||
TEST_F(ComponentHidlTest, Flush_M) {
|
||||
TEST_P(ComponentHidlTest, Flush_M) {
|
||||
description("Test Flush monkeying");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
Message msg;
|
||||
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
if (compClass == audio_decoder || compClass == audio_encoder) {
|
||||
|
@ -669,14 +666,14 @@ TEST_F(ComponentHidlTest, Flush_M) {
|
|||
}
|
||||
|
||||
// test port mode configuration when the component is in various states
|
||||
TEST_F(ComponentHidlTest, PortModeConfig) {
|
||||
TEST_P(ComponentHidlTest, PortModeConfig) {
|
||||
description("Test Port Mode Configuration");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
Message msg;
|
||||
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
if (compClass == audio_decoder || compClass == audio_encoder) {
|
||||
|
@ -733,14 +730,14 @@ TEST_F(ComponentHidlTest, PortModeConfig) {
|
|||
}
|
||||
|
||||
// state transitions test
|
||||
TEST_F(ComponentHidlTest, StateTransitions) {
|
||||
TEST_P(ComponentHidlTest, StateTransitions) {
|
||||
description("Test State Transitions Loaded<->Idle<->Execute");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
OMX_U32 portBase = 0;
|
||||
Message msg;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
if (compClass == audio_decoder || compClass == audio_encoder) {
|
||||
|
@ -852,14 +849,14 @@ TEST_F(ComponentHidlTest, StateTransitions) {
|
|||
}
|
||||
|
||||
// state transitions test - monkeying
|
||||
TEST_F(ComponentHidlTest, DISABLED_StateTransitions_M) {
|
||||
TEST_P(ComponentHidlTest, DISABLED_StateTransitions_M) {
|
||||
description("Test State Transitions monkeying");
|
||||
if (disableTest || isSecure) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
Message msg;
|
||||
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
if (compClass == audio_decoder || compClass == audio_encoder) {
|
||||
|
@ -918,13 +915,13 @@ TEST_F(ComponentHidlTest, DISABLED_StateTransitions_M) {
|
|||
}
|
||||
|
||||
// port enable disable test
|
||||
TEST_F(ComponentHidlTest, DISABLED_PortEnableDisable_Loaded) {
|
||||
TEST_P(ComponentHidlTest, DISABLED_PortEnableDisable_Loaded) {
|
||||
description("Test Port Enable and Disable (Component State :: Loaded)");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
OMX_U32 portBase = 0;
|
||||
Message msg;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
if (compClass == audio_decoder || compClass == audio_encoder) {
|
||||
|
@ -968,14 +965,14 @@ TEST_F(ComponentHidlTest, DISABLED_PortEnableDisable_Loaded) {
|
|||
}
|
||||
|
||||
// port enable disable test
|
||||
TEST_F(ComponentHidlTest, PortEnableDisable_Idle) {
|
||||
TEST_P(ComponentHidlTest, PortEnableDisable_Idle) {
|
||||
description("Test Port Enable and Disable (Component State :: Idle)");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
OMX_U32 portBase = 0;
|
||||
Message msg;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
if (compClass == audio_decoder || compClass == audio_encoder) {
|
||||
|
@ -1074,14 +1071,14 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Idle) {
|
|||
}
|
||||
|
||||
// port enable disable test
|
||||
TEST_F(ComponentHidlTest, PortEnableDisable_Execute) {
|
||||
TEST_P(ComponentHidlTest, PortEnableDisable_Execute) {
|
||||
description("Test Port Enable and Disable (Component State :: Execute)");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
OMX_U32 portBase = 0;
|
||||
Message msg;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
if (compClass == audio_decoder || compClass == audio_encoder) {
|
||||
|
@ -1192,14 +1189,14 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Execute) {
|
|||
}
|
||||
|
||||
// port enable disable test - monkeying
|
||||
TEST_F(ComponentHidlTest, DISABLED_PortEnableDisable_M) {
|
||||
TEST_P(ComponentHidlTest, DISABLED_PortEnableDisable_M) {
|
||||
description(
|
||||
"Test Port Enable and Disable Monkeying (Component State :: Loaded)");
|
||||
if (disableTest || isSecure) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
OMX_U32 portBase = 0;
|
||||
Message msg;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
if (compClass == audio_decoder || compClass == audio_encoder) {
|
||||
|
@ -1267,15 +1264,11 @@ TEST_F(ComponentHidlTest, DISABLED_PortEnableDisable_M) {
|
|||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(PerInstance, ComponentHidlTest, testing::ValuesIn(kTestParameters),
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
gEnv = new ComponentTestEnvironment();
|
||||
::testing::AddGlobalTestEnvironment(gEnv);
|
||||
kTestParameters = getTestParameters("");
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
gEnv->init(&argc, argv);
|
||||
int status = gEnv->initFromOptions(argc, argv);
|
||||
if (status == 0) {
|
||||
status = RUN_ALL_TESTS();
|
||||
ALOGI("Test result = %d", status);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
|
@ -18,6 +18,7 @@ cc_test {
|
|||
name: "VtsHalMediaOmxV1_0TargetMasterTest",
|
||||
defaults: ["VtsHalMediaOmxV1_0Defaults"],
|
||||
srcs: ["VtsHalMediaOmxV1_0TargetMasterTest.cpp"],
|
||||
test_suites: ["general-tests"],
|
||||
test_suites: [
|
||||
"vts-core",
|
||||
],
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
#include <android/hidl/allocator/1.0/IAllocator.h>
|
||||
#include <android/hidl/memory/1.0/IMapper.h>
|
||||
#include <android/hidl/memory/1.0/IMemory.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
using ::android::hardware::media::omx::V1_0::IOmx;
|
||||
using ::android::hardware::media::omx::V1_0::IOmxObserver;
|
||||
|
@ -46,30 +49,18 @@ using ::android::hardware::hidl_vec;
|
|||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <getopt.h>
|
||||
#include <media_hidl_test_common.h>
|
||||
|
||||
static ComponentTestEnvironment* gEnv = nullptr;
|
||||
|
||||
class MasterHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
private:
|
||||
typedef ::testing::VtsHalHidlTargetTestBase Super;
|
||||
public:
|
||||
class MasterHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
Super::SetUp();
|
||||
omxStore = nullptr;
|
||||
omxStore = Super::getService<IOmxStore>();
|
||||
omxStore = IOmxStore::getService(GetParam());
|
||||
ASSERT_NE(omxStore, nullptr);
|
||||
omx = nullptr;
|
||||
omx = omxStore->getOmx(gEnv->getInstance());
|
||||
omx = IOmx::getService(GetParam());
|
||||
ASSERT_NE(omx, nullptr);
|
||||
}
|
||||
|
||||
virtual void TearDown() override {
|
||||
Super::TearDown();
|
||||
}
|
||||
|
||||
sp<IOmxStore> omxStore;
|
||||
sp<IOmx> omx;
|
||||
|
||||
|
@ -89,8 +80,19 @@ void displayComponentInfo(hidl_vec<IOmx::ComponentInfo>& nodeList) {
|
|||
}
|
||||
}
|
||||
|
||||
// Make sure IOmx and IOmxStore have the same set of instances.
|
||||
TEST(MasterHidlTest, instanceMatchValidation) {
|
||||
auto omxInstances = android::hardware::getAllHalInstanceNames(IOmx::descriptor);
|
||||
auto omxStoreInstances = android::hardware::getAllHalInstanceNames(IOmxStore::descriptor);
|
||||
ASSERT_EQ(omxInstances.size(), omxInstances.size());
|
||||
for (const std::string& omxInstance : omxInstances) {
|
||||
EXPECT_TRUE(std::find(omxStoreInstances.begin(), omxStoreInstances.end(), omxInstance) !=
|
||||
omxStoreInstances.end());
|
||||
}
|
||||
}
|
||||
|
||||
// list service attributes
|
||||
TEST_F(MasterHidlTest, ListServiceAttr) {
|
||||
TEST_P(MasterHidlTest, ListServiceAttr) {
|
||||
description("list service attributes");
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
hidl_vec<IOmxStore::Attribute> attributes;
|
||||
|
@ -107,7 +109,7 @@ TEST_F(MasterHidlTest, ListServiceAttr) {
|
|||
}
|
||||
|
||||
// get node prefix
|
||||
TEST_F(MasterHidlTest, getNodePrefix) {
|
||||
TEST_P(MasterHidlTest, getNodePrefix) {
|
||||
description("get node prefix");
|
||||
hidl_string prefix;
|
||||
omxStore->getNodePrefix(
|
||||
|
@ -116,7 +118,7 @@ TEST_F(MasterHidlTest, getNodePrefix) {
|
|||
}
|
||||
|
||||
// list roles
|
||||
TEST_F(MasterHidlTest, ListRoles) {
|
||||
TEST_P(MasterHidlTest, ListRoles) {
|
||||
description("list roles");
|
||||
hidl_vec<IOmxStore::RoleInfo> roleList;
|
||||
omxStore->listRoles([&roleList](hidl_vec<IOmxStore::RoleInfo> const& _nl) {
|
||||
|
@ -126,7 +128,7 @@ TEST_F(MasterHidlTest, ListRoles) {
|
|||
}
|
||||
|
||||
// list components and roles.
|
||||
TEST_F(MasterHidlTest, ListNodes) {
|
||||
TEST_P(MasterHidlTest, ListNodes) {
|
||||
description("enumerate component and roles");
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
hidl_vec<IOmx::ComponentInfo> nodeList;
|
||||
|
@ -174,15 +176,7 @@ TEST_F(MasterHidlTest, ListNodes) {
|
|||
EXPECT_TRUE(isPass);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
gEnv = new ComponentTestEnvironment();
|
||||
::testing::AddGlobalTestEnvironment(gEnv);
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
gEnv->init(&argc, argv);
|
||||
int status = gEnv->initFromOptions(argc, argv);
|
||||
if (status == 0) {
|
||||
status = RUN_ALL_TESTS();
|
||||
ALOGI("Test result = %d", status);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
PerInstance, MasterHidlTest,
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(IOmxStore::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
|
|
|
@ -16,23 +16,33 @@
|
|||
|
||||
cc_test {
|
||||
name: "VtsHalMediaOmxV1_0TargetVideoDecTest",
|
||||
stem: "vts_hal_media_omx_v1_0_video_dec_test",
|
||||
defaults: ["VtsHalMediaOmxV1_0Defaults"],
|
||||
srcs: [
|
||||
"VtsHalMediaOmxV1_0TargetVideoDecTest.cpp",
|
||||
"media_video_hidl_test_common.cpp"
|
||||
"media_video_hidl_test_common.cpp",
|
||||
],
|
||||
data: [":media_omx_video_res"],
|
||||
test_config: "VtsHalMediaOmxV1_0TargetVideoDecTest.xml",
|
||||
test_suites: [
|
||||
"vts-core",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
}
|
||||
|
||||
cc_test {
|
||||
name: "VtsHalMediaOmxV1_0TargetVideoEncTest",
|
||||
stem: "vts_hal_media_omx_v1_0_video_enc_test",
|
||||
defaults: ["VtsHalMediaOmxV1_0Defaults"],
|
||||
srcs: [
|
||||
"VtsHalMediaOmxV1_0TargetVideoEncTest.cpp",
|
||||
"media_video_hidl_test_common.cpp"
|
||||
"media_video_hidl_test_common.cpp",
|
||||
],
|
||||
static_libs: [
|
||||
"libnativewindow",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
data: [":media_omx_video_res"],
|
||||
test_config: "VtsHalMediaOmxV1_0TargetVideoEncTest.xml",
|
||||
test_suites: [
|
||||
"vts-core",
|
||||
],
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <android/hidl/allocator/1.0/IAllocator.h>
|
||||
#include <android/hidl/memory/1.0/IMapper.h>
|
||||
#include <android/hidl/memory/1.0/IMemory.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
|
||||
using ::android::hardware::media::omx::V1_0::IOmx;
|
||||
using ::android::hardware::media::omx::V1_0::IOmxObserver;
|
||||
|
@ -44,49 +46,46 @@ using ::android::hardware::hidl_vec;
|
|||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <getopt.h>
|
||||
#include <media/hardware/HardwareAPI.h>
|
||||
#include <media_hidl_test_common.h>
|
||||
#include <media_video_hidl_test_common.h>
|
||||
#include <fstream>
|
||||
|
||||
static ComponentTestEnvironment* gEnv = nullptr;
|
||||
// Resource directory
|
||||
std::string sResourceDir = "";
|
||||
|
||||
// video decoder test fixture class
|
||||
class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
private:
|
||||
typedef ::testing::VtsHalHidlTargetTestBase Super;
|
||||
public:
|
||||
::std::string getTestCaseInfo() const override {
|
||||
return ::std::string() +
|
||||
"Component: " + gEnv->getComponent().c_str() + " | " +
|
||||
"Role: " + gEnv->getRole().c_str() + " | " +
|
||||
"Instance: " + gEnv->getInstance().c_str() + " | " +
|
||||
"Res: " + gEnv->getRes().c_str();
|
||||
class VideoDecHidlTest
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string, std::string>> {
|
||||
public:
|
||||
::std::string getTestCaseInfo() const {
|
||||
return ::std::string() + "Component: " + component_ + " | " + "Role: " + role_ + " | " +
|
||||
"Instance: " + instance_ + " | " + "Res: " + sResourceDir;
|
||||
}
|
||||
|
||||
virtual void SetUp() override {
|
||||
Super::SetUp();
|
||||
instance_ = std::get<0>(GetParam());
|
||||
component_ = std::get<1>(GetParam());
|
||||
role_ = std::get<2>(GetParam());
|
||||
ASSERT_NE(sResourceDir.empty(), true);
|
||||
|
||||
disableTest = false;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
omx = Super::getService<IOmx>(gEnv->getInstance());
|
||||
omx = IOmx::getService(instance_);
|
||||
ASSERT_NE(omx, nullptr);
|
||||
observer =
|
||||
new CodecObserver([this](Message msg, const BufferInfo* buffer) {
|
||||
handleMessage(msg, buffer);
|
||||
});
|
||||
ASSERT_NE(observer, nullptr);
|
||||
if (strncmp(gEnv->getComponent().c_str(), "OMX.", 4) != 0)
|
||||
disableTest = true;
|
||||
EXPECT_TRUE(omx->allocateNode(
|
||||
gEnv->getComponent(), observer,
|
||||
[&](android::hardware::media::omx::V1_0::Status _s,
|
||||
sp<IOmxNode> const& _nl) {
|
||||
status = _s;
|
||||
this->omxNode = _nl;
|
||||
})
|
||||
.isOk());
|
||||
if (component_.find("OMX.") != 0) disableTest = true;
|
||||
EXPECT_TRUE(omx->allocateNode(component_, observer,
|
||||
[&](android::hardware::media::omx::V1_0::Status _s,
|
||||
sp<IOmxNode> const& _nl) {
|
||||
status = _s;
|
||||
this->omxNode = _nl;
|
||||
})
|
||||
.isOk());
|
||||
if (status == android::hardware::media::omx::V1_0::Status::NAME_NOT_FOUND) {
|
||||
disableTest = true;
|
||||
std::cout << "[ WARN ] Test Disabled, component not present\n";
|
||||
|
@ -94,7 +93,7 @@ class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
}
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_NE(omxNode, nullptr);
|
||||
ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
|
||||
ASSERT_NE(role_.empty(), true) << "Invalid Component Role";
|
||||
struct StringToName {
|
||||
const char* Name;
|
||||
standardComp CompName;
|
||||
|
@ -107,7 +106,7 @@ class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
sizeof(kStringToName) / sizeof(kStringToName[0]);
|
||||
const char* pch;
|
||||
char substring[OMX_MAX_STRINGNAME_SIZE];
|
||||
strcpy(substring, gEnv->getRole().c_str());
|
||||
strcpy(substring, role_.c_str());
|
||||
pch = strchr(substring, '.');
|
||||
ASSERT_NE(pch, nullptr);
|
||||
compName = unknown_comp;
|
||||
|
@ -146,11 +145,8 @@ class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
isSecure = false;
|
||||
portSettingsChange = false;
|
||||
size_t suffixLen = strlen(".secure");
|
||||
if (strlen(gEnv->getComponent().c_str()) >= suffixLen) {
|
||||
isSecure =
|
||||
!strcmp(gEnv->getComponent().c_str() +
|
||||
strlen(gEnv->getComponent().c_str()) - suffixLen,
|
||||
".secure");
|
||||
if (component_.rfind(".secure") == component_.length() - suffixLen) {
|
||||
isSecure = true;
|
||||
}
|
||||
if (isSecure) disableTest = true;
|
||||
omxNode->configureVideoTunnelMode(
|
||||
|
@ -175,7 +171,6 @@ class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
EXPECT_TRUE((omxNode->freeNode()).isOk());
|
||||
omxNode = nullptr;
|
||||
}
|
||||
Super::TearDown();
|
||||
}
|
||||
|
||||
// callback function to process messages received by onMessages() from IL
|
||||
|
@ -255,6 +250,10 @@ class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
unknown_comp,
|
||||
};
|
||||
|
||||
std::string component_;
|
||||
std::string role_;
|
||||
std::string instance_;
|
||||
|
||||
sp<IOmx> omx;
|
||||
sp<CodecObserver> observer;
|
||||
sp<IOmxNode> omxNode;
|
||||
|
@ -719,23 +718,23 @@ void getDefaultColorFormat(sp<IOmxNode> omxNode, OMX_U32 kPortIndexOutput,
|
|||
}
|
||||
|
||||
// set component role
|
||||
TEST_F(VideoDecHidlTest, SetRole) {
|
||||
TEST_P(VideoDecHidlTest, SetRole) {
|
||||
description("Test Set Component Role");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
}
|
||||
|
||||
// port format enumeration
|
||||
TEST_F(VideoDecHidlTest, EnumeratePortFormat) {
|
||||
TEST_P(VideoDecHidlTest, EnumeratePortFormat) {
|
||||
description("Test Component on Mandatory Port Parameters (Port Format)");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar;
|
||||
OMX_U32 xFramerate = (24U << 16);
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
|
||||
|
@ -755,12 +754,12 @@ TEST_F(VideoDecHidlTest, EnumeratePortFormat) {
|
|||
|
||||
// test port settings reconfiguration, elementary stream decode and timestamp
|
||||
// deviation
|
||||
TEST_F(VideoDecHidlTest, DecodeTest) {
|
||||
TEST_P(VideoDecHidlTest, DecodeTest) {
|
||||
description("Tests Port Reconfiguration, Decode and timestamp deviation");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
|
||||
|
@ -770,8 +769,8 @@ TEST_F(VideoDecHidlTest, DecodeTest) {
|
|||
kPortIndexOutput = kPortIndexInput + 1;
|
||||
}
|
||||
char mURL[512], info[512];
|
||||
strcpy(mURL, gEnv->getRes().c_str());
|
||||
strcpy(info, gEnv->getRes().c_str());
|
||||
strcpy(mURL, sResourceDir.c_str());
|
||||
strcpy(info, sResourceDir.c_str());
|
||||
GetURLForComponent(compName, mURL, info);
|
||||
|
||||
std::ifstream eleStream, eleInfo;
|
||||
|
@ -860,7 +859,7 @@ TEST_F(VideoDecHidlTest, DecodeTest) {
|
|||
}
|
||||
|
||||
// Test for adaptive playback support
|
||||
TEST_F(VideoDecHidlTest, AdaptivePlaybackTest) {
|
||||
TEST_P(VideoDecHidlTest, AdaptivePlaybackTest) {
|
||||
description("Tests for Adaptive Playback support");
|
||||
if (disableTest) return;
|
||||
if (!(compName == avc || compName == hevc || compName == vp8 ||
|
||||
|
@ -868,7 +867,7 @@ TEST_F(VideoDecHidlTest, AdaptivePlaybackTest) {
|
|||
return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
|
||||
|
@ -895,7 +894,7 @@ TEST_F(VideoDecHidlTest, AdaptivePlaybackTest) {
|
|||
uint32_t adaptiveMaxHeight = 240;
|
||||
status = omxNode->prepareForAdaptivePlayback(
|
||||
kPortIndexOutput, true, adaptiveMaxWidth, adaptiveMaxHeight);
|
||||
if (strncmp(gEnv->getComponent().c_str(), "OMX.google.", 11) == 0) {
|
||||
if (component_.find("OMX.google.") == 0) {
|
||||
// SoftOMX Decoders donot support graphic buffer modes. So for them
|
||||
// support for adaptive play back is mandatory in Byte Buffer mode
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
@ -944,8 +943,8 @@ TEST_F(VideoDecHidlTest, AdaptivePlaybackTest) {
|
|||
std::ifstream eleStream, eleInfo;
|
||||
char mURL[512], info[512];
|
||||
android::Vector<FrameData> Info;
|
||||
strcpy(mURL, gEnv->getRes().c_str());
|
||||
strcpy(info, gEnv->getRes().c_str());
|
||||
strcpy(mURL, sResourceDir.c_str());
|
||||
strcpy(info, sResourceDir.c_str());
|
||||
GetURLForComponent(compName, mURL, info, i % STREAM_COUNT);
|
||||
eleInfo.open(info);
|
||||
ASSERT_EQ(eleInfo.is_open(), true);
|
||||
|
@ -1008,12 +1007,12 @@ TEST_F(VideoDecHidlTest, AdaptivePlaybackTest) {
|
|||
}
|
||||
|
||||
// end of sequence test
|
||||
TEST_F(VideoDecHidlTest, EOSTest_M) {
|
||||
TEST_P(VideoDecHidlTest, EOSTest_M) {
|
||||
description("Test End of stream monkeying");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
|
||||
|
@ -1074,12 +1073,12 @@ TEST_F(VideoDecHidlTest, EOSTest_M) {
|
|||
}
|
||||
|
||||
// end of sequence test
|
||||
TEST_F(VideoDecHidlTest, ThumbnailTest) {
|
||||
TEST_P(VideoDecHidlTest, ThumbnailTest) {
|
||||
description("Test Request for thumbnail");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
|
||||
|
@ -1089,8 +1088,8 @@ TEST_F(VideoDecHidlTest, ThumbnailTest) {
|
|||
kPortIndexOutput = kPortIndexInput + 1;
|
||||
}
|
||||
char mURL[512], info[512];
|
||||
strcpy(mURL, gEnv->getRes().c_str());
|
||||
strcpy(info, gEnv->getRes().c_str());
|
||||
strcpy(mURL, sResourceDir.c_str());
|
||||
strcpy(info, sResourceDir.c_str());
|
||||
GetURLForComponent(compName, mURL, info);
|
||||
|
||||
std::ifstream eleStream, eleInfo;
|
||||
|
@ -1195,12 +1194,12 @@ TEST_F(VideoDecHidlTest, ThumbnailTest) {
|
|||
}
|
||||
|
||||
// end of sequence test
|
||||
TEST_F(VideoDecHidlTest, SimpleEOSTest) {
|
||||
TEST_P(VideoDecHidlTest, SimpleEOSTest) {
|
||||
description("Test End of stream");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
|
||||
|
@ -1210,8 +1209,8 @@ TEST_F(VideoDecHidlTest, SimpleEOSTest) {
|
|||
kPortIndexOutput = kPortIndexInput + 1;
|
||||
}
|
||||
char mURL[512], info[512];
|
||||
strcpy(mURL, gEnv->getRes().c_str());
|
||||
strcpy(info, gEnv->getRes().c_str());
|
||||
strcpy(mURL, sResourceDir.c_str());
|
||||
strcpy(info, sResourceDir.c_str());
|
||||
GetURLForComponent(compName, mURL, info);
|
||||
|
||||
std::ifstream eleStream, eleInfo;
|
||||
|
@ -1302,12 +1301,12 @@ TEST_F(VideoDecHidlTest, SimpleEOSTest) {
|
|||
}
|
||||
|
||||
// test input/output port flush
|
||||
TEST_F(VideoDecHidlTest, FlushTest) {
|
||||
TEST_P(VideoDecHidlTest, FlushTest) {
|
||||
description("Test Flush");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
|
||||
|
@ -1317,8 +1316,8 @@ TEST_F(VideoDecHidlTest, FlushTest) {
|
|||
kPortIndexOutput = kPortIndexInput + 1;
|
||||
}
|
||||
char mURL[512], info[512];
|
||||
strcpy(mURL, gEnv->getRes().c_str());
|
||||
strcpy(info, gEnv->getRes().c_str());
|
||||
strcpy(mURL, sResourceDir.c_str());
|
||||
strcpy(info, sResourceDir.c_str());
|
||||
GetURLForComponent(compName, mURL, info);
|
||||
|
||||
std::ifstream eleStream, eleInfo;
|
||||
|
@ -1420,15 +1419,21 @@ TEST_F(VideoDecHidlTest, FlushTest) {
|
|||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(PerInstance, VideoDecHidlTest, testing::ValuesIn(kTestParameters),
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
gEnv = new ComponentTestEnvironment();
|
||||
::testing::AddGlobalTestEnvironment(gEnv);
|
||||
kTestParameters = getTestParameters("video_decoder");
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
gEnv->init(&argc, argv);
|
||||
int status = gEnv->initFromOptions(argc, argv);
|
||||
if (status == 0) {
|
||||
status = RUN_ALL_TESTS();
|
||||
ALOGI("Test result = %d", status);
|
||||
|
||||
// Set the resource directory based on command line args.
|
||||
// Test will fail to set up if the argument is not set.
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-P") == 0 && i < argc - 1) {
|
||||
sResourceDir = argv[i + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2020 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the"License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an"AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<configuration description="Runs VtsHalMediaOmxV1_0TargetVideoDecTest.">
|
||||
<target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />
|
||||
|
||||
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
|
||||
<option name="cleanup" value="true" />
|
||||
<option name="push-file" key="vts_hal_media_omx_v1_0_video_dec_test" value="/data/local/tmp/vts_hal_media_omx_v1_0_video_dec_test" />
|
||||
|
||||
<!-- Files used for video testing -->
|
||||
<option name="push-file" key="bbb_352x288_420p_30fps_32frames.yuv" value="/data/local/tmp/media/bbb_352x288_420p_30fps_32frames.yuv" />
|
||||
<option name="push-file" key="bbb_avc_176x144_300kbps_60fps.h264" value="/data/local/tmp/media/bbb_avc_176x144_300kbps_60fps.h264" />
|
||||
<option name="push-file" key="bbb_avc_176x144_300kbps_60fps.info" value="/data/local/tmp/media/bbb_avc_176x144_300kbps_60fps.info" />
|
||||
<option name="push-file" key="bbb_avc_640x360_768kbps_30fps.h264" value="/data/local/tmp/media/bbb_avc_640x360_768kbps_30fps.h264" />
|
||||
<option name="push-file" key="bbb_avc_640x360_768kbps_30fps.info" value="/data/local/tmp/media/bbb_avc_640x360_768kbps_30fps.info" />
|
||||
<option name="push-file" key="bbb_h263_352x288_300kbps_12fps.h263" value="/data/local/tmp/media/bbb_h263_352x288_300kbps_12fps.h263" />
|
||||
<option name="push-file" key="bbb_h263_352x288_300kbps_12fps.info" value="/data/local/tmp/media/bbb_h263_352x288_300kbps_12fps.info" />
|
||||
<option name="push-file" key="bbb_hevc_176x144_176kbps_60fps.hevc" value="/data/local/tmp/media/bbb_hevc_176x144_176kbps_60fps.hevc" />
|
||||
<option name="push-file" key="bbb_hevc_176x144_176kbps_60fps.info" value="/data/local/tmp/media/bbb_hevc_176x144_176kbps_60fps.info" />
|
||||
<option name="push-file" key="bbb_hevc_640x360_1600kbps_30fps.hevc" value="/data/local/tmp/media/bbb_hevc_640x360_1600kbps_30fps.hevc" />
|
||||
<option name="push-file" key="bbb_hevc_640x360_1600kbps_30fps.info" value="/data/local/tmp/media/bbb_hevc_640x360_1600kbps_30fps.info" />
|
||||
<option name="push-file" key="bbb_mpeg2_176x144_105kbps_25fps.info" value="/data/local/tmp/media/bbb_mpeg2_176x144_105kbps_25fps.info" />
|
||||
<option name="push-file" key="bbb_mpeg2_176x144_105kbps_25fps.m2v" value="/data/local/tmp/media/bbb_mpeg2_176x144_105kbps_25fps.m2v" />
|
||||
<option name="push-file" key="bbb_mpeg2_352x288_1mbps_60fps.info" value="/data/local/tmp/media/bbb_mpeg2_352x288_1mbps_60fps.info" />
|
||||
<option name="push-file" key="bbb_mpeg2_352x288_1mbps_60fps.m2v" value="/data/local/tmp/media/bbb_mpeg2_352x288_1mbps_60fps.m2v" />
|
||||
<option name="push-file" key="bbb_mpeg4_352x288_512kbps_30fps.info" value="/data/local/tmp/media/bbb_mpeg4_352x288_512kbps_30fps.info" />
|
||||
<option name="push-file" key="bbb_mpeg4_352x288_512kbps_30fps.m4v" value="/data/local/tmp/media/bbb_mpeg4_352x288_512kbps_30fps.m4v" />
|
||||
<option name="push-file" key="bbb_vp8_176x144_240kbps_60fps.info" value="/data/local/tmp/media/bbb_vp8_176x144_240kbps_60fps.info" />
|
||||
<option name="push-file" key="bbb_vp8_176x144_240kbps_60fps.vp8" value="/data/local/tmp/media/bbb_vp8_176x144_240kbps_60fps.vp8" />
|
||||
<option name="push-file" key="bbb_vp8_640x360_2mbps_30fps.info" value="/data/local/tmp/media/bbb_vp8_640x360_2mbps_30fps.info" />
|
||||
<option name="push-file" key="bbb_vp8_640x360_2mbps_30fps.vp8" value="/data/local/tmp/media/bbb_vp8_640x360_2mbps_30fps.vp8" />
|
||||
<option name="push-file" key="bbb_vp9_176x144_285kbps_60fps.info" value="/data/local/tmp/media/bbb_vp9_176x144_285kbps_60fps.info" />
|
||||
<option name="push-file" key="bbb_vp9_176x144_285kbps_60fps.vp9" value="/data/local/tmp/media/bbb_vp9_176x144_285kbps_60fps.vp9" />
|
||||
<option name="push-file" key="bbb_vp9_640x360_1600kbps_30fps.info" value="/data/local/tmp/media/bbb_vp9_640x360_1600kbps_30fps.info" />
|
||||
<option name="push-file" key="bbb_vp9_640x360_1600kbps_30fps.vp9" value="/data/local/tmp/media/bbb_vp9_640x360_1600kbps_30fps.vp9" />
|
||||
</target_preparer>
|
||||
|
||||
<test class="com.android.tradefed.testtype.GTest" >
|
||||
<option name="native-test-device-path" value="/data/local/tmp" />
|
||||
<option name="module-name" value="vts_hal_media_omx_v1_0_video_dec_test" />
|
||||
<option name="native-test-flag" value="-P /data/local/tmp/media/" />
|
||||
</test>
|
||||
</configuration>
|
|
@ -34,6 +34,8 @@
|
|||
#include <android/hidl/allocator/1.0/IAllocator.h>
|
||||
#include <android/hidl/memory/1.0/IMapper.h>
|
||||
#include <android/hidl/memory/1.0/IMemory.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
|
||||
using ::android::hardware::graphics::bufferqueue::V1_0::IGraphicBufferProducer;
|
||||
using ::android::hardware::graphics::bufferqueue::V1_0::IProducerListener;
|
||||
|
@ -56,51 +58,48 @@ using ::android::hardware::hidl_vec;
|
|||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <getopt.h>
|
||||
#include <media/hardware/HardwareAPI.h>
|
||||
#include <media_hidl_test_common.h>
|
||||
#include <media_video_hidl_test_common.h>
|
||||
#include <system/window.h>
|
||||
#include <fstream>
|
||||
#include <variant>
|
||||
|
||||
static ComponentTestEnvironment* gEnv = nullptr;
|
||||
// Resource directory
|
||||
std::string sResourceDir = "";
|
||||
|
||||
// video encoder test fixture class
|
||||
class VideoEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
private:
|
||||
typedef ::testing::VtsHalHidlTargetTestBase Super;
|
||||
public:
|
||||
::std::string getTestCaseInfo() const override {
|
||||
return ::std::string() +
|
||||
"Component: " + gEnv->getComponent().c_str() + " | " +
|
||||
"Role: " + gEnv->getRole().c_str() + " | " +
|
||||
"Instance: " + gEnv->getInstance().c_str() + " | " +
|
||||
"Res: " + gEnv->getRes().c_str();
|
||||
class VideoEncHidlTest
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string, std::string>> {
|
||||
public:
|
||||
::std::string getTestCaseInfo() const {
|
||||
return ::std::string() + "Component: " + component_ + " | " + "Role: " + role_ + " | " +
|
||||
"Instance: " + instance_ + " | " + "Res: " + sResourceDir;
|
||||
}
|
||||
|
||||
virtual void SetUp() override {
|
||||
Super::SetUp();
|
||||
instance_ = std::get<0>(GetParam());
|
||||
component_ = std::get<1>(GetParam());
|
||||
role_ = std::get<2>(GetParam());
|
||||
ASSERT_NE(sResourceDir.empty(), true);
|
||||
|
||||
disableTest = false;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
omx = Super::getService<IOmx>(gEnv->getInstance());
|
||||
omx = IOmx::getService(instance_);
|
||||
ASSERT_NE(omx, nullptr);
|
||||
observer =
|
||||
new CodecObserver([this](Message msg, const BufferInfo* buffer) {
|
||||
handleMessage(msg, buffer);
|
||||
});
|
||||
ASSERT_NE(observer, nullptr);
|
||||
if (strncmp(gEnv->getComponent().c_str(), "OMX.", 4) != 0)
|
||||
disableTest = true;
|
||||
EXPECT_TRUE(omx->allocateNode(
|
||||
gEnv->getComponent(), observer,
|
||||
[&](android::hardware::media::omx::V1_0::Status _s,
|
||||
sp<IOmxNode> const& _nl) {
|
||||
status = _s;
|
||||
this->omxNode = _nl;
|
||||
})
|
||||
.isOk());
|
||||
if (component_.find("OMX.") != 0) disableTest = true;
|
||||
EXPECT_TRUE(omx->allocateNode(component_, observer,
|
||||
[&](android::hardware::media::omx::V1_0::Status _s,
|
||||
sp<IOmxNode> const& _nl) {
|
||||
status = _s;
|
||||
this->omxNode = _nl;
|
||||
})
|
||||
.isOk());
|
||||
if (status == android::hardware::media::omx::V1_0::Status::NAME_NOT_FOUND) {
|
||||
disableTest = true;
|
||||
std::cout << "[ WARN ] Test Disabled, component not present\n";
|
||||
|
@ -108,7 +107,7 @@ class VideoEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
}
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_NE(omxNode, nullptr);
|
||||
ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
|
||||
ASSERT_NE(role_.empty(), true) << "Invalid Component Role";
|
||||
struct StringToName {
|
||||
const char* Name;
|
||||
standardComp CompName;
|
||||
|
@ -121,7 +120,7 @@ class VideoEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
sizeof(kStringToName) / sizeof(kStringToName[0]);
|
||||
const char* pch;
|
||||
char substring[OMX_MAX_STRINGNAME_SIZE];
|
||||
strcpy(substring, gEnv->getRole().c_str());
|
||||
strcpy(substring, role_.c_str());
|
||||
pch = strchr(substring, '.');
|
||||
ASSERT_NE(pch, nullptr);
|
||||
compName = unknown_comp;
|
||||
|
@ -158,11 +157,8 @@ class VideoEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
source = nullptr;
|
||||
isSecure = false;
|
||||
size_t suffixLen = strlen(".secure");
|
||||
if (strlen(gEnv->getComponent().c_str()) >= suffixLen) {
|
||||
isSecure =
|
||||
!strcmp(gEnv->getComponent().c_str() +
|
||||
strlen(gEnv->getComponent().c_str()) - suffixLen,
|
||||
".secure");
|
||||
if (component_.rfind(".secure") == component_.length() - suffixLen) {
|
||||
isSecure = true;
|
||||
}
|
||||
if (isSecure) disableTest = true;
|
||||
if (disableTest) std::cout << "[ WARN ] Test Disabled \n";
|
||||
|
@ -177,7 +173,6 @@ class VideoEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
EXPECT_TRUE((omxNode->freeNode()).isOk());
|
||||
omxNode = nullptr;
|
||||
}
|
||||
Super::TearDown();
|
||||
}
|
||||
|
||||
// callback function to process messages received by onMessages() from IL
|
||||
|
@ -245,6 +240,10 @@ class VideoEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
unknown_comp,
|
||||
};
|
||||
|
||||
std::string component_;
|
||||
std::string role_;
|
||||
std::string instance_;
|
||||
|
||||
sp<IOmx> omx;
|
||||
sp<CodecObserver> observer;
|
||||
sp<IOmxNode> omxNode;
|
||||
|
@ -1085,23 +1084,23 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
}
|
||||
|
||||
// set component role
|
||||
TEST_F(VideoEncHidlTest, SetRole) {
|
||||
TEST_P(VideoEncHidlTest, SetRole) {
|
||||
description("Test Set Component Role");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
}
|
||||
|
||||
// port format enumeration
|
||||
TEST_F(VideoEncHidlTest, EnumeratePortFormat) {
|
||||
TEST_P(VideoEncHidlTest, EnumeratePortFormat) {
|
||||
description("Test Component on Mandatory Port Parameters (Port Format)");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar;
|
||||
OMX_U32 xFramerate = (30U << 16);
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
|
||||
|
@ -1121,12 +1120,12 @@ TEST_F(VideoEncHidlTest, EnumeratePortFormat) {
|
|||
}
|
||||
|
||||
// Test IOmxBufferSource CallBacks
|
||||
TEST_F(VideoEncHidlTest, BufferSourceCallBacks) {
|
||||
TEST_P(VideoEncHidlTest, BufferSourceCallBacks) {
|
||||
description("Test IOmxBufferSource CallBacks");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
|
||||
|
@ -1178,12 +1177,12 @@ TEST_F(VideoEncHidlTest, BufferSourceCallBacks) {
|
|||
}
|
||||
|
||||
// test raw stream encode (input is byte buffers)
|
||||
TEST_F(VideoEncHidlTest, EncodeTest) {
|
||||
TEST_P(VideoEncHidlTest, EncodeTest) {
|
||||
description("Test Encode");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
|
||||
|
@ -1193,7 +1192,7 @@ TEST_F(VideoEncHidlTest, EncodeTest) {
|
|||
kPortIndexOutput = kPortIndexInput + 1;
|
||||
}
|
||||
char mURL[512];
|
||||
strcpy(mURL, gEnv->getRes().c_str());
|
||||
strcpy(mURL, sResourceDir.c_str());
|
||||
GetURLForComponent(mURL);
|
||||
|
||||
std::ifstream eleStream;
|
||||
|
@ -1293,12 +1292,12 @@ TEST_F(VideoEncHidlTest, EncodeTest) {
|
|||
}
|
||||
|
||||
// test raw stream encode (input is ANW buffers)
|
||||
TEST_F(VideoEncHidlTest, EncodeTestBufferMetaModes) {
|
||||
TEST_P(VideoEncHidlTest, EncodeTestBufferMetaModes) {
|
||||
description("Test Encode Input buffer metamodes");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
|
||||
|
@ -1383,7 +1382,7 @@ TEST_F(VideoEncHidlTest, EncodeTestBufferMetaModes) {
|
|||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
char mURL[512];
|
||||
strcpy(mURL, gEnv->getRes().c_str());
|
||||
strcpy(mURL, sResourceDir.c_str());
|
||||
GetURLForComponent(mURL);
|
||||
|
||||
uint32_t latency = 0;
|
||||
|
@ -1460,12 +1459,12 @@ TEST_F(VideoEncHidlTest, EncodeTestBufferMetaModes) {
|
|||
}
|
||||
|
||||
// Test end of stream
|
||||
TEST_F(VideoEncHidlTest, EncodeTestEOS) {
|
||||
TEST_P(VideoEncHidlTest, EncodeTestEOS) {
|
||||
description("Test EOS");
|
||||
if (disableTest) return;
|
||||
android::hardware::media::omx::V1_0::Status status;
|
||||
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
|
||||
status = setRole(omxNode, gEnv->getRole().c_str());
|
||||
status = setRole(omxNode, role_);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
OMX_PORT_PARAM_TYPE params;
|
||||
status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
|
||||
|
@ -1574,15 +1573,21 @@ TEST_F(VideoEncHidlTest, EncodeTestEOS) {
|
|||
ASSERT_EQ(returnval, 0);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(PerInstance, VideoEncHidlTest, testing::ValuesIn(kTestParameters),
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
gEnv = new ComponentTestEnvironment();
|
||||
::testing::AddGlobalTestEnvironment(gEnv);
|
||||
kTestParameters = getTestParameters("video_encoder");
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
gEnv->init(&argc, argv);
|
||||
int status = gEnv->initFromOptions(argc, argv);
|
||||
if (status == 0) {
|
||||
status = RUN_ALL_TESTS();
|
||||
ALOGI("Test result = %d", status);
|
||||
|
||||
// Set the resource directory based on command line args.
|
||||
// Test will fail to set up if the argument is not set.
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-P") == 0 && i < argc - 1) {
|
||||
sResourceDir = argv[i + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2020 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the"License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an"AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<configuration description="Runs VtsHalMediaOmxV1_0TargetVideoEncTest.">
|
||||
<target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />
|
||||
|
||||
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
|
||||
<option name="cleanup" value="true" />
|
||||
<option name="push-file" key="vts_hal_media_omx_v1_0_video_enc_test" value="/data/local/tmp/vts_hal_media_omx_v1_0_video_enc_test" />
|
||||
|
||||
<!-- Files used for video testing -->
|
||||
<option name="push-file" key="bbb_352x288_420p_30fps_32frames.yuv" value="/data/local/tmp/media/bbb_352x288_420p_30fps_32frames.yuv" />
|
||||
<option name="push-file" key="bbb_avc_176x144_300kbps_60fps.h264" value="/data/local/tmp/media/bbb_avc_176x144_300kbps_60fps.h264" />
|
||||
<option name="push-file" key="bbb_avc_176x144_300kbps_60fps.info" value="/data/local/tmp/media/bbb_avc_176x144_300kbps_60fps.info" />
|
||||
<option name="push-file" key="bbb_avc_640x360_768kbps_30fps.h264" value="/data/local/tmp/media/bbb_avc_640x360_768kbps_30fps.h264" />
|
||||
<option name="push-file" key="bbb_avc_640x360_768kbps_30fps.info" value="/data/local/tmp/media/bbb_avc_640x360_768kbps_30fps.info" />
|
||||
<option name="push-file" key="bbb_h263_352x288_300kbps_12fps.h263" value="/data/local/tmp/media/bbb_h263_352x288_300kbps_12fps.h263" />
|
||||
<option name="push-file" key="bbb_h263_352x288_300kbps_12fps.info" value="/data/local/tmp/media/bbb_h263_352x288_300kbps_12fps.info" />
|
||||
<option name="push-file" key="bbb_hevc_176x144_176kbps_60fps.hevc" value="/data/local/tmp/media/bbb_hevc_176x144_176kbps_60fps.hevc" />
|
||||
<option name="push-file" key="bbb_hevc_176x144_176kbps_60fps.info" value="/data/local/tmp/media/bbb_hevc_176x144_176kbps_60fps.info" />
|
||||
<option name="push-file" key="bbb_hevc_640x360_1600kbps_30fps.hevc" value="/data/local/tmp/media/bbb_hevc_640x360_1600kbps_30fps.hevc" />
|
||||
<option name="push-file" key="bbb_hevc_640x360_1600kbps_30fps.info" value="/data/local/tmp/media/bbb_hevc_640x360_1600kbps_30fps.info" />
|
||||
<option name="push-file" key="bbb_mpeg2_176x144_105kbps_25fps.info" value="/data/local/tmp/media/bbb_mpeg2_176x144_105kbps_25fps.info" />
|
||||
<option name="push-file" key="bbb_mpeg2_176x144_105kbps_25fps.m2v" value="/data/local/tmp/media/bbb_mpeg2_176x144_105kbps_25fps.m2v" />
|
||||
<option name="push-file" key="bbb_mpeg2_352x288_1mbps_60fps.info" value="/data/local/tmp/media/bbb_mpeg2_352x288_1mbps_60fps.info" />
|
||||
<option name="push-file" key="bbb_mpeg2_352x288_1mbps_60fps.m2v" value="/data/local/tmp/media/bbb_mpeg2_352x288_1mbps_60fps.m2v" />
|
||||
<option name="push-file" key="bbb_mpeg4_352x288_512kbps_30fps.info" value="/data/local/tmp/media/bbb_mpeg4_352x288_512kbps_30fps.info" />
|
||||
<option name="push-file" key="bbb_mpeg4_352x288_512kbps_30fps.m4v" value="/data/local/tmp/media/bbb_mpeg4_352x288_512kbps_30fps.m4v" />
|
||||
<option name="push-file" key="bbb_vp8_176x144_240kbps_60fps.info" value="/data/local/tmp/media/bbb_vp8_176x144_240kbps_60fps.info" />
|
||||
<option name="push-file" key="bbb_vp8_176x144_240kbps_60fps.vp8" value="/data/local/tmp/media/bbb_vp8_176x144_240kbps_60fps.vp8" />
|
||||
<option name="push-file" key="bbb_vp8_640x360_2mbps_30fps.info" value="/data/local/tmp/media/bbb_vp8_640x360_2mbps_30fps.info" />
|
||||
<option name="push-file" key="bbb_vp8_640x360_2mbps_30fps.vp8" value="/data/local/tmp/media/bbb_vp8_640x360_2mbps_30fps.vp8" />
|
||||
<option name="push-file" key="bbb_vp9_176x144_285kbps_60fps.info" value="/data/local/tmp/media/bbb_vp9_176x144_285kbps_60fps.info" />
|
||||
<option name="push-file" key="bbb_vp9_176x144_285kbps_60fps.vp9" value="/data/local/tmp/media/bbb_vp9_176x144_285kbps_60fps.vp9" />
|
||||
<option name="push-file" key="bbb_vp9_640x360_1600kbps_30fps.info" value="/data/local/tmp/media/bbb_vp9_640x360_1600kbps_30fps.info" />
|
||||
<option name="push-file" key="bbb_vp9_640x360_1600kbps_30fps.vp9" value="/data/local/tmp/media/bbb_vp9_640x360_1600kbps_30fps.vp9" />
|
||||
</target_preparer>
|
||||
|
||||
<test class="com.android.tradefed.testtype.GTest" >
|
||||
<option name="native-test-device-path" value="/data/local/tmp" />
|
||||
<option name="module-name" value="vts_hal_media_omx_v1_0_video_enc_test" />
|
||||
<option name="native-test-flag" value="-P /data/local/tmp/media/" />
|
||||
</test>
|
||||
</configuration>
|
|
@ -44,7 +44,6 @@ using ::android::hardware::hidl_vec;
|
|||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <hidlmemory/mapping.h>
|
||||
#include <media/hardware/HardwareAPI.h>
|
||||
#include <media_hidl_test_common.h>
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#ifndef MEDIA_VIDEO_HIDL_TEST_COMMON_H
|
||||
#define MEDIA_VIDEO_HIDL_TEST_COMMON_H
|
||||
|
||||
#include <media_hidl_test_common.h>
|
||||
|
||||
/*
|
||||
* Common video utils
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue