Merge "omxvts: exit gracefully during fatal fails" into oc-mr1-dev
am: 3021f1fafb
Change-Id: I8ac8c71c0bdff6aef9f79b393ea2d570de773394
This commit is contained in:
commit
9b0849e333
8 changed files with 550 additions and 415 deletions
|
@ -165,6 +165,7 @@ class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
this->omxNode = _nl;
|
||||
})
|
||||
.isOk());
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_NE(omxNode, nullptr);
|
||||
ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
|
||||
struct StringToName {
|
||||
|
@ -423,6 +424,9 @@ void getInputChannelInfo(sp<IOmxNode> omxNode, OMX_U32 kPortIndexInput,
|
|||
ASSERT_EQ(status,
|
||||
::android::hardware::media::omx::V1_0::Status::OK);
|
||||
*nChannels = param.nChannels;
|
||||
// NOTE: For amrnb sample rate is 8k and amrwb sample rate is 16k.
|
||||
// There is no nSampleRate field in OMX_AUDIO_PARAM_AMRTYPE. Just
|
||||
// return 8k to avoid returning uninit variable.
|
||||
*nSampleRate = 8000;
|
||||
break;
|
||||
}
|
||||
|
@ -548,13 +552,13 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
// set Port Params
|
||||
int32_t nChannels;
|
||||
int32_t nSampleRate;
|
||||
getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
|
||||
&nSampleRate);
|
||||
ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
|
||||
omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
|
||||
// Configure output port
|
||||
// SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way
|
||||
// to
|
||||
// configure output PCM port. The port undergoes auto configuration
|
||||
// internally basing on parsed elementary stream information.
|
||||
// to configure output PCM port. The port undergoes auto
|
||||
// configuration internally basing on parsed elementary stream
|
||||
// information.
|
||||
if (comp != AudioDecHidlTest::standardComp::vorbis &&
|
||||
comp != AudioDecHidlTest::standardComp::opus &&
|
||||
comp != AudioDecHidlTest::standardComp::raw) {
|
||||
|
@ -563,9 +567,8 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
nSampleRate);
|
||||
}
|
||||
|
||||
// If you can disable a port, then you should be able to
|
||||
// enable
|
||||
// it as well
|
||||
// If you can disable a port, then you should be able to enable it
|
||||
// as well
|
||||
status = omxNode->sendCommand(
|
||||
toRawCommandType(OMX_CommandPortEnable), kPortIndexOutput);
|
||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
@ -576,7 +579,8 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
ASSERT_EQ(status,
|
||||
android::hardware::media::omx::V1_0::Status::TIMED_OUT);
|
||||
|
||||
allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput));
|
||||
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer,
|
||||
oBuffer);
|
||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
@ -586,14 +590,14 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
|
||||
// dispatch output buffers
|
||||
for (size_t i = 0; i < oBuffer->size(); i++) {
|
||||
dispatchOutputBuffer(omxNode, oBuffer, i);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchOutputBuffer(omxNode, oBuffer, i));
|
||||
}
|
||||
} else {
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
} else {
|
||||
EXPECT_TRUE(false);
|
||||
return;
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -613,11 +617,12 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
status =
|
||||
observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
|
||||
if (status == android::hardware::media::omx::V1_0::Status::OK) {
|
||||
EXPECT_EQ(msg.type, Message::Type::EVENT);
|
||||
ASSERT_EQ(msg.type, Message::Type::EVENT);
|
||||
packedArgs audioArgs = {eEncoding, comp};
|
||||
portReconfiguration(omxNode, observer, iBuffer, oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, msg,
|
||||
PortMode::PRESET_BYTE_BUFFER, &audioArgs);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
portReconfiguration(omxNode, observer, iBuffer, oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, msg,
|
||||
PortMode::PRESET_BYTE_BUFFER, &audioArgs));
|
||||
}
|
||||
// status == TIMED_OUT, it could be due to process time being large
|
||||
// than DEFAULT_TIMEOUT or component needs output buffers to start
|
||||
|
@ -630,7 +635,8 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
// Dispatch an output buffer assuming outQueue.empty() is true
|
||||
size_t index;
|
||||
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
|
||||
dispatchOutputBuffer(omxNode, oBuffer, index);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchOutputBuffer(omxNode, oBuffer, index));
|
||||
timeOut = TIMEOUT_COUNTER_Q;
|
||||
}
|
||||
}
|
||||
|
@ -660,9 +666,10 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
if (status == android::hardware::media::omx::V1_0::Status::OK &&
|
||||
msg.type == Message::Type::EVENT) {
|
||||
packedArgs audioArgs = {eEncoding, comp};
|
||||
portReconfiguration(omxNode, observer, iBuffer, oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, msg,
|
||||
PortMode::PRESET_BYTE_BUFFER, &audioArgs);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
portReconfiguration(omxNode, observer, iBuffer, oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, msg,
|
||||
PortMode::PRESET_BYTE_BUFFER, &audioArgs));
|
||||
}
|
||||
|
||||
if (frameID == (int)Info->size() || frameID == (offset + range)) break;
|
||||
|
@ -684,15 +691,16 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
if (signalEOS && ((frameID == (int)Info->size() - 1) ||
|
||||
(frameID == (offset + range - 1))))
|
||||
flags |= OMX_BUFFERFLAG_EOS;
|
||||
dispatchInputBuffer(omxNode, iBuffer, index,
|
||||
(*Info)[frameID].bytesCount, flags,
|
||||
(*Info)[frameID].timestamp);
|
||||
ASSERT_NO_FATAL_FAILURE(dispatchInputBuffer(
|
||||
omxNode, iBuffer, index, (*Info)[frameID].bytesCount, flags,
|
||||
(*Info)[frameID].timestamp));
|
||||
frameID++;
|
||||
iQueued = true;
|
||||
}
|
||||
// Dispatch output buffer
|
||||
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
|
||||
dispatchOutputBuffer(omxNode, oBuffer, index);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchOutputBuffer(omxNode, oBuffer, index));
|
||||
oQueued = true;
|
||||
}
|
||||
// Reset Counters when either input or output buffer is dispatched
|
||||
|
@ -701,8 +709,7 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
else
|
||||
timeOut--;
|
||||
if (timeOut == 0) {
|
||||
EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite";
|
||||
break;
|
||||
ASSERT_TRUE(false) << "Wait on Input/Output is found indefinite";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -784,8 +791,8 @@ TEST_F(AudioDecHidlTest, DecodeTest) {
|
|||
setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000,
|
||||
OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned,
|
||||
32);
|
||||
getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
|
||||
&nSampleRate);
|
||||
ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
|
||||
omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
|
||||
// Configure output port
|
||||
// SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
|
||||
// configure output PCM port. The port undergoes auto configuration
|
||||
|
@ -798,28 +805,33 @@ TEST_F(AudioDecHidlTest, DecodeTest) {
|
|||
android::Vector<BufferInfo> iBuffer, oBuffer;
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
// Port Reconfiguration
|
||||
eleStream.open(mURL, std::ifstream::binary);
|
||||
ASSERT_EQ(eleStream.is_open(), true);
|
||||
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
|
||||
kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0,
|
||||
(int)Info.size(), compName);
|
||||
ASSERT_NO_FATAL_FAILURE(decodeNFrames(
|
||||
omxNode, observer, &iBuffer, &oBuffer, eEncoding, kPortIndexInput,
|
||||
kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(), compName));
|
||||
eleStream.close();
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
|
||||
kPortIndexInput, kPortIndexOutput, compName);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
|
||||
kPortIndexInput, kPortIndexOutput, compName));
|
||||
packedArgs audioArgs = {eEncoding, compName};
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs);
|
||||
ASSERT_NO_FATAL_FAILURE(testEOS(
|
||||
omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs));
|
||||
if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true);
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
// set state to executing
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
// end of sequence test
|
||||
|
@ -845,8 +857,8 @@ TEST_F(AudioDecHidlTest, EOSTest_M) {
|
|||
setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000,
|
||||
OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned,
|
||||
32);
|
||||
getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
|
||||
&nSampleRate);
|
||||
ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
|
||||
omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
|
||||
// Configure output port
|
||||
// SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
|
||||
// configure output PCM port. The port undergoes auto configuration
|
||||
|
@ -859,26 +871,31 @@ TEST_F(AudioDecHidlTest, EOSTest_M) {
|
|||
android::Vector<BufferInfo> iBuffer, oBuffer;
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
|
||||
// request EOS at the start
|
||||
packedArgs audioArgs = {eEncoding, compName};
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs);
|
||||
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(testEOS(
|
||||
omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs));
|
||||
ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
EXPECT_GE(framesReceived, 0U);
|
||||
framesReceived = 0;
|
||||
timestampUs = 0;
|
||||
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
|
||||
// set state to executing
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
// end of sequence test
|
||||
|
@ -924,8 +941,8 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) {
|
|||
setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000,
|
||||
OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned,
|
||||
32);
|
||||
getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
|
||||
&nSampleRate);
|
||||
ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
|
||||
omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
|
||||
// Configure output port
|
||||
// SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
|
||||
// configure output PCM port. The port undergoes auto configuration
|
||||
|
@ -938,10 +955,11 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) {
|
|||
android::Vector<BufferInfo> iBuffer, oBuffer;
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
|
||||
// request EOS for thumbnail
|
||||
// signal EOS flag with last frame
|
||||
|
@ -949,17 +967,19 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) {
|
|||
while (!(Info[i].flags & OMX_BUFFERFLAG_SYNCFRAME)) i++;
|
||||
eleStream.open(mURL, std::ifstream::binary);
|
||||
ASSERT_EQ(eleStream.is_open(), true);
|
||||
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
|
||||
kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0, i + 1,
|
||||
compName);
|
||||
ASSERT_NO_FATAL_FAILURE(decodeNFrames(
|
||||
omxNode, observer, &iBuffer, &oBuffer, eEncoding, kPortIndexInput,
|
||||
kPortIndexOutput, eleStream, &Info, 0, i + 1, compName));
|
||||
eleStream.close();
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
|
||||
kPortIndexInput, kPortIndexOutput, compName);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
|
||||
kPortIndexInput, kPortIndexOutput, compName));
|
||||
packedArgs audioArgs = {eEncoding, compName};
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs);
|
||||
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(testEOS(
|
||||
omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs));
|
||||
ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
EXPECT_GE(framesReceived, 1U);
|
||||
framesReceived = 0;
|
||||
timestampUs = 0;
|
||||
|
@ -967,25 +987,29 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) {
|
|||
// signal EOS flag after last frame
|
||||
eleStream.open(mURL, std::ifstream::binary);
|
||||
ASSERT_EQ(eleStream.is_open(), true);
|
||||
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
|
||||
kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0, i + 1,
|
||||
compName, false);
|
||||
ASSERT_NO_FATAL_FAILURE(decodeNFrames(
|
||||
omxNode, observer, &iBuffer, &oBuffer, eEncoding, kPortIndexInput,
|
||||
kPortIndexOutput, eleStream, &Info, 0, i + 1, compName, false));
|
||||
eleStream.close();
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
|
||||
kPortIndexInput, kPortIndexOutput, compName);
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs);
|
||||
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
|
||||
kPortIndexInput, kPortIndexOutput, compName));
|
||||
ASSERT_NO_FATAL_FAILURE(testEOS(
|
||||
omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs));
|
||||
ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
EXPECT_GE(framesReceived, 1U);
|
||||
framesReceived = 0;
|
||||
timestampUs = 0;
|
||||
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
// set state to executing
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
// end of sequence test
|
||||
|
@ -1031,8 +1055,8 @@ TEST_F(AudioDecHidlTest, SimpleEOSTest) {
|
|||
setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000,
|
||||
OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned,
|
||||
32);
|
||||
getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
|
||||
&nSampleRate);
|
||||
ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
|
||||
omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
|
||||
// Configure output port
|
||||
// SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
|
||||
// configure output PCM port. The port undergoes auto configuration
|
||||
|
@ -1045,33 +1069,39 @@ TEST_F(AudioDecHidlTest, SimpleEOSTest) {
|
|||
android::Vector<BufferInfo> iBuffer, oBuffer;
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
|
||||
// request EOS at the end
|
||||
eleStream.open(mURL, std::ifstream::binary);
|
||||
ASSERT_EQ(eleStream.is_open(), true);
|
||||
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
|
||||
kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0,
|
||||
(int)Info.size(), compName, false);
|
||||
ASSERT_NO_FATAL_FAILURE(decodeNFrames(omxNode, observer, &iBuffer, &oBuffer,
|
||||
eEncoding, kPortIndexInput,
|
||||
kPortIndexOutput, eleStream, &Info, 0,
|
||||
(int)Info.size(), compName, false));
|
||||
eleStream.close();
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
|
||||
kPortIndexInput, kPortIndexOutput, compName);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
|
||||
kPortIndexInput, kPortIndexOutput, compName));
|
||||
packedArgs audioArgs = {eEncoding, compName};
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs);
|
||||
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(testEOS(
|
||||
omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs));
|
||||
ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
framesReceived = 0;
|
||||
timestampUs = 0;
|
||||
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
// set state to executing
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
// test input/output port flush
|
||||
|
@ -1117,8 +1147,8 @@ TEST_F(AudioDecHidlTest, FlushTest) {
|
|||
setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000,
|
||||
OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned,
|
||||
32);
|
||||
getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
|
||||
&nSampleRate);
|
||||
ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
|
||||
omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
|
||||
// Configure output port
|
||||
// SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
|
||||
// configure output PCM port. The port undergoes auto configuration
|
||||
|
@ -1131,10 +1161,11 @@ TEST_F(AudioDecHidlTest, FlushTest) {
|
|||
android::Vector<BufferInfo> iBuffer, oBuffer;
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
|
||||
// Decode 128 frames and flush. here 128 is chosen to ensure there is a key
|
||||
// frame after this so that the below section can be convered for all
|
||||
|
@ -1142,11 +1173,11 @@ TEST_F(AudioDecHidlTest, FlushTest) {
|
|||
int nFrames = 128;
|
||||
eleStream.open(mURL, std::ifstream::binary);
|
||||
ASSERT_EQ(eleStream.is_open(), true);
|
||||
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
|
||||
kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0,
|
||||
nFrames, compName, false);
|
||||
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(decodeNFrames(
|
||||
omxNode, observer, &iBuffer, &oBuffer, eEncoding, kPortIndexInput,
|
||||
kPortIndexOutput, eleStream, &Info, 0, nFrames, compName, false));
|
||||
ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
framesReceived = 0;
|
||||
|
||||
// Seek to next key frame and start decoding till the end
|
||||
|
@ -1163,19 +1194,22 @@ TEST_F(AudioDecHidlTest, FlushTest) {
|
|||
index++;
|
||||
}
|
||||
if (keyFrame) {
|
||||
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
|
||||
kPortIndexInput, kPortIndexOutput, eleStream, &Info,
|
||||
index, Info.size() - index, compName, false);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
|
||||
kPortIndexInput, kPortIndexOutput, eleStream, &Info,
|
||||
index, Info.size() - index, compName, false));
|
||||
}
|
||||
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
framesReceived = 0;
|
||||
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
// set state to executing
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
|
|
@ -165,6 +165,7 @@ class AudioEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
this->omxNode = _nl;
|
||||
})
|
||||
.isOk());
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_NE(omxNode, nullptr);
|
||||
ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
|
||||
struct StringToName {
|
||||
|
@ -352,7 +353,7 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
size_t i = 0;
|
||||
status =
|
||||
observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
|
||||
EXPECT_EQ(status,
|
||||
ASSERT_EQ(status,
|
||||
android::hardware::media::omx::V1_0::Status::TIMED_OUT);
|
||||
// status == TIMED_OUT, it could be due to process time being large
|
||||
// than DEFAULT_TIMEOUT or component needs output buffers to start
|
||||
|
@ -365,7 +366,8 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
// Dispatch an output buffer assuming outQueue.empty() is true
|
||||
size_t index;
|
||||
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
|
||||
dispatchOutputBuffer(omxNode, oBuffer, index);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchOutputBuffer(omxNode, oBuffer, index));
|
||||
timeOut = TIMEOUT_COUNTER_Q;
|
||||
}
|
||||
}
|
||||
|
@ -408,15 +410,16 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
if (eleStream.gcount() != bytesCount) break;
|
||||
flags = OMX_BUFFERFLAG_ENDOFFRAME;
|
||||
if (signalEOS && (nFrames == 1)) flags |= OMX_BUFFERFLAG_EOS;
|
||||
dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags,
|
||||
timestamp);
|
||||
ASSERT_NO_FATAL_FAILURE(dispatchInputBuffer(
|
||||
omxNode, iBuffer, index, bytesCount, flags, timestamp));
|
||||
timestamp += timestampIncr;
|
||||
nFrames--;
|
||||
iQueued = true;
|
||||
}
|
||||
// Dispatch output buffer
|
||||
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
|
||||
dispatchOutputBuffer(omxNode, oBuffer, index);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchOutputBuffer(omxNode, oBuffer, index));
|
||||
oQueued = true;
|
||||
}
|
||||
// Reset Counters when either input or output buffer is dispatched
|
||||
|
@ -425,8 +428,7 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
else
|
||||
timeOut--;
|
||||
if (timeOut == 0) {
|
||||
EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite";
|
||||
break;
|
||||
ASSERT_TRUE(false) << "Wait on Input/Output is found indefinite";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -517,31 +519,39 @@ TEST_F(AudioEncHidlTest, SimpleEncodeTest) {
|
|||
}
|
||||
setupPCMPort(omxNode, kPortIndexInput, nChannels, OMX_NumericalDataSigned,
|
||||
16, nSampleRate, OMX_AUDIO_PCMModeLinear);
|
||||
|
||||
// Configure output port
|
||||
setDefaultPortParam(omxNode, kPortIndexOutput, eEncoding, compName,
|
||||
nChannels, nSampleRate, nBitRate);
|
||||
ASSERT_NO_FATAL_FAILURE(setDefaultPortParam(omxNode, kPortIndexOutput,
|
||||
eEncoding, compName, nChannels,
|
||||
nSampleRate, nBitRate));
|
||||
|
||||
android::Vector<BufferInfo> iBuffer, oBuffer;
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
|
||||
eleStream.open(mURL, std::ifstream::binary);
|
||||
ASSERT_EQ(eleStream.is_open(), true);
|
||||
encodeNFrames(omxNode, observer, &iBuffer, &oBuffer, 128, samplesPerFrame,
|
||||
nChannels, nSampleRate, eleStream);
|
||||
ASSERT_NO_FATAL_FAILURE(encodeNFrames(omxNode, observer, &iBuffer, &oBuffer,
|
||||
128, samplesPerFrame, nChannels,
|
||||
nSampleRate, eleStream));
|
||||
eleStream.close();
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer);
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer));
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag));
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
// set state to executing
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
|
|
@ -233,7 +233,7 @@ void allocateGraphicBuffers(sp<IOmxNode> omxNode, OMX_U32 portIndex,
|
|||
error = _s;
|
||||
descriptor = _n1;
|
||||
});
|
||||
EXPECT_EQ(error, android::hardware::graphics::mapper::V2_0::Error::NONE);
|
||||
ASSERT_EQ(error, android::hardware::graphics::mapper::V2_0::Error::NONE);
|
||||
|
||||
static volatile int32_t nextId = 0;
|
||||
uint64_t id = static_cast<uint64_t>(getpid()) << 32;
|
||||
|
@ -279,7 +279,7 @@ void allocateBuffer(sp<IOmxNode> omxNode, BufferInfo* buffer, OMX_U32 portIndex,
|
|||
} else if (portMode == PortMode::PRESET_BYTE_BUFFER ||
|
||||
portMode == PortMode::DYNAMIC_ANW_BUFFER) {
|
||||
sp<IAllocator> allocator = IAllocator::getService("ashmem");
|
||||
EXPECT_NE(allocator.get(), nullptr);
|
||||
ASSERT_NE(allocator.get(), nullptr);
|
||||
|
||||
buffer->owner = client;
|
||||
buffer->omxBuffer.type = CodecBuffer::Type::SHARED_MEM;
|
||||
|
@ -319,13 +319,14 @@ void allocateBuffer(sp<IOmxNode> omxNode, BufferInfo* buffer, OMX_U32 portIndex,
|
|||
OMX_PARAM_PORTDEFINITIONTYPE portDef;
|
||||
status = getPortParam(omxNode, OMX_IndexParamPortDefinition, portIndex,
|
||||
&portDef);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
int32_t nStride;
|
||||
buffer->owner = client;
|
||||
buffer->omxBuffer.type = CodecBuffer::Type::ANW_BUFFER;
|
||||
allocateGraphicBuffers(omxNode, portIndex, buffer,
|
||||
portDef.format.video.nFrameWidth,
|
||||
portDef.format.video.nFrameHeight, &nStride,
|
||||
portDef.format.video.eColorFormat);
|
||||
ASSERT_NO_FATAL_FAILURE(allocateGraphicBuffers(
|
||||
omxNode, portIndex, buffer, portDef.format.video.nFrameWidth,
|
||||
portDef.format.video.nFrameHeight, &nStride,
|
||||
portDef.format.video.eColorFormat));
|
||||
omxNode->useBuffer(
|
||||
portIndex, buffer->omxBuffer,
|
||||
[&status, &buffer](android::hardware::media::omx::V1_0::Status _s,
|
||||
|
@ -352,14 +353,14 @@ void allocatePortBuffers(sp<IOmxNode> omxNode,
|
|||
|
||||
for (size_t i = 0; i < portDef.nBufferCountActual; i++) {
|
||||
BufferInfo buffer;
|
||||
allocateBuffer(omxNode, &buffer, portIndex, portDef.nBufferSize,
|
||||
portMode);
|
||||
ASSERT_NO_FATAL_FAILURE(allocateBuffer(omxNode, &buffer, portIndex,
|
||||
portDef.nBufferSize, portMode));
|
||||
if (allocGrap && portMode == PortMode::DYNAMIC_ANW_BUFFER) {
|
||||
int32_t nStride;
|
||||
allocateGraphicBuffers(omxNode, portIndex, &buffer,
|
||||
portDef.format.video.nFrameWidth,
|
||||
portDef.format.video.nFrameHeight, &nStride,
|
||||
portDef.format.video.eColorFormat);
|
||||
ASSERT_NO_FATAL_FAILURE(allocateGraphicBuffers(
|
||||
omxNode, portIndex, &buffer, portDef.format.video.nFrameWidth,
|
||||
portDef.format.video.nFrameHeight, &nStride,
|
||||
portDef.format.video.eColorFormat));
|
||||
}
|
||||
buffArray->push(buffer);
|
||||
}
|
||||
|
@ -391,14 +392,16 @@ void changeStateLoadedtoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
|
||||
|
||||
// allocate buffers on input port
|
||||
allocatePortBuffers(omxNode, iBuffer, kPortIndexInput, pm[0], allocGrap);
|
||||
ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
|
||||
omxNode, iBuffer, kPortIndexInput, pm[0], allocGrap));
|
||||
|
||||
// Dont switch states until the ports are populated
|
||||
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
|
||||
allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput, pm[1], allocGrap);
|
||||
ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
|
||||
omxNode, oBuffer, kPortIndexOutput, pm[1], allocGrap));
|
||||
|
||||
// As the ports are populated, check if the state transition is complete
|
||||
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
|
||||
|
@ -645,7 +648,8 @@ void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
if (signalEOS) {
|
||||
if ((i = getEmptyBufferID(iBuffer)) < iBuffer->size()) {
|
||||
// signal an empty buffer with flag set to EOS
|
||||
dispatchInputBuffer(omxNode, iBuffer, i, 0, OMX_BUFFERFLAG_EOS, 0);
|
||||
ASSERT_NO_FATAL_FAILURE(dispatchInputBuffer(omxNode, iBuffer, i, 0,
|
||||
OMX_BUFFERFLAG_EOS, 0));
|
||||
} else {
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
|
@ -656,7 +660,8 @@ void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
// Dispatch all client owned output buffers to recover remaining frames
|
||||
while (1) {
|
||||
if ((i = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
|
||||
dispatchOutputBuffer(omxNode, oBuffer, i, pm[1]);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchOutputBuffer(omxNode, oBuffer, i, pm[1]));
|
||||
// if dispatch is successful, perhaps there is a latency
|
||||
// in the component. Dont be in a haste to leave. reset timeout
|
||||
// counter
|
||||
|
@ -672,16 +677,16 @@ void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
if (status == android::hardware::media::omx::V1_0::Status::OK) {
|
||||
if (msg.data.eventData.event == OMX_EventPortSettingsChanged) {
|
||||
if (fptr) {
|
||||
(*fptr)(omxNode, observer, iBuffer, oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, msg, pm[1],
|
||||
args);
|
||||
ASSERT_NO_FATAL_FAILURE((*fptr)(
|
||||
omxNode, observer, iBuffer, oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, msg, pm[1], args));
|
||||
} else {
|
||||
// something unexpected happened
|
||||
EXPECT_TRUE(false);
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
} else {
|
||||
// something unexpected happened
|
||||
EXPECT_TRUE(false);
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
}
|
||||
if (eosFlag == true) break;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2016, The Android Open Source Project
|
||||
* Copyright 2017, 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.
|
||||
|
|
|
@ -149,6 +149,7 @@ class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
this->omxNode = _nl;
|
||||
})
|
||||
.isOk());
|
||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_NE(omxNode, nullptr);
|
||||
ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
|
||||
struct StringToClass {
|
||||
|
@ -233,7 +234,6 @@ void initPortMode(PortMode* pm, bool isSecure,
|
|||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// test dispatch message API call
|
||||
|
@ -410,6 +410,7 @@ TEST_F(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
|
|||
std::cerr << "[ ERROR ] port direction has to be read only "
|
||||
"but is changeable \n";
|
||||
}
|
||||
EXPECT_EQ(portDef.eDir, mirror.eDir);
|
||||
setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &mirror);
|
||||
|
||||
// Port Min BufferCount - Read Only
|
||||
|
@ -435,6 +436,7 @@ TEST_F(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
|
|||
EXPECT_EQ(portDef.nBufferCountActual,
|
||||
mirror.nBufferCountActual + 1);
|
||||
}
|
||||
setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &mirror);
|
||||
|
||||
// Port BufferSize is although read only as per OMX-IL 1.2, android
|
||||
// doesnt abide by this.
|
||||
|
@ -518,8 +520,9 @@ TEST_F(ComponentHidlTest, DISABLED_PopulatePort) {
|
|||
|
||||
for (size_t i = 0; i < portDef.nBufferCountActual; i++) {
|
||||
BufferInfo buffer;
|
||||
allocateBuffer(omxNode, &buffer, portBase, nBufferSize,
|
||||
PortMode::PRESET_BYTE_BUFFER);
|
||||
ASSERT_NO_FATAL_FAILURE(allocateBuffer(omxNode, &buffer, portBase,
|
||||
nBufferSize,
|
||||
PortMode::PRESET_BYTE_BUFFER));
|
||||
pBuffer.push(buffer);
|
||||
}
|
||||
|
||||
|
@ -560,39 +563,47 @@ TEST_F(ComponentHidlTest, Flush) {
|
|||
PortMode portMode[2];
|
||||
initPortMode(portMode, isSecure, compClass);
|
||||
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
|
||||
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
|
||||
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
// dispatch buffers
|
||||
for (size_t i = 0; i < oBuffer.size(); i++) {
|
||||
dispatchOutputBuffer(omxNode, &oBuffer, i, portMode[1]);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchOutputBuffer(omxNode, &oBuffer, i, portMode[1]));
|
||||
}
|
||||
// flush port
|
||||
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
#if 0
|
||||
// TODO: Sending empty input buffers is slightly tricky.
|
||||
// Components sometimes process input buffers even when output buffers are
|
||||
// not dispatched. For instance Parsing sequence header does not require
|
||||
// output buffers. In such instances sending 0 size input buffers might
|
||||
// make component to send error events. so lets skip this aspect of testing.
|
||||
// dispatch buffers
|
||||
// for (size_t i = 0; i < iBuffer.size(); i++) {
|
||||
// dispatchInputBuffer(omxNode, &iBuffer, i, 0, 0, 0, portMode[0]);
|
||||
// }
|
||||
// // flush ports
|
||||
// flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
// kPortIndexOutput);
|
||||
for (size_t i = 0; i < iBuffer.size(); i++) {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchInputBuffer(omxNode, &iBuffer, i, 0, 0, 0, portMode[0]));
|
||||
}
|
||||
// flush ports
|
||||
ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
#endif
|
||||
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
// set state to loaded
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
// Flush test - monkeying
|
||||
|
@ -623,9 +634,9 @@ TEST_F(ComponentHidlTest, Flush_M) {
|
|||
PortMode portMode[2];
|
||||
initPortMode(portMode, isSecure, compClass);
|
||||
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
|
||||
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
|
||||
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
// // Flush all ports ; receive error OMX_ErrorIncorrectStateOperation
|
||||
// status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
|
||||
|
@ -633,8 +644,9 @@ TEST_F(ComponentHidlTest, Flush_M) {
|
|||
// ASSERT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode));
|
||||
|
||||
// // Flush all ports ; receive error OMX_ErrorIncorrectStateOperation
|
||||
// status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
|
||||
|
@ -642,10 +654,12 @@ TEST_F(ComponentHidlTest, Flush_M) {
|
|||
// ASSERT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
|
||||
// dispatch buffers
|
||||
for (size_t i = 0; i < oBuffer.size(); i++) {
|
||||
dispatchOutputBuffer(omxNode, &oBuffer, i, portMode[1]);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchOutputBuffer(omxNode, &oBuffer, i, portMode[1]));
|
||||
}
|
||||
|
||||
// // flush invalid port, expecting OMX_ErrorBadPortIndex
|
||||
|
@ -692,10 +706,12 @@ TEST_F(ComponentHidlTest, Flush_M) {
|
|||
}
|
||||
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
// set state to loaded
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
// test port mode configuration when the component is in various states
|
||||
|
@ -726,13 +742,14 @@ TEST_F(ComponentHidlTest, PortModeConfig) {
|
|||
PortMode portMode[2];
|
||||
initPortMode(portMode, isSecure, compClass);
|
||||
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
|
||||
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
|
||||
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode));
|
||||
// Only Allow Port Mode configuration in loaded state
|
||||
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
|
||||
EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
@ -740,7 +757,7 @@ TEST_F(ComponentHidlTest, PortModeConfig) {
|
|||
EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
// Only Allow Port Mode configuration in loaded state
|
||||
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
|
||||
EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
@ -748,10 +765,12 @@ TEST_F(ComponentHidlTest, PortModeConfig) {
|
|||
EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
// set state to loaded
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
|
||||
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
|
||||
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
@ -788,9 +807,9 @@ TEST_F(ComponentHidlTest, StateTransitions) {
|
|||
PortMode portMode[2];
|
||||
initPortMode(portMode, isSecure, compClass);
|
||||
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
|
||||
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
|
||||
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
// set state to idle
|
||||
status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
|
||||
|
@ -812,8 +831,8 @@ TEST_F(ComponentHidlTest, StateTransitions) {
|
|||
android::hardware::media::omx::V1_0::Status::TIMED_OUT);
|
||||
|
||||
BufferInfo buffer;
|
||||
allocateBuffer(omxNode, &buffer, j, def.nBufferSize,
|
||||
portMode[j - portBase]);
|
||||
ASSERT_NO_FATAL_FAILURE(allocateBuffer(
|
||||
omxNode, &buffer, j, def.nBufferSize, portMode[j - portBase]));
|
||||
pBuffer[j - portBase].push(buffer);
|
||||
}
|
||||
}
|
||||
|
@ -828,23 +847,28 @@ TEST_F(ComponentHidlTest, StateTransitions) {
|
|||
ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
|
||||
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
// dispatch buffers
|
||||
for (size_t i = 0; i < pBuffer[1].size(); i++) {
|
||||
dispatchOutputBuffer(omxNode, &pBuffer[1], i, portMode[1]);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchOutputBuffer(omxNode, &pBuffer[1], i, portMode[1]));
|
||||
}
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]);
|
||||
// // set state to executing
|
||||
// changeStateIdletoExecute(omxNode, observer);
|
||||
// // TODO: Sending empty input buffers is slightly tricky.
|
||||
// // dispatch buffers
|
||||
// for (size_t i = 0; i < pBuffer[0].size(); i++) {
|
||||
// dispatchInputBuffer(omxNode, &pBuffer[0], i, 0, 0, 0,
|
||||
// portMode[0]);
|
||||
// }
|
||||
// // set state to idle
|
||||
// changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]));
|
||||
#if 0
|
||||
// set state to executing
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
// TODO: Sending empty input buffers is slightly tricky.
|
||||
// dispatch buffers
|
||||
for (size_t i = 0; i < pBuffer[0].size(); i++) {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchInputBuffer(omxNode, &pBuffer[0], i, 0, 0, 0, portMode[0]));
|
||||
}
|
||||
// set state to idle
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]));
|
||||
#endif
|
||||
|
||||
// set state to loaded
|
||||
status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
|
||||
|
@ -908,8 +932,9 @@ TEST_F(ComponentHidlTest, DISABLED_StateTransitions_M) {
|
|||
EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
|
||||
// set state to idle ; receive error OMX_ErrorSameState
|
||||
status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
|
||||
|
@ -917,7 +942,7 @@ TEST_F(ComponentHidlTest, DISABLED_StateTransitions_M) {
|
|||
EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
|
||||
// set state to executing ; receive error OMX_ErrorSameState
|
||||
status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
|
||||
|
@ -929,12 +954,13 @@ TEST_F(ComponentHidlTest, DISABLED_StateTransitions_M) {
|
|||
OMX_StateLoaded);
|
||||
EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
// set state to Idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
|
||||
// set state to Loaded
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
// set state to idle
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
// set state to loaded
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
// port enable disable test
|
||||
|
@ -1017,14 +1043,14 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Idle) {
|
|||
PortMode portMode[2];
|
||||
initPortMode(portMode, isSecure, compClass);
|
||||
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
|
||||
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
|
||||
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1],
|
||||
kPortIndexInput, kPortIndexOutput, portMode);
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateLoadedtoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1],
|
||||
kPortIndexInput, kPortIndexOutput, portMode));
|
||||
for (size_t i = portBase; i < portBase + 2; i++) {
|
||||
status =
|
||||
omxNode->sendCommand(toRawCommandType(OMX_CommandPortDisable), i);
|
||||
|
@ -1072,8 +1098,8 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Idle) {
|
|||
ASSERT_EQ(status,
|
||||
android::hardware::media::omx::V1_0::Status::TIMED_OUT);
|
||||
|
||||
allocatePortBuffers(omxNode, &pBuffer[i - portBase], i,
|
||||
portMode[i - portBase]);
|
||||
ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
|
||||
omxNode, &pBuffer[i - portBase], i, portMode[i - portBase]));
|
||||
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
|
||||
&pBuffer[0], &pBuffer[1]);
|
||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
@ -1087,8 +1113,9 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Idle) {
|
|||
}
|
||||
|
||||
// set state to Loaded
|
||||
changeStateIdletoLoaded(omxNode, observer, &pBuffer[0], &pBuffer[1],
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateIdletoLoaded(omxNode, observer, &pBuffer[0], &pBuffer[1],
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
}
|
||||
|
||||
// port enable disable test
|
||||
|
@ -1121,20 +1148,20 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Execute) {
|
|||
PortMode portMode[2];
|
||||
initPortMode(portMode, isSecure, compClass);
|
||||
status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
|
||||
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
|
||||
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1],
|
||||
kPortIndexInput, kPortIndexOutput, portMode);
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateLoadedtoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1],
|
||||
kPortIndexInput, kPortIndexOutput, portMode));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
// dispatch buffers
|
||||
for (size_t i = 0; i < pBuffer[1].size(); i++) {
|
||||
dispatchOutputBuffer(omxNode, &pBuffer[1], i, portMode[1]);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchOutputBuffer(omxNode, &pBuffer[1], i, portMode[1]));
|
||||
}
|
||||
|
||||
for (size_t i = portBase; i < portBase + 2; i++) {
|
||||
|
@ -1187,8 +1214,8 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Execute) {
|
|||
ASSERT_EQ(status,
|
||||
android::hardware::media::omx::V1_0::Status::TIMED_OUT);
|
||||
|
||||
allocatePortBuffers(omxNode, &pBuffer[i - portBase], i,
|
||||
portMode[i - portBase]);
|
||||
ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
|
||||
omxNode, &pBuffer[i - portBase], i, portMode[i - portBase]));
|
||||
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
|
||||
&pBuffer[0], &pBuffer[1]);
|
||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
@ -1201,12 +1228,13 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Execute) {
|
|||
}
|
||||
}
|
||||
|
||||
// set state to Idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]);
|
||||
|
||||
// set state to Loaded
|
||||
changeStateIdletoLoaded(omxNode, observer, &pBuffer[0], &pBuffer[1],
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
// set state to idle
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]));
|
||||
// set state to loaded
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateIdletoLoaded(omxNode, observer, &pBuffer[0], &pBuffer[1],
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
}
|
||||
|
||||
// port enable disable test - monkeying
|
||||
|
|
|
@ -150,6 +150,7 @@ TEST_F(MasterHidlTest, ListServiceAttr) {
|
|||
attributes = _nl;
|
||||
})
|
||||
.isOk());
|
||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||
if (attributes.size() == 0) ALOGV("Warning, Attribute list empty");
|
||||
}
|
||||
|
||||
|
@ -186,6 +187,7 @@ TEST_F(MasterHidlTest, ListNodes) {
|
|||
nodeList = _nl;
|
||||
})
|
||||
.isOk());
|
||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||
if (nodeList.size() == 0)
|
||||
ALOGV("Warning, ComponentInfo list empty");
|
||||
else {
|
||||
|
@ -204,6 +206,7 @@ TEST_F(MasterHidlTest, ListNodes) {
|
|||
omxNode = _nl;
|
||||
})
|
||||
.isOk());
|
||||
ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
|
||||
if (omxNode == nullptr) {
|
||||
isPass = false;
|
||||
std::cerr << "[ !OK ] " << nodeList[i].mName.c_str()
|
||||
|
|
|
@ -166,6 +166,7 @@ class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
this->omxNode = _nl;
|
||||
})
|
||||
.isOk());
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_NE(omxNode, nullptr);
|
||||
ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
|
||||
struct StringToName {
|
||||
|
@ -498,8 +499,7 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
nFrameWidth, nFrameHeight, 0, xFramerate);
|
||||
|
||||
// If you can disable a port, then you should be able to
|
||||
// enable
|
||||
// it as well
|
||||
// enable it as well
|
||||
status = omxNode->sendCommand(
|
||||
toRawCommandType(OMX_CommandPortEnable), kPortIndexOutput);
|
||||
ASSERT_EQ(status,
|
||||
|
@ -512,8 +512,8 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
status,
|
||||
android::hardware::media::omx::V1_0::Status::TIMED_OUT);
|
||||
|
||||
allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput,
|
||||
oPortMode, true);
|
||||
ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
|
||||
omxNode, oBuffer, kPortIndexOutput, oPortMode, true));
|
||||
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
|
||||
iBuffer, oBuffer);
|
||||
ASSERT_EQ(status,
|
||||
|
@ -534,7 +534,8 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
|
||||
// dispatch output buffers
|
||||
for (size_t i = 0; i < oBuffer->size(); i++) {
|
||||
dispatchOutputBuffer(omxNode, oBuffer, i, oPortMode);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchOutputBuffer(omxNode, oBuffer, i, oPortMode));
|
||||
}
|
||||
} else {
|
||||
ASSERT_TRUE(false);
|
||||
|
@ -550,7 +551,7 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
} else if (msg.data.eventData.event == OMX_EventError) {
|
||||
std::cerr << "[ ERROR ] OMX_EventError/ "
|
||||
"Decode Frame Call might be failed \n";
|
||||
return;
|
||||
ASSERT_TRUE(false);
|
||||
} else {
|
||||
// something unexpected happened
|
||||
ASSERT_TRUE(false);
|
||||
|
@ -572,10 +573,10 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
status =
|
||||
observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
|
||||
if (status == android::hardware::media::omx::V1_0::Status::OK) {
|
||||
EXPECT_EQ(msg.type, Message::Type::EVENT);
|
||||
portReconfiguration(omxNode, observer, iBuffer, oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, msg,
|
||||
oPortMode, nullptr);
|
||||
ASSERT_EQ(msg.type, Message::Type::EVENT);
|
||||
ASSERT_NO_FATAL_FAILURE(portReconfiguration(
|
||||
omxNode, observer, iBuffer, oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, msg, oPortMode, nullptr));
|
||||
}
|
||||
// status == TIMED_OUT, it could be due to process time being large
|
||||
// than DEFAULT_TIMEOUT or component needs output buffers to start
|
||||
|
@ -588,7 +589,8 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
// Dispatch an output buffer assuming outQueue.empty() is true
|
||||
size_t index;
|
||||
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
|
||||
dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode));
|
||||
timeOut = TIMEOUT_COUNTER_Q;
|
||||
}
|
||||
}
|
||||
|
@ -617,9 +619,9 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
// Port Reconfiguration
|
||||
if (status == android::hardware::media::omx::V1_0::Status::OK &&
|
||||
msg.type == Message::Type::EVENT) {
|
||||
portReconfiguration(omxNode, observer, iBuffer, oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, msg,
|
||||
oPortMode, nullptr);
|
||||
ASSERT_NO_FATAL_FAILURE(portReconfiguration(
|
||||
omxNode, observer, iBuffer, oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, msg, oPortMode, nullptr));
|
||||
}
|
||||
|
||||
if (frameID == (int)Info->size() || frameID == (offset + range)) break;
|
||||
|
@ -641,15 +643,16 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
if (signalEOS && ((frameID == (int)Info->size() - 1) ||
|
||||
(frameID == (offset + range - 1))))
|
||||
flags |= OMX_BUFFERFLAG_EOS;
|
||||
dispatchInputBuffer(omxNode, iBuffer, index,
|
||||
(*Info)[frameID].bytesCount, flags,
|
||||
(*Info)[frameID].timestamp);
|
||||
ASSERT_NO_FATAL_FAILURE(dispatchInputBuffer(
|
||||
omxNode, iBuffer, index, (*Info)[frameID].bytesCount, flags,
|
||||
(*Info)[frameID].timestamp));
|
||||
frameID++;
|
||||
iQueued = true;
|
||||
}
|
||||
// Dispatch output buffer
|
||||
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
|
||||
dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode));
|
||||
oQueued = true;
|
||||
}
|
||||
// Reset Counters when either input or output buffer is dispatched
|
||||
|
@ -658,8 +661,7 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
else
|
||||
timeOut--;
|
||||
if (timeOut == 0) {
|
||||
EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite";
|
||||
break;
|
||||
ASSERT_TRUE(false) << "Wait on Input/Output is found indefinite";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -888,28 +890,33 @@ TEST_F(VideoDecHidlTest, DecodeTest) {
|
|||
android::Vector<BufferInfo> iBuffer, oBuffer;
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode, true);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
|
||||
omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, portMode, true));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
|
||||
// Port Reconfiguration
|
||||
eleStream.open(mURL, std::ifstream::binary);
|
||||
ASSERT_EQ(eleStream.is_open(), true);
|
||||
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(),
|
||||
portMode[1]);
|
||||
ASSERT_NO_FATAL_FAILURE(decodeNFrames(
|
||||
omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(), portMode[1]));
|
||||
eleStream.close();
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode[1]);
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode[1]));
|
||||
ASSERT_NO_FATAL_FAILURE(testEOS(
|
||||
omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
|
||||
if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true);
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
// set state to executing
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
// Test for adaptive playback support
|
||||
|
@ -985,10 +992,11 @@ TEST_F(VideoDecHidlTest, AdaptivePlaybackTest) {
|
|||
android::Vector<BufferInfo> iBuffer, oBuffer;
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode, true);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
|
||||
omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, portMode, true));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
|
||||
timestampDevTest = true;
|
||||
uint32_t timestampOffset = 0;
|
||||
|
@ -1021,9 +1029,10 @@ TEST_F(VideoDecHidlTest, AdaptivePlaybackTest) {
|
|||
// Port Reconfiguration
|
||||
eleStream.open(mURL, std::ifstream::binary);
|
||||
ASSERT_EQ(eleStream.is_open(), true);
|
||||
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(),
|
||||
portMode[1], false);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, eleStream, &Info,
|
||||
0, (int)Info.size(), portMode[1], false));
|
||||
eleStream.close();
|
||||
|
||||
getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth,
|
||||
|
@ -1042,16 +1051,20 @@ TEST_F(VideoDecHidlTest, AdaptivePlaybackTest) {
|
|||
}
|
||||
portSettingsChange = false;
|
||||
}
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode[1]);
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode[1]));
|
||||
ASSERT_NO_FATAL_FAILURE(testEOS(
|
||||
omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
|
||||
if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true);
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
// set state to executing
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
// end of sequence test
|
||||
|
@ -1095,25 +1108,29 @@ TEST_F(VideoDecHidlTest, EOSTest_M) {
|
|||
android::Vector<BufferInfo> iBuffer, oBuffer;
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode, true);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
|
||||
omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, portMode, true));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
|
||||
// request EOS at the start
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
|
||||
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(testEOS(
|
||||
omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
|
||||
ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
EXPECT_GE(framesReceived, 0U);
|
||||
framesReceived = 0;
|
||||
timestampUs = 0;
|
||||
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
// set state to executing
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
// end of sequence test
|
||||
|
@ -1183,50 +1200,58 @@ TEST_F(VideoDecHidlTest, ThumbnailTest) {
|
|||
android::Vector<BufferInfo> iBuffer, oBuffer;
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode, true);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
|
||||
omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, portMode, true));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
|
||||
// request EOS for thumbnail
|
||||
size_t i = 0;
|
||||
while (!(Info[i].flags & OMX_BUFFERFLAG_SYNCFRAME)) i++;
|
||||
eleStream.open(mURL, std::ifstream::binary);
|
||||
ASSERT_EQ(eleStream.is_open(), true);
|
||||
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1]);
|
||||
ASSERT_NO_FATAL_FAILURE(decodeNFrames(
|
||||
omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1]));
|
||||
eleStream.close();
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode[1]);
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
|
||||
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode[1]));
|
||||
ASSERT_NO_FATAL_FAILURE(testEOS(
|
||||
omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
|
||||
ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
EXPECT_GE(framesReceived, 1U);
|
||||
framesReceived = 0;
|
||||
timestampUs = 0;
|
||||
|
||||
eleStream.open(mURL, std::ifstream::binary);
|
||||
ASSERT_EQ(eleStream.is_open(), true);
|
||||
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1],
|
||||
false);
|
||||
ASSERT_NO_FATAL_FAILURE(decodeNFrames(
|
||||
omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1], false));
|
||||
eleStream.close();
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode[1]);
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
|
||||
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode[1]));
|
||||
ASSERT_NO_FATAL_FAILURE(testEOS(
|
||||
omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
|
||||
ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
EXPECT_GE(framesReceived, 1U);
|
||||
framesReceived = 0;
|
||||
timestampUs = 0;
|
||||
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
// set state to executing
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
// end of sequence test
|
||||
|
@ -1302,32 +1327,38 @@ TEST_F(VideoDecHidlTest, SimpleEOSTest) {
|
|||
android::Vector<BufferInfo> iBuffer, oBuffer;
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode, true);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
|
||||
omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, portMode, true));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
|
||||
// request EOS at the end
|
||||
eleStream.open(mURL, std::ifstream::binary);
|
||||
ASSERT_EQ(eleStream.is_open(), true);
|
||||
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(),
|
||||
portMode[1], false);
|
||||
ASSERT_NO_FATAL_FAILURE(decodeNFrames(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput,
|
||||
eleStream, &Info, 0, (int)Info.size(),
|
||||
portMode[1], false));
|
||||
eleStream.close();
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode[1]);
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
|
||||
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode[1]));
|
||||
ASSERT_NO_FATAL_FAILURE(testEOS(
|
||||
omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
|
||||
portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
|
||||
ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
framesReceived = 0;
|
||||
timestampUs = 0;
|
||||
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
// set state to executing
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
// test input/output port flush
|
||||
|
@ -1397,10 +1428,11 @@ TEST_F(VideoDecHidlTest, FlushTest) {
|
|||
android::Vector<BufferInfo> iBuffer, oBuffer;
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode, true);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
|
||||
omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, portMode, true));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
|
||||
// Decode 128 frames and flush. here 128 is chosen to ensure there is a key
|
||||
// frame after this so that the below section can be convered for all
|
||||
|
@ -1408,11 +1440,11 @@ TEST_F(VideoDecHidlTest, FlushTest) {
|
|||
int nFrames = 128;
|
||||
eleStream.open(mURL, std::ifstream::binary);
|
||||
ASSERT_EQ(eleStream.is_open(), true);
|
||||
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, eleStream, &Info, 0, nFrames, portMode[1],
|
||||
false);
|
||||
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(decodeNFrames(
|
||||
omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, eleStream, &Info, 0, nFrames, portMode[1], false));
|
||||
ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
framesReceived = 0;
|
||||
|
||||
// Seek to next key frame and start decoding till the end
|
||||
|
@ -1429,20 +1461,23 @@ TEST_F(VideoDecHidlTest, FlushTest) {
|
|||
index++;
|
||||
}
|
||||
if (keyFrame) {
|
||||
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, eleStream, &Info, index,
|
||||
Info.size() - index, portMode[1], false);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, eleStream, &Info,
|
||||
index, Info.size() - index, portMode[1], false));
|
||||
}
|
||||
eleStream.close();
|
||||
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
framesReceived = 0;
|
||||
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
// set state to executing
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
|
|
@ -179,6 +179,7 @@ class VideoEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
this->omxNode = _nl;
|
||||
})
|
||||
.isOk());
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
ASSERT_NE(omxNode, nullptr);
|
||||
ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
|
||||
struct StringToName {
|
||||
|
@ -617,7 +618,7 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
size_t i = 0;
|
||||
status =
|
||||
observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
|
||||
EXPECT_EQ(status,
|
||||
ASSERT_EQ(status,
|
||||
android::hardware::media::omx::V1_0::Status::TIMED_OUT);
|
||||
// status == TIMED_OUT, it could be due to process time being large
|
||||
// than DEFAULT_TIMEOUT or component needs output buffers to start
|
||||
|
@ -634,7 +635,8 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
// Dispatch an output buffer assuming outQueue.empty() is true
|
||||
size_t index;
|
||||
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
|
||||
dispatchOutputBuffer(omxNode, oBuffer, index);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchOutputBuffer(omxNode, oBuffer, index));
|
||||
timeOut = TIMEOUT_COUNTER_Q;
|
||||
}
|
||||
}
|
||||
|
@ -1008,8 +1010,7 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
ASSERT_EQ(msg.data.eventData.data2,
|
||||
OMX_IndexConfigAndroidIntraRefresh);
|
||||
} else if (msg.data.eventData.event == OMX_EventError) {
|
||||
EXPECT_TRUE(false) << "Received OMX_EventError, not sure why";
|
||||
break;
|
||||
ASSERT_TRUE(false) << "Received OMX_EventError, not sure why";
|
||||
} else if (msg.data.eventData.event == OMX_EventDataSpaceChanged) {
|
||||
// TODO: how am i supposed to respond now?
|
||||
std::cout << "[ INFO ] OMX_EventDataSpaceChanged \n";
|
||||
|
@ -1025,8 +1026,13 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
if (inputDataIsMeta) {
|
||||
if (listener->freeBuffers > listener->minUnDequeuedCount) {
|
||||
if (dispatchGraphicBuffer(omxNode, producer, listener, iBuffer,
|
||||
portIndexInput, eleStream, timestamp))
|
||||
break;
|
||||
portIndexInput, eleStream,
|
||||
timestamp)) {
|
||||
if (::testing::Test::HasFailure())
|
||||
ASSERT_TRUE(false);
|
||||
else
|
||||
break;
|
||||
}
|
||||
timestamp += timestampIncr;
|
||||
nFrames--;
|
||||
ipCount++;
|
||||
|
@ -1044,8 +1050,8 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
break;
|
||||
flags = OMX_BUFFERFLAG_ENDOFFRAME;
|
||||
if (signalEOS && (nFrames == 1)) flags |= OMX_BUFFERFLAG_EOS;
|
||||
dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags,
|
||||
timestamp);
|
||||
ASSERT_NO_FATAL_FAILURE(dispatchInputBuffer(
|
||||
omxNode, iBuffer, index, bytesCount, flags, timestamp));
|
||||
if (timestampUslist) timestampUslist->push_back(timestamp);
|
||||
timestamp += timestampIncr;
|
||||
nFrames--;
|
||||
|
@ -1055,7 +1061,8 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
}
|
||||
// Dispatch output buffer
|
||||
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
|
||||
dispatchOutputBuffer(omxNode, oBuffer, index);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
dispatchOutputBuffer(omxNode, oBuffer, index));
|
||||
oQueued = true;
|
||||
}
|
||||
// Reset Counters when either input or output buffer is dispatched
|
||||
|
@ -1064,8 +1071,7 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
|
|||
else
|
||||
timeOut--;
|
||||
if (timeOut == 0) {
|
||||
EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite";
|
||||
break;
|
||||
ASSERT_TRUE(false) << "Wait on Input/Output is found indefinite";
|
||||
}
|
||||
// Runtime Param Configuration
|
||||
if (ipCount == 15) {
|
||||
|
@ -1137,7 +1143,7 @@ TEST_F(VideoEncHidlTest, BufferSourceCallBacks) {
|
|||
xFramerate, eColorFormat);
|
||||
|
||||
sp<DummyBufferSource> buffersource = new DummyBufferSource(omxNode);
|
||||
EXPECT_NE(buffersource, nullptr);
|
||||
ASSERT_NE(buffersource, nullptr);
|
||||
status = omxNode->setInputSurface(buffersource);
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
|
@ -1151,20 +1157,20 @@ TEST_F(VideoEncHidlTest, BufferSourceCallBacks) {
|
|||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &buffersource->iBuffer,
|
||||
&buffersource->oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput, portMode);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
|
||||
omxNode, observer, &buffersource->iBuffer, &buffersource->oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
testEOS(omxNode, observer, &buffersource->iBuffer, &buffersource->oBuffer,
|
||||
false, eosFlag);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
ASSERT_NO_FATAL_FAILURE(testEOS(omxNode, observer, &buffersource->iBuffer,
|
||||
&buffersource->oBuffer, false, eosFlag));
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &buffersource->iBuffer,
|
||||
&buffersource->oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateExecutetoIdle(
|
||||
omxNode, observer, &buffersource->iBuffer, &buffersource->oBuffer));
|
||||
// set state to executing
|
||||
changeStateIdletoLoaded(omxNode, observer, &buffersource->iBuffer,
|
||||
&buffersource->oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(
|
||||
omxNode, observer, &buffersource->iBuffer, &buffersource->oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput));
|
||||
// test for callbacks
|
||||
EXPECT_EQ(buffersource->callback, 31);
|
||||
}
|
||||
|
@ -1218,8 +1224,9 @@ TEST_F(VideoEncHidlTest, EncodeTest) {
|
|||
|
||||
// Configure output port
|
||||
uint32_t nBitRate = 512000;
|
||||
setDefaultPortParam(omxNode, kPortIndexOutput, eCompressionFormat,
|
||||
nFrameWidth, nFrameHeight, nBitRate, xFramerate);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
setDefaultPortParam(omxNode, kPortIndexOutput, eCompressionFormat,
|
||||
nFrameWidth, nFrameHeight, nBitRate, xFramerate));
|
||||
setRefreshPeriod(omxNode, kPortIndexOutput, 0);
|
||||
|
||||
unsigned int index;
|
||||
|
@ -1255,27 +1262,32 @@ TEST_F(VideoEncHidlTest, EncodeTest) {
|
|||
android::Vector<BufferInfo> iBuffer, oBuffer;
|
||||
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
|
||||
eleStream.open(mURL, std::ifstream::binary);
|
||||
ASSERT_EQ(eleStream.is_open(), true);
|
||||
encodeNFrames(omxNode, observer, kPortIndexInput, kPortIndexOutput,
|
||||
&iBuffer, &oBuffer, 32, xFramerate,
|
||||
(nFrameWidth * nFrameHeight * 3) >> 1, eleStream,
|
||||
×tampUslist);
|
||||
ASSERT_NO_FATAL_FAILURE(encodeNFrames(
|
||||
omxNode, observer, kPortIndexInput, kPortIndexOutput, &iBuffer,
|
||||
&oBuffer, 32, xFramerate, (nFrameWidth * nFrameHeight * 3) >> 1,
|
||||
eleStream, ×tampUslist));
|
||||
eleStream.close();
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer);
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer));
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag));
|
||||
if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true);
|
||||
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
// set state to executing
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
}
|
||||
|
||||
// test raw stream encode (input is ANW buffers)
|
||||
|
@ -1304,9 +1316,9 @@ TEST_F(VideoEncHidlTest, EncodeTestBufferMetaModes) {
|
|||
|
||||
// Configure output port
|
||||
uint32_t nBitRate = 512000;
|
||||
setDefaultPortParam(omxNode, kPortIndexOutput, eCompressionFormat,
|
||||
nFrameWidth, nFrameHeight, nBitRate, xFramerate);
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
setDefaultPortParam(omxNode, kPortIndexOutput, eCompressionFormat,
|
||||
nFrameWidth, nFrameHeight, nBitRate, xFramerate));
|
||||
// CreateInputSurface
|
||||
EXPECT_TRUE(omx->createInputSurface(
|
||||
[&](android::hardware::media::omx::V1_0::Status _s,
|
||||
|
@ -1413,28 +1425,32 @@ TEST_F(VideoEncHidlTest, EncodeTestBufferMetaModes) {
|
|||
|
||||
android::Vector<BufferInfo> iBuffer, oBuffer;
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
|
||||
eleStream.open(mURL, std::ifstream::binary);
|
||||
ASSERT_EQ(eleStream.is_open(), true);
|
||||
encodeNFrames(omxNode, observer, kPortIndexInput, kPortIndexOutput,
|
||||
&iBuffer, &oBuffer, 1024, xFramerate,
|
||||
(nFrameWidth * nFrameHeight * 3) >> 1, eleStream, nullptr,
|
||||
false, true, producer, listener);
|
||||
ASSERT_NO_FATAL_FAILURE(encodeNFrames(
|
||||
omxNode, observer, kPortIndexInput, kPortIndexOutput, &iBuffer,
|
||||
&oBuffer, 1024, xFramerate, (nFrameWidth * nFrameHeight * 3) >> 1,
|
||||
eleStream, nullptr, false, true, producer, listener));
|
||||
eleStream.close();
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, true,
|
||||
listener);
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
|
||||
ASSERT_NO_FATAL_FAILURE(waitOnInputConsumption(omxNode, observer, &iBuffer,
|
||||
&oBuffer, true, listener));
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag));
|
||||
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
EXPECT_EQ(portDef.nBufferCountActual, listener->freeBuffers);
|
||||
// set state to executing
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
|
||||
returnval = producer->disconnect(
|
||||
NATIVE_WINDOW_API_CPU, IGraphicBufferProducer::DisconnectMode::API);
|
||||
|
@ -1528,24 +1544,28 @@ TEST_F(VideoEncHidlTest, EncodeTestEOS) {
|
|||
|
||||
android::Vector<BufferInfo> iBuffer, oBuffer;
|
||||
// set state to idle
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput, portMode));
|
||||
// set state to executing
|
||||
changeStateIdletoExecute(omxNode, observer);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
|
||||
|
||||
// send EOS
|
||||
status = source->signalEndOfInputStream();
|
||||
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
|
||||
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, true,
|
||||
listener);
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
|
||||
ASSERT_NO_FATAL_FAILURE(waitOnInputConsumption(omxNode, observer, &iBuffer,
|
||||
&oBuffer, true, listener));
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag));
|
||||
|
||||
// set state to idle
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
|
||||
EXPECT_EQ(portDef.nBufferCountActual, listener->freeBuffers);
|
||||
// set state to executing
|
||||
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
|
||||
kPortIndexInput, kPortIndexOutput);
|
||||
ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
|
||||
&oBuffer, kPortIndexInput,
|
||||
kPortIndexOutput));
|
||||
|
||||
returnval = producer->disconnect(
|
||||
NATIVE_WINDOW_API_CPU, IGraphicBufferProducer::DisconnectMode::API);
|
||||
|
|
Loading…
Reference in a new issue