From c8df8940e1595f8d35cbd1df744eb3460a4c2d77 Mon Sep 17 00:00:00 2001 From: Ram Mohan M Date: Thu, 22 Jun 2017 13:53:12 +0530 Subject: bug fix: handle OMX_EventBufferFlag events 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, this event is not sent for processing bug:64102197 Merged-In: I3a978a885b1e4446f82f2356ae677f70ea6f8150 Change-Id: I3a978a885b1e4446f82f2356ae677f70ea6f8150 --- .../audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp | 55 +++++++++++++++------- .../functional/common/media_hidl_test_common.cpp | 15 ++++-- .../vts/functional/common/media_hidl_test_common.h | 15 +++++- .../video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp | 25 +++++----- 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 omxNode, sp observer, android::Vector* iBuffer, android::Vector* 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(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 omxNode, sp observer, android::Vector* iBuffer, android::Vector* 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 omxNode, sp 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 omxNode, sp 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 omxNode, sp observer, void testEOS(sp omxNode, sp observer, android::Vector* iBuffer, android::Vector* 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 omxNode, sp 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 omxNode, sp observer, android::Vector* oBuffer, OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput, int64_t timeoutUs = DEFAULT_TIMEOUT); +typedef void (*portreconfig)(sp omxNode, sp observer, + android::Vector* iBuffer, + android::Vector* oBuffer, + OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput, + Message msg, PortMode oPortMode, void* args); void testEOS(sp omxNode, sp observer, android::Vector* iBuffer, android::Vector* 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 omxNode, sp observer, android::Vector* iBuffer, android::Vector* 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 omxNode, sp 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 omxNode, sp 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 omxNode, sp 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; -- cgit v1.2.3