Merge "AudioDec Test: Ignore output port configuration" into oc-dev

am: 11e9b588c4

Change-Id: Ib50f2f61385a5382d7f9f24608c93682594dfa1e
This commit is contained in:
Ram Mohan M 2017-06-09 03:17:20 +00:00 committed by android-build-merger
commit 8cbb07a5f6
2 changed files with 62 additions and 25 deletions

View file

@ -479,7 +479,9 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
android::Vector<BufferInfo>* oBuffer, android::Vector<BufferInfo>* oBuffer,
OMX_AUDIO_CODINGTYPE eEncoding, OMX_AUDIO_CODINGTYPE eEncoding,
OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput, OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput,
Message msg) { Message msg,
AudioDecHidlTest::standardComp comp =
AudioDecHidlTest::standardComp::unknown_comp) {
android::hardware::media::omx::V1_0::Status status; android::hardware::media::omx::V1_0::Status status;
if (msg.data.eventData.event == OMX_EventPortSettingsChanged) { if (msg.data.eventData.event == OMX_EventPortSettingsChanged) {
@ -514,8 +516,18 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
int32_t nSampleRate; int32_t nSampleRate;
getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels, getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
&nSampleRate); &nSampleRate);
setDefaultPortParam(omxNode, kPortIndexOutput, OMX_AUDIO_CodingPCM, // Configure output port
nChannels, nSampleRate); // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way
// to
// configure output PCM port. The port undergoes auto configuration
// internally basing on parsed elementary stream information.
if (comp != AudioDecHidlTest::standardComp::vorbis &&
comp != AudioDecHidlTest::standardComp::opus &&
comp != AudioDecHidlTest::standardComp::raw) {
setDefaultPortParam(omxNode, kPortIndexOutput,
OMX_AUDIO_CodingPCM, nChannels,
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 // enable
@ -594,7 +606,7 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
OMX_AUDIO_CODINGTYPE eEncoding, OMX_U32 kPortIndexInput, OMX_AUDIO_CODINGTYPE eEncoding, OMX_U32 kPortIndexInput,
OMX_U32 kPortIndexOutput, std::ifstream& eleStream, OMX_U32 kPortIndexOutput, std::ifstream& eleStream,
android::Vector<FrameData>* Info, int offset, int range, android::Vector<FrameData>* Info, int offset, int range,
bool signalEOS = true) { AudioDecHidlTest::standardComp comp, bool signalEOS = true) {
android::hardware::media::omx::V1_0::Status status; android::hardware::media::omx::V1_0::Status status;
Message msg; Message msg;
@ -633,7 +645,7 @@ 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) {
portReconfiguration(omxNode, observer, iBuffer, oBuffer, eEncoding, portReconfiguration(omxNode, observer, iBuffer, oBuffer, eEncoding,
kPortIndexInput, kPortIndexOutput, msg); kPortIndexInput, kPortIndexOutput, msg, comp);
} }
if (frameID == (int)Info->size() || frameID == (offset + range)) break; if (frameID == (int)Info->size() || frameID == (offset + range)) break;
@ -754,8 +766,13 @@ TEST_F(AudioDecHidlTest, DecodeTest) {
getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels, getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
&nSampleRate); &nSampleRate);
// Configure output port // Configure output port
setDefaultPortParam(omxNode, kPortIndexOutput, OMX_AUDIO_CodingPCM, // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
nChannels, nSampleRate); // configure output PCM port. The port undergoes auto configuration
// internally basing on parsed elementary stream information.
if (compName != vorbis && compName != opus && compName != raw) {
setDefaultPortParam(omxNode, kPortIndexOutput, OMX_AUDIO_CodingPCM,
nChannels, nSampleRate);
}
android::Vector<BufferInfo> iBuffer, oBuffer; android::Vector<BufferInfo> iBuffer, oBuffer;
@ -769,7 +786,7 @@ TEST_F(AudioDecHidlTest, DecodeTest) {
ASSERT_EQ(eleStream.is_open(), true); ASSERT_EQ(eleStream.is_open(), true);
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding, decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0, kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0,
(int)Info.size()); (int)Info.size(), compName);
eleStream.close(); eleStream.close();
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding, waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
kPortIndexInput, kPortIndexOutput); kPortIndexInput, kPortIndexOutput);
@ -812,8 +829,13 @@ TEST_F(AudioDecHidlTest, DISABLED_EOSTest_M) {
getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels, getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
&nSampleRate); &nSampleRate);
// Configure output port // Configure output port
setDefaultPortParam(omxNode, kPortIndexOutput, OMX_AUDIO_CodingPCM, // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
nChannels, nSampleRate); // configure output PCM port. The port undergoes auto configuration
// internally basing on parsed elementary stream information.
if (compName != vorbis && compName != opus && compName != raw) {
setDefaultPortParam(omxNode, kPortIndexOutput, OMX_AUDIO_CodingPCM,
nChannels, nSampleRate);
}
android::Vector<BufferInfo> iBuffer, oBuffer; android::Vector<BufferInfo> iBuffer, oBuffer;
@ -884,8 +906,13 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) {
getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels, getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
&nSampleRate); &nSampleRate);
// Configure output port // Configure output port
setDefaultPortParam(omxNode, kPortIndexOutput, OMX_AUDIO_CodingPCM, // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
nChannels, nSampleRate); // configure output PCM port. The port undergoes auto configuration
// internally basing on parsed elementary stream information.
if (compName != vorbis && compName != opus && compName != raw) {
setDefaultPortParam(omxNode, kPortIndexOutput, OMX_AUDIO_CodingPCM,
nChannels, nSampleRate);
}
android::Vector<BufferInfo> iBuffer, oBuffer; android::Vector<BufferInfo> iBuffer, oBuffer;
@ -902,8 +929,8 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) {
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, decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0, kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0, i + 1,
i + 1); compName);
eleStream.close(); eleStream.close();
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding, waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
kPortIndexInput, kPortIndexOutput); kPortIndexInput, kPortIndexOutput);
@ -919,7 +946,7 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) {
ASSERT_EQ(eleStream.is_open(), true); ASSERT_EQ(eleStream.is_open(), true);
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding, decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0, i + 1, kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0, i + 1,
false); compName, false);
eleStream.close(); eleStream.close();
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding, waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
kPortIndexInput, kPortIndexOutput); kPortIndexInput, kPortIndexOutput);
@ -983,8 +1010,13 @@ TEST_F(AudioDecHidlTest, SimpleEOSTest) {
getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels, getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
&nSampleRate); &nSampleRate);
// Configure output port // Configure output port
setDefaultPortParam(omxNode, kPortIndexOutput, OMX_AUDIO_CodingPCM, // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
nChannels, nSampleRate); // configure output PCM port. The port undergoes auto configuration
// internally basing on parsed elementary stream information.
if (compName != vorbis && compName != opus && compName != raw) {
setDefaultPortParam(omxNode, kPortIndexOutput, OMX_AUDIO_CodingPCM,
nChannels, nSampleRate);
}
android::Vector<BufferInfo> iBuffer, oBuffer; android::Vector<BufferInfo> iBuffer, oBuffer;
@ -999,11 +1031,11 @@ TEST_F(AudioDecHidlTest, SimpleEOSTest) {
ASSERT_EQ(eleStream.is_open(), true); ASSERT_EQ(eleStream.is_open(), true);
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding, decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0, kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0,
(int)Info.size()); (int)Info.size(), compName, false);
eleStream.close(); eleStream.close();
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding, waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
kPortIndexInput, kPortIndexOutput); kPortIndexInput, kPortIndexOutput);
testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag); testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag);
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
kPortIndexOutput); kPortIndexOutput);
framesReceived = 0; framesReceived = 0;
@ -1062,8 +1094,13 @@ TEST_F(AudioDecHidlTest, FlushTest) {
getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels, getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels,
&nSampleRate); &nSampleRate);
// Configure output port // Configure output port
setDefaultPortParam(omxNode, kPortIndexOutput, OMX_AUDIO_CodingPCM, // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
nChannels, nSampleRate); // configure output PCM port. The port undergoes auto configuration
// internally basing on parsed elementary stream information.
if (compName != vorbis && compName != opus && compName != raw) {
setDefaultPortParam(omxNode, kPortIndexOutput, OMX_AUDIO_CodingPCM,
nChannels, nSampleRate);
}
android::Vector<BufferInfo> iBuffer, oBuffer; android::Vector<BufferInfo> iBuffer, oBuffer;
@ -1081,7 +1118,7 @@ TEST_F(AudioDecHidlTest, FlushTest) {
ASSERT_EQ(eleStream.is_open(), true); ASSERT_EQ(eleStream.is_open(), true);
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding, decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0, kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0,
nFrames, false); nFrames, compName, false);
// Note: Assumes 200 ms is enough to end any decode call that started // Note: Assumes 200 ms is enough to end any decode call that started
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
kPortIndexOutput, 200000); kPortIndexOutput, 200000);
@ -1103,7 +1140,7 @@ TEST_F(AudioDecHidlTest, FlushTest) {
if (keyFrame) { if (keyFrame) {
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding, decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
kPortIndexInput, kPortIndexOutput, eleStream, &Info, kPortIndexInput, kPortIndexOutput, eleStream, &Info,
index, Info.size() - index, false); index, Info.size() - index, compName, false);
} }
// Note: Assumes 200 ms is enough to end any decode call that started // Note: Assumes 200 ms is enough to end any decode call that started
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,

View file

@ -1062,11 +1062,11 @@ TEST_F(VideoDecHidlTest, SimpleEOSTest) {
ASSERT_EQ(eleStream.is_open(), true); ASSERT_EQ(eleStream.is_open(), true);
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(), kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(),
portMode[1]); portMode[1], false);
eleStream.close(); eleStream.close();
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); testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode);
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
kPortIndexOutput); kPortIndexOutput);
framesReceived = 0; framesReceived = 0;