diff options
author | Ram Mohan M <ram.mohan@ittiam.com> | 2017-08-08 00:47:23 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-08-08 00:47:23 +0000 |
commit | 0b4146ba504683981fd90f242157763fb288da7f (patch) | |
tree | 48035e82213366f277622eec94f7b0a65ca95581 | |
parent | e893a9fc7a4b3ce2706e225067951c2fb16b6aff (diff) | |
parent | c8df8940e1595f8d35cbd1df744eb3460a4c2d77 (diff) | |
download | platform_hardware_interfaces-0b4146ba504683981fd90f242157763fb288da7f.tar.gz platform_hardware_interfaces-0b4146ba504683981fd90f242157763fb288da7f.tar.bz2 platform_hardware_interfaces-0b4146ba504683981fd90f242157763fb288da7f.zip |
bug fix: handle OMX_EventBufferFlag events
am: c8df8940e1
Change-Id: I4f29647546d22b981c6c7c356d910b3ef0ced038
4 files changed, 76 insertions, 34 deletions
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp index fe67cb9b2e..0c698da11d 100644 --- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp +++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp @@ -474,15 +474,20 @@ void GetURLForComponent(AudioDecHidlTest::standardComp comp, char* mURL, // port settings reconfiguration during runtime. reconfigures sample rate and // number +typedef struct { + OMX_AUDIO_CODINGTYPE eEncoding; + AudioDecHidlTest::standardComp comp; +} packedArgs; void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer, android::Vector<BufferInfo>* iBuffer, android::Vector<BufferInfo>* oBuffer, - OMX_AUDIO_CODINGTYPE eEncoding, OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput, - Message msg, - AudioDecHidlTest::standardComp comp = - AudioDecHidlTest::standardComp::unknown_comp) { + Message msg, PortMode oPortMode, void* args) { android::hardware::media::omx::V1_0::Status status; + packedArgs* audioArgs = static_cast<packedArgs*>(args); + OMX_AUDIO_CODINGTYPE eEncoding = audioArgs->eEncoding; + AudioDecHidlTest::standardComp comp = audioArgs->comp; + (void)oPortMode; if (msg.data.eventData.event == OMX_EventPortSettingsChanged) { ASSERT_EQ(msg.data.eventData.data1, kPortIndexOutput); @@ -568,7 +573,8 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer, android::Vector<BufferInfo>* iBuffer, android::Vector<BufferInfo>* oBuffer, OMX_AUDIO_CODINGTYPE eEncoding, - OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput) { + OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput, + AudioDecHidlTest::standardComp comp) { android::hardware::media::omx::V1_0::Status status; Message msg; int timeOut = TIMEOUT_COUNTER; @@ -579,8 +585,10 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer, observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer); if (status == android::hardware::media::omx::V1_0::Status::OK) { EXPECT_EQ(msg.type, Message::Type::EVENT); - portReconfiguration(omxNode, observer, iBuffer, oBuffer, eEncoding, - kPortIndexInput, kPortIndexOutput, msg); + packedArgs audioArgs = {eEncoding, comp}; + portReconfiguration(omxNode, observer, iBuffer, oBuffer, + kPortIndexInput, kPortIndexOutput, msg, + PortMode::PRESET_BYTE_BUFFER, &audioArgs); } // status == TIMED_OUT, it could be due to process time being large // than DEFAULT_TIMEOUT or component needs output buffers to start @@ -644,8 +652,10 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, // Port Reconfiguration if (status == android::hardware::media::omx::V1_0::Status::OK && msg.type == Message::Type::EVENT) { - portReconfiguration(omxNode, observer, iBuffer, oBuffer, eEncoding, - kPortIndexInput, kPortIndexOutput, msg, comp); + packedArgs audioArgs = {eEncoding, comp}; + portReconfiguration(omxNode, observer, iBuffer, oBuffer, + kPortIndexInput, kPortIndexOutput, msg, + PortMode::PRESET_BYTE_BUFFER, &audioArgs); } if (frameID == (int)Info->size() || frameID == (offset + range)) break; @@ -789,8 +799,10 @@ TEST_F(AudioDecHidlTest, DecodeTest) { (int)Info.size(), compName); eleStream.close(); waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding, - kPortIndexInput, kPortIndexOutput); - testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag); + kPortIndexInput, kPortIndexOutput, compName); + packedArgs audioArgs = {eEncoding, compName}; + testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr, + portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs); EXPECT_EQ(timestampUslist.empty(), true); // set state to idle changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); @@ -846,7 +858,9 @@ TEST_F(AudioDecHidlTest, DISABLED_EOSTest_M) { changeStateIdletoExecute(omxNode, observer); // request EOS at the start - testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag); + packedArgs audioArgs = {eEncoding, compName}; + testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr, + portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs); flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, kPortIndexOutput); EXPECT_GE(framesReceived, 0U); @@ -933,8 +947,10 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) { compName); eleStream.close(); waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding, - kPortIndexInput, kPortIndexOutput); - testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag); + kPortIndexInput, kPortIndexOutput, compName); + packedArgs audioArgs = {eEncoding, compName}; + testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr, + portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs); flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, kPortIndexOutput); EXPECT_GE(framesReceived, 1U); @@ -949,8 +965,9 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) { compName, false); eleStream.close(); waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding, - kPortIndexInput, kPortIndexOutput); - testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag); + kPortIndexInput, kPortIndexOutput, compName); + testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr, + portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs); flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, kPortIndexOutput); EXPECT_GE(framesReceived, 1U); @@ -1034,8 +1051,10 @@ TEST_F(AudioDecHidlTest, SimpleEOSTest) { (int)Info.size(), compName, false); eleStream.close(); waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding, - kPortIndexInput, kPortIndexOutput); - testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag); + kPortIndexInput, kPortIndexOutput, compName); + packedArgs audioArgs = {eEncoding, compName}; + testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr, + portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs); flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, kPortIndexOutput); framesReceived = 0; diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp b/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp index e81e6dd4d0..700d2f31c3 100755 --- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp +++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp @@ -406,7 +406,8 @@ void flushPorts(sp<IOmxNode> omxNode, sp<CodecObserver> observer, void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer, android::Vector<BufferInfo>* iBuffer, android::Vector<BufferInfo>* oBuffer, bool signalEOS, - bool& eosFlag, PortMode* portMode) { + bool& eosFlag, PortMode* portMode, portreconfig fptr, + OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput, void* args) { android::hardware::media::omx::V1_0::Status status; PortMode defaultPortMode[2], *pm; @@ -443,9 +444,15 @@ void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer, status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer); if (status == android::hardware::media::omx::V1_0::Status::OK) { - if (msg.data.eventData.event == OMX_EventBufferFlag) { - // soft omx components donot send this, we will just ignore it - // for now + if (msg.data.eventData.event == OMX_EventPortSettingsChanged) { + if (fptr) { + (*fptr)(omxNode, observer, iBuffer, oBuffer, + kPortIndexInput, kPortIndexOutput, msg, pm[1], + args); + } else { + // something unexpected happened + EXPECT_TRUE(false); + } } else { // something unexpected happened EXPECT_TRUE(false); diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h index d617e45e43..354b7a7e5e 100644 --- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h +++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h @@ -113,6 +113,12 @@ struct CodecObserver : public IOmxObserver { android::hardware::media::omx::V1_0::Message::Type::EVENT) { *msg = *it; msgQueue.erase(it); + // OMX_EventBufferFlag event is sent when the component has + // processed a buffer with its EOS flag set. This event is + // not sent by soft omx components. Vendor components can + // send this. From IOMX point of view, we will ignore this + // event. + if (msg->data.eventData.event == OMX_EventBufferFlag) break; return ::android::hardware::media::omx::V1_0::Status::OK; } else if (it->type == android::hardware::media::omx::V1_0:: Message::Type::FILL_BUFFER_DONE) { @@ -299,9 +305,16 @@ void flushPorts(sp<IOmxNode> omxNode, sp<CodecObserver> observer, android::Vector<BufferInfo>* oBuffer, OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput, int64_t timeoutUs = DEFAULT_TIMEOUT); +typedef void (*portreconfig)(sp<IOmxNode> omxNode, sp<CodecObserver> observer, + android::Vector<BufferInfo>* iBuffer, + android::Vector<BufferInfo>* oBuffer, + OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput, + Message msg, PortMode oPortMode, void* args); void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer, android::Vector<BufferInfo>* iBuffer, android::Vector<BufferInfo>* oBuffer, bool signalEOS, - bool& eosFlag, PortMode* portMode = nullptr); + bool& eosFlag, PortMode* portMode = nullptr, + portreconfig fptr = nullptr, OMX_U32 kPortIndexInput = 0, + OMX_U32 kPortIndexOutput = 1, void* args = nullptr); #endif // MEDIA_HIDL_TEST_COMMON_H diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp index 2ff8ed3be0..9773cb00b9 100644 --- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp +++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp @@ -474,8 +474,9 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer, android::Vector<BufferInfo>* iBuffer, android::Vector<BufferInfo>* oBuffer, OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput, - Message msg, PortMode oPortMode) { + Message msg, PortMode oPortMode, void* args) { android::hardware::media::omx::V1_0::Status status; + (void)args; if (msg.data.eventData.event == OMX_EventPortSettingsChanged) { ASSERT_EQ(msg.data.eventData.data1, kPortIndexOutput); @@ -575,9 +576,6 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer, std::cout << "[ ] Warning ! OMX_EventError/ " "Decode Frame Call might be failed \n"; return; - } else if (msg.data.eventData.event == OMX_EventBufferFlag) { - // soft omx components donot send this, we will just ignore it - // for now } else { // something unexpected happened ASSERT_TRUE(false); @@ -602,7 +600,7 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer, EXPECT_EQ(msg.type, Message::Type::EVENT); portReconfiguration(omxNode, observer, iBuffer, oBuffer, kPortIndexInput, kPortIndexOutput, msg, - oPortMode); + oPortMode, nullptr); } // status == TIMED_OUT, it could be due to process time being large // than DEFAULT_TIMEOUT or component needs output buffers to start @@ -668,7 +666,7 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, msg.type == Message::Type::EVENT) { portReconfiguration(omxNode, observer, iBuffer, oBuffer, kPortIndexInput, kPortIndexOutput, msg, - oPortMode); + oPortMode, nullptr); } if (frameID == (int)Info->size() || frameID == (offset + range)) break; @@ -834,7 +832,8 @@ TEST_F(VideoDecHidlTest, DecodeTest) { eleStream.close(); waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, kPortIndexOutput, portMode[1]); - testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode); + testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode, + portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); EXPECT_EQ(timestampUslist.empty(), true); // set state to idle changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); @@ -884,7 +883,8 @@ TEST_F(VideoDecHidlTest, EOSTest_M) { changeStateIdletoExecute(omxNode, observer); // request EOS at the start - testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode); + testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode, + portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, kPortIndexOutput); EXPECT_GE(framesReceived, 0U); @@ -968,7 +968,8 @@ TEST_F(VideoDecHidlTest, ThumbnailTest) { eleStream.close(); waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, kPortIndexOutput, portMode[1]); - testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode); + testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode, + portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, kPortIndexOutput); EXPECT_GE(framesReceived, 1U); @@ -983,7 +984,8 @@ TEST_F(VideoDecHidlTest, ThumbnailTest) { eleStream.close(); waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, kPortIndexOutput, portMode[1]); - testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode); + testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode, + portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, kPortIndexOutput); EXPECT_GE(framesReceived, 1U); @@ -1066,7 +1068,8 @@ TEST_F(VideoDecHidlTest, SimpleEOSTest) { eleStream.close(); waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, kPortIndexOutput, portMode[1]); - testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode); + testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode, + portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, kPortIndexOutput); framesReceived = 0; |