mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
omx:component: add support for tunneled components in ComponentTest
am: 4609857ee4
Change-Id: I54aef53b8a0a954e1df36bc8594283cffdc84639
This commit is contained in:
@@ -387,17 +387,28 @@ void changeStateLoadedtoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||||||
OMX_StateIdle);
|
OMX_StateIdle);
|
||||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||||
|
|
||||||
|
OMX_PARAM_PORTDEFINITIONTYPE portDefInput;
|
||||||
|
OMX_PARAM_PORTDEFINITIONTYPE portDefOutput;
|
||||||
|
status = getPortParam(omxNode, OMX_IndexParamPortDefinition, kPortIndexInput, &portDefInput);
|
||||||
|
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||||
|
status = getPortParam(omxNode, OMX_IndexParamPortDefinition, kPortIndexOutput, &portDefOutput);
|
||||||
|
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||||
|
|
||||||
// Dont switch states until the ports are populated
|
// Dont switch states until the ports are populated
|
||||||
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
|
if (portDefInput.nBufferCountActual || portDefOutput.nBufferCountActual) {
|
||||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
|
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
|
||||||
|
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
|
||||||
|
}
|
||||||
|
|
||||||
// allocate buffers on input port
|
// allocate buffers on input port
|
||||||
ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
|
ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
|
||||||
omxNode, iBuffer, kPortIndexInput, pm[0], allocGrap));
|
omxNode, iBuffer, kPortIndexInput, pm[0], allocGrap));
|
||||||
|
|
||||||
// Dont switch states until the ports are populated
|
// Dont switch states until the ports are populated
|
||||||
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
|
if (portDefOutput.nBufferCountActual) {
|
||||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
|
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
|
||||||
|
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
|
||||||
|
}
|
||||||
|
|
||||||
// allocate buffers on output port
|
// allocate buffers on output port
|
||||||
ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
|
ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
|
||||||
@@ -430,9 +441,18 @@ void changeStateIdletoLoaded(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||||||
OMX_StateLoaded);
|
OMX_StateLoaded);
|
||||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||||
|
|
||||||
|
OMX_PARAM_PORTDEFINITIONTYPE portDefInput;
|
||||||
|
OMX_PARAM_PORTDEFINITIONTYPE portDefOutput;
|
||||||
|
status = getPortParam(omxNode, OMX_IndexParamPortDefinition, kPortIndexInput, &portDefInput);
|
||||||
|
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||||
|
status = getPortParam(omxNode, OMX_IndexParamPortDefinition, kPortIndexOutput, &portDefOutput);
|
||||||
|
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||||
|
|
||||||
// dont change state until all buffers are freed
|
// dont change state until all buffers are freed
|
||||||
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
|
if (portDefInput.nBufferCountActual || portDefOutput.nBufferCountActual) {
|
||||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
|
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
|
||||||
|
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < iBuffer->size(); ++i) {
|
for (size_t i = 0; i < iBuffer->size(); ++i) {
|
||||||
status = omxNode->freeBuffer(kPortIndexInput, (*iBuffer)[i].id);
|
status = omxNode->freeBuffer(kPortIndexInput, (*iBuffer)[i].id);
|
||||||
@@ -440,8 +460,10 @@ void changeStateIdletoLoaded(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// dont change state until all buffers are freed
|
// dont change state until all buffers are freed
|
||||||
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
|
if (portDefOutput.nBufferCountActual) {
|
||||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
|
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
|
||||||
|
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < oBuffer->size(); ++i) {
|
for (size_t i = 0; i < oBuffer->size(); ++i) {
|
||||||
status = omxNode->freeBuffer(kPortIndexOutput, (*oBuffer)[i].id);
|
status = omxNode->freeBuffer(kPortIndexOutput, (*oBuffer)[i].id);
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||||||
}
|
}
|
||||||
if (compClass == unknown_class) disableTest = true;
|
if (compClass == unknown_class) disableTest = true;
|
||||||
isSecure = false;
|
isSecure = false;
|
||||||
|
mTunnel = false;
|
||||||
size_t suffixLen = strlen(".secure");
|
size_t suffixLen = strlen(".secure");
|
||||||
if (strlen(gEnv->getComponent().c_str()) >= suffixLen) {
|
if (strlen(gEnv->getComponent().c_str()) >= suffixLen) {
|
||||||
isSecure =
|
isSecure =
|
||||||
@@ -122,6 +123,18 @@ class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||||||
strlen(gEnv->getComponent().c_str()) - suffixLen,
|
strlen(gEnv->getComponent().c_str()) - suffixLen,
|
||||||
".secure");
|
".secure");
|
||||||
}
|
}
|
||||||
|
if (compClass == video_decoder) {
|
||||||
|
omxNode->configureVideoTunnelMode(
|
||||||
|
1, OMX_TRUE, 0,
|
||||||
|
[&](android::hardware::media::omx::V1_0::Status _s,
|
||||||
|
const ::android::hardware::hidl_handle& sidebandHandle) {
|
||||||
|
(void)sidebandHandle;
|
||||||
|
if (_s == android::hardware::media::omx::V1_0::Status::OK)
|
||||||
|
this->mTunnel = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// NOTES: secure components are not covered in these tests.
|
||||||
|
// we are disabling tests for them
|
||||||
if (disableTest) std::cout << "[ WARN ] Test Disabled \n";
|
if (disableTest) std::cout << "[ WARN ] Test Disabled \n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,6 +162,7 @@ class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||||||
sp<CodecObserver> observer;
|
sp<CodecObserver> observer;
|
||||||
sp<IOmxNode> omxNode;
|
sp<IOmxNode> omxNode;
|
||||||
standardCompClass compClass;
|
standardCompClass compClass;
|
||||||
|
bool mTunnel;
|
||||||
bool isSecure;
|
bool isSecure;
|
||||||
bool disableTest;
|
bool disableTest;
|
||||||
|
|
||||||
@@ -991,7 +1005,8 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Idle) {
|
|||||||
ASSERT_NO_FATAL_FAILURE(
|
ASSERT_NO_FATAL_FAILURE(
|
||||||
changeStateLoadedtoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1],
|
changeStateLoadedtoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1],
|
||||||
kPortIndexInput, kPortIndexOutput, portMode));
|
kPortIndexInput, kPortIndexOutput, portMode));
|
||||||
for (size_t i = portBase; i < portBase + 2; i++) {
|
int range = mTunnel ? 1 : 2;
|
||||||
|
for (size_t i = portBase; i < portBase + range; i++) {
|
||||||
status =
|
status =
|
||||||
omxNode->sendCommand(toRawCommandType(OMX_CommandPortDisable), i);
|
omxNode->sendCommand(toRawCommandType(OMX_CommandPortDisable), i);
|
||||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||||
@@ -1104,7 +1119,8 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Execute) {
|
|||||||
dispatchOutputBuffer(omxNode, &pBuffer[1], i, portMode[1]));
|
dispatchOutputBuffer(omxNode, &pBuffer[1], i, portMode[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = portBase; i < portBase + 2; i++) {
|
int range = mTunnel ? 1 : 2;
|
||||||
|
for (size_t i = portBase; i < portBase + range; i++) {
|
||||||
status =
|
status =
|
||||||
omxNode->sendCommand(toRawCommandType(OMX_CommandPortDisable), i);
|
omxNode->sendCommand(toRawCommandType(OMX_CommandPortDisable), i);
|
||||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||||
|
|||||||
@@ -153,7 +153,17 @@ class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||||||
".secure");
|
".secure");
|
||||||
}
|
}
|
||||||
if (isSecure) disableTest = true;
|
if (isSecure) disableTest = true;
|
||||||
|
omxNode->configureVideoTunnelMode(
|
||||||
|
1, OMX_TRUE, 0,
|
||||||
|
[&](android::hardware::media::omx::V1_0::Status _s,
|
||||||
|
const ::android::hardware::hidl_handle& sidebandHandle) {
|
||||||
|
(void)sidebandHandle;
|
||||||
|
if (_s == android::hardware::media::omx::V1_0::Status::OK)
|
||||||
|
this->disableTest = true;
|
||||||
|
});
|
||||||
if (disableTest) std::cout << "[ WARN ] Test Disabled \n";
|
if (disableTest) std::cout << "[ WARN ] Test Disabled \n";
|
||||||
|
// NOTES: secure and tunneled components are not covered in these tests.
|
||||||
|
// we are disabling tests for them
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() override {
|
virtual void TearDown() override {
|
||||||
|
|||||||
Reference in New Issue
Block a user