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